Class TLcdGradientIndexColorModelFactory

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

public class TLcdGradientIndexColorModelFactory extends Object implements ILcdColorModelFactory
This class implements an ILcdColorModelFactory for creating IndexColorModel objects whose entries represent a color gradient between 2 colors. You can use TLcdJetIndexColorModelFactory for a gradient between more colors. 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 gradient map (default = 256).
  • firstColor: the first color in the gradient map (default = black).
  • lastColor: the last color in the gradient map (default = white).
  • transparentIndex: an optional color index specifying a transparent color (default = -1).
The colors inbetween the specified first color (with index 0) and the last color (with index 2^bits-1) are interpolated (including their alpha values, if any). The remaining colors are left black (or transparent).
  • Constructor Details

    • TLcdGradientIndexColorModelFactory

      public TLcdGradientIndexColorModelFactory()
  • Method Details

    • setBits

      public void setBits(int aBits)
    • getBits

      public int getBits()
    • setSize

      public void setSize(int aSize)
    • getSize

      public int getSize()
    • setFirstColor

      public void setFirstColor(Color aFirstColor)
    • getFirstColor

      public Color getFirstColor()
    • setLastColor

      public void setLastColor(Color aLastColor)
    • getLastColor

      public Color getLastColor()
    • setTransparentIndex

      public void setTransparentIndex(int aTransparentIndex)
    • getTransparentIndex

      public int getTransparentIndex()
    • 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 "TLcdGradientIndexColorModelFactory.".

      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, ranging from red to blue, with index 255 being transparent:

       TLcdGradientIndexColorModelFactory.bits = 8
       TLcdGradientIndexColorModelFactory.size = 256
       TLcdGradientIndexColorModelFactory.firstColor = 0x0000ff
       TLcdGradientIndexColorModelFactory.lastColor  = 0xff0000
       TLcdGradientIndexColorModelFactory.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.