Class Gradient

  • All Implemented Interfaces:
    Colormap, java.io.Serializable, java.lang.Cloneable

    public class Gradient
    extends ArrayColormap
    implements java.lang.Cloneable, java.io.Serializable
    A Colormap implemented using Catmull-Rom colour splines. The map has a variable number of knots with a minimum of four. The first and last knots give the tangent at the end of the spline, and colours are interpolated from the second to the second-last knots. Each knot can be given a type of interpolation. These are:
    • LINEAR - linear interpolation to next knot
    • SPLINE - spline interpolation to next knot
    • CONSTANT - no interpolation - the colour is constant to the next knot
    • HUE_CW - interpolation of hue clockwise to next knot
    • HUE_CCW - interpolation of hue counter-clockwise to next knot
    See Also:
    Serialized Form
    • Constructor Detail

      • Gradient

        public Gradient()
      • Gradient

        public Gradient​(int[] rgb)
      • Gradient

        public Gradient​(int[] x,
                        int[] rgb)
      • Gradient

        public Gradient​(int[] x,
                        int[] rgb,
                        byte[] types)
    • Method Detail

      • copyTo

        public void copyTo​(Gradient g)
      • getKnot

        public int getKnot​(int n)
      • setKnot

        public void setKnot​(int n,
                            int color)
      • setKnotType

        public void setKnotType​(int n,
                                int type)
      • getKnotType

        public int getKnotType​(int n)
      • setKnotBlend

        public void setKnotBlend​(int n,
                                 int type)
      • getKnotBlend

        public byte getKnotBlend​(int n)
      • addKnot

        public void addKnot​(int x,
                            int color,
                            int type)
      • removeKnot

        public void removeKnot​(int n)
      • setKnots

        public void setKnots​(int[] x,
                             int[] rgb,
                             byte[] types)
      • setKnots

        public void setKnots​(int[] x,
                             int[] y,
                             byte[] types,
                             int offset,
                             int count)
      • splitSpan

        public void splitSpan​(int n)
      • setKnotPosition

        public void setKnotPosition​(int n,
                                    int x)
      • knotAt

        public int knotAt​(int x)
      • rebuild

        public void rebuild()
      • randomize

        public void randomize()
      • mutate

        public void mutate​(float amount)
      • randomGradient

        public static Gradient randomGradient()