Package org.evoludo.simulator
Class ColorMap.Gradient<T>
- Type Parameters:
T
- type of color object: String orMeshLambertMaterial
for GWT andColor
for JRE
- Direct Known Subclasses:
ColorMap.Gradient1D
,ColorMap.Gradient2D
Abstract super class for color maps following a gradient.
- 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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
interpolateColors
(T[] gradient, Color[] colors) Utility method for creating a smooth gradient spanning all colors in the arraycolors
.void
interpolateColors
(T[] gradient, Color start, int first, Color end, int last) Utility method for creating a smooth gradient ranging from colorstart
to colorend
inlast-first
steps.translate
(double data) Translate thedouble
valuedata
to a color gradient.Methods inherited from class ColorMap
addAlpha, addAlpha, addColors, blendColors, blendColors, color2Color, translate, translate, translate, translate, translate, translate
-
Constructor Details
-
Gradient
public Gradient()Constructs a new gradient color map.
-
-
Method Details
-
interpolateColors
Utility method for creating a smooth gradient ranging from colorstart
to colorend
inlast-first
steps. The color gradient is stored in the arraygradient
from elementsfirst
tolast
(inclusive).- Parameters:
gradient
- the array for storing the color gradientstart
- the starting colorfirst
- the index ingradient
for thestart
colorend
- the end colorlast
- the index ingradient
for theend
color
-
interpolateColors
Utility method for creating a smooth gradient spanning all colors in the arraycolors
. An equal number of shades are created between two adjacent colors. The color gradient is stored in the arraygradient
.- Parameters:
gradient
- the array for storing the color gradientcolors
- the array of colors for the gradient
-
translate
Translate thedouble
valuedata
to a color gradient. The type of object returned depends on the implementation.- Parameters:
data
- thedouble
value to convert to a color- Returns:
- the color object
-