| java.awt.image.IndexColorModel org.geotools.resources.image.MultiBandsIndexColorModel
MultiBandsIndexColorModel | final class MultiBandsIndexColorModel extends IndexColorModel (Code) | | An
IndexColorModel tolerant with image having more than one band.
Reminder:
MultiBandsIndexColorModel.getNumComponents will returns 3 or 4 no matter
how many bands were specified to the constructor. This is not specific to this class;
IndexColorModel behave that way. So we can't rely on this method for checking
the number of bands.
since: 2.0 version: $Id: MultiBandsIndexColorModel.java 20970 2006-08-11 07:53:22Z jgarnett $ author: Martin Desruisseaux author: Andrea Aime |
Field Summary | |
final int | numBands The number of bands. |
Constructor Summary | |
public | MultiBandsIndexColorModel(int bits, int size, int[] cmap, int start, boolean hasAlpha, int transparent, int transferType, int numBands, int visibleBand) Construct an object with the specified properties.
Parameters: bits - The number of bits each pixel occupies. Parameters: size - The size of the color component arrays. Parameters: cmap - The array of color components. Parameters: start - The starting offset of the first color component. Parameters: hasalpha - Indicates whether alpha values are contained in the cmap array. Parameters: transparent - The index of the fully transparent pixel. Parameters: transferType - The data type of the array used to represent pixel values. |
Method Summary | |
public SampleModel | createCompatibleSampleModel(int width, int height) Creates a
SampleModel with the specified
width and height that has a data layout compatible with
this
ColorModel . | public WritableRaster | createCompatibleWritableRaster(int width, int height) Creates a
WritableRaster with the specified width
and height that has a data layout (
SampleModel )
compatible with this
ColorModel . | public int | getAlpha(Object inData) Returns the alpha component for the specified pixel, scaled from 0 to 255. | public int | getBlue(Object inData) Returns the blue color component for the specified pixel, scaled
from 0 to 255 in the default RGB
ColorSpace , sRGB. | public int[] | getComponents(Object pixel, int[] components, int offset) Returns an array of unnormalized color/alpha components for a specified pixel
in this color model. | public Object | getDataElements(int RGB, Object pixel) Returns a data element array representation of a pixel in this color model,
given an integer pixel representation in the default RGB color model.
This method returns an array with a length equals to the number of bands specified to
the constructor (
IndexColorModel would returns an array of length 1). | public int | getGreen(Object inData) Returns the green color component for the specified pixel, scaled
from 0 to 255 in the default RGB
ColorSpace , sRGB. | public int | getRed(Object inData) Returns the red color component for the specified pixel, scaled
from 0 to 255 in the default RGB
ColorSpace , sRGB. | public boolean | isCompatibleRaster(Raster raster) Returns
true if
raster is compatible
with this
ColorModel . | public boolean | isCompatibleSampleModel(SampleModel sm) Checks if the specified
SampleModel is compatible
with this
ColorModel . |
numBands | final int numBands(Code) | | The number of bands.
|
MultiBandsIndexColorModel | public MultiBandsIndexColorModel(int bits, int size, int[] cmap, int start, boolean hasAlpha, int transparent, int transferType, int numBands, int visibleBand)(Code) | | Construct an object with the specified properties.
Parameters: bits - The number of bits each pixel occupies. Parameters: size - The size of the color component arrays. Parameters: cmap - The array of color components. Parameters: start - The starting offset of the first color component. Parameters: hasalpha - Indicates whether alpha values are contained in the cmap array. Parameters: transparent - The index of the fully transparent pixel. Parameters: transferType - The data type of the array used to represent pixel values. Thedata type must be either DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT . Parameters: numBands - The number of bands. Parameters: visibleBands - The band to display. throws: IllegalArgumentException - if bits is less than 1 or greater than 16. throws: IllegalArgumentException - if size is less than 1. throws: IllegalArgumentException - if transferType is not one of DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT . |
createCompatibleSampleModel | public SampleModel createCompatibleSampleModel(int width, int height)(Code) | | Creates a
SampleModel with the specified
width and height that has a data layout compatible with
this
ColorModel .
|
createCompatibleWritableRaster | public WritableRaster createCompatibleWritableRaster(int width, int height)(Code) | | Creates a
WritableRaster with the specified width
and height that has a data layout (
SampleModel )
compatible with this
ColorModel .
|
getAlpha | public int getAlpha(Object inData)(Code) | | Returns the alpha component for the specified pixel, scaled from 0 to 255.
|
getBlue | public int getBlue(Object inData)(Code) | | Returns the blue color component for the specified pixel, scaled
from 0 to 255 in the default RGB
ColorSpace , sRGB.
|
getDataElements | public Object getDataElements(int RGB, Object pixel)(Code) | | Returns a data element array representation of a pixel in this color model,
given an integer pixel representation in the default RGB color model.
This method returns an array with a length equals to the number of bands specified to
the constructor (
IndexColorModel would returns an array of length 1). All array
elements are set to the same value. Replicating the pixel value is a somewhat arbitrary
choice, but this choice make this image appears as a gray scale image if the underlying
DataBuffer were displayed again with a RGB color model instead of this one. Such
a gray scale image seems more neutral than an image where only the Red component would vary.
All other
getDataElement methods in this color model are ultimately defined in terms
of this method, so overriding this method should be enough.
|
getGreen | public int getGreen(Object inData)(Code) | | Returns the green color component for the specified pixel, scaled
from 0 to 255 in the default RGB
ColorSpace , sRGB.
|
getRed | public int getRed(Object inData)(Code) | | Returns the red color component for the specified pixel, scaled
from 0 to 255 in the default RGB
ColorSpace , sRGB.
|
isCompatibleRaster | public boolean isCompatibleRaster(Raster raster)(Code) | | Returns
true if
raster is compatible
with this
ColorModel .
|
isCompatibleSampleModel | public boolean isCompatibleSampleModel(SampleModel sm)(Code) | | Checks if the specified
SampleModel is compatible
with this
ColorModel .
|
Methods inherited from java.awt.image.IndexColorModel | public BufferedImage convertToIntDiscrete(Raster raster, boolean forceARGB)(Code)(Java Doc) public SampleModel createCompatibleSampleModel(int w, int h)(Code)(Java Doc) public WritableRaster createCompatibleWritableRaster(int w, int h)(Code)(Java Doc) public void finalize()(Code)(Java Doc) final public int getAlpha(int pixel)(Code)(Java Doc) final public void getAlphas(byte a)(Code)(Java Doc) final public int getBlue(int pixel)(Code)(Java Doc) final public void getBlues(byte b)(Code)(Java Doc) public int[] getComponentSize()(Code)(Java Doc) public int[] getComponents(int pixel, int[] components, int offset)(Code)(Java Doc) public int[] getComponents(Object pixel, int[] components, int offset)(Code)(Java Doc) public int getDataElement(int[] components, int offset)(Code)(Java Doc) public synchronized Object getDataElements(int rgb, Object pixel)(Code)(Java Doc) public Object getDataElements(int[] components, int offset, Object pixel)(Code)(Java Doc) final public int getGreen(int pixel)(Code)(Java Doc) final public void getGreens(byte g)(Code)(Java Doc) final public int getMapSize()(Code)(Java Doc) final public int getRGB(int pixel)(Code)(Java Doc) final public void getRGBs(int rgb)(Code)(Java Doc) final public int getRed(int pixel)(Code)(Java Doc) final public void getReds(byte r)(Code)(Java Doc) public int getTransparency()(Code)(Java Doc) final public int getTransparentPixel()(Code)(Java Doc) public BigInteger getValidPixels()(Code)(Java Doc) public boolean isCompatibleRaster(Raster raster)(Code)(Java Doc) public boolean isCompatibleSampleModel(SampleModel sm)(Code)(Java Doc) public boolean isValid(int pixel)(Code)(Java Doc) public boolean isValid()(Code)(Java Doc) public String toString()(Code)(Java Doc)
|
|
|