java.lang.Object | |
↳ | javax.imageio.ImageTypeSpecifier |
A class that allows the format of an image (in particular, its
SampleModel
and ColorModel
) to be
specified in a convenient manner.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
colorModel | The ColorModel to be used as a prototype. |
||||||||||
sampleModel | A SampleModel to be used as a prototype. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs an
ImageTypeSpecifier directly
from a ColorModel and a SampleModel . | |||||||||||
Constructs an
ImageTypeSpecifier from a
RenderedImage . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns a specifier for a banded image format that will use a
ComponentColorModel and a
BandedSampleModel to store each channel in a
separate array. | |||||||||||
Creates a
BufferedImage with a given width and
height according to the specification embodied in this object. | |||||||||||
Returns an
ImageTypeSpecifier that encodes
one of the standard BufferedImage types
(other than TYPE_CUSTOM ). | |||||||||||
Returns an
ImageTypeSpecifier that encodes the
layout of a RenderedImage (which may be a
BufferedImage ). | |||||||||||
Returns a specifier for a grayscale plus alpha image format
that will pack pixels of the given bit depth into array
elements of the specified data type.
| |||||||||||
Returns a specifier for a grayscale image format that will pack
pixels of the given bit depth into array elements of
the specified data type.
| |||||||||||
Returns a specifier for an indexed-color image format that will pack
index values of the given bit depth into array elements of
the specified data type.
| |||||||||||
Returns a specifier for an interleaved image format that will
use a
ComponentColorModel and a
PixelInterleavedSampleModel to store each pixel
component in a separate byte, short, or int. | |||||||||||
Returns a specifier for a packed image format that will use a
DirectColorModel and a packed
SampleModel to store each pixel packed into in a
single byte, short, or int. | |||||||||||
Returns
true if the given Object is
an ImageTypeSpecifier and has a
SampleModel and ColorModel that are
equal to those of this object. | |||||||||||
Return the number of bits used to represent samples of the given band.
| |||||||||||
Returns an int containing one of the enumerated constant values
describing image formats from
BufferedImage . | |||||||||||
Returns the
ColorModel specified by this object. | |||||||||||
Return the number of bands
specified by this object.
| |||||||||||
Return the number of color components
specified by this object.
| |||||||||||
Returns a
SampleModel based on the settings
encapsulated within this object. | |||||||||||
Returns a
SampleModel based on the settings
encapsulated within this object. | |||||||||||
Returns the hash code for this ImageTypeSpecifier.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Constructs an ImageTypeSpecifier
directly
from a ColorModel
and a SampleModel
.
It is the caller's responsibility to supply compatible
parameters.
colorModel | a ColorModel . |
---|---|
sampleModel | a SampleModel . |
IllegalArgumentException | if either parameter is
null . |
---|---|
IllegalArgumentException | if sampleModel
is not compatible with colorModel .
|
Constructs an ImageTypeSpecifier
from a
RenderedImage
. If a BufferedImage
is
being used, one of the factory methods
createFromRenderedImage
or
createFromBufferedImageType
should be used instead in
order to get a more accurate result.
image | a RenderedImage . |
---|
IllegalArgumentException | if the argument is
null .
|
---|
Returns a specifier for a banded image format that will use a
ComponentColorModel
and a
BandedSampleModel
to store each channel in a
separate array.
colorSpace | the desired ColorSpace . |
---|---|
bankIndices | an array of int s indicating the
bank in which each band will be stored. |
bandOffsets | an array of int s indicating the
starting offset of each band within its bank. |
dataType | the desired data type, as one of the enumerations
from the DataBuffer class. |
hasAlpha | true if an alpha channel is desired. |
isAlphaPremultiplied | true if the color channels
will be premultipled by the alpha channel. |
ImageTypeSpecifier
with the desired
characteristics.IllegalArgumentException | if colorSpace
is null . |
---|---|
IllegalArgumentException | if bankIndices
is null . |
IllegalArgumentException | if bandOffsets
is null . |
IllegalArgumentException | if the lengths of
bankIndices and bandOffsets differ. |
IllegalArgumentException | if
bandOffsets.length does not equal the number of
color space components, plus 1 if hasAlpha is
true . |
IllegalArgumentException | if dataType is
not one of the legal DataBuffer.TYPE_* constants.
|
Creates a BufferedImage
with a given width and
height according to the specification embodied in this object.
width | the desired width of the returned
BufferedImage . |
---|---|
height | the desired height of the returned
BufferedImage . |
BufferedImage
IllegalArgumentException | if either width or
height are negative or zero. |
---|---|
IllegalArgumentException | if the product of
width and height is greater than
Integer.MAX_VALUE , or if the number of array
elements needed to store the image is greater than
Integer.MAX_VALUE .
|
Returns an ImageTypeSpecifier
that encodes
one of the standard BufferedImage
types
(other than TYPE_CUSTOM
).
bufferedImageType | an int representing one of the standard
BufferedImage types. |
---|
ImageTypeSpecifier
with the desired
characteristics.IllegalArgumentException | if
bufferedImageType is not one of the standard
types, or is equal to TYPE_CUSTOM . |
---|
Returns an ImageTypeSpecifier
that encodes the
layout of a RenderedImage
(which may be a
BufferedImage
).
image | a RenderedImage . |
---|
ImageTypeSpecifier
with the desired
characteristics.IllegalArgumentException | if image is
null .
|
---|
Returns a specifier for a grayscale plus alpha image format that will pack pixels of the given bit depth into array elements of the specified data type.
bits | the number of bits per gray value (1, 2, 4, 8, or 16). |
---|---|
dataType | the desired data type, as one of the enumerations
from the DataBuffer class. |
isSigned | true if negative values are to
be represented. |
isAlphaPremultiplied | true if the luminance channel
will be premultipled by the alpha channel. |
ImageTypeSpecifier
with the desired
characteristics.IllegalArgumentException | if bits is
not one of 1, 2, 4, 8, or 16. |
---|---|
IllegalArgumentException | if dataType is
not one of DataBuffer.TYPE_BYTE ,
DataBuffer.TYPE_SHORT , or
DataBuffer.TYPE_USHORT . |
IllegalArgumentException | if bits is
larger than the bit size of the given dataType .
|
Returns a specifier for a grayscale image format that will pack pixels of the given bit depth into array elements of the specified data type.
bits | the number of bits per gray value (1, 2, 4, 8, or 16). |
---|---|
dataType | the desired data type, as one of the enumerations
from the DataBuffer class. |
isSigned | true if negative values are to
be represented. |
ImageTypeSpecifier
with the desired
characteristics.IllegalArgumentException | if bits is
not one of 1, 2, 4, 8, or 16. |
---|---|
IllegalArgumentException | if dataType is
not one of DataBuffer.TYPE_BYTE ,
DataBuffer.TYPE_SHORT , or
DataBuffer.TYPE_USHORT . |
IllegalArgumentException | if bits is
larger than the bit size of the given dataType .
|
Returns a specifier for an indexed-color image format that will pack index values of the given bit depth into array elements of the specified data type.
redLUT | an array of byte s containing
the red values for each index. |
---|---|
greenLUT | an array of byte s containing * the
green values for each index. |
blueLUT | an array of byte s containing the
blue values for each index. |
alphaLUT | an array of byte s containing the
alpha values for each index, or null to create a
fully opaque LUT. |
bits | the number of bits in each index. |
dataType | the desired output type, as one of the enumerations
from the DataBuffer class. |
ImageTypeSpecifier
with the desired
characteristics.IllegalArgumentException | if redLUT is
null . |
---|---|
IllegalArgumentException | if greenLUT is
null . |
IllegalArgumentException | if blueLUT is
null . |
IllegalArgumentException | if bits is
not one of 1, 2, 4, 8, or 16. |
IllegalArgumentException | if the
non-null LUT parameters do not have lengths of
exactly 1 << bits . |
IllegalArgumentException | if dataType is
not one of DataBuffer.TYPE_BYTE ,
DataBuffer.TYPE_SHORT ,
DataBuffer.TYPE_USHORT ,
or DataBuffer.TYPE_INT . |
IllegalArgumentException | if bits is
larger than the bit size of the given dataType .
|
Returns a specifier for an interleaved image format that will
use a ComponentColorModel
and a
PixelInterleavedSampleModel
to store each pixel
component in a separate byte, short, or int.
colorSpace | the desired ColorSpace . |
---|---|
bandOffsets | an array of int s indicating the
offsets for each band. |
dataType | the desired data type, as one of the enumerations
from the DataBuffer class. |
hasAlpha | true if an alpha channel is desired. |
isAlphaPremultiplied | true if the color channels
will be premultipled by the alpha channel. |
ImageTypeSpecifier
with the desired
characteristics.IllegalArgumentException | if colorSpace
is null . |
---|---|
IllegalArgumentException | if bandOffsets
is null . |
IllegalArgumentException | if dataType is
not one of the legal DataBuffer.TYPE_* constants. |
IllegalArgumentException | if
bandOffsets.length does not equal the number of
color space components, plus 1 if hasAlpha is
true .
|
Returns a specifier for a packed image format that will use a
DirectColorModel
and a packed
SampleModel
to store each pixel packed into in a
single byte, short, or int.
colorSpace | the desired ColorSpace . |
---|---|
redMask | a contiguous mask indicated the position of the red channel. |
greenMask | a contiguous mask indicated the position of the green channel. |
blueMask | a contiguous mask indicated the position of the blue channel. |
alphaMask | a contiguous mask indicated the position of the alpha channel. |
transferType | the desired SampleModel transfer type. |
isAlphaPremultiplied | true if the color channels
will be premultipled by the alpha channel. |
ImageTypeSpecifier
with the desired
characteristics.IllegalArgumentException | if colorSpace
is null . |
---|---|
IllegalArgumentException | if colorSpace
is not of type TYPE_RGB . |
IllegalArgumentException | if no mask has at least 1 bit set. |
IllegalArgumentException | if
transferType if not one of
DataBuffer.TYPE_BYTE ,
DataBuffer.TYPE_USHORT , or
DataBuffer.TYPE_INT .
|
Returns true
if the given Object
is
an ImageTypeSpecifier
and has a
SampleModel
and ColorModel
that are
equal to those of this object.
o | the Object to be compared for equality. |
---|
true
if the given object is an equivalent
ImageTypeSpecifier
.
Return the number of bits used to represent samples of the given band.
band | the index of the band to be queried, as an int. |
---|
IllegalArgumentException | if band is
negative or greater than the largest band index.
|
---|
Returns an int containing one of the enumerated constant values
describing image formats from BufferedImage
.
int
representing a
BufferedImage
type.Returns the ColorModel
specified by this object.
ColorModel
.
Return the number of bands
specified by this object. This is the same value as returned by
SampleModel.getNumBands
Return the number of color components
specified by this object. This is the same value as returned by
ColorModel.getNumComponents
Returns a SampleModel
based on the settings
encapsulated within this object. The width and height of the
SampleModel
will be set to the supplied values.
width | the desired width of the returned SampleModel . |
---|---|
height | the desired height of the returned
SampleModel . |
SampleModel
with the given dimensions.IllegalArgumentException | if either width or
height are negative or zero. |
---|---|
IllegalArgumentException | if the product of
width and height is greater than
Integer.MAX_VALUE
|
Returns a SampleModel
based on the settings
encapsulated within this object. The width and height of the
SampleModel
will be set to arbitrary values.
SampleModel
with arbitrary dimensions.
Returns the hash code for this ImageTypeSpecifier.