|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.image.ColorModel | +--java.awt.image.PackedColorModel
The translation from pixel values to color/alpha components for display or processing purposes is a one-to-one correspondence of samples to components. A PackedColorModel is typically used with image data which uses masks to define packed samples. For example, a PackedColorModel can be used in conjunction with a SinglePixelPackedSampleModel to construct a BufferedImage. Normally the masks used by the SampleModel and the ColorModel would be the same. However, if they are different, the color interpretation of pixel data will be done according to the masks of the ColorModel.
A single int pixel representation is valid for all objects of this class, since it is always possible to represent pixel values used with this class in a single int. Therefore, methods which use this representation will not throw an IllegalArgumentException due to an invalid pixel value.
A subclass of PackedColorModel is DirectColorModel, which is similar to an X11 TrueColor visual.
DirectColorModel
,
SinglePixelPackedSampleModel
,
BufferedImage
Fields inherited from class java.awt.image.ColorModel | |
pixel_bits , transferType |
Constructor Summary | |
PackedColorModel(ColorSpace space,
int bits,
int rmask,
int gmask,
int bmask,
int amask,
boolean isAlphaPremultiplied,
int trans,
int transferType)
Constructs a PackedColorModel from the given masks specifying which bits in an int pixel representation contain the alpha, red, green and blue color samples. |
|
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. |
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)
|
WritableRaster | getAlphaRaster(WritableRaster raster)
Returns a Raster representing the alpha channel of an image, extracted from the input Raster. |
int | getMask(int index)
Returns the mask indicating which bits in an int pixel representation contain the specified color/alpha sample. |
int[] | getMasks()
Returns a mask array indicating which bits in an int pixel representation contain the color and alpha samples. |
boolean | isCompatibleSampleModel(SampleModel sm)
Checks if the SampleModel is compatible with this ColorModel. |
Methods inherited from class java.awt.image.ColorModel | |
coerceData , createCompatibleWritableRaster , finalize , getAlpha , getAlpha , getBlue , getBlue , getColorSpace , getComponents , getComponents , getComponentSize , getComponentSize , getDataElement , getDataElements , getGreen , getGreen , getNormalizedComponents , getNumColorComponents , getNumComponents , getPixelSize , getRed , getRed , getRGB , getRGB , getRGBdefault , getTransparency , getUnnormalizedComponents , hasAlpha , isAlphaPremultiplied , isCompatibleRaster , setDataElements , toString |
Methods inherited from class java.lang.Object | |
clone , getClass , hashCode , notify , notifyAll , wait , wait , wait |
Constructor Detail |
public PackedColorModel(ColorSpace space, int bits, int[] colorMaskArray, int alphaMask, boolean isAlphaPremultiplied, int trans, int transferType)
public PackedColorModel(ColorSpace space, int bits, int rmask, int gmask, int bmask, int amask, boolean isAlphaPremultiplied, int trans, int transferType)
ColorSpace
Method Detail |
public final int getMask(int index)
alphaIndex = numComponents() - 1;
public final int[] getMasks()
public SampleModel createCompatibleSampleModel(int w, int h)
SampleModel
public boolean isCompatibleSampleModel(SampleModel sm)
SampleModel
public WritableRaster getAlphaRaster(WritableRaster raster)
public boolean equals(Object obj)
|
Java Platform 1.2 Beta 4 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |