| 
 | JavaTM 2 Platform Standard Ed. 5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.image.ColorModel
java.awt.image.IndexColorModel
public class IndexColorModel
The IndexColorModel class is a ColorModel
 class that works with pixel values consisting of a
 single sample that is an index into a fixed colormap in the default
 sRGB color space.  The colormap specifies red, green, blue, and
 optional alpha components corresponding to each index.  All components
 are represented in the colormap as 8-bit unsigned integral values.
 Some constructors allow the caller to specify "holes" in the colormap
 by indicating which colormap entries are valid and which represent
 unusable colors via the bits set in a BigInteger object.
 This color model is similar to an X11 PseudoColor visual.
 
 Some constructors provide a means to specify an alpha component
 for each pixel in the colormap, while others either provide no
 such means or, in some cases, a flag to indicate whether the
 colormap data contains alpha values.  If no alpha is supplied to
 the constructor, an opaque alpha component (alpha = 1.0) is
 assumed for each entry.
 An optional transparent pixel value can be supplied that indicates a
 pixel to be made completely transparent, regardless of any alpha
 component supplied or assumed for that pixel value.
 Note that the color components in the colormap of an
 IndexColorModel objects are never pre-multiplied with
 the alpha components.
 
 If an IndexColorModel object has 
 a transparency value of Transparency.OPAQUE,
 then the hasAlpha 
 and getNumComponents methods
 (both inherited from ColorModel) 
 return false and 3, respectively.
 For any other transparency value,
 hasAlpha returns true
 and getNumComponents returns 4.
 
 The index represented by a pixel value is stored in the least
 significant n bits of the pixel representations passed to the
 methods of this class, where n is the pixel size specified to the
 constructor for a particular IndexColorModel object;
 n must be between 1 and 16, inclusive.  
 Higher order bits in pixel representations are assumed to be zero.
 For those methods that use a primitive array pixel representation of
 type transferType, the array length is always one.  
 The transfer types supported are DataBuffer.TYPE_BYTE and 
 DataBuffer.TYPE_USHORT.  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 that use this representation do 
 not throw an IllegalArgumentException due to an invalid 
 pixel value.
 
Many of the methods in this class are final. The reason for this is that 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 behaviour of those methods.
ColorModel, 
ColorSpace, 
DataBuffer| 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 | |
|---|---|
| IndexColorModel(int bits,
                int size,
                byte[] r,
                byte[] g,
                byte[] b)Constructs an IndexColorModelfrom the specified 
 arrays of red, green, and blue components. | |
| IndexColorModel(int bits,
                int size,
                byte[] r,
                byte[] g,
                byte[] b,
                byte[] a)Constructs an IndexColorModelfrom the given 
 arrays of red, green, blue and alpha components. | |
| IndexColorModel(int bits,
                int size,
                byte[] r,
                byte[] g,
                byte[] b,
                int trans)Constructs an IndexColorModelfrom the given arrays 
 of red, green, and blue components. | |
| IndexColorModel(int bits,
                int size,
                byte[] cmap,
                int start,
                boolean hasalpha)Constructs an IndexColorModelfrom a single 
 array of interleaved red, green, blue and optional alpha 
 components. | |
| IndexColorModel(int bits,
                int size,
                byte[] cmap,
                int start,
                boolean hasalpha,
                int trans)Constructs an IndexColorModelfrom a single array of 
 interleaved red, green, blue and optional alpha components. | |
| IndexColorModel(int bits,
                int size,
                int[] cmap,
                int start,
                boolean hasalpha,
                int trans,
                int transferType)Constructs an IndexColorModelfrom an array of 
 ints where each int is comprised of red, green, blue, and 
 optional alpha components in the default RGB color model format. | |
| IndexColorModel(int bits,
                int size,
                int[] cmap,
                int start,
                int transferType,
                BigInteger validBits)Constructs an IndexColorModelfrom anintarray where eachintis 
 comprised of red, green, blue, and alpha            
 components in the default RGB color model format. | |
| Method Summary | |
|---|---|
|  BufferedImage | convertToIntDiscrete(Raster raster,
                     boolean forceARGB)Returns a new BufferedImageof TYPE_INT_ARGB or 
 TYPE_INT_RGB that has aRasterwith pixel data 
 computed by expanding the indices in the sourceRasterusing the color/alpha component arrays of thisColorModel. | 
|  SampleModel | createCompatibleSampleModel(int w,
                            int h)Creates a SampleModelwith the specified 
 width and height that has a data layout compatible with 
 thisColorModel. | 
