Class TLcdJetIndexColorModelFactory

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

public class TLcdJetIndexColorModelFactory extends Object implements ILcdColorModelFactory
This ILcdColorModelFactory creates IndexColorModel instances with smoothly varying colors. A sparse list of basic colors can be specified. Colors inbetween will then be interpolated (including their alpha values).

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).
  • signedIndices: specifies whether the indices to specify colors are signed (default = false). The indices in the resulting IndexColorModel can then be treated as signed too.
  • size: the number of colors in the color map (default = 256).
  • basicColor.i: the color at index i (default = a set of jet colors: blue/cyan/yellow/orange/red, at indices 0/64/128/192/255 respectively).
  • transparentIndex: an optional color index specifying a single transparent color (default = an invalid color index, meaning no single transparent color).
  • interpolateInHsbSpace: specifies whether the colors are interpolated in the Hue/Saturation/Brightness color space or the Red/Green/Blue color space (default = false).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Creates a new ColorModel.
    getBasicColor(int aIndex)
    Returns the basic color used for the IndexColorModel instances.
    int
    Returns the number of bits used for the IndexColorModel instances.
    int
    Returns the number of colors used for the IndexColorModel instances.
    int
    Returns the optional transparent index used for the IndexColorModel instances.
    boolean
    Returns whether the colors are interpolated in the Hue/Saturation/Value color space or the Red/Green/Blue color space.
    boolean
    Returns whether the indices of the basic colors are specified as signed values.
    void
    loadProperties(Properties aProperties, String aPrefix, String aSuffix)
    Loads the relevant properties for this ILcdColorModelFactory.
    void
    setBasicColor(int aIndex, Color aColor)
    Sets the given basic color to be used for the IndexColorModel instances.
    void
    setBits(int aBits)
    Sets the number of bits to be used for the IndexColorModel instances.
    void
    setInterpolateInHsbSpace(boolean aInterpolateInHsbSpace)
    Sets whether the colors will be interpolated in the Hue/Saturation/Value color space, or the Red/Green/Blue color space.
    void
    setSignedIndices(boolean aSignedIndices)
    Sets whether the indices of the basic colors will be specified as signed values.
    void
    setSize(int aSize)
    Sets the number of colors to be used for the IndexColorModel instances.
    void
    setTransparentIndex(int aTransparentIndex)
    Sets the optional transparent index to be used for the IndexColorModel instances.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TLcdJetIndexColorModelFactory

      public TLcdJetIndexColorModelFactory()
  • Method Details

    • setBits

      public void setBits(int aBits)
      Sets the number of bits to be used for the IndexColorModel instances.
    • getBits

      public int getBits()
      Returns the number of bits used for the IndexColorModel instances.
    • setSignedIndices

      public void setSignedIndices(boolean aSignedIndices)
      Sets whether the indices of the basic colors will be specified as signed values.
    • isSignedIndices

      public boolean isSignedIndices()
      Returns whether the indices of the basic colors are specified as signed values.
    • setSize

      public void setSize(int aSize)
      Sets the number of colors to be used for the IndexColorModel instances.
    • getSize

      public int getSize()
      Returns the number of colors used for the IndexColorModel instances.
    • setBasicColor

      public void setBasicColor(int aIndex, Color aColor)
      Sets the given basic color to be used for the IndexColorModel instances. Its index should lie between 0 and the number of colors. Colors that are not set are interpolated linearly between the nearest neighbors that are set.
    • getBasicColor

      public Color getBasicColor(int aIndex)
      Returns the basic color used for the IndexColorModel instances.
    • setTransparentIndex

      public void setTransparentIndex(int aTransparentIndex)
      Sets the optional transparent index to be used for the IndexColorModel instances.
    • getTransparentIndex

      public int getTransparentIndex()
      Returns the optional transparent index used for the IndexColorModel instances.
    • setInterpolateInHsbSpace

      public void setInterpolateInHsbSpace(boolean aInterpolateInHsbSpace)
      Sets whether the colors will be interpolated in the Hue/Saturation/Value color space, or the Red/Green/Blue color space.
    • isInterpolateInHsbSpace

      public boolean isInterpolateInHsbSpace()
      Returns whether the colors are interpolated in the Hue/Saturation/Value color space or the Red/Green/Blue color space.
    • 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 "TLcdJetIndexColorModelFactory.".

      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, over green, to blue, with index 255 being transparent:

       TLcdJetIndexColorModelFactory.bits = 8
       TLcdJetIndexColorModelFactory.size = 256
       TLcdJetIndexColorModelFactory.basicColor.0   = 0x0000ff
       TLcdJetIndexColorModelFactory.basicColor.128 = 0x00ff00
       TLcdJetIndexColorModelFactory.basicColor.255 = 0xff0000
       TLcdJetIndexColorModelFactory.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.