java.awt.image
Class MacDirectColorModel
java.lang.Object
|
+--java.awt.image.ColorModel
|
+--java.awt.image.PackedColorModel
|
+--java.awt.image.DirectColorModel
|
+--java.awt.image.MacDirectColorModel
- All Implemented Interfaces:
- Transparency
- public class MacDirectColorModel
- extends DirectColorModel
A ColorModel class that works with pixel values which represent RGB
color and alpha information as separate samples and which pack all
samples for a single pixel into a single int, short, or byte quantity.
This class can be used only with ColorSpaces of type ColorSpace.TYPE_RGB.
There must be three color samples in the pixel values and there may
be a single alpha sample. For those methods which use a primitive array
pixel representation of type transferType, the array length is always
one. Color and alpha samples are stored in the single element of the
array in bits indicated by bit masks. Each bit mask must be contiguous
and masks must not overlap. The same masks apply to the single int
pixel representation used by other methods. The correspondence of
masks and color/alpha samples is as follows. Masks are identified by
indices running from 0 through 2, if no alpha is present, or 3. The
first three indices refer to color samples; index 0 corresponds to red,
index 1 to green, and index 2 to blue. Index 3 corresponds to the alpha
sample, if present. The transfer types supported are DataBuffer.TYPE_BYTE,
DataBuffer.TYPE_USHORT, and DataBuffer.TYPE_INT.
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 MacDirectColorModel is typically used with image data which uses masks
to define packed samples. For example, a MacDirectColorModel 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.
This color model is similar to an X11 TrueColor visual.
The default RGB ColorModel specified by the ColorModel.getRGBdefault
method is a MacDirectColorModel with the following parameters:
Number of bits: 32
Red mask: 0x00ff0000
Green mask: 0x0000ff00
Blue mask: 0x000000ff
Alpha mask: 0xff000000
Color space: sRGB
isAlphaPremultiplied: False
Transparency: Transparency.TRANSLUCENT
transferType: DataBuffer.TYPE_INT
Many of the methods in this class are final. This is because the
underlying native graphics code makes assumptions about the layout
and operation of this class and those assumptions are reflected in
the implementations of the methods here that are marked final. You
can subclass this class for other reasons, but you cannot override
or modify the behavior of those methods.
- See Also:
ColorModel,
ColorSpace,
SinglePixelPackedSampleModel,
BufferedImage,
ColorModel.getRGBdefault()
|
Constructor Summary |
MacDirectColorModel(boolean gworldbased,
boolean supportsAlpha,
int bits,
int rmask,
int gmask,
int bmask,
int amask)
|
MacDirectColorModel(boolean gworldbased,
int bits,
int rmask,
int gmask,
int bmask,
int amask)
|
MacDirectColorModel(boolean gworldbased,
int bits,
int rmask,
int gmask,
int bmask,
int amask,
boolean isAlphaPremultiplied)
|
MacDirectColorModel(ColorSpace space,
int bits,
int rmask,
int gmask,
int bmask,
int amask,
boolean isAlphaPremultiplied,
int transferType)
|
MacDirectColorModel(int bits,
int rmask,
int gmask,
int bmask)
|
MacDirectColorModel(int bits,
int rmask,
int gmask,
int bmask,
int amask)
|
|
Method Summary |
static WritableRaster |
CreateCompatibleMacWritableRaster(int gworld,
boolean inSupportsAlpha,
int pixel_bits,
int w,
int h,
int rmask,
int gmask,
int bmask,
int amask)
|
WritableRaster |
createCompatibleMacWritableRaster(int w,
int h)
Creates a WritableRaster with the specified width and height that
has a data layout (SampleModel) compatible with this ColorModel. |
WritableRaster |
createCompatibleMacWritableRaster(int w,
int h,
boolean isAlphaPremultiplied)
|
WritableRaster |
createCompatibleMacWritableRaster(int gworld,
int pixel_bits,
int w,
int h)
|
static WritableRaster |
createPackedRaster(DataBuffer dataBuffer,
int w,
int h,
int scanlineStride,
int[] bandMasks,
Point location)
|
static GraphicsConfiguration |
GetImageConfiguration(BufferedImage bi)
|
static BufferedImage |
GetWrappedGWorldImage(int gworld,
int pixel_bits,
int w,
int h,
boolean inAlphaChannelPresent)
|
boolean |
isCompatibleRaster(Raster raster)
Returns true if raster is compatible
with this ColorModel and false if it is
not. |
| Methods inherited from class java.awt.image.DirectColorModel |
coerceData, createCompatibleWritableRaster, getAlpha, getAlpha, getAlphaMask, getBlue, getBlue, getBlueMask, getComponents, getComponents, getDataElement, getDataElements, getDataElements, getGreen, getGreen, getGreenMask, getRed, getRed, getRedMask, getRGB, getRGB, toString |
| Methods inherited from class java.awt.image.ColorModel |
finalize, getColorSpace, getComponentSize, getComponentSize, getNormalizedComponents, getNumColorComponents, getNumComponents, getPixelSize, getRGBdefault, getTransferType, getTransparency, getUnnormalizedComponents, hasAlpha, hashCode, isAlphaPremultiplied |
MacDirectColorModel
public MacDirectColorModel(int bits,
int rmask,
int gmask,
int bmask)
MacDirectColorModel
public MacDirectColorModel(boolean gworldbased,
boolean supportsAlpha,
int bits,
int rmask,
int gmask,
int bmask,
int amask)
MacDirectColorModel
public MacDirectColorModel(boolean gworldbased,
int bits,
int rmask,
int gmask,
int bmask,
int amask)
MacDirectColorModel
public MacDirectColorModel(int bits,
int rmask,
int gmask,
int bmask,
int amask)
MacDirectColorModel
public MacDirectColorModel(ColorSpace space,
int bits,
int rmask,
int gmask,
int bmask,
int amask,
boolean isAlphaPremultiplied,
int transferType)
MacDirectColorModel
public MacDirectColorModel(boolean gworldbased,
int bits,
int rmask,
int gmask,
int bmask,
int amask,
boolean isAlphaPremultiplied)
GetImageConfiguration
public static final GraphicsConfiguration GetImageConfiguration(BufferedImage bi)
createCompatibleMacWritableRaster
public final WritableRaster createCompatibleMacWritableRaster(int w,
int h)
- Creates a WritableRaster with the specified width and height that
has a data layout (SampleModel) compatible with this ColorModel.
- See Also:
WritableRaster,
SampleModel
createCompatibleMacWritableRaster
public final WritableRaster createCompatibleMacWritableRaster(int w,
int h,
boolean isAlphaPremultiplied)
GetWrappedGWorldImage
public static final BufferedImage GetWrappedGWorldImage(int gworld,
int pixel_bits,
int w,
int h,
boolean inAlphaChannelPresent)
isCompatibleRaster
public boolean isCompatibleRaster(Raster raster)
- Description copied from class:
DirectColorModel
- Returns
true if raster is compatible
with this ColorModel and false if it is
not.
- Overrides:
isCompatibleRaster in class DirectColorModel
- Following copied from class:
java.awt.image.DirectColorModel
- Parameters:
raster - the Raster object to test for compatibility- Returns:
true if raster is compatible
with this ColorModel; false otherwise.
createCompatibleMacWritableRaster
public final WritableRaster createCompatibleMacWritableRaster(int gworld,
int pixel_bits,
int w,
int h)
CreateCompatibleMacWritableRaster
public static final WritableRaster CreateCompatibleMacWritableRaster(int gworld,
boolean inSupportsAlpha,
int pixel_bits,
int w,
int h,
int rmask,
int gmask,
int bmask,
int amask)
createPackedRaster
public static WritableRaster createPackedRaster(DataBuffer dataBuffer,
int w,
int h,
int scanlineStride,
int[] bandMasks,
Point location)
Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.