|  WritableRaster | createCompatibleWritableRaster(int w,
                               int h)Creates a WritableRasterwith the specified width 
 and height that has a data layout (SampleModel) 
 compatible with thisColorModel. | 
|  void | finalize()Disposes of system resources associated with this ColorModelonce thisColorModelis no
 longer referenced. | 
|  int | getAlpha(int pixel)Returns the alpha component for the specified pixel, scaled from 0 to 255. | 
|  void | getAlphas(byte[] a)Copies the array of alpha transparency components into the specified array. | 
|  int | getBlue(int pixel)Returns the blue color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. | 
|  void | getBlues(byte[] b)Copies the array of blue color components into the specified array. | 
|  int[] | getComponents(int pixel,
              int[] components,
              int offset)Returns an array of unnormalized color/alpha components for a specified pixel in this ColorModel. | 
|  int[] | getComponents(Object pixel,
              int[] components,
              int offset)Returns an array of unnormalized color/alpha components for a specified pixel in this ColorModel. | 
|  int[] | getComponentSize()Returns an array of the number of bits for each color/alpha component. | 
|  int | getDataElement(int[] components,
               int offset)Returns a pixel value represented as an int in this ColorModelgiven an array of unnormalized 
 color/alpha components. | 
|  Object | getDataElements(int[] components,
                int offset,
                Object pixel)Returns a data element array representation of a pixel in this ColorModelgiven an array of unnormalized color/alpha 
 components. | 
|  Object | getDataElements(int rgb,
                Object pixel)Returns a data element array representation of a pixel in this ColorModel, given an integer pixel representation in the default RGB color model. | 
|  int | getGreen(int pixel)Returns the green color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. | 
|  void | getGreens(byte[] g)Copies the array of green color components into the specified array. | 
|  int | getMapSize()Returns the size of the color/alpha component arrays in this IndexColorModel. | 
|  int | getRed(int pixel)Returns the red color component for the specified pixel, scaled from 0 to 255 in the default RGB ColorSpace, sRGB. | 
|  void | getReds(byte[] r)Copies the array of red color components into the specified array. | 
|  int | getRGB(int pixel)Returns the color/alpha components of the pixel in the default RGB color model format. | 
|  void | getRGBs(int[] rgb)Converts data for each index from the color and alpha component arrays to an int in the default RGB ColorModel format and copies the resulting 32-bit ARGB values into the specified array. | 
|  int | getTransparency()Returns the transparency. | 
|  int | getTransparentPixel()Returns the index of a transparent pixel in this IndexColorModelor -1 if there is no pixel
 with an alpha value of 0. | 
|  BigInteger | getValidPixels()Returns a BigIntegerthat indicates the valid/invalid
 pixels in the colormap. | 
|  boolean | isCompatibleRaster(Raster raster)Returns trueifrasteris compatible 
 with thisColorModelorfalseif it 
 is not compatible with thisColorModel. | 
|  boolean | isCompatibleSampleModel(SampleModel sm)Checks if the specified SampleModelis compatible 
 with thisColorModel. | 
|  boolean | isValid()Returns whether or not all of the pixels are valid. | 
|  boolean | isValid(int pixel)Returns whether or not the pixel is valid. | 
|  String | toString()Returns the Stringrepresentation of the contents of
 thisColorModelobject. | 
| Methods inherited from class java.awt.image.ColorModel | 
|---|
| coerceData, equals, getAlpha, getAlphaRaster, getBlue, getColorSpace, getComponentSize, getDataElement, getDataElements, getGreen, getNormalizedComponents, getNormalizedComponents, getNumColorComponents, getNumComponents, getPixelSize, getRed, getRGB, getRGBdefault, getTransferType, getUnnormalizedComponents, hasAlpha, hashCode, isAlphaPremultiplied | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, getClass, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public IndexColorModel(int bits,
                       int size,
                       byte[] r,
                       byte[] g,
                       byte[] b)
IndexColorModel from the specified 
 arrays of red, green, and blue components.  Pixels described 
 by this color model all have alpha components of 255 
 unnormalized (1.0 normalized), which means they
 are fully opaque.  All of the arrays specifying the color 
 components must have at least the specified number of entries.  
 The ColorSpace is the default sRGB space.
 Since there is no alpha information in any of the arguments
 to this constructor, the transparency value is always 
 Transparency.OPAQUE.
 The transfer type is the smallest of DataBuffer.TYPE_BYTE
 or DataBuffer.TYPE_USHORT that can hold a single pixel.
