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:
java.awt.Shape
,java.io.Serializable
,java.lang.Cloneable
public class TJTransform extends java.awt.Rectangle
Lossless transform parameters- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description TJCustomFilter
cf
Custom filter instancestatic int
NUMOP
The number of lossless transform operationsint
op
Transform operation (one ofOP_*
)static int
OP_HFLIP
Flip (mirror) image horizontally.static int
OP_NONE
Do not transform the position of the image pixels.static int
OP_ROT180
Rotate image 180 degrees.static int
OP_ROT270
Rotate image counter-clockwise by 90 degrees.static int
OP_ROT90
Rotate image clockwise by 90 degrees.static int
OP_TRANSPOSE
Transpose image (flip/mirror along upper left to lower right axis).static int
OP_TRANSVERSE
Transverse transpose image (flip/mirror along upper right to lower left axis).static int
OP_VFLIP
Flip (mirror) image vertically.static int
OPT_ARITHMETIC
Enable arithmetic entropy coding in the destination image.static int
OPT_COPYNONE
Do not copy any extra markers (including Exif and ICC profile data) from the source image to the destination image.static int
OPT_CROP
Enable lossless cropping.static int
OPT_GRAY
Discard the color data in the source image, and generate a grayscale destination image.static int
OPT_NOOUTPUT
Do not generate a destination image.static int
OPT_OPTIMIZE
Enable Huffman table optimization for the destination image.static int
OPT_PERFECT
This option causesTJTransformer.transform()
to throw an exception if the transform is not perfect.static int
OPT_PROGRESSIVE
Generate a progressive destination image instead of a single-scan destination image.static int
OPT_TRIM
Discard any partial iMCUs that cannot be transformed.int
options
Transform options (bitwise OR of one or more ofOPT_*
)
-
Constructor Summary
Constructors Constructor Description TJTransform()
Create 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(java.awt.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, union
-
Methods inherited from class java.awt.geom.Rectangle2D
add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union
-
Methods inherited from class java.awt.geom.RectangularShape
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal
-
-
-
-
Field Detail
-
NUMOP
public static final int NUMOP
The number of lossless transform operations- See Also:
- Constant Field Values
-
OP_NONE
public static final int OP_NONE
Do not transform the position of the image pixels.- See Also:
- Constant Field Values
-
OP_HFLIP
public static final int OP_HFLIP
Flip (mirror) image horizontally. This transform is imperfect if there are any partial iMCUs on the right edge.- See Also:
OPT_PERFECT
, Constant Field Values
-
OP_VFLIP
public static final int OP_VFLIP
Flip (mirror) image vertically. This transform is imperfect if there are any partial iMCUs on the bottom edge.- See Also:
OPT_PERFECT
, Constant Field Values
-
OP_TRANSPOSE
public static final int OP_TRANSPOSE
Transpose image (flip/mirror along upper left to lower right axis). This transform is always perfect.- See Also:
OPT_PERFECT
, Constant Field Values
-
OP_TRANSVERSE
public static final int OP_TRANSVERSE
Transverse transpose image (flip/mirror along upper right to lower left axis). This transform is imperfect if there are any partial iMCUs in the image.- See Also:
OPT_PERFECT
, Constant Field Values
-
OP_ROT90
public static final int OP_ROT90
Rotate image clockwise by 90 degrees. This transform is imperfect if there are any partial iMCUs on the bottom edge.- See Also:
OPT_PERFECT
, Constant Field Values
-
OP_ROT180
public static final int OP_ROT180
Rotate image 180 degrees. This transform is imperfect if there are any partial iMCUs in the image.- See Also:
OPT_PERFECT
, Constant Field Values
-
OP_ROT270
public static final int OP_ROT270
Rotate image counter-clockwise by 90 degrees. This transform is imperfect if there are any partial iMCUs on the right edge.- See Also:
OPT_PERFECT
, Constant Field Values
-
OPT_PERFECT
public static final int OPT_PERFECT
This option causesTJTransformer.transform()
to throw an exception if the transform is not perfect. Lossless transforms operate on iMCUs, the size of which depends on the level of chrominance subsampling used. If the image's width or height is not evenly divisible by the iMCU size (seeTJ.getMCUWidth()
andTJ.getMCUHeight()
), then there will be partial iMCUs on the right and/or bottom edges. It is not possible to move these partial iMCUs 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 iMCUs 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:
- Constant Field Values
-
OPT_TRIM
public static final int OPT_TRIM
Discard any partial iMCUs that cannot be transformed.- See Also:
- Constant Field Values
-
OPT_CROP
public static final int OPT_CROP
Enable lossless cropping.- See Also:
- Constant Field Values
-
OPT_GRAY
public static final int OPT_GRAY
Discard the color data in the source image, and generate a grayscale destination image.- See Also:
- Constant Field Values
-
OPT_NOOUTPUT
public static final int OPT_NOOUTPUT
Do not generate a destination image. This can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.- See Also:
- Constant Field Values
-
OPT_PROGRESSIVE
public static final int OPT_PROGRESSIVE
Generate a progressive destination image instead of a single-scan destination image. Progressive JPEG images generally have better compression ratios than single-scan JPEG images (much better if the image has large areas of solid color), but progressive JPEG decompression is considerably slower than single-scan JPEG decompression. Can be combined withOPT_ARITHMETIC
. ImpliesOPT_OPTIMIZE
unlessOPT_ARITHMETIC
is also specified.- See Also:
- Constant Field Values
-
OPT_COPYNONE
public static final int OPT_COPYNONE
Do not copy any extra markers (including Exif and ICC profile data) from the source image to the destination image.- See Also:
- Constant Field Values
-
OPT_ARITHMETIC
public static final int OPT_ARITHMETIC
Enable arithmetic entropy coding in the destination image. Arithmetic entropy coding generally improves compression relative to Huffman entropy coding (the default), but it reduces decompression performance considerably. Can be combined withOPT_PROGRESSIVE
.- See Also:
- Constant Field Values
-
OPT_OPTIMIZE
public static final int OPT_OPTIMIZE
Enable Huffman table optimization for the destination image. Huffman table optimization improves compression slightly (generally 5% or less.)- See Also:
- Constant Field Values
-
op
public int op
Transform operation (one ofOP_*
)
-
options
public int options
Transform options (bitwise OR of one or more ofOPT_*
)
-
cf
public TJCustomFilter cf
Custom filter instance
-
-
Constructor Detail
-
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)
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 iMCU width (seeTJ.getMCUWidth()
) of the destination image.y
- the upper boundary of the cropping region. This must be evenly divisible by the iMCU height (seeTJ.getMCUHeight()
) of the destination image.w
- the width of the cropping region. Setting this to 0 is the equivalent of setting it to (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 (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 theTJCustomFilter
interface, or null if no custom filter is needed
-
TJTransform
public TJTransform(java.awt.Rectangle r, int op, int options, TJCustomFilter cf)
Create a new lossless transform instance with the given parameters.- Parameters:
r
- ajava.awt.Rectangle
instance that specifies the cropping region. SeeTJTransform(int, int, int, int, int, int, TJCustomFilter)
for more details.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 theTJCustomFilter
interface, or null if no custom filter is needed
-
-