Package toxi.color
Class ColorGradient
java.lang.Object
toxi.color.ColorGradient
This class can be used to calculate multi-color gradients with colors
positioned along an imaginary axis.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addColorAt
(float p, ReadonlyTColor c) Adds a new color at specified position.calcGradient
(float pos, int width) Calculates the gradient from specified position.List<toxi.color.ColorGradient.GradPoint>
float
void
setInterpolator
(InterpolateStrategy interpolator) void
setMaxDither
(float maxDither) Sets the maximum dither amount.
-
Constructor Details
-
ColorGradient
public ColorGradient()Constructs a new empty gradient.
-
-
Method Details
-
addColorAt
Adds a new color at specified position.- Parameters:
p
-c
-
-
calcGradient
-
calcGradient
Calculates the gradient from specified position.- Parameters:
pos
-width
-- Returns:
- list of interpolated gradient colors
-
getGradientPoints
-
getInterpolator
- Returns:
- the interpolator
-
getMaxDither
public float getMaxDither()- Returns:
- the maximum dither amount.
-
setInterpolator
- Parameters:
interpolator
- the interpolator to set
-
setMaxDither
public void setMaxDither(float maxDither) Sets the maximum dither amount. Setting this to values >0 will jitter the interpolated colors in the calculated gradient. The value range for this parameter is 0.0 (off) to 1.0 (100%).- Parameters:
maxDither
-
-