Package toxi.color

Class ColorGradient

java.lang.Object
toxi.color.ColorGradient

public class ColorGradient extends Object
This class can be used to calculate multi-color gradients with colors positioned along an imaginary axis.
  • Constructor Details

    • ColorGradient

      public ColorGradient()
      Constructs a new empty gradient.
  • Method Details

    • 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 List<toxi.color.ColorGradient.GradPoint> getGradientPoints()
    • getInterpolator

      public InterpolateStrategy getInterpolator()
      Returns:
      the interpolator
    • getMaxDither

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

      public void setInterpolator(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 -