javax.imageio
Class ImageReadParam

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.imageio.IIOParam sample code for javax.imageio.IIOParam definition code for javax.imageio.IIOParam 
      extended by javax.imageio.ImageReadParam
Direct Known Subclasses:
JPEGImageReadParam sample code for javax.imageio.plugins.jpeg.JPEGImageReadParam definition code for javax.imageio.plugins.jpeg.JPEGImageReadParam

public class ImageReadParam
extends IIOParam sample code for javax.imageio.IIOParam definition code for javax.imageio.IIOParam

A class describing how a stream is to be decoded. Instances of this class or its subclasses are used to supply prescriptive "how-to" information to instances of ImageReader.

An image encoded as part of a file or stream may be thought of extending out in multiple dimensions: the spatial dimensions of width and height, a number of bands, and a number of progressive decoding passes. This class allows a contiguous (hyper)rectangular subarea of the image in all of these dimensions to be selected for decoding. Additionally, the spatial dimensions may be subsampled discontinuously. Finally, color and format conversions may be specified by controlling the ColorModel and SampleModel of the destination image, either by providing a BufferedImage or by using an ImageTypeSpecifier.

An ImageReadParam object is used to specify how an image, or a set of images, will be converted on input from a stream in the context of the Java Image I/O framework. A plug-in for a specific image format will return instances of ImageReadParam from the getDefaultReadParam method of its ImageReader implementation.

The state maintained by an instance of ImageReadParam is independent of any particular image being decoded. When actual decoding takes place, the values set in the read param are combined with the actual properties of the image being decoded from the stream and the destination BufferedImage that will receive the decoded pixel data. For example, the source region set using setSourceRegion will first be intersected with the actual valid source area. The result will be translated by the value returned by getDestinationOffset, and the resulting rectangle intersected with the actual valid destination area to yield the destination area that will be written.

The parameters specified by an ImageReadParam are applied to an image as follows. First, if a rendering size has been set by setSourceRenderSize, the entire decoded image is rendered at the size given by getSourceRenderSize. Otherwise, the image has its natural size given by ImageReader.getWidth and ImageReader.getHeight.

Next, the image is clipped against the source region specified by getSourceXOffset, getSourceYOffset, getSourceWidth, and getSourceHeight.

The resulting region is then subsampled according to the factors given in IIOParam.setSourceSubsampling sample code for javax.imageio.IIOParam.setSourceSubsampling(int, int, int, int) definition code for javax.imageio.IIOParam.setSourceSubsampling(int, int, int, int) . The first pixel, the number of pixels per row, and the number of rows all depend on the subsampling settings. Call the minimum X and Y coordinates of the resulting rectangle (minX, minY), its width w and its height h.

This rectangle is offset by (getDestinationOffset().x, getDestinationOffset().y) and clipped against the destination bounds. If no destination image has been set, the destination is defined to have a width of getDestinationOffset().x + w, and a height of getDestinationOffset().y + h so that all pixels of the source region may be written to the destination.

Pixels that land, after subsampling, within the destination image, and that are written in one of the progressive passes specified by getSourceMinProgressivePass and getSourceNumProgressivePasses are passed along to the next step.

Finally, the source samples of each pixel are mapped into destination bands according to the algorithm described in the comment for setDestinationBands.

Plug-in writers may extend the functionality of ImageReadParam by providing a subclass that implements additional, plug-in specific interfaces. It is up to the plug-in to document what interfaces are available and how they are to be used. Readers will silently ignore any extended features of an ImageReadParam subclass of which they are not aware. Also, they may ignore any optional features that they normally disable when creating their own ImageReadParam instances via getDefaultReadParam.

Note that unless a query method exists for a capability, it must be supported by all ImageReader implementations (e.g. source render size is optional, but subsampling must be supported).

See Also:
ImageReader sample code for javax.imageio.ImageReader definition code for javax.imageio.ImageReader , ImageWriter sample code for javax.imageio.ImageWriter definition code for javax.imageio.ImageWriter , ImageWriteParam sample code for javax.imageio.ImageWriteParam definition code for javax.imageio.ImageWriteParam

