toxi.color
Class ColorGradient

java.lang.Object
  extended by toxi.color.ColorGradient

public class ColorGradient
extends java.lang.Object

This class can be used to calculate multi-color gradients with colors positioned along an imaginary axis.


Constructor Summary
ColorGradient()
          Constructs a new empty gradient.
 
Method Summary
 void addColorAt(float p, ReadonlyTColor c)
          Adds a new color at specified position.
 ColorList calcGradient()
           
 ColorList calcGradient(float pos, int width)
          Calculates the gradient from specified position.
 java.util.List<toxi.color.ColorGradient.GradPoint> getGradientPoints()
           
 toxi.math.InterpolateStrategy getInterpolator()
           
 float getMaxDither()
           
 void setInterpolator(toxi.math.InterpolateStrategy interpolator)
           
 void setMaxDither(float maxDither)
          Sets the maximum dither amount.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ColorGradient

public ColorGradient()
Constructs a new empty gradient.

Method Detail

addColorAt

public void addColorAt(float p,
                       ReadonlyTColor c)
Adds a new color at specified position.

Parameters:
p -
c -

calcGradient

public ColorList calcGradient()

calcGradient

public ColorList calcGradient(float pos,
                              int width)
Calculates the gradient from specified position.

Parameters:
pos -
width -
Returns:
list of interpolated gradient colors

getGradientPoints

public java.util.List<toxi.color.ColorGradient.GradPoint> getGradientPoints()

getInterpolator

public toxi.math.InterpolateStrategy getInterpolator()
Returns:
the interpolator

getMaxDither

public float getMaxDither()
Returns:
the maximum dither amount.

setInterpolator

public void setInterpolator(toxi.math.InterpolateStrategy interpolator)
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 -