|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.4.2
javax.imageio
|
Field Summary | |
protected boolean |
canSetSourceRenderSize
true if this ImageReadParam allows
the source rendering dimensions to be set. |
protected BufferedImage |
destination
The current destination BufferedImage , or
null if none has been set. |
protected int[] |
destinationBands
The set of destination bands to be used, as an array of int s. |
protected int |
minProgressivePass
The minimum index of a progressive pass to read from the source. |
protected int |
numProgressivePasses
The maximum number of progressive passes to read from the source. |
protected Dimension |
sourceRenderSize
The desired rendering width and height of the source, if canSetSourceRenderSize is true , or
null . |
Fields inherited from class javax.imageio.IIOParam |
controller, defaultController, destinationOffset, destinationType, sourceBands, sourceRegion, sourceXSubsampling, sourceYSubsampling, subsamplingXOffset, subsamplingYOffset |
Constructor Summary | |
ImageReadParam()
Constructs an ImageReadParam . |
Method Summary | |
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. |
BufferedImage |
getDestination()
Returns the BufferedImage currently set by the
setDestination method, or null
if none is set. |
int[] |
getDestinationBands()
Returns the set of band indices where data will be placed. |
int |
getSourceMaxProgressivePass()
If getSourceNumProgressivePasses is equal to
Integer.MAX_VALUE , returns
Integer.MAX_VALUE . |
int |
getSourceMinProgressivePass()
Returns the index of the first progressive pass that will be decoded. |
int |
getSourceNumProgressivePasses()
Returns the number of the progressive passes that will be decoded. |
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. |
void |
setDestination(BufferedImage destination)
Supplies a BufferedImage to be used as the
destination for decoded pixel data. |
void |
setDestinationBands(int[] destinationBands)
Sets the indices of the destination bands where data will be placed. |
void |
setDestinationType(ImageTypeSpecifier destinationType)
Sets the desired image type for the destination image, using an ImageTypeSpecifier . |
void |
setSourceProgressivePasses(int minPass,
int numPasses)
Sets the range of progressive passes that will be decoded. |
void |
setSourceRenderSize(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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
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.
ImageReader
s that do not support setting of
the source render size should set this value to
false
.
protected Dimension sourceRenderSize
canSetSourceRenderSize
is true
, or
null
.
ImageReader
s that do not support setting of
the source render size may ignore this value.
protected BufferedImage destination
BufferedImage
, or
null
if none has been set. By default, the value
is null
.
protected int[] destinationBands
int
s. By default, the value is null
,
indicating all destination bands should be written in order.
protected int minProgressivePass
Subclasses should ensure that this value is non-negative.
protected int numProgressivePasses
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 |
public ImageReadParam()
ImageReadParam
.
Method Detail |
public void setDestinationType(ImageTypeSpecifier destinationType)
IIOParam
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.
setDestinationType
in class IIOParam
destinationType
- the ImageTypeSpecifier
to
be used to determine the destination layout and color type.IIOParam.getDestinationType()
public void setDestination(BufferedImage destination)
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 ImageTypeSpecifier
s
returned from the ImageReader
's
getImageTypes
method. If it does not, the reader
will throw an IIOException
.
destination
- the BufferedImage to be written to, or
null
.getDestination()
public BufferedImage getDestination()
BufferedImage
currently set by the
setDestination
method, or null
if none is set.
setDestination(java.awt.image.BufferedImage)
public void setDestinationBands(int[] destinationBands)
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.
destinationBands
- an array of integer band indices to be
used.
IllegalArgumentException
- if destinationBands
contains a negative or duplicate value.getDestinationBands()
,
IIOParam.getSourceBands()
,
ImageReader.checkReadParamBandSettings(javax.imageio.ImageReadParam, int, int)
public int[] getDestinationBands()
null
is returned to
indicate that all destination bands will be used.
null
.setDestinationBands(int[])
public boolean canSetSourceRenderSize()
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
.
true
if setting source rendering size is
supported.setSourceRenderSize(java.awt.Dimension)
public void setSourceRenderSize(Dimension size) throws UnsupportedOperationException
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
.
size
- a Dimension
indicating the desired
width and height.
IllegalArgumentException
- if either the width or the
height is negative or 0.
UnsupportedOperationException
- if image resizing
is not supported by this plug-in.getSourceRenderSize()
,
ImageReader.getWidth(int)
,
ImageReader.getHeight(int)
,
ImageReader.getAspectRatio(int)
public Dimension getSourceRenderSize()
setSourceRenderSize
method. A
null
value indicates that no setting has been made.
Dimension
.setSourceRenderSize(java.awt.Dimension)
public void setSourceProgressivePasses(int minPass, int numPasses)
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)
.
minPass
- the index of the first pass to be decoded.numPasses
- the maximum number of passes to be decoded.
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
.getSourceMinProgressivePass()
,
getSourceMaxProgressivePass()
public int getSourceMinProgressivePass()
setSourceProgressivePasses(int, int)
,
getSourceNumProgressivePasses()
public int getSourceMaxProgressivePass()
getSourceNumProgressivePasses
is equal to
Integer.MAX_VALUE
, returns
Integer.MAX_VALUE
. Otherwise, returns
getSourceMinProgressivePass() +
getSourceNumProgressivePasses() - 1
.
Integer.MAX_VALUE
.public int getSourceNumProgressivePasses()
Integer.MAX_VALUE
will be returned (which is the
correct value).
setSourceProgressivePasses(int, int)
,
getSourceMinProgressivePass()