public class ImageTypeSpecifier extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.awt.image.ColorModel |
colorModel
The image's color model.
|
protected java.awt.image.SampleModel |
sampleModel
The image's sample model.
|
| Constructor and Description |
|---|
ImageTypeSpecifier(java.awt.image.ColorModel colorModel,
java.awt.image.SampleModel sampleModel)
Construct an image type specifier with the given models.
|
ImageTypeSpecifier(java.awt.image.RenderedImage image)
Construct an image type specifier that describes the given
rendered image.
|
| Modifier and Type | Method and Description |
|---|---|
static ImageTypeSpecifier |
createBanded(java.awt.color.ColorSpace colorSpace,
int[] bankIndices,
int[] bankOffsets,
int dataType,
boolean hasAlpha,
boolean isAlphaPremultiplied)
Create an image type specifier for a banded image using a
component color model and a banded sample model.
|
java.awt.image.BufferedImage |
createBufferedImage(int width,
int height)
Create a buffered image with the given dimensions using that has
the characteristics specified by this image type specifier.
|
static ImageTypeSpecifier |
createFromBufferedImageType(int bufferedImageType)
Create an image type specifier that describes the given buffered
image type.
|
static ImageTypeSpecifier |
createFromRenderedImage(java.awt.image.RenderedImage image)
Create an image type specifier that describes the given rendered
image's type.
|
static ImageTypeSpecifier |
createGrayscale(int bits,
int dataType,
boolean isSigned)
Create a grayscale image type specifier, given the number of
bits, data type and whether or not the data is signed.
|
static ImageTypeSpecifier |
createGrayscale(int bits,
int dataType,
boolean isSigned,
boolean isAlphaPremultiplied)
Create a grayscale image type specifier, given the number of
bits, data type and whether or not the data is signed.
|
static ImageTypeSpecifier |
createIndexed(byte[] redLUT,
byte[] greenLUT,
byte[] blueLUT,
byte[] alphaLUT,
int bits,
int dataType)
Return an image type specifier for an image that uses an indexed
colour model where each colour value has the specified number of
bits and type and where the colour tables are those given.
|
static ImageTypeSpecifier |
createInterleaved(java.awt.color.ColorSpace colorSpace,
int[] bandOffsets,
int dataType,
boolean hasAlpha,
boolean isAlphaPremultiplied)
Create an image type specifier that uses a component colour model
and a pixel interleaved sample model.
|
static ImageTypeSpecifier |
createPacked(java.awt.color.ColorSpace colorSpace,
int redMask,
int greenMask,
int blueMask,
int alphaMask,
int transferType,
boolean isAlphaPremultiplied)
Create an image type specifier using a direct color model and a
packed sample model.
|
int |
getBitsPerBand(int band)
Get the number of bits per sample in the given band.
|
int |
getBufferedImageType()
Get the buffered image constant specified by this image type
specifier.
|
java.awt.image.ColorModel |
getColorModel()
Get the color model specified by this image type specifier.
|
int |
getNumBands()
Get the number of bands specified by this image type specifier's
sample model.
|
int |
getNumComponents()
Get the number of components specified by this image type
specifier's color model.
|
java.awt.image.SampleModel |
getSampleModel()
Get the sample model specified by this image type specifier.
|
java.awt.image.SampleModel |
getSampleModel(int width,
int height)
Create a sample model that is compatible with the one specified
by this image type specifier, with the given dimensions.
|
protected java.awt.image.ColorModel colorModel
protected java.awt.image.SampleModel sampleModel
public ImageTypeSpecifier(java.awt.image.ColorModel colorModel, java.awt.image.SampleModel sampleModel)
colorModel - the color modelsampleModel - the sample modeljava.lang.IllegalArgumentException - if either model argument is
nulljava.lang.IllegalArgumentException - if the models are
incompatible with one anotherpublic ImageTypeSpecifier(java.awt.image.RenderedImage image)
image - a rendered imagejava.lang.IllegalArgumentException - if image is nullpublic static ImageTypeSpecifier createBanded(java.awt.color.ColorSpace colorSpace, int[] bankIndices, int[] bankOffsets, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied)
colorSpace - the color spacebankIndices - the bank indices at which each band will be
storedbankOffsets - the starting band offset for each band within
its bankdataType - the data type, a DataBuffer constanthasAlpha - true if this image type specifier should have an
alpha component, false otherwiseisAlphaPremultiplied - true if other color components should
be premultiplied by the alpha component, false otherwisejava.lang.IllegalArgumentException - if any of colorSpace,
bankIndices or bankOffsets is nulljava.lang.IllegalArgumentException - if bankIndices and
bankOffsets differ in lengthif - dataType is not a valid DataBuffer constantpublic java.awt.image.BufferedImage createBufferedImage(int width, int height)
width - width of the buffered image, in pixelsheight - the height of the buffered image, in pixelsjava.lang.IllegalArgumentException - if either width or height is
less than or equal to zerojava.lang.IllegalArgumentException - if width * height is greater
than Integer.MAX_VALUE or if the storage required is greater than
Integer.MAX_VALUEpublic static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType)
bufferedImageType - the buffered image type to represent
with the returned image type specifierjava.lang.IllegalArgumentException - if bufferedImageType is not a
BufferedImage constant or is BufferedImage.TYPE_CUSTOMpublic static ImageTypeSpecifier createFromRenderedImage(java.awt.image.RenderedImage image)
image - the rendered imagejava.lang.IllegalArgumentException - if image is nullpublic static ImageTypeSpecifier createGrayscale(int bits, int dataType, boolean isSigned)
bits - the number of bits used to specify a greyscale valuedataType - a DataBuffer type constantisSigned - true if this type specifier should support
negative values, false otherwisejava.lang.IllegalArgumentException - if bits is not 1, 2, 4, 8 or 16java.lang.IllegalArgumentException - if dataType is not
DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
DataBuffer.TYPE_USHORTif - bits is larger than the number of bits in the given
data typepublic static ImageTypeSpecifier createGrayscale(int bits, int dataType, boolean isSigned, boolean isAlphaPremultiplied)
bits - the number of bits used to specify a greyscale valuedataType - a DataBuffer type constantisSigned - true if this type specifier should support
negative values, false otherwisejava.lang.IllegalArgumentException - if bits is not 1, 2, 4, 8 or
16java.lang.IllegalArgumentException - if dataType is not
DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
DataBuffer.TYPE_USHORTif - bits is larger than the number of bits in the given
data typepublic static ImageTypeSpecifier createIndexed(byte[] redLUT, byte[] greenLUT, byte[] blueLUT, byte[] alphaLUT, int bits, int dataType)
redLUT - the red index valuesgreenLUT - the green index valuesblueLUT - the blue index valuesalphaLUT - the alpha index valuesbits - the number of bits per index valuedataType - the type of each index valuejava.lang.IllegalArgumentException - if any of the colour arrays,
not including alphaLUT, is nulljava.lang.IllegalArgumentException - if bits is not 1, 2, 4, 8 or
16java.lang.IllegalArgumentException - if dataType is not
DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
DataBuffer.TYPE_USHORTif - bits is larger than the number of bits in the given
data typepublic static ImageTypeSpecifier createInterleaved(java.awt.color.ColorSpace colorSpace, int[] bandOffsets, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied)
colorSpace - the colour space used by the colour modelbandOffsets - the starting band offset for each band within
its bankdataType - the type of each pixel valuehasAlpha - true if an alpha channel should be specified,
false otherwiseisAlphaPremultiplied - true if other colour channels should
be premultiplied by the alpha value, false otherwisejava.lang.IllegalArgumentException - if either colorSpace or
bandOffsets is nullif - dataType is not a valid DataBuffer constantpublic static ImageTypeSpecifier createPacked(java.awt.color.ColorSpace colorSpace, int redMask, int greenMask, int blueMask, int alphaMask, int transferType, boolean isAlphaPremultiplied)
colorSpace - the color space to use in the color modelredMask - the bitmask for the red bitsgreenMask - the bitmask for the green bitsblueMask - the bitmask for the blue bitsalphaMask - the bitmask for the alpha bitstransferType - the data type used to store pixel valuesisAlphaPremultiplied - true if other colour channels should
be premultiplied by the alpha value, false otherwisejava.lang.IllegalArgumentException - if colorSpace is nulljava.lang.IllegalArgumentException - if colorSpace does not have
type ColorSpace.TYPE_RGBjava.lang.IllegalArgumentException - if all masks are 0java.lang.IllegalArgumentException - if dataType is not
DataBuffer.TYPE_BYTE, DataBuffer.TYPE_SHORT or
DataBuffer.TYPE_INTpublic int getBitsPerBand(int band)
band - the band from which to get the number of bitsjava.lang.IllegalArgumentException - if band is out-of-boundspublic int getBufferedImageType()
public java.awt.image.SampleModel getSampleModel(int width, int height)
width - the width of the returned sample modelheight - the height of the returned sample modeljava.lang.IllegalArgumentException - if either width or height is
less than or equal to 0java.lang.IllegalArgumentException - if width * height is greater
than Intere.MAX_VALUEpublic java.awt.image.ColorModel getColorModel()
public int getNumBands()
public int getNumComponents()
public java.awt.image.SampleModel getSampleModel()