## org.apache.fop.render.awt
Class AWTRenderer

    java.lang.Object
      |
      +--org.apache.fop.render.awt.AWTRenderer

public class AWTRenderer
extends java.lang.Object
implements Renderer, java.awt.print.Printable, java.awt.print.Pageable

Field Summary
`protected float` `currentBlue`
`protected java.lang.String` `currentFontName` The current (internal) font name
`protected int` `currentFontSize` The current font size in millipoints
`protected float` `currentGreen`
`protected float` `currentRed` The current colour's red, green and blue component
`protected int` `currentXPosition` The current horizontal position in millipoints from left
`protected int` `currentYPosition` The current vertical position in millipoints from bottom
`protected java.util.Hashtable` `fontNames`
`protected java.util.Hashtable` `fontStyles`
`protected int` `pageHeight`
`protected int` `pageNumber`
`protected int` `pageWidth`
`protected java.awt.Component` `parent` The parent component, used to set up the font.
`protected ProgressListener` `progressListener`
`protected Translator` `res`
`protected java.awt.Color` `saveColor`
`protected double` `scaleFactor`
`protected AreaTree` `tree`

Fields inherited from interface java.awt.print.Printable
`NO_SUCH_PAGE, PAGE_EXISTS`

Fields inherited from interface java.awt.print.Pageable
`UNKNOWN_NUMBER_OF_PAGES`

Constructor Summary
`AWTRenderer(Translator aRes)`

Method Summary
`protected void` `addLine(int x1, int y1, int x2, int y2, int th, float r, float g, float b)` add a line to the current stream
`protected void` `addRect(int x, int y, int w, int h, float r, float g, float b)` draw a filled rectangle
`protected void` `addRect(int x, int y, int w, int h, float r, float g, float b, float fr, float fg, float fb)` draw a filled rectangle
`static java.awt.Color` `colorType2Color(ColorType ct)`
`java.awt.geom.GeneralPath` `convertPath(SVGPathElementImpl svgpath, float x, float y)` Mapps a SVG-Path to a AWT-GeneralPath.
`java.awt.Polygon` `convertPolygon(SVGPolygonElementImpl svgpl, int x, int y)` Mapps a SVG-Polygon to a AWT-Polygon.
`protected org.apache.fop.render.awt.AWTRenderer.DrawingInstruction` `createInstruction(GraphicImpl area, java.util.Hashtable style)`
`protected void` `drawFrame()`
`protected void` `drawShape(java.awt.Shape s, org.apache.fop.render.awt.AWTRenderer.DrawingInstruction di)`
`protected java.awt.geom.Rectangle2D` `getBounds(Area a)`
`java.awt.image.BufferedImage` `getLastRenderedPage()`
`int` `getNumberOfPages()`
`int` `getPageCount()` Retrieve the number of pages in this document.
`java.awt.print.PageFormat` `getPageFormat(int pageIndex)`
`int` `getPageNumber()`
`java.awt.print.Printable` `getPrintable(int pageIndex)`
`double` `getScaleFactor()`
`int` `print(java.awt.Graphics g, java.awt.print.PageFormat pageFormat, int pageIndex)`
`void` `render(AreaTree areaTree, int aPageNumber)`
`void` `render(AreaTree areaTree, java.io.OutputStream stream)` render the given area tree to the given stream
`void` `render(int aPageNumber)`
`void` `renderAreaContainer(AreaContainer area)` render the given area container
`void` `renderBlockArea(BlockArea area)` render the given block area
`void` `renderBodyAreaContainer(BodyAreaContainer area)` render the given area container
`void` `renderDisplaySpace(DisplaySpace space)` render the given display space
`void` `renderElement(SVGArea svgarea, GraphicImpl area, int posx, int posy, java.util.Vector parentTransforms)`
`void` `renderForeignObjectArea(ForeignObjectArea area)` render a foreign object area
`void` `renderGArea(SVGArea svgarea, SVGGElementImpl area, int posx, int posy)`
`void` `renderGArea(SVGArea svgarea, SVGGElementImpl area, int posx, int posy, java.util.Vector v)`
`void` `renderImage(java.lang.String href, float x, float y, float width, float height, java.util.Vector transform)` Draws an image.
`void` `renderImageArea(ImageArea area)` render the given image area
`void` `renderInlineSpace(InlineSpace space)` render the given inline space
`void` `renderLeaderArea(LeaderArea area)` render leader area into AWT
`void` `renderLineArea(LineArea area)` render the given line area
`void` `renderPage(Page page)` render the given page
`void` `renderSpanArea(SpanArea area)` render the given span area
`void` `renderSVGArea(SVGArea area)` render the given SVG area
`void` `renderWordArea(WordArea area)` render the given inline area
`void` `setComponent(java.awt.Component parent)` Sets parent component which is used to set up the font.
`void` `setPageNumber(int aValue)`
`void` `setProducer(java.lang.String producer)` set the producer of the rendering
`void` `setProgressListener(ProgressListener l)`
`void` `setScaleFactor(double newScaleFactor)`
`void` `setupFontInfo(FontInfo fontInfo)` set up the given FontInfo
`void` `transform(java.awt.Graphics2D g2d, double zoomPercent, double angle)` To configure before print.
`java.awt.Shape` `transformShape(java.util.Vector trans, java.awt.Shape shape)` Applies SVGTransform to the shape and gets the transformed shape.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### pageWidth

    protected int pageWidth

