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.
  • Constructor Details

    • RelativeLinearGradientPaint

      public RelativeLinearGradientPaint(Point2D start, Point2D end, float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod)
      Constructs a LinearGradientPaint with a default SRGB color space.
      Parameters:
      start - the gradient axis start Point2D in user space
      end - the gradient axis end Point2D in user space
      fractions - numbers ranging from 0.0 to 1.0 specifying the distribution of colors along the gradient
      colors - array of colors corresponding to each fractional value
      cycleMethod - either NO_CYCLE, REFLECT, or REPEAT
      Throws:
      NullPointerException - if one of the points is null, or fractions array is null, or colors array is null, or cycleMethod is null
      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 order
    • RelativeLinearGradientPaint

      public RelativeLinearGradientPaint(Point2D start, Point2D end, float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethod cycleMethod, MultipleGradientPaint.ColorSpaceType colorSpace, AffineTransform gradientTransform)
      Constructs a LinearGradientPaint.
      Parameters:
      start - the gradient axis start Point2D in user space
      end - the gradient axis end Point2D in user space
      fractions - numbers ranging from 0.0 to 1.0 specifying the distribution of colors along the gradient
      colors - array of colors corresponding to each fractional value
      cycleMethod - 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 gradient
      Throws:
      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 null
      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 order
  • Method Details

    • beforePaint

      public void beforePaint(Rectangle2D shapeSize)
      Specified by:
      beforePaint in interface RelativePaint
    • createContext

      public PaintContext createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform transform, RenderingHints hints)
      Specified by:
      createContext in interface Paint
    • rotatePaint

      public void rotatePaint(double angle, Point2D anchor, Rectangle2D r1, Rectangle2D r2)
      Description copied from interface: RotatablePaint
      Call to rotate this paint.
      Specified by:
      rotatePaint in interface RotatablePaint
      r1 - The bounds of the shape before rotation.
      r2 - The bounds of the shape after rotation.
    • getStartPoint

      public Point2D 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 this LinearGradientPaint
    • getEndPoint

      public Point2D 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 this LinearGradientPaint