Class RelativeLinearGradientPaint

    • 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 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:
        java.lang.NullPointerException - if one of the points is null, or fractions array is null, or colors array is null, or cycleMethod is null
        java.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 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 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:
        java.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 null
        java.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 order
    • Method Detail

      • beforePaint

        public void beforePaint​(java.awt.geom.Rectangle2D shapeSize)
        Specified by:
        beforePaint in interface RelativePaint
      • 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:
        createContext in interface java.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: 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 java.awt.geom.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 java.awt.geom.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