Package org.evoludo.simulator
Class ColorMap.Index<T>
- Type Parameters:
T- type of color object: String orMeshLambertMaterialfor GWT andColorfor 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 intNumber 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.voidAssign a newcolortoindex.voidAssign a newcolortoindexwith transparencyalpha.abstract ColorMap.Gradient1D<T> toGradient1D(int nIncr) Convert the index colors into a 1D gradient with a total ofnIncrshades.booleanTranslate thedataarray ofintvalues to colors and store the results in thecolorarray.Methods inherited from class ColorMap
addAlpha, addAlpha, addColors, blendColors, blendColors, color2Color, 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 newcolortoindex.- Parameters:
index- the index of thecolorcolor- the new color forindex
-
setColor
Assign a newcolortoindexwith transparencyalpha.Note: the transparency of the supplied color is always honoured.
- Parameters:
index- the index of thecolorcolor- the new color forindexalpha- the transparency of the new color
-
translate
Description copied from class:ColorMapTranslate thedataarray ofintvalues to colors and store the results in thecolorarray. The type of thecolorarray depends on the implementation.Note: for performance reasons no validity checks are performed on the data. If any data entry is negative or
>nColorsan ArrayIndexOutOfBoundsException is thrown. -
toGradient1D
Convert the index colors into a 1D gradient with a total ofnIncrshades.- Parameters:
nIncr- the total number of color increments- Returns:
- the 1D color gradient
-