Package com.luciad.format.raster
Class TLcdJetIndexColorModelFactory
java.lang.Object
com.luciad.format.raster.TLcdJetIndexColorModelFactory
- All Implemented Interfaces:
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 theIndexColorModel
(default = 8).signedIndices
: specifies whether the indices to specify colors are signed (default = false). The indices in the resultingIndexColorModel
can then be treated as signed too.size
: the number of colors in the color map (default = 256).basicColor.i
: the color at indexi
(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 -
Method Summary
Modifier and TypeMethodDescriptionCreates a newColorModel
.getBasicColor
(int aIndex) Returns the basic color used for theIndexColorModel
instances.int
getBits()
Returns the number of bits used for theIndexColorModel
instances.int
getSize()
Returns the number of colors used for theIndexColorModel
instances.int
Returns the optional transparent index used for theIndexColorModel
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 thisILcdColorModelFactory
.void
setBasicColor
(int aIndex, Color aColor) Sets the given basic color to be used for theIndexColorModel
instances.void
setBits
(int aBits) Sets the number of bits to be used for theIndexColorModel
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 theIndexColorModel
instances.void
setTransparentIndex
(int aTransparentIndex) Sets the optional transparent index to be used for theIndexColorModel
instances.
-
Constructor Details
-
TLcdJetIndexColorModelFactory
public TLcdJetIndexColorModelFactory()
-
-
Method Details
-
setBits
public void setBits(int aBits) Sets the number of bits to be used for theIndexColorModel
instances. -
getBits
public int getBits()Returns the number of bits used for theIndexColorModel
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 theIndexColorModel
instances. -
getSize
public int getSize()Returns the number of colors used for theIndexColorModel
instances. -
setBasicColor
Sets the given basic color to be used for theIndexColorModel
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
Returns the basic color used for theIndexColorModel
instances. -
setTransparentIndex
public void setTransparentIndex(int aTransparentIndex) Sets the optional transparent index to be used for theIndexColorModel
instances. -
getTransparentIndex
public int getTransparentIndex()Returns the optional transparent index used for theIndexColorModel
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
Description copied from interface:ILcdColorModelFactory
Creates a newColorModel
.- Specified by:
createColorModel
in interfaceILcdColorModelFactory
- Returns:
- the
ColorModel
.
-
loadProperties
public void loadProperties(Properties aProperties, String aPrefix, String aSuffix) throws IllegalArgumentException Loads the relevant properties for thisILcdColorModelFactory
. 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 interfaceILcdColorModelFactory
- 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.
-