Class PDMeshBasedShadingType

All Implemented Interfaces:
COSObjectable
Direct Known Subclasses:
PDShadingType6, PDShadingType7

abstract class PDMeshBasedShadingType extends PDShadingType4
Common resources for shading types 6 and 7
  • Field Details

    • LOG

      private static final org.apache.commons.logging.Log LOG
  • Constructor Details

    • PDMeshBasedShadingType

      PDMeshBasedShadingType(COSDictionary shadingDictionary)
  • Method Details

    • collectPatches

      final List<Patch> collectPatches(AffineTransform xform, Matrix matrix, int controlPoints) throws IOException
      Create a patch list from a data stream, the returned list contains all the patches contained in the data stream.
      Parameters:
      xform - transformation for user to device space
      matrix - the pattern matrix concatenated with that of the parent content stream
      controlPoints - number of control points, 12 for type 6 shading and 16 for type 7 shading
      Returns:
      the obtained patch list
      Throws:
      IOException - when something went wrong
    • readPatch

      protected Patch readPatch(ImageInputStream input, boolean isFree, Point2D[] implicitEdge, float[][] implicitCornerColor, long maxSrcCoord, long maxSrcColor, PDRange rangeX, PDRange rangeY, PDRange[] colRange, Matrix matrix, AffineTransform xform, int controlPoints) throws IOException
      Read a single patch from a data stream, a patch contains information of its coordinates and color parameters.
      Parameters:
      input - the image source data stream
      isFree - whether this is a free patch
      implicitEdge - implicit edge when a patch is not free, otherwise it's not used
      implicitCornerColor - implicit colors when a patch is not free, otherwise it's not used
      maxSrcCoord - the maximum coordinate value calculated from source data
      maxSrcColor - the maximum color value calculated from source data
      rangeX - range for coordinate x
      rangeY - range for coordinate y
      colRange - range for color
      matrix - the pattern matrix concatenated with that of the parent content stream
      xform - transformation for user to device space
      controlPoints - number of control points, 12 for type 6 shading and 16 for type 7 shading
      Returns:
      a single patch
      Throws:
      IOException - when something went wrong
    • generatePatch

      abstract Patch generatePatch(Point2D[] points, float[][] color)
      Create a patch using control points and 4 corner color values, in Type6ShadingContext, a CoonsPatch is returned; in Type6ShadingContext, a TensorPatch is returned.
      Parameters:
      points - 12 or 16 control points
      color - 4 corner colors
      Returns:
      a patch instance
    • getBounds

      public abstract Rectangle2D getBounds(AffineTransform xform, Matrix matrix) throws IOException
      Description copied from class: PDShading
      Calculate a bounding rectangle around the areas of this shading context.
      Overrides:
      getBounds in class PDTriangleBasedShadingType
      Returns:
      Bounding rectangle or null, if not supported by this shading type.
      Throws:
      IOException
    • getBounds

      Rectangle2D getBounds(AffineTransform xform, Matrix matrix, int controlPoints) throws IOException
      Throws:
      IOException