### pageHeight

    protected int pageHeight

### scaleFactor

    protected double scaleFactor

### pageNumber

    protected int pageNumber

### tree

    protected AreaTree tree

### progressListener

    protected ProgressListener progressListener

### res

    protected Translator res

### fontNames

    protected java.util.Hashtable fontNames

### fontStyles

    protected java.util.Hashtable fontStyles

### saveColor

    protected java.awt.Color saveColor

### currentFontName

    protected java.lang.String currentFontName

  The current (internal) font name

### parent

    protected java.awt.Component parent

  The parent component, used to set up the font. This is needed as FontSetup needs a live AWT component in order to generate valid font measures.

### currentFontSize

    protected int currentFontSize

  The current font size in millipoints

### currentRed

    protected float currentRed

  The current colour's red, green and blue component

### currentGreen

    protected float currentGreen

### currentBlue

    protected float currentBlue

### currentYPosition

    protected int currentYPosition

  The current vertical position in millipoints from bottom

### currentXPosition

    protected int currentXPosition

  The current horizontal position in millipoints from left

Constructor Detail

### AWTRenderer

    public AWTRenderer(Translator aRes)

Method Detail

### setComponent

    public void setComponent(java.awt.Component parent)

  Sets parent component which is used to set up the font. This is needed as FontSetup needs a live AWT component in order to generate valid font measures.
  Parameters:
    `parent` - the live AWT component reference

### getPageNumber

    public int getPageNumber()

### setPageNumber

    public void setPageNumber(int aValue)

### setScaleFactor

    public void setScaleFactor(double newScaleFactor)

### getScaleFactor

    public double getScaleFactor()

### getLastRenderedPage

    public java.awt.image.BufferedImage getLastRenderedPage()

### addLine

    protected void addLine(int x1,
                           int y1,
                           int x2,
                           int y2,
                           int th,
                           float r,
                           float g,
                           float b)

  add a line to the current stream
  Parameters:
    `x1` - the start x location in millipoints
    `y1` - the start y location in millipoints
    `x2` - the end x location in millipoints
    `y2` - the end y location in millipoints
    `th` - the thickness in millipoints
    `r` - the red component
    `g` - the green component
    `b` - the blue component

### addRect

    protected void addRect(int x,
                           int y,
                           int w,
                           int h,
                           float r,
                           float g,
                           float b)

  draw a filled rectangle
  Parameters:
    `x` - the x position of left edge in millipoints
    `y` - the y position of top edge in millipoints
    `w` - the width in millipoints
    `h` - the height in millipoints
    `r` - the red component
    `g` - the green component
    `b` - the blue component

### addRect

    protected void addRect(int x,
                           int y,
                           int w,
                           int h,
                           float r,
                           float g,
                           float b,
                           float fr,
                           float fg,
                           float fb)

  draw a filled rectangle
  Parameters:
    `x` - the x position of left edge in millipoints
    `y` - the y position of top edge in millipoints
    `w` - the width in millipoints
    `h` - the height in millipoints
    `r` - the red component of edges
    `g` - the green component of edges
    `b` - the blue component of edges
    `fr` - the red component of the fill
    `fg` - the green component of the fill
    `fb` - the blue component of the fill

### transform

    public void transform(java.awt.Graphics2D g2d,
                          double zoomPercent,
                          double angle)

  To configure before print. Choose pages Zoom factor Page format / Landscape or Portrait

### drawFrame

    protected void drawFrame()

### getPageCount

    public int getPageCount()

  Retrieve the number of pages in this document.
  Returns:
    the number of pages

### render

    public void render(int aPageNumber)

### render

    public void render(AreaTree areaTree,
                       java.io.OutputStream stream)
                throws java.io.IOException

  Description copied from interface: Renderer
  render the given area tree to the given stream
  Specified by:
    render in interface Renderer

### render

    public void render(AreaTree areaTree,
                       int aPageNumber)
                throws java.io.IOException

### renderPage

    public void renderPage(Page page)

  Description copied from interface: Renderer
  render the given page
  Specified by:
    renderPage in interface Renderer

### renderAreaContainer

    public void renderAreaContainer(AreaContainer area)

  Description copied from interface: Renderer
  render the given area container
  Specified by:
    renderAreaContainer in interface Renderer

### renderBodyAreaContainer

    public void renderBodyAreaContainer(BodyAreaContainer area)

  Description copied from interface: Renderer
  render the given area container
  Specified by:
    renderBodyAreaContainer in interface Renderer

