|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gif4j.GifTransformer
Helper java class containing static methods to affine transform animated and non-animated GIF images
represented by GifImage objects including resize, scale, rotate and flip gif image transform operations.
// resize gif image to the width=150px with maintaining the aspect ratio of the original gif image dimension GifImage resizedGifImage1 = GifTransformer.resize(gifImage, 150, -1, false); // resize gif image to the width=150px and height=100px GifImage resizedGifImage2 = GifTransformer.resize(gifImage, 150, 100, false);
// scale gif image by factor 0.5 with maintaining the aspect ratio of the original gif image dimension GifImage scaledGifImage1 = GifTransformer.scale(gifImage, 0.5, -1, false); // scale gif image by X-axis scale factor = 0.8 and Y-axis scale factor = 0.6 GifImage scaledGifImage2 = GifTransformer.scale(gifImage, 0.8, 0.6, false);
// rotate gif image by 45 degrees (PI/4 radians) GifImage rotatedGifImage45 = GifTransformer.rotate(gifImage, Math.PI/4, false); // rotate gif image by 90 degrees counter-clockwise GifImage rotatedGifImage90CCW = GifTransformer.rotate90Left(gifImage); // rotate gif image by 90 degrees clockwise GifImage rotatedGifImage90CW = GifTransformer.rotate90Right(gifImage); // rotate gif image by 180 degrees GifImage rotatedGifImage180 = GifTransformer.rotate180(gifImage);
// flip gif image vertical GifImage flipVerticalGifImage = GifTransformer.flipVertical(gifImage); // flip gif image horizontal (mirror gif image) GifImage flipHorizontalGifImage = GifTransformer.flipHorizontal(gifImage);
GifImage,
Quantizer| Method Summary | |
static GifImage |
crop(GifImage gifImage,
java.awt.Rectangle cropArea)
Create a cropped version of the specified gif image according to the specified rectangular area. |
static GifImage |
exactRequantize(GifImage source,
int quantizerMode,
int colorsNum)
Requantize frames of the GIF image using the specified quantizer mode to the specified number of colors. |
static GifImage |
flipHorizontal(GifImage gifImage)
Create a horizontally flip version of the specified gif image: mirror the specified gif image. |
static GifImage |
flipVertical(GifImage gifImage)
Create a vertically flip version of the specified gif image: the top row becomes the bottom row and vice versa, and so on. |
static GifImage |
optimize(GifImage gifImage)
|
static GifImage |
requantize(GifImage source,
int quantizerMode,
int colorBitDepth)
Requantize frames of the GIF image using the specified quantizer mode to the specified color bits depth. |
static GifImage |
resize(GifImage gifImage,
int width,
int height,
boolean smooth)
Create a resized version of the specified gif image. |
static GifImage |
resizeViaIR4J(GifImage gifImage,
int width,
int height,
int interpolationType)
Create a resized version of the specified gif image using ImageResize4J library. |
static GifImage |
resizeViaIR4J(GifImage gifImage,
int width,
int height,
int interpolationType,
int colorBitDepth)
Create a resized version of the specified gif image using ImageResize4J library. |
static GifImage |
rotate(GifImage gifImage,
double theta,
boolean smooth)
Create a rotated version of the specified gif image by the specified angle in radians. |
static GifImage |
rotate180(GifImage gifImage)
Create a rotated version of the specified gif image by 180 degrees |
static GifImage |
rotate90Left(GifImage gifImage)
Create a rotated version of the specified gif image by 90 degrees counter-clockwise (to the left). |
static GifImage |
rotate90Right(GifImage gifImage)
Create a rotated version of the specified gif image by 90 degrees clockwise (to the right). |
static GifImage |
scale(GifImage gifImage,
double xscale,
double yscale,
boolean smooth)
Create a scaled version of the specified gif image. |
static GifImage |
scaleViaIR4J(GifImage gifImage,
double xscale,
double yscale,
int interpolationType)
Create a scaled version of the specified gif image using ImageResize4J library. |
static GifImage |
scaleViaIR4J(GifImage gifImage,
double xscale,
double yscale,
int interpolationType,
int colorBitDepth)
Create a scaled version of the specified gif image using ImageResize4J library. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static final GifImage crop(GifImage gifImage,
java.awt.Rectangle cropArea)
gifImage - GifImage to cropcropArea - crop area bounds
java.lang.NullPointerException - If the specified GifImage is nullGifImage
public static final GifImage exactRequantize(GifImage source,
int quantizerMode,
int colorsNum)
quantizerMode - one of the predefined quantizer modes:
ExactQuantizer.MEMORY_LOW_FAST,
ExactQuantizer.MEMORY_LOW_FAST_DITHER,
ExactQuantizer.MEMORY_LOW_OPTIMIZED,
ExactQuantizer.MEMORY_LOW_OPTIMIZED_DITHER,
ExactQuantizer.MEMORY_NORMAL_FAST,
ExactQuantizer.MEMORY_NORMAL_FAST_DITHER,
ExactQuantizer.MEMORY_NORMAL_OPTIMIZED,
ExactQuantizer.MEMORY_NORMAL_OPTIMIZED_DITHERsource - the specified image to quantizecolorsNum - desired number of colors. Should be between 4 and 65536.
java.lang.IllegalArgumentException - If desired number of colors less than 4 or more than 65536;
java.lang.IllegalArgumentException - If unknown quantizer mode;
java.lang.NullPointerException - If source image is nullpublic static final GifImage flipHorizontal(GifImage gifImage)
gifImage - GifImage to flip
java.lang.NullPointerException - If the specified GifImage is nullGifImagepublic static final GifImage flipVertical(GifImage gifImage)
gifImage - GifImage to flip
java.lang.NullPointerException - If the specified GifImage is nullGifImagepublic static final GifImage optimize(GifImage gifImage)
public static final GifImage requantize(GifImage source,
int quantizerMode,
int colorBitDepth)
quantizerMode - one of the predefined quantizer modes:
Quantizer.MEMORY_LOW_FAST,
Quantizer.MEMORY_LOW_OPTIMIZED,
Quantizer.MEMORY_LOW_OPTIMIZED_DITHER,
Quantizer.MEMORY_NORMAL_FAST,
Quantizer.MEMORY_NORMAL_FAST_DITHER,
Quantizer.MEMORY_NORMAL_OPTIMIZED,
Quantizer.MEMORY_NORMAL_OPTIMIZED_DITHERsource - the specified image to quantizecolorBitDepth - desired color table bit depth. Should be between 2 and 8.
java.lang.IllegalArgumentException - If desired number of colors less than 2 or more than 8;
java.lang.IllegalArgumentException - If unknown quantizer mode;
java.lang.NullPointerException - If source image is null
public static final GifImage resize(GifImage gifImage,
int width,
int height,
boolean smooth)
GifImage object is returned which will render the GifImage at the specified width and height by default.
If either the width or height is a negative number then a value is substituted to maintain the aspect ratio of the original gif image dimensions.
gifImage - GifImage to resizewidth - the width to which to scale the GifImageheight - the height to which to scale the GifImagesmooth - choose a gif image resizing algorithm.
If true then the gif image resizing algorithm that gives higher priority to GifImage smoothness than scaling speed is used.
java.lang.NullPointerException - If the specified GifImage is null
java.lang.NullPointerException - If the specified width and height are both less than or equal to 0GifImage
public static final GifImage resizeViaIR4J(GifImage gifImage,
int width,
int height,
int interpolationType)
Note: You should have ImageResize4J library jar in CLASSPATH!
A newGifImage object is returned which will render the GifImage at the specified width and height by default.
If either the width or height is a negative number then a value is substituted to maintain the aspect ratio of the original gif image dimensions.
gifImage - GifImage to resizewidth - the width to which to scale the GifImageheight - the height to which to scale the GifImageinterpolationType - one of the integer
interpolation type constants defined in com.imageresize4j.ImageResizeProcessor class.
java.lang.NullPointerException - If the specified GifImage is null
java.lang.NullPointerException - If the specified width and height are both less than or equal to 0
java.lang.RuntimeException - If com.imageresize4j.ImageResizeProcessor not found in CLASSPATH.GifImage
public static final GifImage resizeViaIR4J(GifImage gifImage,
int width,
int height,
int interpolationType,
int colorBitDepth)
Note: You should have ImageResize4J library jar in CLASSPATH!
A newGifImage object is returned which will render the GifImage at the specified width and height by default.
If either the width or height is a negative number then a value is substituted to maintain the aspect ratio of the original gif image dimensions.
gifImage - GifImage to resizewidth - the width to which to scale the GifImageheight - the height to which to scale the GifImageinterpolationType - one of the integer
interpolation type constants defined in com.imageresize4j.ImageResizeProcessor class.colorBitDepth - desired color table bit depth of scaled image. Should be between 2 and 16.
To determine actual size of the color table, raise 2 to this parameter: for example, to quantize the specified image to 256 colors this parameter has to be equal to 8 (raise 2 to 8 = 256).
java.lang.NullPointerException - If the specified GifImage is null
java.lang.NullPointerException - If the specified width and height are both less than or equal to 0
java.lang.RuntimeException - If com.imageresize4j.ImageResizeProcessor not found in CLASSPATH.GifImage
public static final GifImage rotate(GifImage gifImage,
double theta,
boolean smooth)
gifImage - GifImage to rotatetheta - the angle of rotation in radianssmooth - choose a gif image rotating algorithm.
If true then the gif image rotating algorithm that gives higher priority to GifImage smoothness than rotating speed is used.
GifImagepublic static final GifImage rotate180(GifImage gifImage)
gifImage - GifImage to rotate
java.lang.NullPointerException - If the specified GifImage is nullGifImagepublic static final GifImage rotate90Left(GifImage gifImage)
gifImage - GifImage to rotate
java.lang.NullPointerException - If the specified GifImage is nullGifImagepublic static final GifImage rotate90Right(GifImage gifImage)
gifImage - GifImage to rotate
java.lang.NullPointerException - If the specified GifImage is nullGifImage
public static final GifImage scale(GifImage gifImage,
double xscale,
double yscale,
boolean smooth)
GifImage object is returned which will render the GifImage at the calculated width and height by default.
If either the xscale or yscale is a negative number then a value is substituted to maintain the aspect ratio of the original gif image dimensions.
gifImage - GifImage to resizexscale - the factor by which GifImage are scaled along the
X axis directionyscale - the factor by which GifImage are scaled along the
Y axis directionsmooth - choose a gif image scaling algorithm.
If true then the gif image scaling algorithm that gives higher priority to GifImage smoothness than scaling speed is used.
java.lang.NullPointerException - If the specified GifImage is null
java.lang.NullPointerException - If the specified xscale and yscale are both less than or equal to 0GifImage
public static final GifImage scaleViaIR4J(GifImage gifImage,
double xscale,
double yscale,
int interpolationType)
Note: You should have ImageResize4J library jar in CLASSPATH!
A newGifImage object is returned which will render the GifImage at the calculated width and height by default.
If either the xscale or yscale is a negative number then a value is substituted to maintain the aspect ratio of the original gif image dimensions.
gifImage - GifImage to resizexscale - the factor by which GifImage are scaled along the
X axis directionyscale - the factor by which GifImage are scaled along the
Y axis directioninterpolationType - one of the integer
interpolation type constants defined in com.imageresize4j.ImageResizeProcessor class.
java.lang.NullPointerException - If the specified GifImage is null
java.lang.NullPointerException - If the specified xscale and yscale are both less than or equal to 0
java.lang.RuntimeException - If com.imageresize4j.ImageResizeProcessor not found in CLASSPATH.GifImage
public static final GifImage scaleViaIR4J(GifImage gifImage,
double xscale,
double yscale,
int interpolationType,
int colorBitDepth)
Note: You should have ImageResize4J library jar in CLASSPATH!
A newGifImage object is returned which will render the GifImage at the calculated width and height by default.
If either the xscale or yscale is a negative number then a value is substituted to maintain the aspect ratio of the original gif image dimensions.
gifImage - GifImage to resizexscale - the factor by which GifImage are scaled along the
X axis directionyscale - the factor by which GifImage are scaled along the
Y axis directioninterpolationType - one of the integer
interpolation type constants defined in com.imageresize4j.ImageResizeProcessor class.colorBitDepth - desired color table bit depth of scaled image. Should be between 2 and 16.
To determine actual size of the color table, raise 2 to this parameter: for example, to quantize the specified image to 256 colors this parameter has to be equal to 8 (raise 2 to 8 = 256).
java.lang.NullPointerException - If the specified GifImage is null
java.lang.NullPointerException - If the specified xscale and yscale are both less than or equal to 0
java.lang.RuntimeException - If com.imageresize4j.ImageResizeProcessor not found in CLASSPATH.GifImage
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||