public class TLcdGradientIndexColorModelFactory extends Object implements ILcdColorModelFactory
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 the
IndexColorModel
(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 and Description |
---|
TLcdGradientIndexColorModelFactory() |
Modifier and Type | Method and Description |
---|---|
ColorModel |
createColorModel()
Creates a new
ColorModel . |
int |
getBits() |
Color |
getFirstColor() |
Color |
getLastColor() |
int |
getSize() |
int |
getTransparentIndex() |
void |
loadProperties(Properties aProperties,
String aPrefix,
String aSuffix)
Loads the relevant properties for this
ILcdColorModelFactory . |
void |
setBits(int aBits) |
void |
setFirstColor(Color aFirstColor) |
void |
setLastColor(Color aLastColor) |
void |
setSize(int aSize) |
void |
setTransparentIndex(int aTransparentIndex) |
public void setBits(int aBits)
public int getBits()
public void setSize(int aSize)
public int getSize()
public void setFirstColor(Color aFirstColor)
public Color getFirstColor()
public void setLastColor(Color aLastColor)
public Color getLastColor()
public void setTransparentIndex(int aTransparentIndex)
public int getTransparentIndex()
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
"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
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.