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,java.awt.Paint,java.awt.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
-
-
Constructor Summary
Constructors Constructor Description RelativeLinearGradientPaint(java.awt.geom.Point2D start, java.awt.geom.Point2D end, float[] fractions, java.awt.Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod)Constructs aLinearGradientPaintwith a defaultSRGBcolor 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 aLinearGradientPaint.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforePaint(java.awt.geom.Rectangle2D shapeSize)java.awt.PaintContextcreateContext(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.Point2DgetEndPoint()Returns a copy of the end point of the gradient axis.java.awt.geom.Point2DgetStartPoint()Returns a copy of the start point of the gradient axis.voidrotatePaint(double angle, java.awt.geom.Point2D anchor, java.awt.geom.Rectangle2D r1, java.awt.geom.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
-
-
-
-
Constructor Detail
-
RelativeLinearGradientPaint
public RelativeLinearGradientPaint(java.awt.geom.Point2D start, java.awt.geom.Point2D end, float[] fractions, java.awt.Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod)Constructs aLinearGradientPaintwith a defaultSRGBcolor space.- Parameters:
start- the gradient axis startPoint2Din user spaceend- the gradient axis endPoint2Din 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:
java.lang.NullPointerException- if one of the points is null, orfractionsarray is null, orcolorsarray is null, orcycleMethodis nulljava.lang.IllegalArgumentException- if start and end points are the same points, orfractions.length != colors.length, orcolorsis less than 2 in size, or afractionsvalue is less than 0.0 or greater than 1.0, or thefractionsare not provided in strictly increasing order
-
RelativeLinearGradientPaint
public 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 aLinearGradientPaint.- Parameters:
start- the gradient axis startPoint2Din user spaceend- the gradient axis endPoint2Din 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, orREPEATcolorSpace- which color space to use for interpolation, eitherSRGBorLINEAR_RGBgradientTransform- transform to apply to the gradient- Throws:
java.lang.NullPointerException- if one of the points is null, orfractionsarray is null, orcolorsarray is null, orcycleMethodis null, orcolorSpaceis null, orgradientTransformis nulljava.lang.IllegalArgumentException- if start and end points are the same points, orfractions.length != colors.length, orcolorsis less than 2 in size, or afractionsvalue is less than 0.0 or greater than 1.0, or thefractionsare not provided in strictly increasing order
-
-
Method Detail
-
beforePaint
public void beforePaint(java.awt.geom.Rectangle2D shapeSize)
- Specified by:
beforePaintin interfaceRelativePaint
-
createContext
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)- Specified by:
createContextin interfacejava.awt.Paint
-
rotatePaint
public void rotatePaint(double angle, java.awt.geom.Point2D anchor, java.awt.geom.Rectangle2D r1, java.awt.geom.Rectangle2D r2)Description copied from interface:RotatablePaintCall to rotate this paint.- Specified by:
rotatePaintin interfaceRotatablePaintr1- The bounds of the shape before rotation.r2- The bounds of the shape after rotation.
-
getStartPoint
public java.awt.geom.Point2D getStartPoint()
Returns a copy of the start point of the gradient axis.- Returns:
- a
Point2Dobject that is a copy of the point that anchors the first color of thisLinearGradientPaint
-
getEndPoint
public java.awt.geom.Point2D getEndPoint()
Returns a copy of the end point of the gradient axis.- Returns:
- a
Point2Dobject that is a copy of the point that anchors the last color of thisLinearGradientPaint
-
-