public class TLcdJetIndexColorModelFactory extends Object implements ILcdColorModelFactory
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 the
IndexColorModel
(default = 8).
signedIndices
: specifies whether the indices to specify
colors are signed (default = false). The indices in the resulting
IndexColorModel
can then be treated as signed too.
size
: the number of colors in the color map (default = 256).
basicColor.i
: the color at index i
(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 and Description |
---|
TLcdJetIndexColorModelFactory() |
Modifier and Type | Method and Description |
---|---|
ColorModel |
createColorModel()
Creates a new
ColorModel . |
Color |
getBasicColor(int aIndex)
Returns the basic color used for the
IndexColorModel
instances. |
int |
getBits()
Returns the number of bits used for the
IndexColorModel
instances. |
int |
getSize()
Returns the number of colors used for the
IndexColorModel
instances. |
int |
getTransparentIndex()
Returns the optional transparent index used for the
IndexColorModel instances. |
boolean |
isInterpolateInHsbSpace()
Returns whether the colors are interpolated in the Hue/Saturation/Value
color space or the Red/Green/Blue color space.
|
boolean |
isSignedIndices()
Returns whether the indices of the basic colors are specified as
signed values.
|
void |
loadProperties(Properties aProperties,
String aPrefix,
String aSuffix)
Loads the relevant properties for this
ILcdColorModelFactory . |
void |
setBasicColor(int aIndex,
Color aColor)
Sets the given basic color to be used for the
IndexColorModel
instances. |
void |
setBits(int aBits)
Sets the number of bits to be used for the
IndexColorModel
instances. |
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.
|
void |
setSignedIndices(boolean aSignedIndices)
Sets whether the indices of the basic colors will be specified as
signed values.
|
void |
setSize(int aSize)
Sets the number of colors to be used for the
IndexColorModel
instances. |
void |
setTransparentIndex(int aTransparentIndex)
Sets the optional transparent index to be used for the
IndexColorModel instances. |
public void setBits(int aBits)
IndexColorModel
instances.public int getBits()
IndexColorModel
instances.public void setSignedIndices(boolean aSignedIndices)
public boolean isSignedIndices()
public void setSize(int aSize)
IndexColorModel
instances.public int getSize()
IndexColorModel
instances.public void setBasicColor(int aIndex, Color aColor)
IndexColorModel
instances. 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.public Color getBasicColor(int aIndex)
IndexColorModel
instances.public void setTransparentIndex(int aTransparentIndex)
IndexColorModel
instances.public int getTransparentIndex()
IndexColorModel
instances.public void setInterpolateInHsbSpace(boolean aInterpolateInHsbSpace)
public boolean isInterpolateInHsbSpace()
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
"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
IndexColorModel
with 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
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.