org.apache.fop.render.svg
Class SVGRenderer

java.lang.Object
  extended by org.apache.fop.render.AbstractRenderer
      extended by org.apache.fop.render.svg.SVGRenderer
All Implemented Interfaces:
Renderer

public class SVGRenderer
extends AbstractRenderer


Field Summary
protected  float currentBlue
           
protected  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  Map fontNames
           
protected  Map fontStyles
           
protected  Map options
          options
protected  int pageHeight
           
protected  int pageNumber
           
protected  int pageWidth
           
protected  Color saveColor
           
 
Fields inherited from class org.apache.fop.render.AbstractRenderer
currentAreaContainerXPosition, currentXPosition, currentYPosition, idReferences, log
 
Constructor Summary
SVGRenderer()
           
 
Method Summary
protected  void addFilledRect(int x, int y, int w, int h, ColorType col)
          Add a filled rectangle to the current stream This default implementation calls addRect using the same color for fill and border.
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, boolean drawAsOutline)
          draw a filled rectangle in the current color
protected  void addRect(int x, int y, int w, int h, float r, float g, float b)
          draw a 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 Color colorType2Color(ColorType ct)
           
protected  void doFrame(Area area)
           
protected  void drawFrame()
           
protected  void drawImageClipped(int x, int y, int clipX, int clipY, int clipW, int clipH, FopImage image, FontState fs)
          Renders an image, clipping it as specified.
protected  void drawImageScaled(int x, int y, int w, int h, FopImage image, FontState fs)
          Renders an image, scaling it to the given width and height.
protected  Rectangle2D getBounds(Area a)
           
 void render(Page page)
           
 void render(Page page, OutputStream stream)
          render the given area tree to the given stream
 void renderDisplaySpace(DisplaySpace space)
          render the given display space
 void renderForeignObjectArea(ForeignObjectArea area)
          render a foreign object area
 void renderImageArea(ImageArea area)
          Render an image area.
 void renderInlineSpace(InlineSpace space)
          render the given inline space
 void renderLeaderArea(LeaderArea area)
          render the given leader area
 void renderPage(Page page)
          render the given page
 void renderSVGArea(SVGArea area)
          render the given SVG area
protected  void renderSVGDocument(Document doc, float x, float y)
           
 void renderWordArea(WordArea area)
          render the given inline area
 void setOptions(Map options)
          set up renderer options
 void setProducer(String producer)
          set the producer of the rendering
 void setupFontInfo(FontInfo fontInfo)
          set up the given FontInfo
 void startRenderer(OutputStream outputStream)
           
 void stopRenderer(OutputStream outputStream)
           
 
Methods inherited from class org.apache.fop.render.AbstractRenderer
doBackground, drawImage, getIDReferences, renderAreaContainer, renderBlockArea, renderBodyAreaContainer, renderLineArea, renderRegionAreaContainer, renderRegions, renderSpanArea, setLogger
 
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

pageNumber

protected int pageNumber

fontNames

protected Map fontNames

fontStyles

protected Map fontStyles

saveColor

protected Color saveColor

currentFontName

protected String currentFontName
The current (internal) font name


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

options

protected Map options
options

Constructor Detail

SVGRenderer

public SVGRenderer()
Method Detail

setOptions

public void setOptions(Map options)
set up renderer options


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 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

addRect

protected void addRect(int x,
                       int y,
                       int w,
                       int h,
                       boolean drawAsOutline)
draw a filled rectangle in the current color

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
drawAsOutline - true for draw, false for fill

addFilledRect

protected void addFilledRect(int x,
                             int y,
                             int w,
                             int h,
                             ColorType col)
Description copied from class: AbstractRenderer
Add a filled rectangle to the current stream This default implementation calls addRect using the same color for fill and border.

Specified by:
addFilledRect in class AbstractRenderer
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

drawFrame

protected void drawFrame()

render

public void render(Page page,
                   OutputStream stream)
            throws IOException
Description copied from interface: Renderer
render the given area tree to the given stream

Throws:
IOException

render

public void render(Page page)
            throws IOException
Throws:
IOException

renderPage

public void renderPage(Page page)
Description copied from interface: Renderer
render the given page


doFrame

protected void doFrame(Area area)
Specified by:
doFrame in class AbstractRenderer

getBounds

protected Rectangle2D getBounds(Area a)

setupFontInfo

public void setupFontInfo(FontInfo fontInfo)
                   throws FOPException
Description copied from interface: Renderer
set up the given FontInfo

Throws:
FOPException

renderDisplaySpace

public void renderDisplaySpace(DisplaySpace space)
Description copied from interface: Renderer
render the given display space


drawImageScaled

protected void drawImageScaled(int x,
                               int y,
                               int w,
                               int h,
                               FopImage image,
                               FontState fs)
Renders an image, scaling it to the given width and height. If the scaled width and height is the same intrinsic size of the image, the image is not scaled.

Specified by:
drawImageScaled in class AbstractRenderer
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
image - the image to be rendered
fs - the font state to use when rendering text in non-bitmapped images.

drawImageClipped

protected void drawImageClipped(int x,
                                int y,
                                int clipX,
                                int clipY,
                                int clipW,
                                int clipH,
                                FopImage image,
                                FontState fs)
Renders an image, clipping it as specified.

Specified by:
drawImageClipped in class AbstractRenderer
Parameters:
x - the x position of left edge in millipoints.
y - the y position of top edge in millipoints.
clipX - the left edge of the clip in millipoints
clipY - the top edge of the clip in millipoints
clipW - the clip width in millipoints
clipH - the clip height in millipoints
fill - the image to be rendered
fs - the font state to use when rendering text in non-bitmapped images.

renderImageArea

public void renderImageArea(ImageArea area)
Description copied from class: AbstractRenderer
Render an image area.

Specified by:
renderImageArea in interface Renderer
Overrides:
renderImageArea in class AbstractRenderer
Parameters:
area - the image area to render

renderWordArea

public void renderWordArea(WordArea area)
Description copied from interface: Renderer
render the given inline area


renderInlineSpace

public void renderInlineSpace(InlineSpace space)
Description copied from interface: Renderer
render the given inline space


renderLeaderArea

public void renderLeaderArea(LeaderArea area)
Description copied from interface: Renderer
render the given leader area

Parameters:
area - area to render

renderSVGArea

public void renderSVGArea(SVGArea area)
Description copied from interface: Renderer
render the given SVG area


renderSVGDocument

protected void renderSVGDocument(Document doc,
                                 float x,
                                 float y)

setProducer

public void setProducer(String producer)
Description copied from interface: Renderer
set the producer of the rendering


colorType2Color

public static Color colorType2Color(ColorType ct)

renderForeignObjectArea

public void renderForeignObjectArea(ForeignObjectArea area)
Description copied from interface: Renderer
render a foreign object area


startRenderer

public void startRenderer(OutputStream outputStream)
                   throws IOException
Throws:
IOException

stopRenderer

public void stopRenderer(OutputStream outputStream)
                  throws IOException
Throws:
IOException


Copyright ? 1999-2003 Apache Software Foundation. All Rights Reserved.