public class IlvValueGradientPaint extends Ilv3DPaint implements Paint, Serializable, IlvMultipleGradientPaintConstants
Paint
whose definition is based on
data values.
An IlvValueGradientPaint
can be specified as the stroke or fill
paint of an IlvStyle
, and thus be used with chart renderers.
The gradient is defined by values that act as key-frames with specific
colors.
The following code illustrates two examples:
double[] xVals = new double[] {0., 100.}; Color[] colors = new Color[] {Color.white, Color.red}; IlvValueGradientPaint grad1 = new IlvValueGradientPaint(chart, xVals, colors); double[] yVals = new double[] {0., 80., 80., 100.}; Color[] colors = new Color[] {Color.white, Color.white, Color.red, Color.red}; IlvValueGradientPaint grad2 = new IlvValueGradientPaint(chart, 0, yVals, colors);
grad1
defines a gradient along the X axis that will produce
the following colors:
x <= 0
,0 < x < 100
,x >= 100
.grad2
defines a gradient along the Y axis that will produce
the following colors:
y <= 80
,y > 80
.Limitation: These gradients can be used in 3D mode for bar, area, and pie charts, but not for line charts.
LinearARGBColorModel
BITMASK, OPAQUE, TRANSLUCENT
LINEAR_RGB, SPREAD_PAD, SPREAD_REFLECT, SPREAD_REPEAT, SRGB
Constructor and Description |
---|
IlvValueGradientPaint(IlvChart chart,
double[] xValues,
Color[] colors)
Creates a gradient based on the specified x-values.
|
IlvValueGradientPaint(IlvChart chart,
double[] xValues,
Color[] colors,
boolean clipValues)
Creates a gradient based on the specified x-values.
|
IlvValueGradientPaint(IlvChart chart,
double[] xValues,
Color[] colors,
short colorSpace,
boolean clipValues)
Creates a gradient based on the specified x-values.
|
IlvValueGradientPaint(IlvChart chart,
int yAxisIdx,
double[] yValues,
Color[] colors)
Creates a gradient based on the specified y-values.
|
IlvValueGradientPaint(IlvChart chart,
int yAxisIdx,
double[] yValues,
Color[] colors,
boolean clipValues)
Creates a gradient based on the specified y-values.
|
IlvValueGradientPaint(IlvChart chart,
int yAxisIdx,
double[] yValues,
Color[] colors,
short colorSpace,
boolean clipValues)
Creates a gradient based on the specified y-values.
|
Modifier and Type | Method and Description |
---|---|
PaintContext |
createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform transform,
RenderingHints hints)
Creates and returns a context used to generate the gradient.
|
Paint |
createPlaneRestrictedPaint(ilog.views.chart.view3d.Ilv3DTransform transform3D,
ilog.views.chart.view3d.Ilv3DVector planeNormal,
double planeConstant)
Creates and returns a
Paint that can be used to generate the color
pattern for a piece of the scene that lies on a given plane. |
void |
dispose()
Releases the resources allocated for this gradient.
|
IlvAxis |
getAxis()
Returns the axis along which this gradient is defined.
|
Color[] |
getColors()
Returns a copy of the array of colors used by this gradient.
|
int |
getPixelARGB(int xd,
int yd,
double xu,
double yu,
double zu,
double x3d,
double y3d,
double z3d)
Returns the color, as an ARGB-encoded integer, of the given pixel.
|
int |
getTransparency()
Returns the transparency mode for this
GradientPaint . |
double[] |
getValues()
Returns a copy of the array of values used by this gradient.
|
protected void |
setColors(Color[] colors)
Modifies the colors defining this gradient.
|
protected void |
setValues(double[] values)
Modifies the values defining this gradient.
|
protected void |
update()
Called when the gradient needs to be recomputed.
|
createContext
public IlvValueGradientPaint(IlvChart chart, int yAxisIdx, double[] yValues, Color[] colors)
chart
- The chart on which this gradient is based.yAxisIdx
- The index of the considered y-axis.yValues
- The y-values that will define the key-frames of the gradient.
This array must be sorted.colors
- The colors for the gradient.public IlvValueGradientPaint(IlvChart chart, int yAxisIdx, double[] yValues, Color[] colors, boolean clipValues)
chart
- The chart on which this gradient is based.yAxisIdx
- The index of the considered y-axis.yValues
- The y-values that will define the key-frames of the gradient.
This array must be sorted.colors
- The colors for the gradient.clipValues
- Whether the values should be clipped to the axis data range.public IlvValueGradientPaint(IlvChart chart, int yAxisIdx, double[] yValues, Color[] colors, short colorSpace, boolean clipValues)
chart
- The chart on which this gradient is based.yAxisIdx
- The index of the considered y-axis.yValues
- The y-values that will define the key-frames of the gradient.
This array must be sorted.colors
- The colors for the gradient.colorSpace
- The color space in which the color interpolation shall
occur. Either IlvMultipleGradientPaintConstants.SRGB
or
IlvMultipleGradientPaintConstants.LINEAR_RGB
.clipValues
- Whether the values should be clipped to the axis data range.public IlvValueGradientPaint(IlvChart chart, double[] xValues, Color[] colors)
chart
- The chart on which this gradient is based.xValues
- The x-values that will define the key-frames of the gradient.
This array must be sorted.colors
- The colors for the gradient.public IlvValueGradientPaint(IlvChart chart, double[] xValues, Color[] colors, boolean clipValues)
chart
- The chart on which this gradient is based.xValues
- The x-values that will define the key-frames of the gradient.
This array must be sorted.colors
- The colors for the gradient.clipValues
- Whether the values should be clipped to the axis data range.public IlvValueGradientPaint(IlvChart chart, double[] xValues, Color[] colors, short colorSpace, boolean clipValues)
chart
- The chart on which this gradient is based.xValues
- The x-values that will define the key-frames of the gradient.
This array must be sorted.colors
- The colors for the gradient.colorSpace
- The color space in which the color interpolation shall
occur. Either IlvMultipleGradientPaintConstants.SRGB
or
IlvMultipleGradientPaintConstants.LINEAR_RGB
.clipValues
- Whether the values should be clipped to the axis data range.public void dispose()
Note: This method must be called when the gradient is no more used by a chart.
public Color[] getColors()
protected void setColors(Color[] colors)
Note: This method should only be called from this object, because a
Paint
is conceptually an immutable object.
colors
- The colors for the gradient.public double[] getValues()
protected void setValues(double[] values)
Note: This method should only be called from this object, because a
Paint
is conceptually an immutable object.
values
- The values that will define the key-frames of the gradient.public final IlvAxis getAxis()
protected void update()
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints)
createContext
in interface Paint
public int getTransparency()
GradientPaint
.getTransparency
in interface Transparency
public int getPixelARGB(int xd, int yd, double xu, double yu, double zu, double x3d, double y3d, double z3d)
getPixelARGB
in class Ilv3DPaint
public Paint createPlaneRestrictedPaint(ilog.views.chart.view3d.Ilv3DTransform transform3D, ilog.views.chart.view3d.Ilv3DVector planeNormal, double planeConstant)
Paint
that can be used to generate the color
pattern for a piece of the scene that lies on a given plane.createPlaneRestrictedPaint
in class Ilv3DPaint
transform3D
- The 3D transformation of the view.planeNormal
- The normal vector of the given plane.planeConstant
- The constant part of the plane's equation.Paint
object that can be used for the points in the
given plane.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.