bits - the number of bits each pixel occupiessize - the size of the color component arraysr - the array of red color componentsg - the array of green color componentsb - the array of blue color components
IllegalArgumentException - if bits is less
         than 1 or greater than 16
IllegalArgumentException - if size is less
         than 1
public IndexColorModel(int bits,
                       int size,
                       byte[] r,
                       byte[] g,
                       byte[] b,
                       int trans)
IndexColorModel from the given arrays 
 of red, green, and blue components.  Pixels described by this color
 model all have alpha components of 255 unnormalized 
 (1.0 normalized), which means they are fully opaque, except 
 for the indicated pixel to be made transparent.  All of the arrays
 specifying the color components must have at least the specified
 number of entries.
 The ColorSpace is the default sRGB space.
 The transparency value may be Transparency.OPAQUE or
 Transparency.BITMASK depending on the arguments, as
 specified in the class description above.
 The transfer type is the smallest of DataBuffer.TYPE_BYTE
 or DataBuffer.TYPE_USHORT that can hold a
 single pixel.
bits - the number of bits each pixel occupiessize - the size of the color component arraysr - the array of red color componentsg - the array of green color componentsb - the array of blue color componentstrans - the index of the transparent pixel
IllegalArgumentException - if bits is less than
          1 or greater than 16
IllegalArgumentException - if size is less than
          1
public IndexColorModel(int bits,
                       int size,
                       byte[] r,
                       byte[] g,
                       byte[] b,
                       byte[] a)
IndexColorModel from the given 
 arrays of red, green, blue and alpha components.  All of the 
 arrays specifying the components must have at least the specified 
 number of entries.
 The ColorSpace is the default sRGB space.
 The transparency value may be any of Transparency.OPAQUE,
 Transparency.BITMASK,
 or Transparency.TRANSLUCENT
 depending on the arguments, as specified
 in the class description above.
 The transfer type is the smallest of DataBuffer.TYPE_BYTE
 or DataBuffer.TYPE_USHORT that can hold a single pixel.
bits - the number of bits each pixel occupiessize - the size of the color component arraysr - the array of red color componentsg - the array of green color componentsb - the array of blue color componentsa - the array of alpha value components
IllegalArgumentException - if bits is less
           than 1 or greater than 16
IllegalArgumentException - if size is less
           than 1
public IndexColorModel(int bits,
                       int size,
                       byte[] cmap,
                       int start,
                       boolean hasalpha)
IndexColorModel from a single 
 array of interleaved red, green, blue and optional alpha 
 components.  The array must have enough values in it to 
 fill all of the needed component arrays of the specified 
 size.  The ColorSpace is the default sRGB space.
 The transparency value may be any of Transparency.OPAQUE,
 Transparency.BITMASK,
 or Transparency.TRANSLUCENT
 depending on the arguments, as specified
 in the class description above.
 The transfer type is the smallest of
 DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT 
 that can hold a single pixel.
bits - the number of bits each pixel occupiessize - the size of the color component arrayscmap - the array of color componentsstart - the starting offset of the first color componenthasalpha - indicates whether alpha values are contained in
                        the cmap array
IllegalArgumentException - if bits is less
           than 1 or greater than 16
IllegalArgumentException - if size is less
           than 1
public IndexColorModel(int bits,
                       int size,
                       byte[] cmap,
                       int start,
                       boolean hasalpha,
                       int trans)
IndexColorModel from a single array of 
 interleaved red, green, blue and optional alpha components.  The 
 specified transparent index represents a pixel that is made
 entirely transparent regardless of any alpha value specified
 for it.  The array must have enough values in it to fill all
 of the needed component arrays of the specified size.
 The ColorSpace is the default sRGB space.
 The transparency value may be any of Transparency.OPAQUE,
 Transparency.BITMASK,
 or Transparency.TRANSLUCENT
 depending on the arguments, as specified
 in the class description above.
 The transfer type is the smallest of
 DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT
 that can hold a single pixel.
bits - the number of bits each pixel occupiessize - the size of the color component arrayscmap - the array of color componentsstart - the starting offset of the first color componenthasalpha - indicates whether alpha values are contained in
                        the cmap arraytrans - the index of the fully transparent pixel
IllegalArgumentException - if bits is less than
               1 or greater than 16
IllegalArgumentException - if size is less than
               1
