|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.java2d.IlvMultipleGradientPaint
ilog.views.java2d.IlvRadialGradientPaint
public class IlvRadialGradientPaint
This class defines a multiple radial color gradient paint that will be
used to fill Java 2 Shape objects.
You can, for example, set it on an IlvGeneralPath to fill
it.
The user must provide an array of floats in an increasing order specifying how to distribute the colors along the gradient. These values should range from 0.0 to 1.0 and act like keyframes along the gradient (they mark where the gradient should be exactly a particular color).
In the event that the user does not set the first keyframe value equal to 0 and the last keyframe value equal to 1, keyframes will be created at these positions, and the first and last colors will be replicated there.
This paint will map the first color of the gradient to a focal point within the circle and the last color to the perimeter of the circle, interpolating smoothly for any in-between colors specified by the user. Any line drawn from the focal point to the circumference will span all the gradient colors. By default, the focus is set to be the center of the circle.
Specifying a focal point outside of the circle's radius will result in the focus being set to the intersection point of the focus-center line and the perimeter of the circle.
The user may also select what action the IlvRadialGradientPaint
should take when filling color outside the start and end points. If no spread
method is specified, SPREAD_PAD will be chosen by default, so the endpoint
colors will be used to fill the remaining area.
Here is a sample drawing produced by a radial gradient:

Paint,
IlvMultipleGradientPaint| Field Summary |
|---|
| Fields inherited from class ilog.views.java2d.IlvMultipleGradientPaint |
|---|
LINEAR_RGB, SPREAD_PAD, SPREAD_REFLECT, SPREAD_REPEAT, SRGB |
| Fields inherited from interface java.awt.Transparency |
|---|
BITMASK, OPAQUE, TRANSLUCENT |
| Constructor Summary | |
|---|---|
IlvRadialGradientPaint(float cx,
float cy,
float radius,
float[] stops,
Color[] colors,
boolean adapt)
Builds a circular IlvRadialGradientPaint instance. |
|
IlvRadialGradientPaint(float cx,
float cy,
float radius,
float[] stops,
Color[] colors,
float fx,
float fy,
boolean adapt)
Builds a circular IlvRadialGradientPaint instance. |
|
IlvRadialGradientPaint(float cx,
float cy,
float radius,
float[] stops,
Color[] colors,
float fx,
float fy,
short spreadMethod,
boolean adapt)
Builds a circular IlvRadialGradientPaint instance. |
|
IlvRadialGradientPaint(float cx,
float cy,
float radius,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapt)
Builds a circular IlvRadialGradientPaint instance. |
|
IlvRadialGradientPaint(IlvInputStream stream)
Builds an IlvRadialGradientPaint from an
IlvInputStream. |
|
IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
boolean adapt)
Builds a circular IlvRadialGradientPaint instance. |
|
IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
Point2D focal,
boolean adapt)
Builds a circular IlvRadialGradientPaint instance. |
|
IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
Point2D focal,
short spreadMethod,
boolean adapt)
Builds a circular IlvRadialGradientPaint instance. |
|
IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
Point2D focal,
short spreadMethod,
short colorSpace,
AffineTransform transform,
boolean adapt)
Builds a circular IlvRadialGradientPaint instance. |
|
IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapt)
Builds a circular IlvRadialGradientPaint instance. |
|
| Method Summary | |
|---|---|
PaintContext |
createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform transform,
RenderingHints hints)
Creates and returns a context used to generate the gradient. |
Point2D |
getCenter()
Returns the gradient center. |
Point2D |
getFocal()
Returns the gradient focus. |
float |
getRadius()
Returns the gradient radius. |
void |
write(IlvOutputStream stream)
Writes the IlvRadialGradientPaint to an
IlvOutputStream. |
| Methods inherited from class ilog.views.java2d.IlvMultipleGradientPaint |
|---|
getColors, getColorSpace, getSpreadMethod, getStops, getTransform, getTransparency, isAdapting |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
boolean adapt)
IlvRadialGradientPaint instance.
center - The center of the circle.radius - The radius of the circle.stops - Array of stops of the gradient.colors - Array of colors of the gradient.adapt - true if the gradient should be adapted to the
shape on which it is drawn.
public IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapt)
IlvRadialGradientPaint instance.
center - The center of the circle.radius - The radius of the circle.stops - Array of stops of the gradient.colors - Array of colors of the gradient.spreadMethod - How to fill the remainder region.adapt - true if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaint.SPREAD_PAD,
IlvMultipleGradientPaint.SPREAD_REPEAT,
IlvMultipleGradientPaint.SPREAD_REFLECT
public IlvRadialGradientPaint(float cx,
float cy,
float radius,
float[] stops,
Color[] colors,
boolean adapt)
IlvRadialGradientPaint instance.
cx - The x coordinate of the circle center.cy - The y coordinate of the circle center.radius - The radius of the circle.stops - Array of stops of the gradient.colors - Array of colors of the gradient.adapt - true if the gradient should be adapted to the
shape on which it is drawn.
public IlvRadialGradientPaint(float cx,
float cy,
float radius,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapt)
IlvRadialGradientPaint instance.
cx - The x coordinate of the circle center.cy - The y coordinate of the circle center.radius - The radius of the circle.stops - Array of stops of the gradient.colors - Array of colors of the gradient.spreadMethod - How to fill the remainder region.adapt - true if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaint.SPREAD_PAD,
IlvMultipleGradientPaint.SPREAD_REPEAT,
IlvMultipleGradientPaint.SPREAD_REFLECT
public IlvRadialGradientPaint(float cx,
float cy,
float radius,
float[] stops,
Color[] colors,
float fx,
float fy,
boolean adapt)
IlvRadialGradientPaint instance.
cx - The x coordinate of the circle center.cy - The y coordinate of the circle center.radius - The radius of the circle.stops - Array of stops of the gradient.colors - Array of colors of the gradient.fx - The x coordinate of the focal point.fy - The y coordinate of the focal point.adapt - true if the gradient should be adapted to the
shape on which it is drawn.
public IlvRadialGradientPaint(float cx,
float cy,
float radius,
float[] stops,
Color[] colors,
float fx,
float fy,
short spreadMethod,
boolean adapt)
IlvRadialGradientPaint instance.
cx - The x coordinate of the circle center.cy - The y coordinate of the circle center.radius - The radius of the circle.stops - Array of stops of the gradient.colors - Array of colors of the gradient.fx - The x coordinate of the focal point.fy - The y coordinate of the focal point.spreadMethod - How to fill the remainder region.adapt - true if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaint.SPREAD_PAD,
IlvMultipleGradientPaint.SPREAD_REPEAT,
IlvMultipleGradientPaint.SPREAD_REFLECT
public IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
Point2D focal,
boolean adapt)
IlvRadialGradientPaint instance.
center - The center of the circle.radius - The radius of the circle.colors - Array of colors of the gradient.stops - Array of stops of the gradient.focal - The focal point.adapt - true if the gradient should be adapted to the
shape on which it is drawn.
public IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
Point2D focal,
short spreadMethod,
boolean adapt)
IlvRadialGradientPaint instance.
center - The center of the circle.radius - The radius of the circle.colors - Array of colors of the gradient.stops - Array of stops of the gradient.focal - The focal point.spreadMethod - How to fill the remainder region.adapt - true if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaint.SPREAD_PAD,
IlvMultipleGradientPaint.SPREAD_REPEAT,
IlvMultipleGradientPaint.SPREAD_REFLECT
public IlvRadialGradientPaint(Point2D center,
float radius,
float[] stops,
Color[] colors,
Point2D focal,
short spreadMethod,
short colorSpace,
AffineTransform transform,
boolean adapt)
IlvRadialGradientPaint instance.
center - The center of the circle.radius - The radius of the circle.colors - Array of colors of the gradient.stops - Array of stops of the gradient.focal - The focal point.spreadMethod - How to fill the remainder region.colorSpace - The color space where the color interpolation
should take place.transform - An additional transformer to apply when drawing
the gradient.adapt - true if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaint.SPREAD_PAD,
IlvMultipleGradientPaint.SPREAD_REPEAT,
IlvMultipleGradientPaint.SPREAD_REFLECT,
IlvMultipleGradientPaint.SRGB,
IlvMultipleGradientPaint.LINEAR_RGB
public IlvRadialGradientPaint(IlvInputStream stream)
throws IOException,
IlvReadFileException
IlvRadialGradientPaint from an
IlvInputStream.
stream - The input stream.
IOException
IlvReadFileException| Method Detail |
|---|
public PaintContext createContext(ColorModel cm,
Rectangle deviceBounds,
Rectangle2D userBounds,
AffineTransform transform,
RenderingHints hints)
createContext in interface Paintpublic Point2D getCenter()
public float getRadius()
public Point2D getFocal()
public void write(IlvOutputStream stream)
throws IOException
IlvRadialGradientPaint to an
IlvOutputStream.
write in interface IlvPersistentObjectwrite in class IlvMultipleGradientPaintstream - The output stream.
IOException - thrown when an exception occurs during
the write operation for this object.
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||