### renderSpanArea

    public void renderSpanArea(SpanArea area)

  Description copied from interface: Renderer
  render the given span area
  Specified by:
    renderSpanArea in interface Renderer

### getBounds

    protected java.awt.geom.Rectangle2D getBounds(Area a)

### renderBlockArea

    public void renderBlockArea(BlockArea area)

  Description copied from interface: Renderer
  render the given block area
  Specified by:
    renderBlockArea in interface Renderer

### setupFontInfo

    public void setupFontInfo(FontInfo fontInfo)

  Description copied from interface: Renderer
  set up the given FontInfo
  Specified by:
    setupFontInfo in interface Renderer

### renderDisplaySpace

    public void renderDisplaySpace(DisplaySpace space)

  Description copied from interface: Renderer
  render the given display space
  Specified by:
    renderDisplaySpace in interface Renderer

### renderImageArea

    public void renderImageArea(ImageArea area)

  Description copied from interface: Renderer
  render the given image area
  Specified by:
    renderImageArea in interface Renderer

### renderWordArea

    public void renderWordArea(WordArea area)

  Description copied from interface: Renderer
  render the given inline area
  Specified by:
    renderWordArea in interface Renderer

### renderInlineSpace

    public void renderInlineSpace(InlineSpace space)

  Description copied from interface: Renderer
  render the given inline space
  Specified by:
    renderInlineSpace in interface Renderer

### renderLineArea

    public void renderLineArea(LineArea area)

  Description copied from interface: Renderer
  render the given line area
  Specified by:
    renderLineArea in interface Renderer

### renderLeaderArea

    public void renderLeaderArea(LeaderArea area)

  render leader area into AWT
  Specified by:
    renderLeaderArea in interface Renderer
  Parameters:
    `area` - area to render

### renderSVGArea

    public void renderSVGArea(SVGArea area)

  Description copied from interface: Renderer
  render the given SVG area
  Specified by:
    renderSVGArea in interface Renderer

### setProducer

    public void setProducer(java.lang.String producer)

  Description copied from interface: Renderer
  set the producer of the rendering
  Specified by:
    setProducer in interface Renderer

### print

    public int print(java.awt.Graphics g,
                     java.awt.print.PageFormat pageFormat,
                     int pageIndex)
              throws java.awt.print.PrinterException

  Specified by:
    print in interface java.awt.print.Printable

### getNumberOfPages

    public int getNumberOfPages()

  Specified by:
    getNumberOfPages in interface java.awt.print.Pageable

### getPageFormat

    public java.awt.print.PageFormat getPageFormat(int pageIndex)
                                            throws java.lang.IndexOutOfBoundsException

  Specified by:
    getPageFormat in interface java.awt.print.Pageable

### getPrintable

    public java.awt.print.Printable getPrintable(int pageIndex)
                                          throws java.lang.IndexOutOfBoundsException

  Specified by:
    getPrintable in interface java.awt.print.Pageable

### setProgressListener

    public void setProgressListener(ProgressListener l)

### colorType2Color

    public static java.awt.Color colorType2Color(ColorType ct)

### renderImage

    public void renderImage(java.lang.String href,
                            float x,
                            float y,
                            float width,
                            float height,
                            java.util.Vector transform)

  Draws an image. TODO: protect other image formats (JIMI)

### renderElement

    public void renderElement(SVGArea svgarea,
                              GraphicImpl area,
                              int posx,
                              int posy,
                              java.util.Vector parentTransforms)

### renderGArea

    public void renderGArea(SVGArea svgarea,
                            SVGGElementImpl area,
                            int posx,
                            int posy,
                            java.util.Vector v)

### renderGArea

    public void renderGArea(SVGArea svgarea,
                            SVGGElementImpl area,
                            int posx,
                            int posy)

### transformShape

    public java.awt.Shape transformShape(java.util.Vector trans,
                                         java.awt.Shape shape)

  Applies SVGTransform to the shape and gets the transformed shape. The type of the new shape may be different to the original type.

### convertPolygon

    public java.awt.Polygon convertPolygon(SVGPolygonElementImpl svgpl,
                                           int x,
                                           int y)

  Mapps a SVG-Polygon to a AWT-Polygon.

### createInstruction

    protected org.apache.fop.render.awt.AWTRenderer.DrawingInstruction createInstruction(GraphicImpl area,
                                                                                         java.util.Hashtable style)

### drawShape

    protected void drawShape(java.awt.Shape s,
                             org.apache.fop.render.awt.AWTRenderer.DrawingInstruction di)

### convertPath

    public java.awt.geom.GeneralPath convertPath(SVGPathElementImpl svgpath,
                                                 float x,
                                                 float y)

  Mapps a SVG-Path to a AWT-GeneralPath.

### renderForeignObjectArea

    public void renderForeignObjectArea(ForeignObjectArea area)

  Description copied from interface: Renderer
  render a foreign object area
  Specified by:
    renderForeignObjectArea in interface Renderer

Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.