Package com.luciad.format.raster
Class TLcdGradientIndexColorModelFactory
java.lang.Object
com.luciad.format.raster.TLcdGradientIndexColorModelFactory
- All Implemented Interfaces:
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 theIndexColorModel
(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).
2^bits-1
) are interpolated
(including their alpha values, if any). The remaining colors are left
black (or transparent).-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newColorModel
.int
getBits()
int
getSize()
int
void
loadProperties
(Properties aProperties, String aPrefix, String aSuffix) Loads the relevant properties for thisILcdColorModelFactory
.void
setBits
(int aBits) void
setFirstColor
(Color aFirstColor) void
setLastColor
(Color aLastColor) void
setSize
(int aSize) void
setTransparentIndex
(int aTransparentIndex)
-
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
-
getFirstColor
-
setLastColor
-
getLastColor
-
setTransparentIndex
public void setTransparentIndex(int aTransparentIndex) -
getTransparentIndex
public int getTransparentIndex() -
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 "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 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.
-