Field Summary
protected  boolean canSetSourceRenderSize sample code for javax.imageio.ImageReadParam.canSetSourceRenderSize definition code for javax.imageio.ImageReadParam.canSetSourceRenderSize
          true if this ImageReadParam allows the source rendering dimensions to be set.
protected  BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage destination sample code for javax.imageio.ImageReadParam.destination definition code for javax.imageio.ImageReadParam.destination
          The current destination BufferedImage, or null if none has been set.
protected  int[] destinationBands sample code for javax.imageio.ImageReadParam.destinationBands definition code for javax.imageio.ImageReadParam.destinationBands
          The set of destination bands to be used, as an array of ints.
protected  int minProgressivePass sample code for javax.imageio.ImageReadParam.minProgressivePass definition code for javax.imageio.ImageReadParam.minProgressivePass
          The minimum index of a progressive pass to read from the source.
protected  int numProgressivePasses sample code for javax.imageio.ImageReadParam.numProgressivePasses definition code for javax.imageio.ImageReadParam.numProgressivePasses
          The maximum number of progressive passes to read from the source.
protected  Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension sourceRenderSize sample code for javax.imageio.ImageReadParam.sourceRenderSize definition code for javax.imageio.ImageReadParam.sourceRenderSize
          The desired rendering width and height of the source, if canSetSourceRenderSize is true, or null.
 
Fields inherited from class javax.imageio.IIOParam sample code for javax.imageio.IIOParam definition code for javax.imageio.IIOParam
controller sample code for javax.imageio.IIOParam.controller definition code for javax.imageio.IIOParam.controller , defaultController sample code for javax.imageio.IIOParam.defaultController definition code for javax.imageio.IIOParam.defaultController , destinationOffset sample code for javax.imageio.IIOParam.destinationOffset definition code for javax.imageio.IIOParam.destinationOffset , destinationType sample code for javax.imageio.IIOParam.destinationType definition code for javax.imageio.IIOParam.destinationType , sourceBands sample code for javax.imageio.IIOParam.sourceBands definition code for javax.imageio.IIOParam.sourceBands , sourceRegion sample code for javax.imageio.IIOParam.sourceRegion definition code for javax.imageio.IIOParam.sourceRegion , sourceXSubsampling sample code for javax.imageio.IIOParam.sourceXSubsampling definition code for javax.imageio.IIOParam.sourceXSubsampling , sourceYSubsampling sample code for javax.imageio.IIOParam.sourceYSubsampling definition code for javax.imageio.IIOParam.sourceYSubsampling , subsamplingXOffset sample code for javax.imageio.IIOParam.subsamplingXOffset definition code for javax.imageio.IIOParam.subsamplingXOffset , subsamplingYOffset sample code for javax.imageio.IIOParam.subsamplingYOffset definition code for javax.imageio.IIOParam.subsamplingYOffset
 
Constructor Summary
ImageReadParam sample code for javax.imageio.ImageReadParam.ImageReadParam() definition code for javax.imageio.ImageReadParam.ImageReadParam() ()
          Constructs an ImageReadParam.
 
