|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.jhlabs.image.ArrayColormap
com.jhlabs.image.Gradient
public class Gradient
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:
| Field Summary | |
|---|---|
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. |
| Fields inherited from class com.jhlabs.image.ArrayColormap |
|---|
map |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class com.jhlabs.image.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 |
|---|
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
| Constructor Detail |
|---|
public Gradient()
public Gradient(int[] rgb)
rgb - the colors
public Gradient(int[] x,
int[] rgb)
x - the knot positionsrgb - the colors
public Gradient(int[] x,
int[] rgb,
byte[] types)
x - the knot positionsrgb - the colorstypes - interpolation types| Method Detail |
|---|
public Object clone()
clone in class ArrayColormappublic void copyTo(Gradient g)
g - the Gradient to copy into
public void setColor(int n,
int color)
setColor in class ArrayColormapn - 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 index
setKnot(int, int)
public void setKnotType(int n,
int type)
n - the knot indextype - the typegetKnotType(int)public int getKnotType(int n)
n - the knot index
setKnotType(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 index
setKnotBlend(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 types
public 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 index
public void setKnotPosition(int n,
int x)
n - the knot indexx - the knot positionsetKnotPosition(int, int)public int getKnotPosition(int n)
n - the knot index
setKnotPosition(int, int)public int knotAt(int x)
x - the position
public void randomize()
public void mutate(float amount)
amount - the amount in the range zero to onepublic static Gradient randomGradient()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||