public class TLcdIndexColorModelFactory extends Object implements ILcdColorModelFactory
IndexColorModel
objects.
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).
size
: the number of colors in the color map (default = 256).
color.i
: the ith color in the gradient map
(i between 0 and size-1
; default = black).
transparentIndex
: an optional color index specifying a
transparent color (default = -1).
Constructor and Description |
---|
TLcdIndexColorModelFactory() |
Modifier and Type | Method and Description |
---|---|
ColorModel |
createColorModel()
Creates a new
ColorModel . |
int |
getBits() |
int |
getColor(int aIndex) |
int |
getSize() |
void |
loadProperties(Properties aProperties,
String aPrefix,
String aSuffix)
Loads the relevant properties for this
ILcdColorModelFactory . |
void |
setBits(int aBits) |
void |
setColor(int aIndex,
int aColor) |
void |
setSize(int aSize) |
public void setBits(int aBits)
public int getBits()
public void setSize(int aSize)
public int getSize()
public void setColor(int aIndex, int aColor)
public int getColor(int aIndex)
public ColorModel createColorModel()
ILcdColorModelFactory
ColorModel
.createColorModel
in interface ILcdColorModelFactory
ColorModel
.public void loadProperties(Properties aProperties, String aPrefix, String aSuffix) throws IllegalArgumentException
ILcdColorModelFactory
.
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
IndexColorModel
with 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
loadProperties
in interface ILcdColorModelFactory
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.IllegalArgumentException
- in case of parsing problems.