Class ShadingContext

java.lang.Object
org.apache.pdfbox.pdmodel.graphics.shading.ShadingContext
Direct Known Subclasses:
AxialShadingContext, RadialShadingContext, TriangleBasedShadingContext, Type1ShadingContext

public abstract class ShadingContext extends Object
A base class to handle what is common to all shading types.
  • Field Details

    • background

      private float[] background
    • rgbBackground

      private int rgbBackground
    • shading

      private final PDShading shading
    • outputColorModel

      private ColorModel outputColorModel
    • shadingColorSpace

      private PDColorSpace shadingColorSpace
  • Constructor Details

    • ShadingContext

      public ShadingContext(PDShading shading, ColorModel cm, AffineTransform xform, Matrix matrix) throws IOException
      Constructor.
      Parameters:
      shading - the shading type to be used
      cm - 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
      Throws:
      IOException - if there is an error getting the color space or doing background color conversion.
  • Method Details

    • getShadingColorSpace

      PDColorSpace getShadingColorSpace()
    • getShading

      PDShading getShading()
    • getBackground

      float[] getBackground()
    • getRgbBackground

      int getRgbBackground()
    • convertToRGB

      final int convertToRGB(float[] values) throws IOException
      Convert color values from shading colorspace to RGB color values encoded into an integer.
      Parameters:
      values - color values in shading colorspace.
      Returns:
      RGB values encoded in an integer.
      Throws:
      IOException - if the color conversion fails.
    • getColorModel

      ColorModel getColorModel()
    • dispose

      void dispose()