Package com.luciad.format.raster
Class TLcdIndexColorModelFactory
java.lang.Object
com.luciad.format.raster.TLcdIndexColorModelFactory
- All Implemented Interfaces:
ILcdColorModelFactory
This class implements an ILcdColorModelFactory for creating general
IndexColorModel objects.
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 color map (default = 256).color.i: the ith color in the gradient map (i between 0 andsize-1; default = black).transparentIndex: an optional color index specifying a transparent color (default = -1).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a newColorModel.intgetBits()intgetColor(int aIndex) intgetSize()voidloadProperties(Properties aProperties, String aPrefix, String aSuffix) Loads the relevant properties for thisILcdColorModelFactory.voidsetBits(int aBits) voidsetColor(int aIndex, int aColor) voidsetSize(int aSize)
-
Constructor Details
-
TLcdIndexColorModelFactory
public TLcdIndexColorModelFactory()
-
-
Method Details
-
setBits
public void setBits(int aBits) -
getBits
public int getBits() -
setSize
public void setSize(int aSize) -
getSize
public int getSize() -
setColor
public void setColor(int aIndex, int aColor) -
getColor
public int getColor(int aIndex) -
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 "TLcdIndexColorModelFactory.".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, with index 255 being transparent:TLcdIndexColorModelFactory.bits = 8 TLcdIndexColorModelFactory.size = 256 TLcdIndexColorModelFactory.color.0 = 0x000000 TLcdIndexColorModelFactory.color.1 = 0x0000ff ..... TLcdIndexColorModelFactory.color.255 = 0xffffff TLcdIndexColorModelFactory.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.
-