Class Java2DMarkupHandler

    • Constructor Summary

      Constructors 
      Constructor Description
      Java2DMarkupHandler​(java.awt.Graphics2D g)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void beginPage​(float width, float height)
      Set the bounds of the page.
      void clipChanged​(PDFGState g)
      reset the clip
      void drawImage​(PDFGState g, java.awt.Image i, java.awt.geom.AffineTransform ixform)
      Draw an image
      void drawTiledImage​(PDFTiledImage.TiledImageProxy i, java.awt.geom.AffineTransform ixform)  
      void endPage()
      Restore Graphics2D to the state it was in before we started.
      void fillPath​(PDFGState g, java.awt.geom.GeneralPath p)
      Fill the current path using the fill params in the gstate
      java.awt.font.FontRenderContext getFontRenderContext()
      Return an awt FontRenderContext object which will be used to render the fonts.
      java.awt.Graphics getGraphics()
      Return an awt Graphics object which will be used for suspect purposes.
      void setDestinationRect​(java.awt.geom.Rectangle2D r)
      Set the bounds in the Graphics2D's coordinate system where the page will be drawn.
      void setGraphics​(java.awt.Graphics2D g)
      Set the Graphics2D object that will do all the rendering.
      void showText​(PDFGState g, java.awt.font.GlyphVector v)
      Draw some text at the current text position.
      void strokePath​(PDFGState g, java.awt.geom.GeneralPath p)
      Stroke the current path with the current miter limit, color, etc.
      void sun_bug_4723021_workaround​(java.awt.Image i, java.awt.geom.AffineTransform ixform)
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4723021
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Java2DMarkupHandler

        public Java2DMarkupHandler​(java.awt.Graphics2D g)
    • Method Detail

      • setGraphics

        public void setGraphics​(java.awt.Graphics2D g)
        Set the Graphics2D object that will do all the rendering.
      • getGraphics

        public java.awt.Graphics getGraphics()
        Description copied from class: PDFMarkupHandler
        Return an awt Graphics object which will be used for suspect purposes. TODO: this is really to help get the FontMetrics for a given font
        Specified by:
        getGraphics in class PDFMarkupHandler
      • setDestinationRect

        public void setDestinationRect​(java.awt.geom.Rectangle2D r)
        Set the bounds in the Graphics2D's coordinate system where the page will be drawn.
      • beginPage

        public void beginPage​(float width,
                              float height)
        Set the bounds of the page. This will be called before any marking operations.
        Specified by:
        beginPage in class PDFMarkupHandler
      • endPage

        public void endPage()
        Restore Graphics2D to the state it was in before we started.
        Overrides:
        endPage in class PDFMarkupHandler
      • strokePath

        public void strokePath​(PDFGState g,
                               java.awt.geom.GeneralPath p)
        Stroke the current path with the current miter limit, color, etc.
        Specified by:
        strokePath in class PDFMarkupHandler
      • fillPath

        public void fillPath​(PDFGState g,
                             java.awt.geom.GeneralPath p)
        Fill the current path using the fill params in the gstate
        Specified by:
        fillPath in class PDFMarkupHandler
      • drawImage

        public void drawImage​(PDFGState g,
                              java.awt.Image i,
                              java.awt.geom.AffineTransform ixform)
        Draw an image
        Specified by:
        drawImage in class PDFMarkupHandler
      • sun_bug_4723021_workaround

        public void sun_bug_4723021_workaround​(java.awt.Image i,
                                               java.awt.geom.AffineTransform ixform)
        http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4723021

        Applying a transform to an image with interesting SampleModels fails. To work around this, we try creating an untransformed RGBA image first and then redrawing that with the desired transform.

      • showText

        public void showText​(PDFGState g,
                             java.awt.font.GlyphVector v)
        Draw some text at the current text position. The glyphVector will have been created by the parser using the current font and its character encodings.
        Specified by:
        showText in class PDFMarkupHandler
      • getFontRenderContext

        public java.awt.font.FontRenderContext getFontRenderContext()
        Description copied from class: PDFMarkupHandler
        Return an awt FontRenderContext object which will be used to render the fonts. The same rendercontext is used for the entire page.
        Specified by:
        getFontRenderContext in class PDFMarkupHandler