Package com.jhlabs.image
Class SplineColormap
java.lang.Object
com.jhlabs.image.ArrayColormap
com.jhlabs.image.SplineColormap
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.
-
Field Summary
Fields inherited from class com.jhlabs.image.ArrayColormap
map -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a SplineColormap.SplineColormap(int[] xKnots, int[] yKnots) Construct a SplineColormap. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddKnot(int x, int color) Add a new knot.intgetKnot(int n) Get a knot color.voidremoveKnot(int n) Remove a knot.voidsetKnot(int n, int color) Set a knot color.voidsetKnotPosition(int n, int x) Set a knot position.Methods inherited from class com.jhlabs.image.ArrayColormap
clone, getColor, getMap, setColor, setColorInterpolated, setColorRange, setColorRange, setMap
-
Constructor Details
-
SplineColormap
public SplineColormap()Construct a SplineColormap. -
SplineColormap
public SplineColormap(int[] xKnots, int[] yKnots) Construct a SplineColormap.- Parameters:
xKnots- the knot positionsyKnots- the knot colors
-
-
Method Details
-
setKnot
public void setKnot(int n, int color) Set a knot color.- Parameters:
n- the knot indexcolor- the color- See Also:
-
getKnot
public int getKnot(int n) Get a knot color.- Parameters:
n- the knot index- Returns:
- the knot color
- See Also:
-
addKnot
public void addKnot(int x, int color) Add a new knot.- Parameters:
x- the knot positioncolor- the color- See Also:
-
removeKnot
public void removeKnot(int n) Remove a knot.- Parameters:
n- the knot index- See Also:
-
setKnotPosition
public void setKnotPosition(int n, int x) Set a knot position.- Parameters:
n- the knot indexx- the knot position
-