public class Gradient extends ArrayColormap implements Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
CIRCLE_DOWN
Interpolate with a falling circle shape curve.
|
static int |
CIRCLE_UP
Interpolate with a rising circle shape curve.
|
static int |
CONSTANT
Don't tnterpolate - just use the starting value.
|
static int |
HUE_CCW
Interpolate hue counter clockwise.
|
static int |
HUE_CW
Interpolate hue clockwise.
|
static int |
LINEAR
Interpolate linearly.
|
static int |
RGB
Interpolate in RGB space.
|
static int |
SPLINE
Interpolate using a spline.
|
map
Constructor and Description |
---|
Gradient()
Construct a Gradient.
|
Gradient(int[] rgb)
Construct a Gradient with the given colors.
|
Gradient(int[] x,
int[] rgb)
Construct a Gradient with the given colors and knot positions.
|
Gradient(int[] x,
int[] rgb,
byte[] types)
Construct a Gradient with the given colors, knot positions and interpolation types.
|
Modifier and Type | Method and Description |
---|---|
void |
addKnot(int x,
int color,
int type)
Add a new knot.
|
Object |
clone() |
void |
copyTo(Gradient g)
Copy one Gradient into another.
|
int |
getKnot(int n)
Get a knot color.
|
byte |
getKnotBlend(int n)
Get a knot blend type.
|
int |
getKnotPosition(int n)
Get a knot position.
|
int |
getKnotType(int n)
Get a knot type.
|
int |
getNumKnots()
Get the number of knots in the gradient.
|
int |
knotAt(int x)
Return the knot at a given position.
|
void |
mutate(float amount)
Mutate the gradient.
|
static Gradient |
randomGradient()
Build a random gradient.
|
void |
randomize()
Randomize the gradient.
|
void |
removeKnot(int n)
Remove a knot.
|
void |
setColor(int n,
int color)
Set a knot color.
|
void |
setKnot(int n,
int color)
Set a knot color.
|
void |
setKnotBlend(int n,
int type)
Set a knot blend type.
|
void |
setKnotPosition(int n,
int x)
Set a knot position.
|
void |
setKnots(int[] x,
int[] rgb,
byte[] types)
Set the values of all the knots.
|
void |
setKnots(int[] x,
int[] y,
byte[] types,
int offset,
int count)
Set the values of a set of knots.
|
void |
setKnotType(int n,
int type)
Set a knot type.
|
void |
splitSpan(int n)
Split a span into two by adding a knot in the middle.
|
getColor, getMap, setColorInterpolated, setColorRange, setColorRange, setMap
public static final int RGB
public static final int HUE_CW
public static final int HUE_CCW
public static final int LINEAR
public static final int SPLINE
public static final int CIRCLE_UP
public static final int CIRCLE_DOWN
public static final int CONSTANT
public Gradient()
public Gradient(int[] rgb)
rgb
- the colorspublic Gradient(int[] x, int[] rgb)
x
- the knot positionsrgb
- the colorspublic Gradient(int[] x, int[] rgb, byte[] types)
x
- the knot positionsrgb
- the colorstypes
- interpolation typespublic Object clone()
clone
in class ArrayColormap
public void copyTo(Gradient g)
g
- the Gradient to copy intopublic void setColor(int n, int color)
setColor
in class ArrayColormap
n
- the knot indexcolor
- the colorArrayColormap.getColor(float)
public int getNumKnots()
public void setKnot(int n, int color)
n
- the knot indexcolor
- the colorgetKnot(int)
public int getKnot(int n)
n
- the knot indexsetKnot(int, int)
public void setKnotType(int n, int type)
n
- the knot indextype
- the typegetKnotType(int)
public int getKnotType(int n)
n
- the knot indexsetKnotType(int, int)
public void setKnotBlend(int n, int type)
n
- the knot indextype
- the knot blend typegetKnotBlend(int)
public byte getKnotBlend(int n)
n
- the knot indexsetKnotBlend(int, int)
public void addKnot(int x, int color, int type)
x
- the knot positioncolor
- the colortype
- the knot typeremoveKnot(int)
public void removeKnot(int n)
n
- the knot indexaddKnot(int, int, int)
public void setKnots(int[] x, int[] rgb, byte[] types)
x
- the knot positionsrgb
- the knot colorstypes
- the knot typespublic void setKnots(int[] x, int[] y, byte[] types, int offset, int count)
x
- the knot positionsy
- the knot colorstypes
- the knot typesoffset
- the first knot to setcount
- the number of knotspublic void splitSpan(int n)
n
- the span indexpublic void setKnotPosition(int n, int x)
n
- the knot indexx
- the knot positionsetKnotPosition(int, int)
public int getKnotPosition(int n)
n
- the knot indexsetKnotPosition(int, int)
public int knotAt(int x)
x
- the positionpublic void randomize()
public void mutate(float amount)
amount
- the amount in the range zero to onepublic static Gradient randomGradient()
Copyright © 2012-2013 Bambi Software Foundation. All Rights Reserved.