com.jhlabs.image
Class Gradient

java.lang.Object
  extended by com.jhlabs.image.ArrayColormap
      extended by com.jhlabs.image.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:

See Also:
Serialized Form

Field Summary
static int CIRCLE_DOWN
           
static int CIRCLE_UP
           
static int CONSTANT
           
static int HUE_CCW
           
static int HUE_CW
           
 byte[] knotTypes
           
static int LINEAR
           
 int numKnots
           
static int RGB
           
static int SPLINE
           
 int[] xKnots
           
 int[] yKnots
           
 
Constructor Summary
Gradient()
           
Gradient(int[] rgb)
           
Gradient(int[] x, int[] rgb)
           
Gradient(int[] x, int[] rgb, byte[] types)
           
 
Method Summary
 void addKnot(int x, int color, int type)
           
 java.lang.Object clone()
           
 void copyTo(Gradient g)
           
 int getKnot(int n)
           
 byte getKnotBlend(int n)
           
 int getKnotType(int n)
           
 int knotAt(int x)
           
 void mutate(float amount)
           
static Gradient randomGradient()
           
 void randomize()
           
 void rebuild()
           
 void removeKnot(int n)
           
 void setColor(int n, int color)
           
 void setKnot(int n, int color)
           
 void setKnotBlend(int n, int type)
           
 void setKnotPosition(int n, int x)
           
 void setKnots(int[] x, int[] rgb, byte[] types)
           
 void setKnots(int[] x, int[] y, byte[] types, int offset, int count)
           
 void setKnotType(int n, int type)
           
 void splitSpan(int n)
           
 
Methods inherited from class com.jhlabs.image.ArrayColormap
getColor, getMap, setColorInterpolated, setColorRange, setColorRange, setMap
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RGB

public static final int RGB
See Also:
Constant Field Values

HUE_CW

public static final int HUE_CW
See Also:
Constant Field Values

HUE_CCW

public static final int HUE_CCW
See Also:
Constant Field Values

LINEAR

public static final int LINEAR
See Also:
Constant Field Values

SPLINE

public static final int SPLINE
See Also:
Constant Field Values

CIRCLE_UP

public static final int CIRCLE_UP
See Also:
Constant Field Values

CIRCLE_DOWN

public static final int CIRCLE_DOWN
See Also:
Constant Field Values

CONSTANT

public static final int CONSTANT
See Also:
Constant Field Values

numKnots

public int numKnots

xKnots

public int[] xKnots

yKnots

public int[] yKnots

knotTypes

public byte[] knotTypes
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

clone

public java.lang.Object clone()
Overrides:
clone in class ArrayColormap

copyTo

public void copyTo(Gradient g)

setColor

public void setColor(int n,
                     int color)
Overrides:
setColor in class ArrayColormap

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()