Package org.libjpegturbo.turbojpeg
Class TJTransform
java.lang.Object
java.awt.geom.RectangularShape
java.awt.geom.Rectangle2D
java.awt.Rectangle
org.libjpegturbo.turbojpeg.TJTransform
- All Implemented Interfaces:
Shape,Serializable,Cloneable
Lossless transform parameters
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D
Rectangle2D.Double, Rectangle2D.Float -
Field Summary
FieldsModifier and TypeFieldDescriptionCustom filter instancestatic final intThe number of lossless transform operationsintTransform operation (one ofOP_*)static final intFlip (mirror) image horizontally.static final intDo not transform the position of the image pixels.static final intRotate image 180 degrees.static final intRotate image counter-clockwise by 90 degrees.static final intRotate image clockwise by 90 degrees.static final intTranspose image (flip/mirror along upper left to lower right axis).static final intTransverse transpose image (flip/mirror along upper right to lower left axis).static final intFlip (mirror) image vertically.static final intThis option will enable lossless cropping.static final intThis option will discard the color data in the input image and produce a grayscale output image.static final intThis option will preventTJTransformer.transform()from outputting a JPEG image for this particular transform.static final intThis option will causeTJTransformer.transform()to throw an exception if the transform is not perfect.static final intThis option will discard any partial MCU blocks that cannot be transformed.intTransform options (bitwise OR of one or more ofOPT_*)private static final longFields inherited from class java.awt.geom.Rectangle2D
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new lossless transform instance.TJTransform(int x, int y, int w, int h, int op, int options, TJCustomFilter cf) Create a new lossless transform instance with the given parameters.TJTransform(Rectangle r, int op, int options, TJCustomFilter cf) Create a new lossless transform instance with the given parameters. -
Method Summary
Methods inherited from class java.awt.Rectangle
add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, unionMethods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, unionMethods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonalMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.Shape
contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
NUMOP
public static final int NUMOPThe number of lossless transform operations- See Also:
-
OP_NONE
public static final int OP_NONEDo not transform the position of the image pixels.- See Also:
-
OP_HFLIP
public static final int OP_HFLIPFlip (mirror) image horizontally. This transform is imperfect if there are any partial MCU blocks on the right edge.- See Also:
-
OP_VFLIP
public static final int OP_VFLIPFlip (mirror) image vertically. This transform is imperfect if there are any partial MCU blocks on the bottom edge.- See Also:
-
OP_TRANSPOSE
public static final int OP_TRANSPOSETranspose image (flip/mirror along upper left to lower right axis). This transform is always perfect.- See Also:
-
OP_TRANSVERSE
public static final int OP_TRANSVERSETransverse transpose image (flip/mirror along upper right to lower left axis). This transform is imperfect if there are any partial MCU blocks in the image.- See Also:
-
OP_ROT90
public static final int OP_ROT90Rotate image clockwise by 90 degrees. This transform is imperfect if there are any partial MCU blocks on the bottom edge.- See Also:
-
OP_ROT180
public static final int OP_ROT180Rotate image 180 degrees. This transform is imperfect if there are any partial MCU blocks in the image.- See Also:
-
OP_ROT270
public static final int OP_ROT270Rotate image counter-clockwise by 90 degrees. This transform is imperfect if there are any partial MCU blocks on the right edge.- See Also:
-
OPT_PERFECT
public static final int OPT_PERFECTThis option will causeTJTransformer.transform()to throw an exception if the transform is not perfect. Lossless transforms operate on MCU blocks, whose size depends on the level of chrominance subsampling used. If the image's width or height is not evenly divisible by the MCU block size (seeTJ.getMCUWidth(int)andTJ.getMCUHeight(int)), then there will be partial MCU blocks on the right and/or bottom edges. It is not possible to move these partial MCU blocks to the top or left of the image, so any transform that would require that is "imperfect." If this option is not specified, then any partial MCU blocks that cannot be transformed will be left in place, which will create odd-looking strips on the right or bottom edge of the image.- See Also:
-
OPT_TRIM
public static final int OPT_TRIMThis option will discard any partial MCU blocks that cannot be transformed.- See Also:
-
OPT_CROP
public static final int OPT_CROPThis option will enable lossless cropping.- See Also:
-
OPT_GRAY
public static final int OPT_GRAYThis option will discard the color data in the input image and produce a grayscale output image.- See Also:
-
OPT_NOOUTPUT
public static final int OPT_NOOUTPUTThis option will preventTJTransformer.transform()from outputting a JPEG image for this particular transform. This can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.- See Also:
-
op
public int opTransform operation (one ofOP_*) -
options
public int optionsTransform options (bitwise OR of one or more ofOPT_*) -
cf
Custom filter instance
-
-
Constructor Details
-
TJTransform
public TJTransform()Create a new lossless transform instance. -
TJTransform
public TJTransform(int x, int y, int w, int h, int op, int options, TJCustomFilter cf) throws Exception Create a new lossless transform instance with the given parameters.- Parameters:
x- the left boundary of the cropping region. This must be evenly divisible by the MCU block width (seeTJ.getMCUWidth(int))y- the upper boundary of the cropping region. This must be evenly divisible by the MCU block height (seeTJ.getMCUHeight(int))w- the width of the cropping region. Setting this to 0 is the equivalent of setting it to the width of the source JPEG image - x.h- the height of the cropping region. Setting this to 0 is the equivalent of setting it to the height of the source JPEG image - y.op- one of the transform operations (OP_*)options- the bitwise OR of one or more of the transform options (OPT_*)cf- an instance of an object that implements theTJCustomFilterinterface, or null if no custom filter is needed- Throws:
Exception
-
TJTransform
Create a new lossless transform instance with the given parameters.- Parameters:
r- aRectangleinstance that specifies the cropping region. SeeTJTransform(int, int, int, int, int, int, TJCustomFilter)for more detail.op- one of the transform operations (OP_*)options- the bitwise OR of one or more of the transform options (OPT_*)cf- an instance of an object that implements theTJCustomFilterinterface, or null if no custom filter is needed- Throws:
Exception
-