Class PDFGraphicsStreamEngine

  • Direct Known Subclasses:
    ExtractImages.ImageGraphicsEngine, PageDrawer

    public abstract class PDFGraphicsStreamEngine
    extends PDFStreamEngine
    PDFStreamEngine subclass for advanced processing of graphics. This class should be subclassed by end users looking to hook into graphics operations.
    • Field Detail

      • page

        private final PDPage page
    • Constructor Detail

      • PDFGraphicsStreamEngine

        protected PDFGraphicsStreamEngine​(PDPage page)
        Constructor.
    • Method Detail

      • getPage

        protected final PDPage getPage()
        Returns the page.
        Returns:
        the page.
      • appendRectangle

        public abstract void appendRectangle​(java.awt.geom.Point2D p0,
                                             java.awt.geom.Point2D p1,
                                             java.awt.geom.Point2D p2,
                                             java.awt.geom.Point2D p3)
                                      throws java.io.IOException
        Append a rectangle to the current path.
        Parameters:
        p0 - point P0 of the rectangle.
        p1 - point P1 of the rectangle.
        p2 - point P2 of the rectangle.
        p3 - point P3 of the rectangle.
        Throws:
        java.io.IOException - if something went wrong.
      • drawImage

        public abstract void drawImage​(PDImage pdImage)
                                throws java.io.IOException
        Draw the image.
        Parameters:
        pdImage - The image to draw.
        Throws:
        java.io.IOException - if something went wrong.
      • clip

        public abstract void clip​(int windingRule)
                           throws java.io.IOException
        Modify the current clipping path by intersecting it with the current path. The clipping path will not be updated until the succeeding painting operator is called.
        Parameters:
        windingRule - The winding rule which will be used for clipping.
        Throws:
        java.io.IOException - if something went wrong.
      • moveTo

        public abstract void moveTo​(float x,
                                    float y)
                             throws java.io.IOException
        Starts a new path at (x,y).
        Parameters:
        x - x-coordinate of the target point.
        y - y-coordinate of the target point.
        Throws:
        java.io.IOException - if something went wrong.
      • lineTo

        public abstract void lineTo​(float x,
                                    float y)
                             throws java.io.IOException
        Draws a line from the current point to (x,y).
        Parameters:
        x - x-coordinate of the end point of the line.
        y - y-coordinate of the end point of the line.
        Throws:
        java.io.IOException - if something went wrong.
      • curveTo

        public abstract void curveTo​(float x1,
                                     float y1,
                                     float x2,
                                     float y2,
                                     float x3,
                                     float y3)
                              throws java.io.IOException
        Draws a curve from the current point to (x3,y3) using (x1,y1) and (x2,y2) as control points.
        Parameters:
        x1 - x-coordinate of the first control point.
        y1 - y-coordinate of the first control point.
        x2 - x-coordinate of the second control point.
        y2 - y-coordinate of the second control point.
        x3 - x-coordinate of the end point of the curve.
        y3 - y-coordinate of the end point of the curve.
        Throws:
        java.io.IOException - if something went wrong.
      • getCurrentPoint

        public abstract java.awt.geom.Point2D getCurrentPoint()
                                                       throws java.io.IOException
        Returns the current point of the current path.
        Returns:
        the current point.
        Throws:
        java.io.IOException - if something went wrong.
      • closePath

        public abstract void closePath()
                                throws java.io.IOException
        Closes the current path.
        Throws:
        java.io.IOException - if something went wrong.
      • endPath

        public abstract void endPath()
                              throws java.io.IOException
        Ends the current path without filling or stroking it. The clipping path is updated here.
        Throws:
        java.io.IOException - if something went wrong.
      • strokePath

        public abstract void strokePath()
                                 throws java.io.IOException
        Stroke the path.
        Throws:
        java.io.IOException - If there is an IO error while stroking the path.
      • fillPath

        public abstract void fillPath​(int windingRule)
                               throws java.io.IOException
        Fill the path.
        Parameters:
        windingRule - The winding rule this path will use.
        Throws:
        java.io.IOException - if something went wrong.
      • fillAndStrokePath

        public abstract void fillAndStrokePath​(int windingRule)
                                        throws java.io.IOException
        Fills and then strokes the path.
        Parameters:
        windingRule - The winding rule this path will use.
        Throws:
        java.io.IOException - if something went wrong.
      • shadingFill

        public abstract void shadingFill​(COSName shadingName)
                                  throws java.io.IOException
        Fill with Shading.
        Parameters:
        shadingName - The name of the Shading Dictionary to use for this fill instruction.
        Throws:
        java.io.IOException - if something went wrong.