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:
KEY_USER_BOUNDS
BITMASK, OPAQUE, TRANSLUCENT
LINEAR_RGB, SPREAD_PAD, SPREAD_REFLECT, SPREAD_REPEAT, SRGB
Constructor and Description |
---|
IlvRadialGradientPaint(double cx,
double cy,
double radius,
float[] stops,
Color[] colors,
boolean adapting)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(double cx,
double cy,
double radius,
float[] stops,
Color[] colors,
double fx,
double fy,
boolean adapting)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(double cx,
double cy,
double radius,
float[] stops,
Color[] colors,
double fx,
double fy,
short spreadMethod,
boolean adapting)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(double cx,
double cy,
double radius,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapting)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(IlvRadialGradientPaint source)
Creates a radial gradient paint by copying an existing one.
|
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
boolean adapting)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
Point2D focal,
boolean adapting)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
Point2D focal,
short spreadMethod,
boolean adapting)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
Point2D focal,
short spreadMethod,
short colorSpace,
AffineTransform transform,
boolean adapting)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapting)
Builds a circular
IlvRadialGradientPaint instance. |
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.
|
Point2D |
getCenter()
Returns the gradient center.
|
Point2D |
getFocal()
Returns the gradient focus.
|
double |
getRadius()
Returns the gradient radius.
|
getColors, getColorSpace, getSpreadMethod, getStops, getTransform, getTransparency, initTransparency, isAdapting
public IlvRadialGradientPaint(Point2D center, double radius, float[] stops, Color[] colors, boolean adapting)
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.adapting
- true
if the gradient should be adapted to the
shape on which it is drawn.public IlvRadialGradientPaint(Point2D center, double radius, float[] stops, Color[] colors, short spreadMethod, boolean adapting)
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.adapting
- true
if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
public IlvRadialGradientPaint(double cx, double cy, double radius, float[] stops, Color[] colors, boolean adapting)
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.adapting
- true
if the gradient should be adapted to the
shape on which it is drawn.public IlvRadialGradientPaint(double cx, double cy, double radius, float[] stops, Color[] colors, short spreadMethod, boolean adapting)
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.adapting
- true
if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
public IlvRadialGradientPaint(double cx, double cy, double radius, float[] stops, Color[] colors, double fx, double fy, boolean adapting)
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.adapting
- true
if the gradient should be adapted to the
shape on which it is drawn.public IlvRadialGradientPaint(double cx, double cy, double radius, float[] stops, Color[] colors, double fx, double fy, short spreadMethod, boolean adapting)
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.adapting
- true
if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
public IlvRadialGradientPaint(Point2D center, double radius, float[] stops, Color[] colors, Point2D focal, boolean adapting)
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.adapting
- true
if the gradient should be adapted to the
shape on which it is drawn.public IlvRadialGradientPaint(Point2D center, double radius, float[] stops, Color[] colors, Point2D focal, short spreadMethod, boolean adapting)
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.adapting
- true
if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
public IlvRadialGradientPaint(Point2D center, double radius, float[] stops, Color[] colors, Point2D focal, short spreadMethod, short colorSpace, AffineTransform transform, boolean adapting)
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.adapting
- true
if the gradient should be adapted to the
shape on which it is drawn.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
,
IlvMultipleGradientPaintConstants.SRGB
,
IlvMultipleGradientPaintConstants.LINEAR_RGB
public IlvRadialGradientPaint(IlvRadialGradientPaint source)
source
- The radial gradient paint to be copied.public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints)
public Point2D getCenter()
public double getRadius()
public Point2D getFocal()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.