Method Summary
 boolean canSetSourceRenderSize sample code for javax.imageio.ImageReadParam.canSetSourceRenderSize() definition code for javax.imageio.ImageReadParam.canSetSourceRenderSize() ()
          Returns true if this reader allows the source image to be rendered at an arbitrary size as part of the decoding process, by means of the setSourceRenderSize method.
 BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage getDestination sample code for javax.imageio.ImageReadParam.getDestination() definition code for javax.imageio.ImageReadParam.getDestination() ()
          Returns the BufferedImage currently set by the setDestination method, or null if none is set.
 int[] getDestinationBands sample code for javax.imageio.ImageReadParam.getDestinationBands() definition code for javax.imageio.ImageReadParam.getDestinationBands() ()
          Returns the set of band indices where data will be placed.
 int getSourceMaxProgressivePass sample code for javax.imageio.ImageReadParam.getSourceMaxProgressivePass() definition code for javax.imageio.ImageReadParam.getSourceMaxProgressivePass() ()
          If getSourceNumProgressivePasses is equal to Integer.MAX_VALUE, returns Integer.MAX_VALUE.
 int getSourceMinProgressivePass sample code for javax.imageio.ImageReadParam.getSourceMinProgressivePass() definition code for javax.imageio.ImageReadParam.getSourceMinProgressivePass() ()
          Returns the index of the first progressive pass that will be decoded.
 int getSourceNumProgressivePasses sample code for javax.imageio.ImageReadParam.getSourceNumProgressivePasses() definition code for javax.imageio.ImageReadParam.getSourceNumProgressivePasses() ()
          Returns the number of the progressive passes that will be decoded.
 Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension getSourceRenderSize sample code for javax.imageio.ImageReadParam.getSourceRenderSize() definition code for javax.imageio.ImageReadParam.getSourceRenderSize() ()
          Returns the width and height of the source image as it will be rendered during decoding, if they have been set via the setSourceRenderSize method.
 void setDestination sample code for javax.imageio.ImageReadParam.setDestination(java.awt.image.BufferedImage) definition code for javax.imageio.ImageReadParam.setDestination(java.awt.image.BufferedImage) (BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage  destination)
          Supplies a BufferedImage to be used as the destination for decoded pixel data.
 void setDestinationBands sample code for javax.imageio.ImageReadParam.setDestinationBands(int[]) definition code for javax.imageio.ImageReadParam.setDestinationBands(int[]) (int[] destinationBands)
          Sets the indices of the destination bands where data will be placed.
 void setDestinationType sample code for javax.imageio.ImageReadParam.setDestinationType(javax.imageio.ImageTypeSpecifier) definition code for javax.imageio.ImageReadParam.setDestinationType(javax.imageio.ImageTypeSpecifier) (ImageTypeSpecifier sample code for javax.imageio.ImageTypeSpecifier definition code for javax.imageio.ImageTypeSpecifier  destinationType)
          Sets the desired image type for the destination image, using an ImageTypeSpecifier.
 void setSourceProgressivePasses sample code for javax.imageio.ImageReadParam.setSourceProgressivePasses(int, int) definition code for javax.imageio.ImageReadParam.setSourceProgressivePasses(int, int) (int minPass, int numPasses)
          Sets the range of progressive passes that will be decoded.
 void setSourceRenderSize sample code for javax.imageio.ImageReadParam.setSourceRenderSize(java.awt.Dimension) definition code for javax.imageio.ImageReadParam.setSourceRenderSize(java.awt.Dimension) (Dimension sample code for java.awt.Dimension definition code for java.awt.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 inherited from class javax.imageio.IIOParam sample code for javax.imageio.IIOParam definition code for javax.imageio.IIOParam
activateController sample code for javax.imageio.IIOParam.activateController() definition code for javax.imageio.IIOParam.activateController() , getController sample code for javax.imageio.IIOParam.getController() definition code for javax.imageio.IIOParam.getController() , getDefaultController sample code for javax.imageio.IIOParam.getDefaultController() definition code for javax.imageio.IIOParam.getDefaultController() , getDestinationOffset sample code for javax.imageio.IIOParam.getDestinationOffset() definition code for javax.imageio.IIOParam.getDestinationOffset() , getDestinationType sample code for javax.imageio.IIOParam.getDestinationType() definition code for javax.imageio.IIOParam.getDestinationType() , getSourceBands sample code for javax.imageio.IIOParam.getSourceBands() definition code for javax.imageio.IIOParam.getSourceBands() , getSourceRegion sample code for javax.imageio.IIOParam.getSourceRegion() definition code for javax.imageio.IIOParam.getSourceRegion() , getSourceXSubsampling sample code for javax.imageio.IIOParam.getSourceXSubsampling() definition code for javax.imageio.IIOParam.getSourceXSubsampling() , getSourceYSubsampling sample code for javax.imageio.IIOParam.getSourceYSubsampling() definition code for javax.imageio.IIOParam.getSourceYSubsampling() , getSubsamplingXOffset sample code for javax.imageio.IIOParam.getSubsamplingXOffset() definition code for javax.imageio.IIOParam.getSubsamplingXOffset() , getSubsamplingYOffset sample code for javax.imageio.IIOParam.getSubsamplingYOffset() definition code for javax.imageio.IIOParam.getSubsamplingYOffset() , hasController sample code for javax.imageio.IIOParam.hasController() definition code for javax.imageio.IIOParam.hasController() , setController sample code for javax.imageio.IIOParam.setController(javax.imageio.IIOParamController) definition code for javax.imageio.IIOParam.setController(javax.imageio.IIOParamController) , setDestinationOffset sample code for javax.imageio.IIOParam.setDestinationOffset(java.awt.Point) definition code for javax.imageio.IIOParam.setDestinationOffset(java.awt.Point) , setSourceBands sample code for javax.imageio.IIOParam.setSourceBands(int[]) definition code for javax.imageio.IIOParam.setSourceBands(int[]) , setSourceRegion sample code for javax.imageio.IIOParam.setSourceRegion(java.awt.Rectangle) definition code for javax.imageio.IIOParam.setSourceRegion(java.awt.Rectangle) , setSourceSubsampling sample code for javax.imageio.IIOParam.setSourceSubsampling(int, int, int, int) definition code for javax.imageio.IIOParam.setSourceSubsampling(int, int, int, int)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

canSetSourceRenderSize sample code for javax.imageio.ImageReadParam.canSetSourceRenderSize

protected boolean canSetSourceRenderSize
true if this ImageReadParam allows the source rendering dimensions to be set. By default, the value is false. Subclasses must set this value manually.

ImageReaders that do not support setting of the source render size should set this value to false.


sourceRenderSize sample code for javax.imageio.ImageReadParam.sourceRenderSize

protected Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  sourceRenderSize
The desired rendering width and height of the source, if canSetSourceRenderSize is true, or null.

ImageReaders that do not support setting of the source render size may ignore this value.


destination sample code for javax.imageio.ImageReadParam.destination

protected BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage  destination
The current destination BufferedImage, or null if none has been set. By default, the value is null.


destinationBands sample code for javax.imageio.ImageReadParam.destinationBands

protected int[] destinationBands
The set of destination bands to be used, as an array of ints. By default, the value is null, indicating all destination bands should be written in order.


minProgressivePass sample code for javax.imageio.ImageReadParam.minProgressivePass

protected int minProgressivePass
The minimum index of a progressive pass to read from the source. By default, the value is set to 0, which indicates that passes starting with the first available pass should be decoded.

Subclasses should ensure that this value is non-negative.


numProgressivePasses sample code for javax.imageio.ImageReadParam.numProgressivePasses

protected int numProgressivePasses
The maximum number of progressive passes to read from the source. By default, the value is set to Integer.MAX_VALUE, which indicates that passes up to and including the last available pass should be decoded.

Subclasses should ensure that this value is positive. Additionally, if the value is not Integer.MAX_VALUE, then minProgressivePass + numProgressivePasses - 1 should not exceed Integer.MAX_VALUE.

Constructor Detail

ImageReadParam sample code for javax.imageio.ImageReadParam() definition code for javax.imageio.ImageReadParam()

public ImageReadParam()
Constructs an ImageReadParam.

Method Detail

setDestinationType sample code for javax.imageio.ImageReadParam.setDestinationType(javax.imageio.ImageTypeSpecifier) definition code for javax.imageio.ImageReadParam.setDestinationType(javax.imageio.ImageTypeSpecifier)

public void setDestinationType(ImageTypeSpecifier sample code for javax.imageio.ImageTypeSpecifier definition code for javax.imageio.ImageTypeSpecifier  destinationType)
Description copied from class: IIOParam sample code for javax.imageio.IIOParam.setDestinationType(javax.imageio.ImageTypeSpecifier) definition code for javax.imageio.IIOParam.setDestinationType(javax.imageio.ImageTypeSpecifier)
Sets the desired image type for the destination image, using an ImageTypeSpecifier.

When reading, if the layout of the destination has been set using this method, each call to an ImageReader read method will return a new BufferedImage using the format specified by the supplied type specifier. As a side effect, any destination BufferedImage set by ImageReadParam.setDestination(BufferedImage) will no longer be set as the destination. In other words, this method may be thought of as calling setDestination((BufferedImage)null).

When writing, the destination type maybe used to determine the color type of the image. The SampleModel information will be ignored, and may be null. For example, a 4-banded image could represent either CMYK or RGBA data. If a destination type is set, its ColorModel will override any ColorModel on the image itself. This is crucial when setSourceBands is used since the image's ColorModel will refer to the entire image rather than to the subset of bands being written.

Overrides:
setDestinationType sample code for javax.imageio.IIOParam.setDestinationType(javax.imageio.ImageTypeSpecifier) definition code for javax.imageio.IIOParam.setDestinationType(javax.imageio.ImageTypeSpecifier) in class IIOParam sample code for javax.imageio.IIOParam definition code for javax.imageio.IIOParam
Parameters:
destinationType - the ImageTypeSpecifier to be used to determine the destination layout and color type.
See Also:
IIOParam.getDestinationType() sample code for javax.imageio.IIOParam.getDestinationType() definition code for javax.imageio.IIOParam.getDestinationType()

setDestination sample code for javax.imageio.ImageReadParam.setDestination(java.awt.image.BufferedImage) definition code for javax.imageio.ImageReadParam.setDestination(java.awt.image.BufferedImage)

public void setDestination(BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage  destination)
Supplies a BufferedImage to be used as the destination for decoded pixel data. The currently set image will be written to by the read, readAll, and readRaster methods, and a reference to it will be returned by those methods.

Pixel data from the aforementioned methods will be written starting at the offset specified by getDestinationOffset.

If destination is null, a newly-created BufferedImage will be returned by those methods.

At the time of reading, the image is checked to verify that its ColorModel and SampleModel correspond to one of the ImageTypeSpecifiers returned from the ImageReader's getImageTypes method. If it does not, the reader will throw an IIOException.

Parameters:
destination - the BufferedImage to be written to, or null.
See Also:
getDestination() sample code for javax.imageio.ImageReadParam.getDestination() definition code for javax.imageio.ImageReadParam.getDestination()

getDestination sample code for javax.imageio.ImageReadParam.getDestination() definition code for javax.imageio.ImageReadParam.getDestination()

public BufferedImage sample code for java.awt.image.BufferedImage definition code for java.awt.image.BufferedImage  getDestination()
Returns the BufferedImage currently set by the setDestination method, or null if none is set.

Returns:
the BufferedImage to be written to.
See Also:
setDestination(java.awt.image.BufferedImage) sample code for javax.imageio.ImageReadParam.setDestination(java.awt.image.BufferedImage) definition code for javax.imageio.ImageReadParam.setDestination(java.awt.image.BufferedImage)

setDestinationBands sample code for javax.imageio.ImageReadParam.setDestinationBands(int[]) definition code for javax.imageio.ImageReadParam.setDestinationBands(int[])

public void setDestinationBands(int[] destinationBands)
Sets the indices of the destination bands where data will be placed. Duplicate indices are not allowed.

A null value indicates that all destination bands will be used.

Choosing a destination band subset will not affect the number of bands in the output image of a read if no destination image is specified; the created destination image will still have the same number of bands as if this method had never been called. If a different number of bands in the destination image is desired, an image must be supplied using the ImageReadParam.setDestination method.

At the time of reading or writing, an IllegalArgumentException will be thrown by the reader or writer if a value larger than the largest destination band index has been specified, or if the number of source bands and destination bands to be used differ. The ImageReader.checkReadParamBandSettings method may be used to automate this test.

Parameters:
destinationBands - an array of integer band indices to be used.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if destinationBands contains a negative or duplicate value.
See Also:
getDestinationBands() sample code for javax.imageio.ImageReadParam.getDestinationBands() definition code for javax.imageio.ImageReadParam.getDestinationBands() , IIOParam.getSourceBands() sample code for javax.imageio.IIOParam.getSourceBands() definition code for javax.imageio.IIOParam.getSourceBands() , ImageReader.checkReadParamBandSettings(javax.imageio.ImageReadParam, int, int) sample code for javax.imageio.ImageReader.checkReadParamBandSettings(javax.imageio.ImageReadParam, int, int) definition code for javax.imageio.ImageReader.checkReadParamBandSettings(javax.imageio.ImageReadParam, int, int)

getDestinationBands sample code for javax.imageio.ImageReadParam.getDestinationBands() definition code for javax.imageio.ImageReadParam.getDestinationBands()

public int[] getDestinationBands()
Returns the set of band indices where data will be placed. If no value has been set, null is returned to indicate that all destination bands will be used.

Returns:
the indices of the destination bands to be used, or null.
See Also:
setDestinationBands(int[]) sample code for javax.imageio.ImageReadParam.setDestinationBands(int[]) definition code for javax.imageio.ImageReadParam.setDestinationBands(int[])

canSetSourceRenderSize sample code for javax.imageio.ImageReadParam.canSetSourceRenderSize() definition code for javax.imageio.ImageReadParam.canSetSourceRenderSize()

public boolean canSetSourceRenderSize()
Returns true if this reader allows the source image to be rendered at an arbitrary size as part of the decoding process, by means of the setSourceRenderSize method. If this method returns false, calls to setSourceRenderSize will throw an UnsupportedOperationException.

Returns:
true if setting source rendering size is supported.
See Also:
setSourceRenderSize(java.awt.Dimension) sample code for javax.imageio.ImageReadParam.setSourceRenderSize(java.awt.Dimension) definition code for javax.imageio.ImageReadParam.setSourceRenderSize(java.awt.Dimension)

setSourceRenderSize sample code for javax.imageio.ImageReadParam.setSourceRenderSize(java.awt.Dimension) definition code for javax.imageio.ImageReadParam.setSourceRenderSize(java.awt.Dimension)

public void setSourceRenderSize(Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  size)
                         throws UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException 
If the image is able to be rendered at an arbitrary size, sets the source width and height to the supplied values. Note that the values returned from the getWidth and getHeight methods on ImageReader are not affected by this method; they will continue to return the default size for the image. Similarly, if the image is also tiled the tile width and height are given in terms of the default size.

Typically, the width and height should be chosen such that the ratio of width to height closely approximates the aspect ratio of the image, as returned from ImageReader.getAspectRatio.

If this plug-in does not allow the rendering size to be set, an UnsupportedOperationException will be thrown.

To remove the render size setting, pass in a value of null for size.

Parameters:
size - a Dimension indicating the desired width and height.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if either the width or the height is negative or 0.
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - if image resizing is not supported by this plug-in.
See Also:
getSourceRenderSize() sample code for javax.imageio.ImageReadParam.getSourceRenderSize() definition code for javax.imageio.ImageReadParam.getSourceRenderSize() , ImageReader.getWidth(int) sample code for javax.imageio.ImageReader.getWidth(int) definition code for javax.imageio.ImageReader.getWidth(int) , ImageReader.getHeight(int) sample code for javax.imageio.ImageReader.getHeight(int) definition code for javax.imageio.ImageReader.getHeight(int) , ImageReader.getAspectRatio(int) sample code for javax.imageio.ImageReader.getAspectRatio(int) definition code for javax.imageio.ImageReader.getAspectRatio(int)

getSourceRenderSize sample code for javax.imageio.ImageReadParam.getSourceRenderSize() definition code for javax.imageio.ImageReadParam.getSourceRenderSize()

public Dimension sample code for java.awt.Dimension definition code for java.awt.Dimension  getSourceRenderSize()
Returns the width and height of the source image as it will be rendered during decoding, if they have been set via the setSourceRenderSize method. A nullvalue indicates that no setting has been made.

Returns:
the rendered width and height of the source image as a Dimension.
See Also:
setSourceRenderSize(java.awt.Dimension) sample code for javax.imageio.ImageReadParam.setSourceRenderSize(java.awt.Dimension) definition code for javax.imageio.ImageReadParam.setSourceRenderSize(java.awt.Dimension)

setSourceProgressivePasses sample code for javax.imageio.ImageReadParam.setSourceProgressivePasses(int, int) definition code for javax.imageio.ImageReadParam.setSourceProgressivePasses(int, int)

public void setSourceProgressivePasses(int minPass,
                                       int numPasses)
Sets the range of progressive passes that will be decoded. Passes outside of this range will be ignored.

A progressive pass is a re-encoding of the entire image, generally at progressively higher effective resolutions, but requiring greater transmission bandwidth. The most common use of progressive encoding is found in the JPEG format, where successive passes include more detailed representations of the high-frequency image content.

The actual number of passes to be decoded is determined during decoding, based on the number of actual passes available in the stream. Thus if minPass + numPasses - 1 is larger than the index of the last available passes, decoding will end with that pass.

A value of numPasses of Integer.MAX_VALUE indicates that all passes from minPass forward should be read. Otherwise, the index of the last pass (i.e., minPass + numPasses - 1) must not exceed Integer.MAX_VALUE.

There is no unsetSourceProgressivePasses method; the same effect may be obtained by calling setSourceProgressivePasses(0, Integer.MAX_VALUE).

Parameters:
minPass - the index of the first pass to be decoded.
numPasses - the maximum number of passes to be decoded.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if minPass is negative, numPasses is negative or 0, or numPasses is smaller than Integer.MAX_VALUE but minPass + numPasses - 1 is greater than INTEGER.MAX_VALUE.
See Also:
getSourceMinProgressivePass() sample code for javax.imageio.ImageReadParam.getSourceMinProgressivePass() definition code for javax.imageio.ImageReadParam.getSourceMinProgressivePass() , getSourceMaxProgressivePass() sample code for javax.imageio.ImageReadParam.getSourceMaxProgressivePass() definition code for javax.imageio.ImageReadParam.getSourceMaxProgressivePass()

getSourceMinProgressivePass sample code for javax.imageio.ImageReadParam.getSourceMinProgressivePass() definition code for javax.imageio.ImageReadParam.getSourceMinProgressivePass()

public int getSourceMinProgressivePass()
Returns the index of the first progressive pass that will be decoded. If no value has been set, 0 will be returned (which is the correct value).

Returns:
the index of the first pass that will be decoded.
See Also:
setSourceProgressivePasses(int, int) sample code for javax.imageio.ImageReadParam.setSourceProgressivePasses(int, int) definition code for javax.imageio.ImageReadParam.setSourceProgressivePasses(int, int) , getSourceNumProgressivePasses() sample code for javax.imageio.ImageReadParam.getSourceNumProgressivePasses() definition code for javax.imageio.ImageReadParam.getSourceNumProgressivePasses()

getSourceMaxProgressivePass sample code for javax.imageio.ImageReadParam.getSourceMaxProgressivePass() definition code for javax.imageio.ImageReadParam.getSourceMaxProgressivePass()

public int getSourceMaxProgressivePass()
If getSourceNumProgressivePasses is equal to Integer.MAX_VALUE, returns Integer.MAX_VALUE. Otherwise, returns getSourceMinProgressivePass() + getSourceNumProgressivePasses() - 1.

Returns:
the index of the last pass to be read, or Integer.MAX_VALUE.

getSourceNumProgressivePasses sample code for javax.imageio.ImageReadParam.getSourceNumProgressivePasses() definition code for javax.imageio.ImageReadParam.getSourceNumProgressivePasses()

public int getSourceNumProgressivePasses()
Returns the number of the progressive passes that will be decoded. If no value has been set, Integer.MAX_VALUE will be returned (which is the correct value).

Returns:
the number of the passes that will be decoded.
See Also:
setSourceProgressivePasses(int, int) sample code for javax.imageio.ImageReadParam.setSourceProgressivePasses(int, int) definition code for javax.imageio.ImageReadParam.setSourceProgressivePasses(int, int) , getSourceMinProgressivePass() sample code for javax.imageio.ImageReadParam.getSourceMinProgressivePass() definition code for javax.imageio.ImageReadParam.getSourceMinProgressivePass()