public abstract class AbstractJava2DImageService extends AbstractImageService
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractJava2DImageService.OperationType |
AbstractImageService.ResizeCoordsJahiaImageService.ResizeType| Constructor and Description |
|---|
AbstractJava2DImageService() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canRead(JCRNodeWrapper node) |
boolean |
cropImage(Image image,
File outputFile,
int top,
int left,
int width,
int height)
Crops an image to a specified file using the specified coordinates
Note : due to a bug, the X and Y are reversed, be careful about that !
|
protected BufferedImage |
getDestImage(int newWidth,
int newHeight,
BufferedImage originalImage) |
protected abstract Graphics2D |
getGraphics2D(BufferedImage bufferedImage,
AbstractJava2DImageService.OperationType operationType) |
int |
getHeight(Image i)
Retrieves the height in pixels of the specified image
|
Image |
getImage(JCRNodeWrapper node)
Retrieve the image stored in a JCR node
|
int |
getWidth(Image i)
Retrieves the width in pixels of the specified image
|
BufferedImage |
resizeImage(BufferedImage image,
int width,
int newHeight,
JahiaImageService.ResizeType resizeType)
Resize an image using different types of resize algorithms.
|
boolean |
resizeImage(Image image,
File outputFile,
int newWidth,
int newHeight,
JahiaImageService.ResizeType resizeType)
Resize an image using different types of resize algorithms.
|
boolean |
rotateImage(Image image,
File outputFile,
boolean clockwise)
Rotate an image clockwise or counter clockwise
|
boolean |
rotateImage(Image image,
File outputFile,
double degrees)
Rotate an image clockwise or counter clockwise
|
protected void |
saveImageToFile(BufferedImage dest,
String mimeType,
File destFile) |
createThumb, getResizeCoords, resizeImagepublic Image getImage(JCRNodeWrapper node) throws IOException, javax.jcr.RepositoryException
JahiaImageServicenode - the JCR node that contains the image data.IOExceptionjavax.jcr.RepositoryException - in case of JCR-related errorspublic int getHeight(Image i)
JahiaImageServicei - the image for which to retrieve the heightpublic int getWidth(Image i)
JahiaImageServicei - the imagepublic boolean cropImage(Image image, File outputFile, int top, int left, int width, int height) throws IOException
JahiaImageServiceimage - the image to cropoutputFile - the destination file in which to store the cropped image. The file type
of the original image is conservedtop - the top Y coordinate at which to start the cropleft - the left X coordinate at which to start the cropwidth - the width of the crop regionheight - the height of the crop region.IOExceptionpublic boolean rotateImage(Image image, File outputFile, boolean clockwise) throws IOException
JahiaImageServiceimage - the image to rotateoutputFile - the file in which to store the rotated image, the original image type
is conservedclockwise - if the true, the image is rotated clockwise, otherwise it is rotated
counter clockwiseIOExceptionpublic boolean rotateImage(Image image, File outputFile, double degrees) throws IOException
JahiaImageServiceimage - the image to rotateoutputFile - the file in which to store the rotated image, the original image type
is conserveddegrees - angle in degrees
counter clockwiseIOExceptionpublic boolean resizeImage(Image image, File outputFile, int newWidth, int newHeight, JahiaImageService.ResizeType resizeType) throws IOException
JahiaImageServiceimage - the image to resizeoutputFile - the file in which to output the resized imagenewWidth - the width of the resized imagenewHeight - the height of the resized imageresizeType - the type of resize algorithm to use. Uses a ResizeType enum also available
in this interfaceIOExceptionpublic BufferedImage resizeImage(BufferedImage image, int width, int newHeight, JahiaImageService.ResizeType resizeType)
JahiaImageServiceimage - the image to resizewidth - the width of the resized imagenewHeight - the height of the resized imageresizeType - the type of resize algorithm to use. Uses a JahiaImageService.ResizeType enum also available in this interfacenull in case of a failurefor details of the resizingprotected abstract Graphics2D getGraphics2D(BufferedImage bufferedImage, AbstractJava2DImageService.OperationType operationType)
protected boolean canRead(JCRNodeWrapper node) throws javax.jcr.RepositoryException
javax.jcr.RepositoryExceptionprotected BufferedImage getDestImage(int newWidth, int newHeight, BufferedImage originalImage)
protected void saveImageToFile(BufferedImage dest, String mimeType, File destFile) throws IOException
IOExceptionCopyright © 2004–2020 Jahia Solutions Group SA. All rights reserved.