Class RelativeLinearGradientPaint
java.lang.Object
com.inductiveautomation.ignition.client.util.gui.paints.MultipleGradientPaint
com.inductiveautomation.ignition.client.util.gui.paints.RelativeLinearGradientPaint
- All Implemented Interfaces:
RelativePaint
,RotatablePaint
,Paint
,Transparency
public final class RelativeLinearGradientPaint
extends MultipleGradientPaint
implements RelativePaint, RotatablePaint
Similar to LinearGradientPaint, but this one specifies it's points as percentages of the user-space bounds of the
object it will fill.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.inductiveautomation.ignition.client.util.gui.paints.MultipleGradientPaint
MultipleGradientPaint.ColorSpaceType, MultipleGradientPaint.CycleMethod
-
Field Summary
Fields inherited from class com.inductiveautomation.ignition.client.util.gui.paints.MultipleGradientPaint
gradientTransform
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
-
Constructor Summary
ConstructorsConstructorDescriptionRelativeLinearGradientPaint
(Point2D start, Point2D end, float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod) Constructs aLinearGradientPaint
with a defaultSRGB
color space.RelativeLinearGradientPaint
(Point2D start, Point2D end, float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, AffineTransform gradientTransform) Constructs aLinearGradientPaint
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
beforePaint
(Rectangle2D shapeSize) createContext
(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints) Returns a copy of the end point of the gradient axis.Returns a copy of the start point of the gradient axis.void
rotatePaint
(double angle, Point2D anchor, Rectangle2D r1, Rectangle2D r2) Call to rotate this paint.Methods inherited from class com.inductiveautomation.ignition.client.util.gui.paints.MultipleGradientPaint
copyOf, copyOf, copyOf, getColors, getColorSpace, getCycleMethod, getFractions, getTransform, getTransparency
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.awt.Transparency
getTransparency
-
Constructor Details
-
RelativeLinearGradientPaint
public RelativeLinearGradientPaint(Point2D start, Point2D end, float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod) Constructs aLinearGradientPaint
with a defaultSRGB
color space.- Parameters:
start
- the gradient axis startPoint2D
in user spaceend
- the gradient axis endPoint2D
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
- eitherNO_CYCLE
,REFLECT
, orREPEAT
- Throws:
NullPointerException
- if one of the points is null, orfractions
array is null, orcolors
array is null, orcycleMethod
is nullIllegalArgumentException
- if start and end points are the same points, orfractions.length != colors.length
, orcolors
is less than 2 in size, or afractions
value is less than 0.0 or greater than 1.0, or thefractions
are not provided in strictly increasing order
-
RelativeLinearGradientPaint
public RelativeLinearGradientPaint(Point2D start, Point2D end, float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, AffineTransform gradientTransform) Constructs aLinearGradientPaint
.- Parameters:
start
- the gradient axis startPoint2D
in user spaceend
- the gradient axis endPoint2D
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
- eitherNO_CYCLE
,REFLECT
, orREPEAT
colorSpace
- which color space to use for interpolation, eitherSRGB
orLINEAR_RGB
gradientTransform
- transform to apply to the gradient- Throws:
NullPointerException
- if one of the points is null, orfractions
array is null, orcolors
array is null, orcycleMethod
is null, orcolorSpace
is null, orgradientTransform
is nullIllegalArgumentException
- if start and end points are the same points, orfractions.length != colors.length
, orcolors
is less than 2 in size, or afractions
value is less than 0.0 or greater than 1.0, or thefractions
are not provided in strictly increasing order
-
-
Method Details
-
beforePaint
- Specified by:
beforePaint
in interfaceRelativePaint
-
createContext
public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints) - Specified by:
createContext
in interfacePaint
-
rotatePaint
Description copied from interface:RotatablePaint
Call to rotate this paint.- Specified by:
rotatePaint
in interfaceRotatablePaint
r1
- The bounds of the shape before rotation.r2
- The bounds of the shape after rotation.
-
getStartPoint
Returns a copy of the start point of the gradient axis.- Returns:
- a
Point2D
object that is a copy of the point that anchors the first color of thisLinearGradientPaint
-
getEndPoint
Returns a copy of the end point of the gradient axis.- Returns:
- a
Point2D
object that is a copy of the point that anchors the last color of thisLinearGradientPaint
-