public class IlvRadialGradientPaint extends IlvRadialGradientPaint implements IlvPersistentObject
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
,
Serialized FormKEY_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 adapt)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(double cx,
double cy,
double radius,
float[] stops,
Color[] colors,
double fx,
double fy,
boolean adapt)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(double cx,
double cy,
double radius,
float[] stops,
Color[] colors,
double fx,
double fy,
short spreadMethod,
boolean adapt)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(double cx,
double cy,
double radius,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapt)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(IlvInputStream stream)
Builds an
IlvRadialGradientPaint from an
IlvInputStream . |
IlvRadialGradientPaint(IlvRadialGradientPaint source)
Creates a radial gradient paint by copying an existing one.
|
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
boolean adapt)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
Point2D focal,
boolean adapt)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
Point2D focal,
short spreadMethod,
boolean adapt)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
Point2D focal,
short spreadMethod,
short colorSpace,
AffineTransform transform,
boolean adapt)
Builds a circular
IlvRadialGradientPaint instance. |
IlvRadialGradientPaint(Point2D center,
double radius,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapt)
Builds a circular
IlvRadialGradientPaint instance. |
Modifier and Type | Method and Description |
---|---|
void |
write(IlvOutputStream stream)
Writes the
IlvRadialGradientPaint to an
IlvOutputStream . |
createContext, getCenter, getFocal, getRadius
getColors, getColorSpace, getSpreadMethod, getStops, getTransform, getTransparency, initTransparency, isAdapting
public IlvRadialGradientPaint(Point2D center, double 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, double 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.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
public IlvRadialGradientPaint(double cx, double cy, double 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(double cx, double cy, double 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.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 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(double cx, double cy, double radius, float[] stops, Color[] colors, double fx, double 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.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
public IlvRadialGradientPaint(Point2D center, double 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, double 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.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 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.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 IlvRadialGradientPaint(IlvInputStream stream) throws IOException, IlvReadFileException
IlvRadialGradientPaint
from an
IlvInputStream
.stream
- The input stream.IOException
IlvReadFileException
public void write(IlvOutputStream stream) throws IOException
IlvRadialGradientPaint
to an
IlvOutputStream
.write
in interface IlvPersistentObject
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.