|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||||||
| JavaTM 2 Platform Std. Ed. v1.5.0
javax.imageio.plugins.jpeg
|
|||||||||||||||||||||||||||||||||||||||
| Field Summary |
|---|
| Fields inherited from class javax.imageio.ImageWriteParam |
|---|
canOffsetTiles, canWriteCompressed, canWriteProgressive, canWriteTiles, compressionMode, compressionQuality, compressionType, compressionTypes, locale, MODE_COPY_FROM_METADATA, MODE_DEFAULT, MODE_DISABLED, MODE_EXPLICIT, preferredTileSizes, progressiveMode, tileGridXOffset, tileGridYOffset, tileHeight, tileWidth, tilingMode, tilingSet |
| Fields inherited from class javax.imageio.IIOParam |
|---|
controller, defaultController, destinationOffset, destinationType, sourceBands, sourceRegion, sourceXSubsampling, sourceYSubsampling, subsamplingXOffset, subsamplingYOffset |
| Constructor Summary | |
|---|---|
JPEGImageWriteParam(Locale locale)
Constructs a JPEGImageWriteParam. |
|
| Method Summary | |
|---|---|
boolean |
areTablesSet()
Returns true if tables are currently set. |
JPEGHuffmanTable[] |
getACHuffmanTables()
Returns a copy of the array of AC Huffman tables set on the most recent call to setEncodeTables, or
null if tables are not currently set. |
String[] |
getCompressionQualityDescriptions()
Returns an array of Strings that may be used along
with getCompressionQualityValues as part of a user
interface for setting or displaying the compression quality
level. |
float[] |
getCompressionQualityValues()
Returns an array of floats that may be used along
with getCompressionQualityDescriptions as part of a user
interface for setting or displaying the compression quality
level. |
JPEGHuffmanTable[] |
getDCHuffmanTables()
Returns a copy of the array of DC Huffman tables set on the most recent call to setEncodeTables, or
null if tables are not currently set. |
boolean |
getOptimizeHuffmanTables()
Returns the value passed into the most recent call to setOptimizeHuffmanTables, or
false if setOptimizeHuffmanTables
has never been called. |
JPEGQTable[] |
getQTables()
Returns a copy of the array of quantization tables set on the most recent call to setEncodeTables, or
null if tables are not currently set. |
boolean |
isCompressionLossless()
Returns false since the JPEG plug-in only supports
lossy compression. |
void |
setEncodeTables(JPEGQTable[] qTables,
JPEGHuffmanTable[] DCHuffmanTables,
JPEGHuffmanTable[] ACHuffmanTables)
Sets the quantization and Huffman tables to use in encoding abbreviated streams. |
void |
setOptimizeHuffmanTables(boolean optimize)
Tells the writer to generate optimized Huffman tables for the image as part of the writing process. |
void |
unsetCompression()
Removes any previous compression quality setting. |
void |
unsetEncodeTables()
Removes any quantization and Huffman tables that are currently set. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JPEGImageWriteParam(Locale locale)
JPEGImageWriteParam. Tiling is not
supported. Progressive encoding is supported. The default
progressive mode is MODE_DISABLED. A single form of compression,
named "JPEG", is supported. The default compression quality is
0.75.
locale - a Locale to be used by the
superclass to localize compression type names and quality
descriptions, or null.| Method Detail |
|---|
public void unsetCompression()
The default implementation resets the compression quality
to 0.75F.
unsetCompression in class ImageWriteParamIllegalStateException - if the compression mode is not
MODE_EXPLICIT.ImageWriteParam.setCompressionType(java.lang.String),
ImageWriteParam.setCompressionQuality(float)public boolean isCompressionLossless()
false since the JPEG plug-in only supports
lossy compression.
isCompressionLossless in class ImageWriteParamfalse.
IllegalStateException - if the compression mode is not
MODE_EXPLICIT.public String[] getCompressionQualityDescriptions()
ImageWriteParamStrings that may be used along
with getCompressionQualityValues as part of a user
interface for setting or displaying the compression quality
level. The String with index i
provides a description of the range of quality levels between
getCompressionQualityValues[i] and
getCompressionQualityValues[i + 1]. Note that the
length of the array returned from
getCompressionQualityValues will always be one
greater than that returned from
getCompressionQualityDescriptions.
As an example, the strings "Good", "Better", and "Best"
could be associated with the ranges [0, .33),
[.33, .66), and [.66, 1.0]. In this
case, getCompressionQualityDescriptions would
return { "Good", "Better", "Best" } and
getCompressionQualityValues would return
{ 0.0F, .33F, .66F, 1.0F }.
If no descriptions are available, null is
returned. If null is returned from
getCompressionQualityValues, this method must also
return null.
The descriptions should be localized for the
Locale returned by getLocale, if it
is non-null.
If there are multiple compression types but none has been set,
an IllegalStateException is thrown.
The default implementation checks that compression is
supported and that the compression mode is
MODE_EXPLICIT. If so, if
getCompressionTypes() is null or
getCompressionType() is non-null, it
returns null.
getCompressionQualityDescriptions in class ImageWriteParamStrings containing localized
descriptions of the compression quality levels.ImageWriteParam.getCompressionQualityValues()public float[] getCompressionQualityValues()
ImageWriteParamfloats that may be used along
with getCompressionQualityDescriptions as part of a user
interface for setting or displaying the compression quality
level. See getCompressionQualityDescriptions for more information.
If no descriptions are available, null is
returned. If null is returned from
getCompressionQualityDescriptions, this method
must also return null.
If there are multiple compression types but none has been set,
an IllegalStateException is thrown.
The default implementation checks that compression is
supported and that the compression mode is
MODE_EXPLICIT. If so, if
getCompressionTypes() is null or
getCompressionType() is non-null, it
returns null.
getCompressionQualityValues in class ImageWriteParamfloats indicating the
boundaries between the compression quality levels as described
by the Strings from
getCompressionQualityDescriptions.ImageWriteParam.getCompressionQualityDescriptions()public boolean areTablesSet()
true if tables are currently set.
true if tables are present.public void setEncodeTables(JPEGQTable[] qTables, JPEGHuffmanTable[] DCHuffmanTables, JPEGHuffmanTable[] ACHuffmanTables)
null.
The two arrays of Huffman tables must have the same number of
elements. The table specifiers in the frame and scan headers
in the metadata are assumed to be equivalent to indices into
these arrays. The argument arrays are copied by this method.
qTables - An array of quantization table objects.DCHuffmanTables - An array of Huffman table objects.ACHuffmanTables - An array of Huffman table objects.
IllegalArgumentException - if any of the arguments
is null or has more than 4 elements, or if the
numbers of DC and AC tables differ.unsetEncodeTables()public void unsetEncodeTables()
public JPEGQTable[] getQTables()
setEncodeTables, or
null if tables are not currently set.
JPEGQTable objects, or
null.setEncodeTables(javax.imageio.plugins.jpeg.JPEGQTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[])public JPEGHuffmanTable[] getDCHuffmanTables()
setEncodeTables, or
null if tables are not currently set.
JPEGHuffmanTable objects, or
null.setEncodeTables(javax.imageio.plugins.jpeg.JPEGQTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[])public JPEGHuffmanTable[] getACHuffmanTables()
setEncodeTables, or
null if tables are not currently set.
JPEGHuffmanTable objects, or
null.setEncodeTables(javax.imageio.plugins.jpeg.JPEGQTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[], javax.imageio.plugins.jpeg.JPEGHuffmanTable[])public void setOptimizeHuffmanTables(boolean optimize)
false. If this flag is set
to true, it overrides any tables specified
in the metadata. Note that this means that any image
written with this flag set to true will
always contain Huffman tables.
optimize - A boolean indicating whether to generate
optimized Huffman tables when writing.getOptimizeHuffmanTables()public boolean getOptimizeHuffmanTables()
setOptimizeHuffmanTables, or
false if setOptimizeHuffmanTables
has never been called.
true if the writer will generate optimized
Huffman tables.setOptimizeHuffmanTables(boolean)