public class IlvLinearGradientPaint extends IlvLinearGradientPaint 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.
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:

Paint,
Serialized FormKEY_USER_BOUNDSBITMASK, OPAQUE, TRANSLUCENTLINEAR_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 adapt)
Builds an
IlvLinearGradientPaint. |
IlvLinearGradientPaint(double x1,
double y1,
double x2,
double y2,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapt)
Builds an
IlvLinearGradientPaint. |
IlvLinearGradientPaint(IlvInputStream stream)
Builds an
IlvLinearGradientPaint from an
IlvInputStream. |
IlvLinearGradientPaint(IlvLinearGradientPaint source)
Creates a linear gradient paint by copying an existing one.
|
IlvLinearGradientPaint(Point2D start,
Point2D end,
float[] stops,
Color[] colors,
boolean adapt)
Builds an
IlvLinearGradientPaint. |
IlvLinearGradientPaint(Point2D start,
Point2D end,
float[] stops,
Color[] colors,
short spreadMethod,
boolean adapt)
Builds an
IlvLinearGradientPaint. |
IlvLinearGradientPaint(Point2D start,
Point2D end,
float[] stops,
Color[] colors,
short spreadMethod,
short colorSpace,
AffineTransform transform,
boolean adapt)
Builds an
IlvLinearGradientPaint. |
| Modifier and Type | Method and Description |
|---|---|
void |
write(IlvOutputStream stream)
Writes the
IlvLinearGradientPaint to an
IlvOutputStream. |
createContext, getEnd, getStartgetColors, getColorSpace, getSpreadMethod, getStops, getTransform, getTransparency, initTransparency, isAdaptingpublic IlvLinearGradientPaint(double x1,
double y1,
double x2,
double y2,
float[] stops,
Color[] colors,
boolean adapt)
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.adapt - 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 adapt)
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.adapt - true if the gradient should be adapted to its
displaying area.IlvMultipleGradientPaintConstants.SPREAD_PAD,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT,
IlvMultipleGradientPaintConstants.SPREAD_REFLECTpublic IlvLinearGradientPaint(Point2D start, Point2D end, float[] stops, Color[] colors, boolean adapt)
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.adapt - true if the gradient should be adapted to its
displaying area.public IlvLinearGradientPaint(Point2D start, Point2D end, float[] stops, Color[] colors, short spreadMethod, boolean adapt)
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.adapt - true if the gradient should be adapted to its
displaying area.IlvMultipleGradientPaintConstants.SPREAD_PAD,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT,
IlvMultipleGradientPaintConstants.SPREAD_REFLECTpublic IlvLinearGradientPaint(Point2D start, Point2D end, float[] stops, Color[] colors, short spreadMethod, short colorSpace, AffineTransform transform, boolean adapt)
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.adapt - true if the gradient should be adapted to its
displaying area.IlvMultipleGradientPaintConstants.SPREAD_PAD,
IlvMultipleGradientPaintConstants.SPREAD_REPEAT,
IlvMultipleGradientPaintConstants.SPREAD_REFLECT,
IlvMultipleGradientPaintConstants.SRGB,
IlvMultipleGradientPaintConstants.LINEAR_RGBpublic IlvLinearGradientPaint(IlvLinearGradientPaint source)
source - The linear gradient paint to be copied.public IlvLinearGradientPaint(IlvInputStream stream) throws IOException, IlvReadFileException
IlvLinearGradientPaint from an
IlvInputStream.IOExceptionIlvReadFileExceptionpublic void write(IlvOutputStream stream) throws IOException
IlvLinearGradientPaint to an
IlvOutputStream.write in interface IlvPersistentObjectstream - the output streamIOException - thrown when an exception occurs during
the write operation for this object.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.