java.awt.image

Class DirectColorModel

public class DirectColorModel extends PackedColorModel

Constructor Summary
DirectColorModel(int pixelBits, int rmask, int gmask, int bmask)
For the color model created with this constructor the pixels will have fully opaque alpha components with a value of 255.
DirectColorModel(int pixelBits, int rmask, int gmask, int bmask, int amask)
For the color model created with this constructor the pixels will have fully opaque alpha components with a value of 255.
DirectColorModel(ColorSpace cspace, int pixelBits, int rmask, int gmask, int bmask, int amask, boolean isAlphaPremultiplied, int transferType)
Method Summary
ColorModelcoerceData(WritableRaster raster, boolean isAlphaPremultiplied)
WritableRastercreateCompatibleWritableRaster(int w, int h)
Creates a WriteableRaster that has a SampleModel that is compatible with this ColorModel.
intgetAlpha(int pixel)
Get the alpha component of the given pixel.
intgetAlpha(Object inData)
intgetAlphaMask()
intgetBlue(int pixel)
Get the blue component of the given pixel.
intgetBlue(Object inData)
intgetBlueMask()
int[]getComponents(int pixel, int[] components, int offset)
Fills an array with the unnormalized component samples from a pixel value.
int[]getComponents(Object pixel, int[] components, int offset)
intgetDataElement(int[] components, int offset)
ObjectgetDataElements(int rgb, Object pixel)
Converts a normalized pixel int value in the sRGB color space to an array containing a single pixel of the color space of the color model.
ObjectgetDataElements(int[] components, int offset, Object obj)
intgetGreen(int pixel)
Get the green component of the given pixel.
intgetGreen(Object inData)
intgetGreenMask()
intgetRed(int pixel)
Get the red component of the given pixel.
intgetRed(Object inData)
intgetRedMask()
intgetRGB(int pixel)
Get the RGB color value of the given pixel using the default RGB color model.
intgetRGB(Object inData)
booleanisCompatibleRaster(Raster raster)
StringtoString()

Constructor Detail

DirectColorModel

public DirectColorModel(int pixelBits, int rmask, int gmask, int bmask)
For the color model created with this constructor the pixels will have fully opaque alpha components with a value of 255. Each mask should describe a fully contiguous set of bits in the most likely order of alpha, red, green, blue from the most significant byte to the least significant byte.

Parameters: pixelBits the number of bits wide used for bit size of pixel values rmask the bits describing the red component of a pixel gmask the bits describing the green component of a pixel bmask the bits describing the blue component of a pixel

DirectColorModel

public DirectColorModel(int pixelBits, int rmask, int gmask, int bmask, int amask)
For the color model created with this constructor the pixels will have fully opaque alpha components with a value of 255. Each mask should describe a fully contiguous set of bits in the most likely order of red, green, blue from the most significant byte to the least significant byte.

Parameters: pixelBits the number of bits wide used for bit size of pixel values rmask the bits describing the red component of a pixel gmask the bits describing the green component of a pixel bmask the bits describing the blue component of a pixel amask the bits describing the alpha component of a pixel

DirectColorModel

public DirectColorModel(ColorSpace cspace, int pixelBits, int rmask, int gmask, int bmask, int amask, boolean isAlphaPremultiplied, int transferType)

Method Detail

coerceData

public ColorModel coerceData(WritableRaster raster, boolean isAlphaPremultiplied)

createCompatibleWritableRaster

public final WritableRaster createCompatibleWritableRaster(int w, int h)
Creates a WriteableRaster that has a SampleModel that is compatible with this ColorModel.

Parameters: w the width of the writeable raster to create h the height of the writeable raster to create

Throws: IllegalArgumentException if w or h is less than or equal to zero

getAlpha

public final int getAlpha(int pixel)
Get the alpha component of the given pixel.

getAlpha

public int getAlpha(Object inData)

getAlphaMask

public final int getAlphaMask()

getBlue

public final int getBlue(int pixel)
Get the blue component of the given pixel.

getBlue

public int getBlue(Object inData)

getBlueMask

public final int getBlueMask()

getComponents

public final int[] getComponents(int pixel, int[] components, int offset)
Fills an array with the unnormalized component samples from a pixel value. I.e. decompose the pixel, but not perform any color conversion.

getComponents

public final int[] getComponents(Object pixel, int[] components, int offset)

getDataElement

public int getDataElement(int[] components, int offset)

getDataElements

public Object getDataElements(int rgb, Object pixel)
Converts a normalized pixel int value in the sRGB color space to an array containing a single pixel of the color space of the color model.

This method performs the inverse function of getRGB(Object inData).

Parameters: rgb pixel as a normalized sRGB, 0xAARRGGBB value. pixel to avoid needless creation of arrays, an array to use to return the pixel can be given. If null, a suitable array will be created.

Returns: array of transferType containing a single pixel. The pixel should be encoded in the natural way of the color model.

See Also: getRGB

getDataElements

public Object getDataElements(int[] components, int offset, Object obj)

getGreen

public final int getGreen(int pixel)
Get the green component of the given pixel.

getGreen

public int getGreen(Object inData)

getGreenMask

public final int getGreenMask()

getRed

public final int getRed(int pixel)
Get the red component of the given pixel.

getRed

public int getRed(Object inData)

getRedMask

public final int getRedMask()

getRGB

public final int getRGB(int pixel)
Get the RGB color value of the given pixel using the default RGB color model.

Parameters: pixel a pixel value

getRGB

public int getRGB(Object inData)

isCompatibleRaster

public boolean isCompatibleRaster(Raster raster)

toString

public String toString()