is new.
java.lang.Objectjavax.imageio.ImageTypeSpecifier
A class that allows the format of an image (in particular, its SampleModel and ColorModel) to be specified in a convenient manner.
| Field Summary | |
|---|---|
| protected ColorModel |
colorModel
The ColorModel to be used as a prototype. |
| protected SampleModel |
sampleModel
A SampleModel to be used as a prototype. |
| Constructor Summary | |
|---|---|
|
ImageTypeSpecifier
(
ColorModel
colorModel,
SampleModel
sampleModel) Constructs an ImageTypeSpecifier directly from a ColorModel and a SampleModel. |
|
|
ImageTypeSpecifier
(
RenderedImage
image) Constructs an ImageTypeSpecifier from a RenderedImage. |
|
| Method Summary | |
|---|---|
| static ImageTypeSpecifier |
createBanded
(
ColorSpace
colorSpace, int[] bankIndices, int[] bandOffsets, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied) Returns a specifier for a banded image format that will use a ComponentColorModel and a BandedSampleModel to store each channel in a separate array. |
| BufferedImage |
createBufferedImage
(int width, int height) Creates a BufferedImage with a given width and height according to the specification embodied in this object. |
| static ImageTypeSpecifier |
createFromBufferedImageType
(int bufferedImageType) Returns an ImageTypeSpecifier that encodes one of the standard BufferedImage types (other than TYPE_CUSTOM). |
| static ImageTypeSpecifier |
createFromRenderedImage
(
RenderedImage
image) Returns an ImageTypeSpecifier that encodes the layout of a RenderedImage (which may be a BufferedImage). |
| static ImageTypeSpecifier |
createGrayscale
(int bits, int dataType, boolean isSigned) 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. |
| static ImageTypeSpecifier |
createGrayscale
(int bits, int dataType, boolean isSigned, boolean isAlphaPremultiplied) 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. |
| static ImageTypeSpecifier |
createIndexed
(byte[] redLUT, byte[] greenLUT, byte[] blueLUT, byte[] alphaLUT, int bits, int 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. |
| static ImageTypeSpecifier |
createInterleaved
(
ColorSpace
colorSpace, int[] bandOffsets, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied) 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. |
| static ImageTypeSpecifier |
createPacked
(
ColorSpace
colorSpace, int redMask, int greenMask, int blueMask, int alphaMask, int transferType, boolean isAlphaPremultiplied) 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. |
| boolean |
equals
(
Object
o) Returns true if the given Object is an ImageTypeSpecifier and has a SampleModel and ColorModel that are equal to those of this object. |
| int |
getBitsPerBand
(int band) Return the number of bits used to represent samples of the given band. |
| int |
getBufferedImageType
() Returns an int containing one of the enumerated constant values describing image formats from BufferedImage. |
| ColorModel |
getColorModel
() Returns the ColorModel specified by this object. |
| int |
getNumBands
() Return the number of bands specified by this object. |
| int |
getNumComponents
() Return the number of color components specified by this object. |
| SampleModel |
getSampleModel
() Returns a SampleModel based on the settings encapsulated within this object. |
| SampleModel |
getSampleModel
(int width, int height) Returns a SampleModel based on the settings encapsulated within this object. |
int
|
hashCode
()
Returns the hash code for this ImageTypeSpecifier.
|
| Methods inherited from class java.lang. Object |
|---|
clone
,
finalize
,
getClass
,
|
| Field Detail |
|---|
protected ColorModel colorModel
protected SampleModel sampleModel
| Constructor Detail |
|---|
public ImageTypeSpecifier(ColorModel colorModel,
SampleModel sampleModel)
public ImageTypeSpecifier(RenderedImage image)
| Method Detail |
|---|
public static ImageTypeSpecifier createPacked(ColorSpace colorSpace,
int redMask,
int greenMask,
int blueMask,
int alphaMask,
int transferType,
boolean isAlphaPremultiplied)
public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace,
int[] bandOffsets,
int dataType,
boolean hasAlpha,
boolean isAlphaPremultiplied)
public static ImageTypeSpecifier createBanded(ColorSpace colorSpace,
int[] bankIndices,
int[] bandOffsets,
int dataType,
boolean hasAlpha,
boolean isAlphaPremultiplied)
public static ImageTypeSpecifier createGrayscale(int bits,
int dataType,
boolean isSigned)
Throws:
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.
public static ImageTypeSpecifier createGrayscale(int bits,
int dataType,
boolean isSigned,
boolean isAlphaPremultiplied)
Throws:
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.
public static ImageTypeSpecifier createIndexed(byte[] redLUT,
byte[] greenLUT,
byte[] blueLUT,
byte[] alphaLUT,
int bits,
int dataType)
DataBuffer.TYPE_USHORT,
DataBuffer.TYPE_INT.
public static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType)
public static ImageTypeSpecifier createFromRenderedImage(RenderedImage image)
public int getBufferedImageType()
public int getNumComponents()
public int getNumBands()
public int getBitsPerBand(int band)
public SampleModel getSampleModel()
public SampleModel getSampleModel(int width,
int height)
public ColorModel getColorModel()
public BufferedImage createBufferedImage(int width,
int height)
public boolean equals(Object o)
hashCode
public int
hashCode
()
Returns the hash code for this ImageTypeSpecifier.
Overrides:
hashCode
in class
Object
Returns:
a hash code for this ImageTypeSpecifier
See Also:
Object.equals(java.lang.Object)
,
Hashtable