类 Gradient
- java.lang.Object
-
- org.meteoinfo.image.filter.ArrayColormap
-
- org.meteoinfo.image.filter.Gradient
-
- 所有已实现的接口:
java.lang.Cloneable,Colormap
public class Gradient extends ArrayColormap implements java.lang.Cloneable
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:- LINEAR - linear interpolation to next knot
- SPLINE - spline interpolation to next knot
- CONSTANT - no interpolation - the colour is constant to the next knot
- HUE_CW - interpolation of hue clockwise to next knot
- HUE_CCW - interpolation of hue counter-clockwise to next knot
-
-
字段概要
字段 修饰符和类型 字段 说明 static intCIRCLE_DOWNInterpolate with a falling circle shape curve.static intCIRCLE_UPInterpolate with a rising circle shape curve.static intCONSTANTDon't tnterpolate - just use the starting value.static intHUE_CCWInterpolate hue counter clockwise.static intHUE_CWInterpolate hue clockwise.static intLINEARInterpolate linearly.static intRGBInterpolate in RGB space.static intSPLINEInterpolate using a spline.-
从类继承的字段 org.meteoinfo.image.filter.ArrayColormap
map
-
-
构造器概要
构造器 构造器 说明 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.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 voidaddKnot(int x, int color, int type)Add a new knot.java.lang.Objectclone()voidcopyTo(Gradient g)Copy one Gradient into another.intgetKnot(int n)Get a knot color.bytegetKnotBlend(int n)Get a knot blend type.intgetKnotPosition(int n)Get a knot position.intgetKnotType(int n)Get a knot type.intgetNumKnots()Get the number of knots in the gradient.intknotAt(int x)Return the knot at a given position.voidmutate(float amount)Mutate the gradient.static GradientrandomGradient()Build a random gradient.voidrandomize()Randomize the gradient.voidremoveKnot(int n)Remove a knot.voidsetColor(int n, int color)Set a knot color.voidsetKnot(int n, int color)Set a knot color.voidsetKnotBlend(int n, int type)Set a knot blend type.voidsetKnotPosition(int n, int x)Set a knot position.voidsetKnots(int[] x, int[] rgb, byte[] types)Set the values of all the knots.voidsetKnots(int[] x, int[] y, byte[] types, int offset, int count)Set the values of a set of knots.voidsetKnotType(int n, int type)Set a knot type.voidsplitSpan(int n)Split a span into two by adding a knot in the middle.-
从类继承的方法 org.meteoinfo.image.filter.ArrayColormap
getColor, getMap, setColorInterpolated, setColorRange, setColorRange, setMap
-
-
-
-
字段详细资料
-
RGB
public static final int RGB
Interpolate in RGB space.- 另请参阅:
- 常量字段值
-
HUE_CW
public static final int HUE_CW
Interpolate hue clockwise.- 另请参阅:
- 常量字段值
-
HUE_CCW
public static final int HUE_CCW
Interpolate hue counter clockwise.- 另请参阅:
- 常量字段值
-
LINEAR
public static final int LINEAR
Interpolate linearly.- 另请参阅:
- 常量字段值
-
SPLINE
public static final int SPLINE
Interpolate using a spline.- 另请参阅:
- 常量字段值
-
CIRCLE_UP
public static final int CIRCLE_UP
Interpolate with a rising circle shape curve.- 另请参阅:
- 常量字段值
-
CIRCLE_DOWN
public static final int CIRCLE_DOWN
Interpolate with a falling circle shape curve.- 另请参阅:
- 常量字段值
-
CONSTANT
public static final int CONSTANT
Don't tnterpolate - just use the starting value.- 另请参阅:
- 常量字段值
-
-
构造器详细资料
-
Gradient
public Gradient()
Construct a Gradient.
-
Gradient
public Gradient(int[] rgb)
Construct a Gradient with the given colors.- 参数:
rgb- the colors
-
Gradient
public Gradient(int[] x, int[] rgb)Construct a Gradient with the given colors and knot positions.- 参数:
x- the knot positionsrgb- the colors
-
Gradient
public Gradient(int[] x, int[] rgb, byte[] types)Construct a Gradient with the given colors, knot positions and interpolation types.- 参数:
x- the knot positionsrgb- the colorstypes- interpolation types
-
-
方法详细资料
-
clone
public java.lang.Object clone()
- 覆盖:
clone在类中ArrayColormap
-
copyTo
public void copyTo(Gradient g)
Copy one Gradient into another.- 参数:
g- the Gradient to copy into
-
setColor
public void setColor(int n, int color)Set a knot color.- 覆盖:
setColor在类中ArrayColormap- 参数:
n- the knot indexcolor- the color- 另请参阅:
ArrayColormap.getColor(float)
-
getNumKnots
public int getNumKnots()
Get the number of knots in the gradient.- 返回:
- the number of knots.
-
setKnot
public void setKnot(int n, int color)Set a knot color.- 参数:
n- the knot indexcolor- the color- 另请参阅:
getKnot(int)
-
getKnot
public int getKnot(int n)
Get a knot color.- 参数:
n- the knot index- 返回:
- the knot color
- 另请参阅:
setKnot(int, int)
-
setKnotType
public void setKnotType(int n, int type)Set a knot type.- 参数:
n- the knot indextype- the type- 另请参阅:
getKnotType(int)
-
getKnotType
public int getKnotType(int n)
Get a knot type.- 参数:
n- the knot index- 返回:
- the knot type
- 另请参阅:
setKnotType(int, int)
-
setKnotBlend
public void setKnotBlend(int n, int type)Set a knot blend type.- 参数:
n- the knot indextype- the knot blend type- 另请参阅:
getKnotBlend(int)
-
getKnotBlend
public byte getKnotBlend(int n)
Get a knot blend type.- 参数:
n- the knot index- 返回:
- the knot blend type
- 另请参阅:
setKnotBlend(int, int)
-
addKnot
public void addKnot(int x, int color, int type)Add a new knot.- 参数:
x- the knot positioncolor- the colortype- the knot type- 另请参阅:
removeKnot(int)
-
removeKnot
public void removeKnot(int n)
Remove a knot.- 参数:
n- the knot index- 另请参阅:
addKnot(int, int, int)
-
setKnots
public void setKnots(int[] x, int[] rgb, byte[] types)Set the values of all the knots. This version does not require the "extra" knots at -1 and 256- 参数:
x- the knot positionsrgb- the knot colorstypes- the knot types
-
setKnots
public void setKnots(int[] x, int[] y, byte[] types, int offset, int count)Set the values of a set of knots.- 参数:
x- the knot positionsy- the knot colorstypes- the knot typesoffset- the first knot to setcount- the number of knots
-
splitSpan
public void splitSpan(int n)
Split a span into two by adding a knot in the middle.- 参数:
n- the span index
-
setKnotPosition
public void setKnotPosition(int n, int x)Set a knot position.- 参数:
n- the knot indexx- the knot position- 另请参阅:
setKnotPosition(int, int)
-
getKnotPosition
public int getKnotPosition(int n)
Get a knot position.- 参数:
n- the knot index- 返回:
- the knot position
- 另请参阅:
setKnotPosition(int, int)
-
knotAt
public int knotAt(int x)
Return the knot at a given position.- 参数:
x- the position- 返回:
- the knot number, or 1 if no knot found
-
randomize
public void randomize()
Randomize the gradient.
-
mutate
public void mutate(float amount)
Mutate the gradient.- 参数:
amount- the amount in the range zero to one
-
randomGradient
public static Gradient randomGradient()
Build a random gradient.- 返回:
- the new Gradient
-
-