|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.render.AbstractRenderer
org.apache.fop.render.PrintRenderer
org.apache.fop.render.afp.AFPRenderer
This is an implementaion of an FOP Renderer that renders areas to AFP.
A renderer is primarily designed to convert a given area tree into the output document format. It should be able to produce pages and fill the pages with the text and graphical content. Usually the output is sent to an output stream. Some output formats may support extra information that is not available from the area tree or depends on the destination of the document. Each renderer is given an area tree to render to its output format. The area tree is simply a representation of the pages and the placement of text and graphical objects on those pages.
The renderer will be given each page as it is ready and an output stream to write the data out. All pages are supplied in the order they appear in the document. In order to save memory it is possble to render the pages out of order. Any page that is not ready to be rendered is setup by the renderer first so that it can reserve a space or reference for when the page is ready to be rendered.The renderer is responsible for managing the output format and associated data and flow.
Each renderer is totally responsible for its output format. Because font metrics (and therefore layout) are obtained in two different ways depending on the renderer, the renderer actually sets up the fonts being used. The font metrics are used during the layout process to determine the size of characters.
The render context is used by handlers. It contains information about the current state of the renderer, such as the page, the position, and any other miscellanous objects that are required to draw into the page.
A renderer is created by implementing the Renderer interface. However, the AbstractRenderer does most of what is needed, including iterating through the tree parts, so it is this that is extended. This means that this object only need to implement the basic functionality such as text, images, and lines. AbstractRenderer's methods can easily be overridden to handle things in a different way or do some extra processing.
The relevent AreaTree structures that will need to be rendered are Page, Viewport, Region, Span, Block, Line, Inline. A renderer implementation renders each individual page, clips and aligns child areas to a viewport, handle all types of inline area, text, image etc and draws various lines and rectangles.
Note: There are specific extensions that have been added to the FO. They are specific to their location within the FO and have to be processed accordingly (ie. at the start or end of the page).
Field Summary | |
protected static org.apache.commons.logging.Log |
LOGGER
Static logging instance |
Fields inherited from class org.apache.fop.render.PrintRenderer |
currentFill, currentFontName, currentFontSize, currentStroke, fontInfo, prevLineThroughColor, prevLineThroughSize, prevLineThroughXEndPos, prevLineThroughYEndPos, prevOverlineColor, prevOverlineSize, prevOverlineXEndPos, prevOverlineYEndPos, prevUnderlineColor, prevUnderlineSize, prevUnderlineXEndPos, prevUnderlineYEndPos |
Fields inherited from class org.apache.fop.render.AbstractRenderer |
currentAreaContainerXPosition, currentXPosition, currentYPosition, idReferences, log |
Constructor Summary | |
AFPRenderer()
Constructor for AFPRenderer. |
Method Summary | |
protected void |
addFilledRect(int x,
int y,
int w,
int h,
org.apache.fop.pdf.PDFPathPaint fill)
Add a filled rectangle to the current stream |
protected void |
addLine(int x1,
int y1,
int x2,
int y2,
int th,
int rs,
org.apache.fop.pdf.PDFPathPaint stroke)
Add a line to the current stream. |
protected void |
addLine(int x1,
int y1,
int x2,
int y2,
int th,
org.apache.fop.pdf.PDFPathPaint stroke)
Add a line to the current stream. |
protected void |
addRect(int x,
int y,
int w,
int h,
org.apache.fop.pdf.PDFPathPaint stroke)
|
protected void |
addRect(int x,
int y,
int w,
int h,
org.apache.fop.pdf.PDFPathPaint stroke,
org.apache.fop.pdf.PDFPathPaint fill)
|
protected void |
doFrame(org.apache.fop.layout.Area area)
Override the doFrame(Area area) method so that we draw lines rather than rectangles when processing an area. |
protected void |
drawImageClipped(int x,
int y,
int clipX,
int clipY,
int clipW,
int clipH,
org.apache.fop.image.FopImage image,
org.apache.fop.layout.FontState fs)
|
protected void |
drawImageScaled(int x,
int y,
int w,
int h,
org.apache.fop.image.FopImage image,
org.apache.fop.layout.FontState fs)
|
void |
render(org.apache.fop.layout.Page page,
java.io.OutputStream stream)
|
void |
renderForeignObjectArea(org.apache.fop.layout.inline.ForeignObjectArea area)
|
void |
renderPage(org.apache.fop.layout.Page page)
|
void |
renderSVGArea(org.apache.fop.svg.SVGArea area)
|
void |
renderWordArea(org.apache.fop.layout.inline.WordArea area)
|
void |
setLandscapeRotation(int rotation)
Sets the rotation to be used for landsacpe pages, valid values are 0, 90, 180, 270 (default). |
void |
setOptions(java.util.Map options)
|
void |
setPortraitRotation(int rotation)
Sets the rotation to be used for portrait pages, valid values are 0 (default), 90, 180, 270. |
void |
setProducer(java.lang.String producer)
|
void |
setupFontInfo(org.apache.fop.layout.FontInfo fontInfo)
set up the font info |
void |
startRenderer(java.io.OutputStream outputStream)
|
void |
stopRenderer(java.io.OutputStream outputStream)
|
Methods inherited from class org.apache.fop.render.PrintRenderer |
addFilledRect, addWordLines, renderDisplaySpace, renderInlineSpace, renderLeaderArea |
Methods inherited from class org.apache.fop.render.AbstractRenderer |
doBackground, drawImage, getIDReferences, renderAreaContainer, renderBlockArea, renderBodyAreaContainer, renderImageArea, 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 |
protected static final org.apache.commons.logging.Log LOGGER
Constructor Detail |
public AFPRenderer()
Method Detail |
protected void addLine(int x1, int y1, int x2, int y2, int th, int rs, org.apache.fop.pdf.PDFPathPaint stroke)
x1
- the start x location in millipointsy1
- the start y location in millipointsx2
- the end x location in millipointsy2
- the end y location in millipointsth
- the thickness in millipointsrs
- the rule stylestroke
- the stroke color/gradientprotected void addLine(int x1, int y1, int x2, int y2, int th, org.apache.fop.pdf.PDFPathPaint stroke)
x1
- the start x location in millipointsy1
- the start y location in millipointsx2
- the end x location in millipointsy2
- the end y location in millipointsth
- the thickness in millipointsstroke
- the stroke color/gradientprotected void addRect(int x, int y, int w, int h, org.apache.fop.pdf.PDFPathPaint stroke, org.apache.fop.pdf.PDFPathPaint fill)
PrintRenderer.addRect(int, int, int, int,
PDFPathPaint, PDFPathPaint)
protected void addRect(int x, int y, int w, int h, org.apache.fop.pdf.PDFPathPaint stroke)
PrintRenderer.addRect(int, int, int, int,
PDFPathPaint)
protected void addFilledRect(int x, int y, int w, int h, org.apache.fop.pdf.PDFPathPaint fill)
x
- the x position of left edge in millipointsy
- the y position of top edge in millipointsw
- the width in millipointsh
- the height in millipointsfill
- the fill color/gradientpublic void renderForeignObjectArea(org.apache.fop.layout.inline.ForeignObjectArea area)
Renderer.renderForeignObjectArea(ForeignObjectArea)
public void renderPage(org.apache.fop.layout.Page page)
Renderer.renderPage(Page)
public void renderSVGArea(org.apache.fop.svg.SVGArea area)
Renderer.renderSVGArea(SVGArea)
public void renderWordArea(org.apache.fop.layout.inline.WordArea area)
Renderer.renderWordArea(WordArea)
public void setProducer(java.lang.String producer)
Renderer.setProducer(String)
protected void drawImageClipped(int x, int y, int clipX, int clipY, int clipW, int clipH, org.apache.fop.image.FopImage image, org.apache.fop.layout.FontState fs)
AbstractRenderer.drawImageClipped(int, int,
int, int, int, int, FopImage, FontState)
protected void doFrame(org.apache.fop.layout.Area area)
protected void drawImageScaled(int x, int y, int w, int h, org.apache.fop.image.FopImage image, org.apache.fop.layout.FontState fs)
AbstractRenderer.drawImageScaled(int, int,
int, int, FopImage, FontState)
public void render(org.apache.fop.layout.Page page, java.io.OutputStream stream) throws java.io.IOException
java.io.IOException
Renderer.render(Page, OutputStream)
public void startRenderer(java.io.OutputStream outputStream) throws java.io.IOException
java.io.IOException
Renderer.startRenderer(java.io.OutputStream)
public void stopRenderer(java.io.OutputStream outputStream) throws java.io.IOException
java.io.IOException
Renderer.stopRenderer(java.io.OutputStream)
public void setOptions(java.util.Map options)
Renderer.setOptions(Map)
public void setupFontInfo(org.apache.fop.layout.FontInfo fontInfo) throws org.apache.fop.apps.FOPException
fontInfo
- font info to set up
org.apache.fop.apps.FOPException
public void setPortraitRotation(int rotation)
rotation
- The rotation in degrees.public void setLandscapeRotation(int rotation)
rotation
- The rotation in degrees.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |