public class IlvRadialGradientPaint extends IlvMultipleGradientPaint
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:
ilvRadialGradientPaint {
class : "ilog.views.util.java2d.IlvRadialGradientPaint(center,radius,stops,colors,focal,spreadMethod,colorSpace,transform,adapting)";
adapting : "false";
center : "@#rectangle2D";
colors[0] : "green";
colors[1] : "red";
colorSpace : "SRGB";
focal : "@#rectangle2D";
radius : "3.0";
spreadMethod : "PAD";
stops[0] : "2.0";
stops[1] : "2.0";
transparency : "OPAQUE";
}
Modifier and Type | Property and Description |
---|---|
boolean |
adapting
Sets true if the gradient is adapting itself on
the shape it is drawn. |
java.awt.geom.Point2D |
center
Sets the gradient center. |
java.lang.String |
class
Builds a circular IlvRadialGradientPaint instance. |
java.awt.Color[] |
colors
Sets a copy of the array of colors used by this gradient. |
short |
colorSpace
Sets the interpolation color space of this gradient. |
java.awt.geom.Point2D |
focal
Sets the gradient focus. |
double |
radius
Sets the gradient radius. |
short |
spreadMethod
Sets the spread method of the gradient. |
float[] |
stops
Sets a copy of the array of floats used by this gradient to calculate color distribution. |
int |
transparency
Sets the transparency mode for this gradient. |
public java.lang.String class
IlvRadialGradientPaint
instance.
class : "ilog.views.util.java2d.IlvRadialGradientPaint(center,radius,stops,colors,focal,spreadMethod,colorSpace,transform,adapting)";
public boolean adapting
true
if the gradient is adapting itself on
the shape it is drawn.
adapting : "false";
public java.awt.geom.Point2D center
center : "@#rectangle2D";
Rectangle2D
for an example of implementing a center.public java.awt.Color[] colors
colors[0] : "green";
colors[1] : "red";
public short colorSpace
colorSpace : "SRGB";
Allowed values: | ||
SRGB |
Indicates that the color interpolation should occur in sRGB space. (default) | |
LINEAR_RGB |
Indicates that the color interpolation should occur in linearized RGB space. |
public java.awt.geom.Point2D focal
focal : "@#rectangle2D";
Rectangle2D
for an example of implementing a focal.public double radius
radius : "3.0";
public short spreadMethod
spreadMethod : "PAD";
Allowed values: | ||
PAD |
Indicates that if the gradient starts or ends inside the target region, the remainder region is filled with the terminal color of the gradient. | |
REFLECT |
Indicates that if the gradient starts or ends inside the target region, the gradient is reflected continuously until the remainder region is filled. | |
REPEAT |
Indicates that if the gradient starts or ends inside the target region, the gradient is repeated continuously until the remainder region is filled. |
public float[] stops
stops[0] : "2.0";
stops[1] : "2.0";
public int transparency
transparency : "OPAQUE";
Allowed values: | ||
OPAQUE |
Represents image data that is guaranteed to be completely opaque, meaning that all pixels have an alpha value of 1.0. | |
BITMASK |
Represents image data that is guaranteed to be either completely opaque, with an alpha value of 1.0, or completely transparent, with an alpha value of 0.0. | |
TRANSLUCENT |
Represents image data that contains or might contain arbitrary alpha values between and including 0.0 and 1.0. |
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.