Class RadialShadingContext

  • All Implemented Interfaces:
    java.awt.PaintContext

    public class RadialShadingContext
    extends ShadingContext
    implements java.awt.PaintContext
    AWT PaintContext for radial shading. Performance improvement done as part of GSoC2014, Tilman Hausherr is the mentor.
    • Field Detail

      • LOG

        private static final org.apache.commons.logging.Log LOG
      • coords

        private final float[] coords
      • domain

        private final float[] domain
      • extend

        private final boolean[] extend
      • x1x0

        private final double x1x0
      • y1y0

        private final double y1y0
      • r1r0

        private final double r1r0
      • r0pow2

        private final double r0pow2
      • d1d0

        private final float d1d0
      • denom

        private final double denom
      • factor

        private final int factor
      • colorTable

        private final int[] colorTable
      • rat

        private java.awt.geom.AffineTransform rat
    • Constructor Detail

      • RadialShadingContext

        public RadialShadingContext​(PDShadingType3 shading,
                                    java.awt.image.ColorModel colorModel,
                                    java.awt.geom.AffineTransform xform,
                                    Matrix matrix,
                                    java.awt.Rectangle deviceBounds)
                             throws java.io.IOException
        Constructor creates an instance to be used for fill operations.
        Parameters:
        shading - the shading type to be used
        colorModel - the color model to be used
        xform - transformation for user to device space
        matrix - the pattern matrix concatenated with that of the parent content stream
        deviceBounds - the bounds of the area to paint, in device units
        Throws:
        java.io.IOException - if there is an error getting the color space or doing color conversion.
    • Method Detail

      • calcColorTable

        private int[] calcColorTable()
                              throws java.io.IOException
        Calculate the color on the line that connects two circles' centers and store the result in an array.
        Returns:
        an array, index denotes the relative position, the corresponding value the color
        Throws:
        java.io.IOException
      • dispose

        public void dispose()
        Specified by:
        dispose in interface java.awt.PaintContext
        Overrides:
        dispose in class ShadingContext
      • getColorModel

        public java.awt.image.ColorModel getColorModel()
        Specified by:
        getColorModel in interface java.awt.PaintContext
        Overrides:
        getColorModel in class ShadingContext
      • getRaster

        public java.awt.image.Raster getRaster​(int x,
                                               int y,
                                               int w,
                                               int h)
        Specified by:
        getRaster in interface java.awt.PaintContext
      • calculateInputValues

        private float[] calculateInputValues​(double x,
                                             double y)
      • getCoords

        public float[] getCoords()
        Returns the coords values.
      • getDomain

        public float[] getDomain()
        Returns the domain values.
      • getExtend

        public boolean[] getExtend()
        Returns the extend values.
      • getFunction

        public PDFunction getFunction()
                               throws java.io.IOException
        Returns the function.
        Throws:
        java.io.IOException - if we were not able to create the function.