public IndexColorModel(int bits,
                       int size,
                       int[] cmap,
                       int start,
                       boolean hasalpha,
                       int trans,
                       int transferType)
IndexColorModel from an array of 
 ints where each int is comprised of red, green, blue, and 
 optional alpha components in the default RGB color model format.  
 The specified transparent index represents a pixel that is made
 entirely transparent regardless of any alpha value specified
 for it.  The array must have enough values in it to fill all
 of the needed component arrays of the specified size.
 The ColorSpace is the default sRGB space.
 The transparency value may be any of Transparency.OPAQUE,
 Transparency.BITMASK,
 or Transparency.TRANSLUCENT
 depending on the arguments, as specified
 in the class description above.
bits - the number of bits each pixel occupiessize - the size of the color component arrayscmap - the array of color componentsstart - the starting offset of the first color componenthasalpha - indicates whether alpha values are contained in
                        the cmap arraytrans - the index of the fully transparent pixeltransferType - the data type of the array used to represent
           pixel values.  The data type must be either 
           DataBuffer.TYPE_BYTE or
           DataBuffer.TYPE_USHORT.
IllegalArgumentException - if bits is less
           than 1 or greater than 16
IllegalArgumentException - if size is less
           than 1
IllegalArgumentException - if transferType is not
           one of DataBuffer.TYPE_BYTE or
           DataBuffer.TYPE_USHORT
public IndexColorModel(int bits,
                       int size,
                       int[] cmap,
                       int start,
                       int transferType,
                       BigInteger validBits)
IndexColorModel from an 
 int array where each int is 
 comprised of red, green, blue, and alpha            
 components in the default RGB color model format.  
 The array must have enough values in it to fill all
 of the needed component arrays of the specified size.
 The ColorSpace is the default sRGB space.  
 The transparency value may be any of Transparency.OPAQUE,
 Transparency.BITMASK,
 or Transparency.TRANSLUCENT
 depending on the arguments, as specified
 in the class description above.
 The transfer type must be one of DataBuffer.TYPE_BYTE
 DataBuffer.TYPE_USHORT.
 The BigInteger object specifies the valid/invalid pixels
 in the cmap array.  A pixel is valid if the 
 BigInteger value at that index is set, and is invalid
 if the BigInteger bit  at that index is not set.
bits - the number of bits each pixel occupiessize - the size of the color component arraycmap - the array of color componentsstart - the starting offset of the first color componenttransferType - the specified data typevalidBits - a BigInteger object.  If a bit is
    set in the BigInteger, the pixel at that index is valid.
    If a bit is not set, the pixel at that index
    is considered invalid.  If null, all pixels are valid.
    Only bits from 0 to the map size are considered.
IllegalArgumentException - if bits is less
           than 1 or greater than 16
IllegalArgumentException - if size is less
           than 1
IllegalArgumentException - if transferType is not
           one of DataBuffer.TYPE_BYTE or
           DataBuffer.TYPE_USHORT| Method Detail | 
|---|
public int getTransparency()
getTransparency in interface TransparencygetTransparency in class ColorModelIndexColorModelTransparency.OPAQUE, 
Transparency.BITMASK, 
Transparency.TRANSLUCENTpublic int[] getComponentSize()
getComponentSize in class ColorModelIndexColorModelpublic final int getMapSize()
IndexColorModel.
public final int getTransparentPixel()
IndexColorModel or -1 if there is no pixel
 with an alpha value of 0.  If a transparent pixel was
 explicitly specified in one of the constructors by its
 index, then that index will be preferred, otherwise,
 the index of any pixel which happens to be fully transparent
 may be returned.
IndexColorModel object, or -1 if there
         is no such pixelpublic final void getReds(byte[] r)
getMapSize are written.
r - the specified array into which the elements of the 
      array of red color components are copiedpublic final void getGreens(byte[] g)
getMapSize are written.
g - the specified array into which the elements of the 
      array of green color components are copiedpublic final void getBlues(byte[] b)
getMapSize are written.
b - the specified array into which the elements of the 
      array of blue color components are copiedpublic final void getAlphas(byte[] a)
getMapSize are written.
a - the specified array into which the elements of the 
      array of alpha components are copiedpublic final void getRGBs(int[] rgb)
getMapSize are
 written.
rgb - the specified array into which the converted ARGB 
        values from this array of color and alpha components
        are copied.public final int getRed(int pixel)
