Class JPEGImageReadParam
getDefaultImageReadParam methods of the built-in JPEG
ImageReader.
The sole purpose of these additions is to allow the
specification of tables for use in decoding abbreviated streams.
The built-in JPEG reader will also accept an ordinary
ImageReadParam, which is sufficient for decoding
non-abbreviated streams.
While tables for abbreviated streams are often obtained by
first reading another abbreviated stream containing only the
tables, in some applications the tables are fixed ahead of time.
This class allows the tables to be specified directly from client
code. If no tables are specified either in the stream or in a
JPEGImageReadParam, then the stream is presumed to use
the "standard" visually lossless tables. See JPEGQTable
and JPEGHuffmanTable for more information
on the default tables.
The default JPEGImageReadParam returned by the
getDefaultReadParam method of the builtin JPEG reader
contains no tables. Default tables may be obtained from the table
classes JPEGQTable and
JPEGHuffmanTable.
If a stream does contain tables, the tables given in a
JPEGImageReadParam are ignored. Furthermore, if the
first image in a stream does contain tables and subsequent ones do
not, then the tables given in the first image are used for all the
abbreviated images. Once tables have been read from a stream, they
can be overridden only by tables subsequently read from the same
stream. In order to specify new tables, the setInput method of
the reader must be called to change the stream.
Note that this class does not provide a means for obtaining the tables found in a stream. These may be extracted from a stream by consulting the IIOMetadata object returned by the reader.
For more information about the operation of the built-in JPEG plug-ins, see the JPEG metadata format specification and usage notes.
-
Field Summary
Fields declared in class ImageReadParam
canSetSourceRenderSize, destination, destinationBands, minProgressivePass, numProgressivePasses, sourceRenderSizeModifier and TypeFieldDescriptionprotected booleantrueif thisImageReadParamallows the source rendering dimensions to be set.protected BufferedImageThe current destinationBufferedImage, ornullif none has been set.protected int[]The set of destination bands to be used, as an array ofints.protected intThe minimum index of a progressive pass to read from the source.protected intThe maximum number of progressive passes to read from the source.protected DimensionThe desired rendering width and height of the source, ifcanSetSourceRenderSizeistrue, ornull.Fields declared in class IIOParam
controller, defaultController, destinationOffset, destinationType, sourceBands, sourceRegion, sourceXSubsampling, sourceYSubsampling, subsamplingXOffset, subsamplingYOffsetModifier and TypeFieldDescriptionprotected IIOParamControllerTheIIOParamControllerthat will be used to provide settings for thisIIOParamobject when theactivateControllermethod is called.protected IIOParamControllerThe defaultIIOParamControllerthat will be used to provide settings for thisIIOParamobject when theactivateControllermethod is called.protected PointThe offset in the destination where the upper-left decoded pixel should be placed.protected ImageTypeSpecifierAnImageTypeSpecifierto be used to generate a destination image when reading, or to set the output color type when writing.protected int[]An array ofints indicating which source bands will be used, ornull.protected RectangleThe source region, onnullif none is set.protected intThe decimation subsampling to be applied in the horizontal direction.protected intThe decimation subsampling to be applied in the vertical direction.protected intA horizontal offset to be applied to the subsampling grid before subsampling.protected intA vertical offset to be applied to the subsampling grid before subsampling. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturnstrueif tables are currently set.Returns a copy of the array of AC Huffman tables set on the most recent call tosetDecodeTables, ornullif tables are not currently set.Returns a copy of the array of DC Huffman tables set on the most recent call tosetDecodeTables, ornullif tables are not currently set.Returns a copy of the array of quantization tables set on the most recent call tosetDecodeTables, ornullif tables are not currently set.voidsetDecodeTables(JPEGQTable[] qTables, JPEGHuffmanTable[] DCHuffmanTables, JPEGHuffmanTable[] ACHuffmanTables) Sets the quantization and Huffman tables to use in decoding abbreviated streams.voidRemoves any quantization and Huffman tables that are currently set.Methods declared in class ImageReadParam
canSetSourceRenderSize, getDestination, getDestinationBands, getSourceMaxProgressivePass, getSourceMinProgressivePass, getSourceNumProgressivePasses, getSourceRenderSize, setDestination, setDestinationBands, setSourceProgressivePasses, setSourceRenderSizeModifier and TypeMethodDescriptionbooleanReturnstrueif this reader allows the source image to be rendered at an arbitrary size as part of the decoding process, by means of thesetSourceRenderSizemethod.Returns theBufferedImagecurrently set by thesetDestinationmethod, ornullif none is set.int[]Returns the set of band indices where data will be placed.intIfgetSourceNumProgressivePassesis equal toInteger.MAX_VALUE, returnsInteger.MAX_VALUE.intReturns the index of the first progressive pass that will be decoded.intReturns the number of the progressive passes that will be decoded.Returns the width and height of the source image as it will be rendered during decoding, if they have been set via thesetSourceRenderSizemethod.voidsetDestination(BufferedImage destination) Supplies aBufferedImageto be used as the destination for decoded pixel data.voidsetDestinationBands(int[] destinationBands) Sets the indices of the destination bands where data will be placed.voidsetSourceProgressivePasses(int minPass, int numPasses) Sets the range of progressive passes that will be decoded.voidsetSourceRenderSize(Dimension size) If the image is able to be rendered at an arbitrary size, sets the source width and height to the supplied values.Methods declared in class IIOParam
activateController, getController, getDefaultController, getDestinationOffset, getDestinationType, getSourceBands, getSourceRegion, getSourceXSubsampling, getSourceYSubsampling, getSubsamplingXOffset, getSubsamplingYOffset, hasController, setController, setDestinationOffset, setDestinationType, setSourceBands, setSourceRegion, setSourceSubsamplingModifier and TypeMethodDescriptionbooleanActivates the installedIIOParamControllerfor thisIIOParamobject and returns the resulting value.Returns whateverIIOParamControlleris currently installed.Returns the defaultIIOParamController, if there is one, regardless of the currently installed controller.Returns the offset in the destination image at which pixels are to be placed.Returns the type of image to be returned by the read, if one was set by a call tosetDestination(ImageTypeSpecifier), as anImageTypeSpecifier.int[]Returns the set of source bands to be used.Returns the source region to be used.intReturns the number of source columns to advance for each pixel.intReturns the number of rows to advance for each pixel.intReturns the horizontal offset of the subsampling grid.intReturns the vertical offset of the subsampling grid.booleanReturnstrueif there is a controller installed for thisIIOParamobject.voidsetController(IIOParamController controller) Sets theIIOParamControllerto be used to provide settings for thisIIOParamobject when theactivateControllermethod is called, overriding any default controller.voidsetDestinationOffset(Point destinationOffset) Specifies the offset in the destination image at which future decoded pixels are to be placed, when reading, or where a region will be written, when writing.voidsetDestinationType(ImageTypeSpecifier destinationType) Sets the desired image type for the destination image, using anImageTypeSpecifier.voidsetSourceBands(int[] sourceBands) Sets the indices of the source bands to be used.voidsetSourceRegion(Rectangle sourceRegion) Sets the source region of interest.voidsetSourceSubsampling(int sourceXSubsampling, int sourceYSubsampling, int subsamplingXOffset, int subsamplingYOffset) Specifies a decimation subsampling to apply on I/O.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.toString()Answers a string containing a concise, human-readable description of the receiver.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
JPEGImageReadParam
public JPEGImageReadParam()Constructs aJPEGImageReadParam.
-
-
Method Details
-
areTablesSet
public boolean areTablesSet()Returnstrueif tables are currently set.- Returns:
trueif tables are present.
-
setDecodeTables
public void setDecodeTables(JPEGQTable[] qTables, JPEGHuffmanTable[] DCHuffmanTables, JPEGHuffmanTable[] ACHuffmanTables) Sets the quantization and Huffman tables to use in decoding abbreviated streams. There may be a maximum of 4 tables of each type. These tables are ignored once tables are encountered in the stream. All arguments must be non-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 stream are assumed to be equivalent to indices into these arrays. The argument arrays are copied by this method.- Parameters:
qTables- an array of quantization table objects.DCHuffmanTables- an array of Huffman table objects.ACHuffmanTables- an array of Huffman table objects.- Throws:
IllegalArgumentException- if any of the arguments isnull, has more than 4 elements, or if the numbers of DC and AC tables differ.- See Also:
-
unsetDecodeTables
public void unsetDecodeTables()Removes any quantization and Huffman tables that are currently set.- See Also:
-
getQTables
Returns a copy of the array of quantization tables set on the most recent call tosetDecodeTables, ornullif tables are not currently set.- Returns:
- an array of
JPEGQTableobjects, ornull. - See Also:
-
getDCHuffmanTables
Returns a copy of the array of DC Huffman tables set on the most recent call tosetDecodeTables, ornullif tables are not currently set.- Returns:
- an array of
JPEGHuffmanTableobjects, ornull. - See Also:
-
getACHuffmanTables
Returns a copy of the array of AC Huffman tables set on the most recent call tosetDecodeTables, ornullif tables are not currently set.- Returns:
- an array of
JPEGHuffmanTableobjects, ornull. - See Also:
-