|
Préférences
Moteurs de recherche
|
|||||||||||||||||||||||||||
| JavaTM 2 Platform Std. Ed. v1.6.0
java.awt.image
|
||||||||||||||||||||||||||||
| Field Summary |
|---|
| Fields inherited from class java.awt.image.ColorModel |
|---|
pixel_bits, transferType |
| Fields inherited from interface java.awt.Transparency |
|---|
BITMASK, OPAQUE, TRANSLUCENT |
| Constructor Summary | |
|---|---|
PackedColorModel(ColorSpace space,
int bits,
int[] colorMaskArray,
int alphaMask,
boolean isAlphaPremultiplied,
int trans,
int transferType)
Constructs a PackedColorModel from a color mask array,
which specifies which bits in an int pixel representation
contain each of the color samples, and an alpha mask. |
|
PackedColorModel(ColorSpace space,
int bits,
int rmask,
int gmask,
int bmask,
int amask,
boolean isAlphaPremultiplied,
int trans,
int transferType)
Constructs a PackedColorModel from the specified
masks which indicate which bits in an int pixel
representation contain the alpha, red, green and blue color samples. |
|
| Method Summary | |
|---|---|
SampleModel |
createCompatibleSampleModel(int w,
int h)
Creates a SampleModel with the specified width and
height that has a data layout compatible with this
ColorModel. |
boolean |
equals(Object obj)
Tests if the specified Object is an instance
of PackedColorModel and equals this
PackedColorModel. |
WritableRaster |
getAlphaRaster(WritableRaster raster)
Returns a WritableRaster representing the alpha channel of
an image, extracted from the input WritableRaster. |
int |
getMask(int index)
Returns the mask indicating which bits in a pixel contain the specified color/alpha sample. |
int[] |
getMasks()
Returns a mask array indicating which bits in a pixel contain the color and alpha samples. |
boolean |
isCompatibleSampleModel(SampleModel sm)
Checks if the specified SampleModel is compatible
with this ColorModel. |
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public PackedColorModel(ColorSpace space, int bits, int[] colorMaskArray, int alphaMask, boolean isAlphaPremultiplied, int trans, int transferType)
PackedColorModel from a color mask array,
which specifies which bits in an int pixel representation
contain each of the color samples, and an alpha mask. Color
components are in the specified ColorSpace. The length of
colorMaskArray should be the number of components in
the ColorSpace. All of the bits in each mask
must be contiguous and fit in the specified number of least significant
bits of an int pixel representation. If the
alphaMask is 0, there is no alpha. If there is alpha,
the boolean isAlphaPremultiplied specifies
how to interpret color and alpha samples in pixel values. If the
boolean is true, color samples are assumed
to have been multiplied by the alpha sample. The transparency,
trans, specifies what alpha values can be represented
by this color model. The transfer type is the type of primitive
array used to represent pixel values.
space - the specified ColorSpacebits - the number of bits in the pixel valuescolorMaskArray - array that specifies the masks representing
the bits of the pixel values that represent the color
componentsalphaMask - specifies the mask representing
the bits of the pixel values that represent the alpha
componentisAlphaPremultiplied - true if color samples are
premultiplied by the alpha sample; false otherwisetrans - specifies the alpha value that can be represented by
this color modeltransferType - the type of array used to represent pixel values
IllegalArgumentException - if bits is less than
1 or greater than 32public PackedColorModel(ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask, boolean isAlphaPremultiplied, int trans, int transferType)
PackedColorModel from the specified
masks which indicate which bits in an int pixel
representation contain the alpha, red, green and blue color samples.
Color components are in the specified ColorSpace, which
must be of type ColorSpace.TYPE_RGB. All of the bits in each
mask must be contiguous and fit in the specified number of
least significant bits of an int pixel representation. If
amask is 0, there is no alpha. If there is alpha,
the boolean isAlphaPremultiplied
specifies how to interpret color and alpha samples
in pixel values. If the boolean is true,
color samples are assumed to have been multiplied by the alpha sample.
The transparency, trans, specifies what alpha values
can be represented by this color model.
The transfer type is the type of primitive array used to represent
pixel values.
space - the specified ColorSpacebits - the number of bits in the pixel valuesrmask - specifies the mask representing
the bits of the pixel values that represent the red
color componentgmask - specifies the mask representing
the bits of the pixel values that represent the green
color componentbmask - specifies the mask representing
the bits of the pixel values that represent
the blue color componentamask - specifies the mask representing
the bits of the pixel values that represent
the alpha componentisAlphaPremultiplied - true if color samples are
premultiplied by the alpha sample; false otherwisetrans - specifies the alpha value that can be represented by
this color modeltransferType - the type of array used to represent pixel values
IllegalArgumentException - if space is not a
TYPE_RGB spaceColorSpace| Method Detail |
|---|
public final int getMask(int index)
index corresponds to the placement of color
sample names in the color space. Thus, an index
equal to 0 for a CMYK ColorSpace would correspond to
Cyan and an index equal to 1 would correspond to
Magenta. If there is alpha, the alpha index would be:
alphaIndex = numComponents() - 1;
index - the specified color or alpha sample
int
pixel representation contain the color or alpha sample specified
by index.
ArrayIndexOutOfBoundsException - if index is
greater than the number of components minus 1 in this
PackedColorModel or if index is
less than zeropublic final int[] getMasks()
int pixel
representation contain the color or alpha samples.public SampleModel createCompatibleSampleModel(int w, int h)
SampleModel with the specified width and
height that has a data layout compatible with this
ColorModel.
createCompatibleSampleModel in class ColorModelw - the width (in pixels) of the region of the image data
describedh - the height (in pixels) of the region of the image data
described
SampleModel.
IllegalArgumentException - if w or
h is not greater than 0SampleModelpublic boolean isCompatibleSampleModel(SampleModel sm)
SampleModel is compatible
with this ColorModel. If sm is
null, this method returns false.
isCompatibleSampleModel in class ColorModelsm - the specified SampleModel,
or null
true if the specified SampleModel
is compatible with this ColorModel;
false otherwise.SampleModelpublic WritableRaster getAlphaRaster(WritableRaster raster)
WritableRaster representing the alpha channel of
an image, extracted from the input WritableRaster.
This method assumes that WritableRaster objects
associated with this ColorModel store the alpha band,
if present, as the last band of image data. Returns null
if there is no separate spatial alpha channel associated with this
ColorModel. This method creates a new
WritableRaster, but shares the data array.
getAlphaRaster in class ColorModelraster - a WritableRaster containing an image
WritableRaster that represents the alpha
channel of the image contained in raster.public boolean equals(Object obj)
Object is an instance
of PackedColorModel and equals this
PackedColorModel.
equals in class ColorModelobj - the Object to test for equality
true if the specified Object
is an instance of PackedColorModel and equals this
PackedColorModel; false otherwise.Object.hashCode(),
Hashtable