getRed in class ColorModelpixel - the specified pixel
public final int getGreen(int pixel)
getGreen in class ColorModelpixel - the specified pixel
public final int getBlue(int pixel)
getBlue in class ColorModelpixel - the specified pixel
public final int getAlpha(int pixel)
getAlpha in class ColorModelpixel - the specified pixel
public final int getRGB(int pixel)
getRGB in class ColorModelpixel - the specified pixel
ColorModel.getRGBdefault()
public Object getDataElements(int rgb,
                              Object pixel)
setDataElements
 method of a WritableRaster object.  If the pixel variable is 
 null, a new array is allocated.  If pixel
 is not null, it must be
 a primitive array of type transferType; otherwise, a
 ClassCastException is thrown.  An 
 ArrayIndexOutOfBoundsException is
 thrown if pixel is not large enough to hold a pixel 
 value for this ColorModel.  The pixel array is returned.
 
 Since IndexColorModel can be subclassed, subclasses 
 inherit the implementation of this method and if they don't 
 override it then they throw an exception if they use an 
 unsupported transferType.
getDataElements in class ColorModelrgb - the integer pixel representation in the default RGB
 color modelpixel - the specified pixel
IndexColorModel.
ClassCastException - if pixel
  is not a primitive array of type transferType
ArrayIndexOutOfBoundsException - if
  pixel is not large enough to hold a pixel value
  for this ColorModel
UnsupportedOperationException - if transferType
         is invalidWritableRaster.setDataElements(int, int, java.lang.Object), 
SampleModel.setDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
public int[] getComponents(int pixel,
                           int[] components,
                           int offset)
ColorModel.  The pixel value 
 is specified as an int.  If the components array is null, 
 a new array is allocated that contains 
 offset + getNumComponents() elements. 
 The components array is returned, 
 with the alpha component included 
 only if hasAlpha returns true.  
 Color/alpha components are stored in the components array starting 
 at offset even if the array is allocated by this method.  
 An ArrayIndexOutOfBoundsException
 is thrown if  the components array is not null and is 
 not large enough to hold all the color and alpha components 
 starting at offset.
getComponents in class ColorModelpixel - the specified pixelcomponents - the array to receive the color and alpha
 components of the specified pixeloffset - the offset into the components array at
 which to start storing the color and alpha components
ColorModel.hasAlpha(), 
ColorModel.getNumComponents()
public int[] getComponents(Object pixel,
                           int[] components,
                           int offset)
ColorModel.  The pixel 
 value is specified by an array of data elements of type 
 transferType passed in as an object reference.
 If pixel is not a primitive array of type 
 transferType, a ClassCastException
 is thrown.  An ArrayIndexOutOfBoundsException
 is thrown if pixel is not large enough to hold 
 a pixel value for this ColorModel.  If the 
 components array is null, a new array 
 is allocated that contains 
 offset + getNumComponents() elements. 
 The components array is returned, 
 with the alpha component included 
 only if hasAlpha returns true.  
 Color/alpha components are stored in the components 
 array starting at offset even if the array is
 allocated by this method.  An 
 ArrayIndexOutOfBoundsException is also
 thrown if  the components array is not 
 null and is not large enough to hold all the color 
 and alpha components starting at offset.  
 
 Since IndexColorModel can be subclassed, subclasses 
 inherit the implementation of this method and if they don't
 override it then they throw an exception if they use an 
 unsupported transferType.
getComponents in class ColorModelpixel - the specified pixelcomponents - an array that receives the color and alpha  
 components of the specified pixeloffset - the index into the components array at
 which to begin storing the color and alpha components of the
 specified pixel
ArrayIndexOutOfBoundsException - if pixel
            is not large enough to hold a pixel value for this
            ColorModel or if the 
            components array is not null 
            and is not large enough to hold all the color 
            and alpha components starting at offset
ClassCastException - if pixel is not a 
            primitive array of type transferType
UnsupportedOperationException - if transferType
         is not one of the supported transer typesColorModel.hasAlpha(), 
ColorModel.getNumComponents()
public int getDataElement(int[] components,
                          int offset)
ColorModel given an array of unnormalized 
 color/alpha components.  An 
 ArrayIndexOutOfBoundsException 
 is thrown if the components array is not large 
 enough to hold all of the color and alpha components starting
 at offset.  Since
 ColorModel can be subclassed, subclasses inherit the
 implementation of this method and if they don't override it then
 they throw an exception if they use an unsupported transferType.
getDataElement in class ColorModelcomponents - an array of unnormalized color and alpha
 componentsoffset - the index into components at which to
 begin retrieving the color and alpha components
