public final class RelativeLinearGradientPaint extends MultipleGradientPaint implements RelativePaint, RotatablePaint
MultipleGradientPaint.ColorSpaceType, MultipleGradientPaint.CycleMethod
gradientTransform
Constructor and Description |
---|
RelativeLinearGradientPaint(java.awt.geom.Point2D start,
java.awt.geom.Point2D end,
float[] fractions,
java.awt.Color[] colors,
MultipleGradientPaint.CycleMethod cycleMethod)
Constructs a
LinearGradientPaint with a default SRGB color space. |
RelativeLinearGradientPaint(java.awt.geom.Point2D start,
java.awt.geom.Point2D end,
float[] fractions,
java.awt.Color[] colors,
MultipleGradientPaint.CycleMethod cycleMethod,
MultipleGradientPaint.ColorSpaceType colorSpace,
java.awt.geom.AffineTransform gradientTransform)
Constructs a
LinearGradientPaint . |
Modifier and Type | Method and Description |
---|---|
void |
beforePaint(java.awt.geom.Rectangle2D shapeSize) |
java.awt.PaintContext |
createContext(java.awt.image.ColorModel cm,
java.awt.Rectangle deviceBounds,
java.awt.geom.Rectangle2D userBounds,
java.awt.geom.AffineTransform transform,
java.awt.RenderingHints hints) |
java.awt.geom.Point2D |
getEndPoint()
Returns a copy of the end point of the gradient axis.
|
java.awt.geom.Point2D |
getStartPoint()
Returns a copy of the start point of the gradient axis.
|
void |
rotatePaint(double angle,
java.awt.geom.Point2D anchor,
java.awt.geom.Rectangle2D r1,
java.awt.geom.Rectangle2D r2)
Call to rotate this paint.
|
copyOf, copyOf, copyOf, getColors, getColorSpace, getCycleMethod, getFractions, getTransform, getTransparency
public RelativeLinearGradientPaint(java.awt.geom.Point2D start, java.awt.geom.Point2D end, float[] fractions, java.awt.Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod)
LinearGradientPaint
with a default SRGB
color space.start
- the gradient axis start Point2D
in user spaceend
- the gradient axis end Point2D
in user spacefractions
- numbers ranging from 0.0 to 1.0 specifying the
distribution of colors along the gradientcolors
- array of colors corresponding to each fractional valuecycleMethod
- either NO_CYCLE
, REFLECT
,
or REPEAT
java.lang.NullPointerException
- if one of the points is null,
or fractions
array is null,
or colors
array is null,
or cycleMethod
is nulljava.lang.IllegalArgumentException
- if start and end points are the same points,
or fractions.length != colors.length
,
or colors
is less than 2 in size,
or a fractions
value is less than 0.0 or greater than 1.0,
or the fractions
are not provided in strictly increasing orderpublic RelativeLinearGradientPaint(java.awt.geom.Point2D start, java.awt.geom.Point2D end, float[] fractions, java.awt.Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, java.awt.geom.AffineTransform gradientTransform)
LinearGradientPaint
.start
- the gradient axis start Point2D
in user spaceend
- the gradient axis end Point2D
in user spacefractions
- numbers ranging from 0.0 to 1.0 specifying the
distribution of colors along the gradientcolors
- array of colors corresponding to each fractional valuecycleMethod
- either NO_CYCLE
, REFLECT
,
or REPEAT
colorSpace
- which color space to use for interpolation,
either SRGB
or LINEAR_RGB
gradientTransform
- transform to apply to the gradientjava.lang.NullPointerException
- if one of the points is null,
or fractions
array is null,
or colors
array is null,
or cycleMethod
is null,
or colorSpace
is null,
or gradientTransform
is nulljava.lang.IllegalArgumentException
- if start and end points are the same points,
or fractions.length != colors.length
,
or colors
is less than 2 in size,
or a fractions
value is less than 0.0 or greater than 1.0,
or the fractions
are not provided in strictly increasing orderpublic void beforePaint(java.awt.geom.Rectangle2D shapeSize)
beforePaint
in interface RelativePaint
public java.awt.PaintContext createContext(java.awt.image.ColorModel cm, java.awt.Rectangle deviceBounds, java.awt.geom.Rectangle2D userBounds, java.awt.geom.AffineTransform transform, java.awt.RenderingHints hints)
createContext
in interface java.awt.Paint
public void rotatePaint(double angle, java.awt.geom.Point2D anchor, java.awt.geom.Rectangle2D r1, java.awt.geom.Rectangle2D r2)
RotatablePaint
rotatePaint
in interface RotatablePaint
r1
- The bounds of the shape before rotation.r2
- The bounds of the shape after rotation.public java.awt.geom.Point2D getStartPoint()
Point2D
object that is a copy of the point
that anchors the first color of this LinearGradientPaint
public java.awt.geom.Point2D getEndPoint()
Point2D
object that is a copy of the point
that anchors the last color of this LinearGradientPaint