Class TLcdIndexColorModelFactory

java.lang.Object
com.luciad.format.raster.TLcdIndexColorModelFactory
All Implemented Interfaces:
ILcdColorModelFactory

public class TLcdIndexColorModelFactory extends Object implements ILcdColorModelFactory
This class implements an ILcdColorModelFactory for creating general IndexColorModel objects. Before creating a color model, a number of properties have to be specified:
  • bits: the number of bits per pixel in the IndexColorModel (default = 8).
  • size: the number of colors in the color map (default = 256).
  • color.i: the ith color in the gradient map (i between 0 and size-1; default = black).
  • transparentIndex: an optional color index specifying a transparent color (default = -1).
Colors that are not specified are left black (or transparent).
  • Constructor Details

    • TLcdIndexColorModelFactory

      public TLcdIndexColorModelFactory()
  • Method Details

    • setBits

      public void setBits(int aBits)
    • getBits

      public int getBits()
    • setSize

      public void setSize(int aSize)
    • getSize

      public int getSize()
    • setColor

      public void setColor(int aIndex, int aColor)
    • getColor

      public int getColor(int aIndex)
    • createColorModel

      public ColorModel createColorModel()
      Description copied from interface: ILcdColorModelFactory
      Creates a new ColorModel.
      Specified by:
      createColorModel in interface ILcdColorModelFactory
      Returns:
      the ColorModel.
    • loadProperties

      public void loadProperties(Properties aProperties, String aPrefix, String aSuffix) throws IllegalArgumentException
      Loads the relevant properties for this ILcdColorModelFactory. The property names should be preceded by the prefix "TLcdIndexColorModelFactory.".

      Note that colors can be specified using the common Java formats for integers, as [A]RGB.

      For example, for setting up a factory that produces an IndexColorModel with 256 colors, with index 255 being transparent:

       TLcdIndexColorModelFactory.bits = 8
       TLcdIndexColorModelFactory.size = 256
       TLcdIndexColorModelFactory.color.0   = 0x000000
       TLcdIndexColorModelFactory.color.1   = 0x0000ff
       .....
       TLcdIndexColorModelFactory.color.255 = 0xffffff
       TLcdIndexColorModelFactory.transparentIndex = 0
       
      Specified by:
      loadProperties in interface ILcdColorModelFactory
      Parameters:
      aProperties - the properties.
      aPrefix - an optional additional prefix for each of the property names, before the common prefix.
      aSuffix - an optional suffix prefix for each of the property names.
      Throws:
      IllegalArgumentException - in case of parsing problems.