Class PDFShapeCmd


  • public class PDFShapeCmd
    extends PDFCmd
    Encapsulates a path. Also contains extra fields and logic to check for consecutive abutting anti-aliased regions. We stroke the shared line between these regions again with a 1-pixel wide line so that the background doesn't show through between them.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.awt.BasicStroke againstroke
      the stroke style for the anti-antialias stroke
      static int BOTH
      perform both stroke and fill
      private java.awt.geom.Rectangle2D bounds
      the bounding box of the path
      static int CLIP
      set the clip region to the path
      static int FILL
      fill the path with the fill paint
      private java.awt.geom.GeneralPath gp
      base path
      static int STROKE
      stroke the outline of the path with the stroke paint
      private int style
      the style
    • Constructor Summary

      Constructors 
      Constructor Description
      PDFShapeCmd​(java.awt.geom.GeneralPath gp, int style)
      create a new PDFShapeCmd and check it against the previous one to find any shared edges.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.awt.geom.GeneralPath checkOverlap​(PDFRenderer state)
      Check for overlap with the previous shape to make anti-aliased shapes that are near each other look good
      java.awt.geom.Rectangle2D execute​(PDFRenderer state)
      perform the stroke and record the dirty region
      java.lang.String getDetails()
      Get detailed information about this shape
      private int getPoints​(java.awt.geom.GeneralPath path, float[] mypoints)
      Get an array of 16 points from a path
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • STROKE

        public static final int STROKE
        stroke the outline of the path with the stroke paint
        See Also:
        Constant Field Values
      • gp

        private java.awt.geom.GeneralPath gp
        base path
      • style

        private int style
        the style
      • bounds

        private java.awt.geom.Rectangle2D bounds
        the bounding box of the path
      • againstroke

        java.awt.BasicStroke againstroke
        the stroke style for the anti-antialias stroke
    • Constructor Detail

      • PDFShapeCmd

        public PDFShapeCmd​(java.awt.geom.GeneralPath gp,
                           int style)
        create a new PDFShapeCmd and check it against the previous one to find any shared edges.
        Parameters:
        gp - the path
        style - the style: an OR of STROKE, FILL, or CLIP. As a convenience, BOTH = STROKE | FILL.
    • Method Detail

      • execute

        public java.awt.geom.Rectangle2D execute​(PDFRenderer state)
        perform the stroke and record the dirty region
        Specified by:
        execute in class PDFCmd
        Parameters:
        state - the current graphics state; may be modified during execution.
        Returns:
        the region of the page made dirty by executing this command or null if no region was touched. Note this value should be in the coordinates of the image touched, not the page.
      • checkOverlap

        private java.awt.geom.GeneralPath checkOverlap​(PDFRenderer state)
        Check for overlap with the previous shape to make anti-aliased shapes that are near each other look good
      • getPoints

        private int getPoints​(java.awt.geom.GeneralPath path,
                              float[] mypoints)
        Get an array of 16 points from a path
        Returns:
        the number of points we actually got
      • getDetails

        public java.lang.String getDetails()
        Get detailed information about this shape
        Overrides:
        getDetails in class PDFCmd