|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.media.jai.codec.JPEGEncodeParam
A class which encapsulates the most common functionality required for
the parameters to a Jpeg encode operation. It does not include all of
the parameters of the com.sun.image.codec.jpeg
classes.
Users needing that additional functionality should use those classes
directly, bearing in mind that they are part of an uncommitted non-core
interface that may be modified or removed in the future.
This class makes very simple assumptions about the image colorspaces.
Images with a single band are assumed to be grayscale.
Images with three bands are assumed to be RGB and are encoded to YCbCr.
This class is not a committed part of the JAI API. It may be removed or changed in future releases of JAI.
Constructor Summary | |
JPEGEncodeParam()
Constructs a JAI JPEGEncodeParam object with default settings. |
Method Summary | |
Object |
clone()
Returns a copy of this JPEGEncodeParam object. |
int |
getHorizontalSubsampling(int component)
Get the horizontal subsampling factor for a band. |
int[] |
getQTable(int component)
Retrieve the contents of the quantization table used for a component. |
int |
getQTableSlot(int component)
Retrieve the quantization table slot used for a component. |
float |
getQuality()
Retrieve the quality setting for this encoding. |
int |
getRestartInterval()
Gets the restart interval in Minimum Coded Units (MCUs). |
int |
getVerticalSubsampling(int component)
Get the vertical subsampling factor for a band. |
boolean |
getWriteImageOnly()
Retrieve the setting of the writeImageOnly flag. |
boolean |
getWriteJFIFHeader()
Retrieve the setting of the writeJFIF flag. |
boolean |
getWriteTablesOnly()
Retrieve the setting of the writeTablesOnly flag. |
boolean |
isQTableSet(int component)
Tests if a Quantization table has been set. |
boolean |
isQualitySet()
Tests if the quality parameter has been set in this JPEGEncodeParam. |
void |
setChromaQTable(int[] qTable)
Sets the quantization table to be used for chrominance data. |
void |
setHorizontalSubsampling(int component,
int subsample)
Sets the horizontal subsampling to be applied to an image band. |
void |
setLumaQTable(int[] qTable)
Sets the quantization table to be used for luminance data. |
void |
setQTable(int component,
int tableSlot,
int[] qTable)
Sets a quantization table to be used for a component. |
void |
setQuality(float quality)
This creates new quantization tables that replace the currently installed quantization tables. |
void |
setRestartInterval(int restartInterval)
Sets the restart interval in Minimum Coded Units (MCUs). |
void |
setVerticalSubsampling(int component,
int subsample)
Sets the vertical subsampling to be applied to an image band. |
void |
setWriteImageOnly(boolean imageOnly)
Controls whether the encoder writes only the compressed image data to the output stream. |
void |
setWriteJFIFHeader(boolean writeJFIF)
Controls whether the encoder writes a JFIF header using the APP0 marker. |
void |
setWriteTablesOnly(boolean tablesOnly)
Instructs the encoder to write only the table data to the output stream. |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public JPEGEncodeParam()
Method Detail |
public void setHorizontalSubsampling(int component, int subsample)
component
- The band for which to set horizontal subsampling.subsample
- The horizontal subsampling factor.public int getHorizontalSubsampling(int component)
component
- The band of the image for which to retrieve subsampling.public void setVerticalSubsampling(int component, int subsample)
component
- The band for which to set vertical subsampling.subsample
- The vertical subsampling factor.public int getVerticalSubsampling(int component)
component
- The band of the image for which to retrieve subsampling.public void setLumaQTable(int[] qTable)
qTable
- Quantization table values in "zig-zag" order.public void setChromaQTable(int[] qTable)
qTable
- Quantization table values in "zig-zag" order.public void setQTable(int component, int tableSlot, int[] qTable)
component
- The band to which this table applies.tableSlot
- The table number that this table is assigned to (0 to 3).qTable
- Quantization table values in "zig-zag" order.public boolean isQTableSet(int component)
public int[] getQTable(int component)
component
- The band to which this table applies.public int getQTableSlot(int component)
component
- The band to which this table slot applies.public void setRestartInterval(int restartInterval)
restartInterval
- Number of MCUs between restart markers.public int getRestartInterval()
public void setQuality(float quality)
At a quality level of 1.0 the table will be all 1's which will lead to no loss of data due to quantization (however chrominace subsampling, if used, and roundoff error in the DCT will still degrade the image some what).
The default setting is 0.75 which provides high quality while insuring a good compression ratio.
Some guidelines: 0.75 high quality 0.5 medium quality 0.25 low quality
quality
- 0.0-1.0 setting of desired quality level.public boolean isQualitySet()
public float getQuality()
public void setWriteTablesOnly(boolean tablesOnly)
tablesOnly
- If true, only the tables will be written.public boolean getWriteTablesOnly()
public void setWriteImageOnly(boolean imageOnly)
imageOnly
- If true, only the compressed image will be written.public boolean getWriteImageOnly()
public void setWriteJFIFHeader(boolean writeJFIF)
writeJFIF
- If true, writes a JFIF header.public boolean getWriteJFIFHeader()
public Object clone()
JPEGEncodeParam
object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |