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 resultingIndexColorModelcan 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 theIndexColorModelinstances.intgetBits()Returns the number of bits used for theIndexColorModelinstances.intgetSize()Returns the number of colors used for theIndexColorModelinstances.intReturns the optional transparent index used for theIndexColorModelinstances.booleanReturns whether the colors are interpolated in the Hue/Saturation/Value color space or the Red/Green/Blue color space.booleanReturns whether the indices of the basic colors are specified as signed values.voidloadProperties(Properties aProperties, String aPrefix, String aSuffix) Loads the relevant properties for thisILcdColorModelFactory.voidsetBasicColor(int aIndex, Color aColor) Sets the given basic color to be used for theIndexColorModelinstances.voidsetBits(int aBits) Sets the number of bits to be used for theIndexColorModelinstances.voidsetInterpolateInHsbSpace(boolean aInterpolateInHsbSpace) Sets whether the colors will be interpolated in the Hue/Saturation/Value color space, or the Red/Green/Blue color space.voidsetSignedIndices(boolean aSignedIndices) Sets whether the indices of the basic colors will be specified as signed values.voidsetSize(int aSize) Sets the number of colors to be used for theIndexColorModelinstances.voidsetTransparentIndex(int aTransparentIndex) Sets the optional transparent index to be used for theIndexColorModelinstances.
-
Constructor Details
-
TLcdJetIndexColorModelFactory
public TLcdJetIndexColorModelFactory()
-
-
Method Details
-
setBits
public void setBits(int aBits) Sets the number of bits to be used for theIndexColorModelinstances. -
getBits
public int getBits()Returns the number of bits used for theIndexColorModelinstances. -
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 theIndexColorModelinstances. -
getSize
public int getSize()Returns the number of colors used for theIndexColorModelinstances. -
setBasicColor
Sets the given basic color to be used for theIndexColorModelinstances. 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 theIndexColorModelinstances. -
setTransparentIndex
public void setTransparentIndex(int aTransparentIndex) Sets the optional transparent index to be used for theIndexColorModelinstances. -
getTransparentIndex
public int getTransparentIndex()Returns the optional transparent index used for theIndexColorModelinstances. -
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:ILcdColorModelFactoryCreates a newColorModel.- Specified by:
createColorModelin 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
IndexColorModelwith 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:
loadPropertiesin 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.
-