Package org.evoludo.simulator
Class ColorMap.Index<T>
- Type Parameters:
T
- type of color object: String orMeshLambertMaterial
for GWT andColor
for JRE
- Direct Known Subclasses:
ColorMap3D.Index
,ColorMapCSS.Index
Associates integer indices with colors.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ColorMap
ColorMap.Gradient<T>, ColorMap.Gradient1D<T>, ColorMap.Gradient2D<T>, ColorMap.GradientND<T>, ColorMap.Hue<T>, ColorMap.Index<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected T[]
Array of generic colorsT
.protected final int
Number of colorsprotected Color[]
This is currently only needed to pass something totoGradient1D(int)
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionT[]
Get the array of colors tha backs this color map.void
Assign a newcolor
toindex
.void
Assign a newcolor
toindex
with transparencyalpha
.abstract ColorMap.Gradient1D
<T> toGradient1D
(int nIncr) Convert the index colors into a 1D gradient with a total ofnIncr
shades.boolean
Translate thedata
array ofint
values to colors and store the results in thecolor
array.Methods inherited from class ColorMap
addAlpha, addAlpha, addColors, blendColors, blendColors, color2Color, translate, translate, translate, translate, translate
-
Field Details
-
colors
Array of generic colorsT
. -
srccolors
This is currently only needed to pass something totoGradient1D(int)
. -
nColors
protected final int nColorsNumber of colors
-
-
Constructor Details
-
Index
protected Index(int size) Constructs a new index color map.- Parameters:
size
- the number of colors
-
Index
Constructs a new index color map with transparencyalpha
.- Parameters:
srccolors
- the indexed colorsalpha
- the transparency of the colorscolors
- the array to store the colors
-
-
Method Details
-
getColors
Get the array of colors tha backs this color map.- Returns:
- the array of colors
-
setColor
Assign a newcolor
toindex
.- Parameters:
index
- the index of thecolor
color
- the new color forindex
-
setColor
Assign a newcolor
toindex
with transparencyalpha
.Note: the transparency of the supplied color is always honoured.
- Parameters:
index
- the index of thecolor
color
- the new color forindex
alpha
- the transparency of the new color
-
translate
Description copied from class:ColorMap
Translate thedata
array ofint
values to colors and store the results in thecolor
array. The type of thecolor
array depends on the implementation.Note: for performance reasons no validity checks are performed on the data. If any data entry is negative or
>nColors
an ArrayIndexOutOfBoundsException is thrown. -
toGradient1D
Convert the index colors into a 1D gradient with a total ofnIncr
shades.- Parameters:
nIncr
- the total number of color increments- Returns:
- the 1D color gradient
-