Class RadialShadingContext

java.lang.Object
org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext
org.apache.pdfbox.pdmodel.graphics.shading.RadialShadingContext
All Implemented Interfaces:
PaintContext

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

    • LOG

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

      private PDShadingType3 radialShadingType
    • 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 AffineTransform rat
  • Constructor Details

    • RadialShadingContext

      public RadialShadingContext(PDShadingType3 shading, ColorModel colorModel, AffineTransform xform, Matrix matrix, Rectangle deviceBounds) throws 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:
      IOException - if there is an error getting the color space or doing color conversion.
  • Method Details

    • calcColorTable

      private int[] calcColorTable() throws 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:
      IOException
    • dispose

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

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

      public Raster getRaster(int x, int y, int w, int h)
      Specified by:
      getRaster in interface 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 IOException
      Returns the function.
      Throws:
      IOException - if we were not able to create the function.