org.jscience.media.pictures.filters
Class Gradient

java.lang.Object
  extended by org.jscience.media.pictures.filters.ArrayColormap
      extended by org.jscience.media.pictures.filters.Gradient
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Colormap

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
          DOCUMENT ME!
static int CIRCLE_UP
          DOCUMENT ME!
static int CONSTANT
          DOCUMENT ME!
static int HUE_CCW
          DOCUMENT ME!
static int HUE_CW
          DOCUMENT ME!
 byte[] knotTypes
          DOCUMENT ME!
static int LINEAR
          DOCUMENT ME!
 int numKnots
          DOCUMENT ME!
static int RGB
          DOCUMENT ME!
static int SPLINE
          DOCUMENT ME!
 int[] xKnots
          DOCUMENT ME!
 int[] yKnots
          DOCUMENT ME!
 
Fields inherited from class org.jscience.media.pictures.filters.ArrayColormap
map
 
Constructor Summary
Gradient()
          Creates a new Gradient object.
Gradient(int[] rgb)
          Creates a new Gradient object.
Gradient(int[] x, int[] rgb)
          Creates a new Gradient object.
Gradient(int[] x, int[] rgb, byte[] types)
          Creates a new Gradient object.
 
Method Summary
 void addKnot(int x, int color, int type)
          DOCUMENT ME!
 java.lang.Object clone()
          DOCUMENT ME!
 void copyTo(Gradient g)
          DOCUMENT ME!
 int getKnot(int n)
          DOCUMENT ME!
 byte getKnotBlend(int n)
          DOCUMENT ME!
 int getKnotType(int n)
          DOCUMENT ME!
 int knotAt(int x)
          DOCUMENT ME!
static Gradient randomGradient()
          DOCUMENT ME!
 void randomize()
          DOCUMENT ME!
 void rebuild()
          DOCUMENT ME!
 void removeKnot(int n)
          DOCUMENT ME!
 void setColor(int n, int color)
          DOCUMENT ME!
 void setKnot(int n, int color)
          DOCUMENT ME!
 void setKnotBlend(int n, int type)
          DOCUMENT ME!
 void setKnotPosition(int n, int x)
          DOCUMENT ME!
 void setKnots(int[] x, int[] rgb, byte[] types)
           
 void setKnots(int[] x, int[] y, byte[] types, int offset, int count)
          DOCUMENT ME!
 void setKnotType(int n, int type)
          DOCUMENT ME!
 void splitSpan(int n)
          DOCUMENT ME!
 
Methods inherited from class org.jscience.media.pictures.filters.ArrayColormap
getColor, getMap, setColorInterpolated, setColorRange, setColorRange, setMap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RGB

public static final int RGB
DOCUMENT ME!

See Also:
Constant Field Values

HUE_CW

public static final int HUE_CW
DOCUMENT ME!

See Also:
Constant Field Values

HUE_CCW

public static final int HUE_CCW
DOCUMENT ME!

See Also:
Constant Field Values

LINEAR

public static final int LINEAR
DOCUMENT ME!

See Also:
Constant Field Values

SPLINE

public static final int SPLINE
DOCUMENT ME!

See Also:
Constant Field Values

CIRCLE_UP

public static final int CIRCLE_UP
DOCUMENT ME!

See Also:
Constant Field Values

CIRCLE_DOWN

public static final int CIRCLE_DOWN
DOCUMENT ME!

See Also:
Constant Field Values

CONSTANT

public static final int CONSTANT
DOCUMENT ME!

See Also:
Constant Field Values

numKnots

public int numKnots
DOCUMENT ME!


xKnots

public int[] xKnots
DOCUMENT ME!


yKnots

public int[] yKnots
DOCUMENT ME!


knotTypes

public byte[] knotTypes
DOCUMENT ME!

Constructor Detail

Gradient

public Gradient()
Creates a new Gradient object.


Gradient

public Gradient(int[] rgb)
Creates a new Gradient object.

Parameters:
rgb - DOCUMENT ME!

Gradient

public Gradient(int[] x,
                int[] rgb)
Creates a new Gradient object.

Parameters:
x - DOCUMENT ME!
rgb - DOCUMENT ME!

Gradient

public Gradient(int[] x,
                int[] rgb,
                byte[] types)
Creates a new Gradient object.

Parameters:
x - DOCUMENT ME!
rgb - DOCUMENT ME!
types - DOCUMENT ME!
Method Detail

clone

public java.lang.Object clone()
DOCUMENT ME!

Overrides:
clone in class ArrayColormap
Returns:
DOCUMENT ME!

copyTo

public void copyTo(Gradient g)
DOCUMENT ME!

Parameters:
g - DOCUMENT ME!

setColor

public void setColor(int n,
                     int color)
DOCUMENT ME!

Overrides:
setColor in class ArrayColormap
Parameters:
n - DOCUMENT ME!
color - DOCUMENT ME!

getKnot

public int getKnot(int n)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!

setKnot

public void setKnot(int n,
                    int color)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!
color - DOCUMENT ME!

setKnotType

public void setKnotType(int n,
                        int type)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!
type - DOCUMENT ME!

getKnotType

public int getKnotType(int n)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!

setKnotBlend

public void setKnotBlend(int n,
                         int type)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!
type - DOCUMENT ME!

getKnotBlend

public byte getKnotBlend(int n)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!
Returns:
DOCUMENT ME!

addKnot

public void addKnot(int x,
                    int color,
                    int type)
DOCUMENT ME!

Parameters:
x - DOCUMENT ME!
color - DOCUMENT ME!
type - DOCUMENT ME!

removeKnot

public void removeKnot(int n)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!

setKnots

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

setKnots

public void setKnots(int[] x,
                     int[] y,
                     byte[] types,
                     int offset,
                     int count)
DOCUMENT ME!

Parameters:
x - DOCUMENT ME!
y - DOCUMENT ME!
types - DOCUMENT ME!
offset - DOCUMENT ME!
count - DOCUMENT ME!

splitSpan

public void splitSpan(int n)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!

setKnotPosition

public void setKnotPosition(int n,
                            int x)
DOCUMENT ME!

Parameters:
n - DOCUMENT ME!
x - DOCUMENT ME!

knotAt

public int knotAt(int x)
DOCUMENT ME!

Parameters:
x - DOCUMENT ME!
Returns:
DOCUMENT ME!

rebuild

public void rebuild()
DOCUMENT ME!


randomize

public void randomize()
DOCUMENT ME!


randomGradient

public static Gradient randomGradient()
DOCUMENT ME!

Returns:
DOCUMENT ME!