public class IlvLinearGradientPaint 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.
The user may also select what action the IlvLinearGradientPaint
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.
Sample drawing produced by a linear gradient:
KEY_USER_BOUNDS
BITMASK, OPAQUE, TRANSLUCENT
LINEAR_RGB, SPREAD_PAD, SPREAD_REFLECT, SPREAD_REPEAT, SRGB
Constructor and Description |
---|
IlvLinearGradientPaint(double x1,
double y1,
double x2,
double y2,
float[] stops,
Color[] colors,
boolean adapting)
Builds an
IlvLinearGradientPaint . |
IlvLinearGradientPaint(double x1,
double y1,
double x2,
double y2,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapting)
Builds an
IlvLinearGradientPaint . |
IlvLinearGradientPaint(IlvLinearGradientPaint source)
Creates a linear gradient paint by copying an existing one.
|
IlvLinearGradientPaint(Point2D start,
Point2D end,
float[] stops,
Color[] colors,
boolean adapting)
Builds an
IlvLinearGradientPaint . |
IlvLinearGradientPaint(Point2D start,
Point2D end,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapting)
Builds an
IlvLinearGradientPaint . |
IlvLinearGradientPaint(Point2D start,
Point2D end,
float[] stops,
Color[] colors,
short spreadMethod,
short colorSpace,
AffineTransform transform,
boolean adapting)
Builds an
IlvLinearGradientPaint . |
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 |
getEnd()
Returns the end point for the gradient.
|
Point2D |
getStart()
Returns the start point for the gradient.
|
getColors, getColorSpace, getSpreadMethod, getStops, getTransform, getTransparency, initTransparency, isAdapting
public IlvLinearGradientPaint(double x1, double y1, double x2, double y2, float[] stops, Color[] colors, boolean adapting)
IlvLinearGradientPaint
.x1
- x coordinate of the gradient axis start point.y1
- y coordinate of the gradient axis start point.x2
- x coordinate of the gradient axis end point.y2
- y coordinate of the gradient axis end point.stops
- Array of stops on the gradient axis.colors
- Array of colors on the gradient axis.adapting
- true
if the gradient should be adapted to its
displaying area.public IlvLinearGradientPaint(double x1, double y1, double x2, double y2, float[] stops, Color[] colors, short spreadMethod, boolean adapting)
IlvLinearGradientPaint
.x1
- x coordinate of the gradient axis start point.y1
- y coordinate of the gradient axis start point.x2
- x coordinate of the gradient axis end point.y2
- y coordinate of the gradient axis end point.stops
- Array of stops on the gradient axis.colors
- Array of colors on the gradient axis.spreadMethod
- How to fill the remainder region.adapting
- true
if the gradient should be adapted to its
displaying area.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
public IlvLinearGradientPaint(Point2D start, Point2D end, float[] stops, Color[] colors, boolean adapting)
IlvLinearGradientPaint
.start
- Coordinates of the gradient axis start point.end
- Coordinates of the gradient axis end point.stops
- Array of stops on the gradient axis.colors
- Array of colors on the gradient axis.adapting
- true
if the gradient should be adapted to its
displaying area.public IlvLinearGradientPaint(Point2D start, Point2D end, float[] stops, Color[] colors, short spreadMethod, boolean adapting)
IlvLinearGradientPaint
.start
- Coordinates of the gradient axis start point.end
- Coordinates of the gradient axis end point.stops
- Array of stops on the gradient axis.colors
- Array of colors on the gradient axis.spreadMethod
- How to fill the remainder region.adapting
- true
if the gradient should be adapted to its
displaying area.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
public IlvLinearGradientPaint(Point2D start, Point2D end, float[] stops, Color[] colors, short spreadMethod, short colorSpace, AffineTransform transform, boolean adapting)
IlvLinearGradientPaint
.start
- Coordinates of the gradient axis start point.end
- Coordinates of the gradient axis end point.stops
- Array of stops on the gradient axis.colors
- Array of colors on the gradient axis.spreadMethod
- How to fill the remainder region.colorSpace
- The color space into 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 its
displaying area.IlvMultipleGradientPaintConstants.SPREAD_PAD
,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT
,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT
,
IlvMultipleGradientPaintConstants.SRGB
,
IlvMultipleGradientPaintConstants.LINEAR_RGB
public IlvLinearGradientPaint(IlvLinearGradientPaint source)
source
- The linear gradient paint to be copied.public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints)
public Point2D getStart()
public Point2D getEnd()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.