int pixel value in this
 ColorModel corresponding to the specified components.
ArrayIndexOutOfBoundsException - if
  the components array is not large enough to
  hold all of the color and alpha components starting at
  offset
UnsupportedOperationException - if transferType
         is invalid
public Object getDataElements(int[] components,
                              int offset,
                              Object pixel)
ColorModel given an array of unnormalized color/alpha 
 components.  This array can then be passed to the 
 setDataElements method of a WritableRaster 
 object.  An ArrayIndexOutOfBoundsException is 
 thrown if the 
 components array is not large enough to hold all of the 
 color and alpha components starting at offset.  
 If the pixel variable is null, a new array
 is allocated.  If pixel is not null, 
 it must be a primitive array of type transferType; 
 otherwise, a ClassCastException is thrown.
 An ArrayIndexOutOfBoundsException is thrown if pixel 
 is not large enough to hold a pixel value for this
 ColorModel.
 
 Since IndexColorModel can be subclassed, subclasses
 inherit the implementation of this method and if they don't
 override it then they throw an exception if they use an
 unsupported transferType
getDataElements in class ColorModelcomponents - an array of unnormalized color and alpha
 componentsoffset - the index into components at which to
 begin retrieving color and alpha componentspixel - the Object representing an array of color
 and alpha components
Object representing an array of color and
 alpha components.
ClassCastException - if pixel
  is not a primitive array of type transferType
ArrayIndexOutOfBoundsException - if 
  pixel is not large enough to hold a pixel value
  for this ColorModel or the components
  array is not large enough to hold all of the color and alpha
  components starting at offset
UnsupportedOperationException - if transferType
         is not one of the supported transer typesWritableRaster.setDataElements(int, int, java.lang.Object), 
SampleModel.setDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
public WritableRaster createCompatibleWritableRaster(int w,
                                                     int h)
WritableRaster with the specified width 
 and height that has a data layout (SampleModel) 
 compatible with this ColorModel.  This method
 only works for color models with 16 or fewer bits per pixel.
 
 Since IndexColorModel can be subclassed, any 
 subclass that supports greater than 16 bits per pixel must
 override this method.
createCompatibleWritableRaster in class ColorModelw - the width to apply to the new WritableRasterh - the height to apply to the new WritableRaster
WritableRaster object with the specified
 width and height.
UnsupportedOperationException - if the number of bits in a
         pixel is greater than 16WritableRaster, 
SampleModelpublic boolean isCompatibleRaster(Raster raster)
true if raster is compatible 
 with this ColorModel or false if it 
 is not compatible with this ColorModel.
isCompatibleRaster in class ColorModelraster - the Raster object to test for compatibility
true if raster is compatible
 with this ColorModel; false otherwise.
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 to apply to the new SampleModelh - the height to apply to the new SampleModel
SampleModel object with the specified
 width and height.
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.SampleModel
public BufferedImage convertToIntDiscrete(Raster raster,
                                          boolean forceARGB)
BufferedImage of TYPE_INT_ARGB or 
 TYPE_INT_RGB that has a Raster with pixel data 
 computed by expanding the indices in the source Raster
 using the color/alpha component arrays of this ColorModel.
 If forceARGB is true, a TYPE_INT_ARGB image is
 returned regardless of whether or not this ColorModel
 has an alpha component array or a transparent pixel.
raster - the specified RasterforceARGB - if true, the returned 
     BufferedImage is TYPE_INT_ARGB; otherwise it is
     TYPE_INT_RGB
BufferedImage created with the specified
     Raster
IllegalArgumentException - if the raster argument is not
           compatible with this IndexColorModelpublic boolean isValid(int pixel)
pixel - the specified pixel value
true if pixel
 is valid; false otherwise.public boolean isValid()
true if all pixels are valid;
 false otherwise.public BigInteger getValidPixels()
BigInteger that indicates the valid/invalid
 pixels in the colormap.  A bit is valid if the 
 BigInteger value at that index is set, and is invalid
 if the BigInteger value at that index is not set.
 The only valid ranges to query in the BigInteger are
 between 0 and the map size.
BigInteger indicating the valid/invalid pixels.public void finalize()
ColorModel once this ColorModel is no
 longer referenced.
finalize in class ColorModelpublic String toString()
String representation of the contents of
 this ColorModelobject.
toString in class ColorModelString representing the contents of this
 ColorModel object.| 
 | JavaTM 2 Platform Standard Ed. 5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.