Package org.evoludo.simulator
Class ColorMap.Gradient<T>
- Type Parameters:
T- type of color object: String orMeshLambertMaterialfor GWT andColorfor 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 TypeMethodDescriptionvoidinterpolateColors(T[] gradient, Color[] colors) Utility method for creating a smooth gradient spanning all colors in the arraycolors.voidinterpolateColors(T[] gradient, Color start, int first, Color end, int last) Utility method for creating a smooth gradient ranging from colorstartto colorendinlast-firststeps.translate(double data) Translate thedoublevaluedatato a color gradient.Methods inherited from class ColorMap
addAlpha, addAlpha, addColors, blendColors, blendColors, color2Color, 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 colorstartto colorendinlast-firststeps. The color gradient is stored in the arraygradientfrom elementsfirsttolast(inclusive).- Parameters:
gradient- the array for storing the color gradientstart- the starting colorfirst- the index ingradientfor thestartcolorend- the end colorlast- the index ingradientfor theendcolor
-
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 thedoublevaluedatato a color gradient. The type of object returned depends on the implementation.- Parameters:
data- thedoublevalue to convert to a color- Returns:
- the color object
-