Abstract base class for all renderers. The Abstract renderer does all the
top level processing of the area tree and adds some abstract methods to
handle viewports. This keeps track of the current block and inline position.
convertTitleToString
protected String convertTitleToString(LineArea title)
Utility method to convert a page sequence title to a string. Some
renderers may only be able to use a string title. A title is a sequence
of inline areas that this method attempts to convert to an equivalent
string.
title
- The Title to convert
- An expanded string representing the title
endVParea
protected abstract void endVParea()
Signals exit from a viewport area. Subclasses can restore transformation matrices
valid before the viewport area was started.
getCurrentPageViewport
protected PageViewport getCurrentPageViewport()
- the current PageViewport or null, if none is active
getMimeType
public String getMimeType()
Get the MIME type of the renderer.
- getMimeType in interface Renderer
- The MIME type of the renderer
getUserAgent
public FOUserAgent getUserAgent()
- the associated
FOUserAgent
handleBlockTraits
protected void handleBlockTraits(Block block)
Handle block traits.
This method is called when the correct ip and bp posiiton is
set. This should be overridden to draw border and background
traits for the block area.
handleRegionTraits
protected void handleRegionTraits(RegionViewport rv)
Handle the traits for a region
This is used to draw the traits for the given page region.
(See Sect. 6.4.1.2 of XSL-FO spec.)
rv
- the RegionViewport whose region is to be drawn
mptToPt
protected AffineTransform mptToPt(AffineTransform at)
Converts a millipoint-based transformation matrix to points.
at
- a millipoint-based transformation matrix
- a point-based transformation matrix
ptToMpt
protected AffineTransform ptToMpt(AffineTransform at)
Converts a point-based transformation matrix to millipoints.
at
- a point-based transformation matrix
- a millipoint-based transformation matrix
renderBeforeFloat
protected void renderBeforeFloat(BeforeFloat bf)
Renders a before float area.
bf
- The before float area
renderBlock
protected void renderBlock(Block block)
Renders a block area.
renderBlockViewport
protected void renderBlockViewport(BlockViewport bv,
List children)
Renders a block viewport.
bv
- The block viewportchildren
- The children to render within the block viewport
renderBlocks
protected void renderBlocks(Block parent,
List blocks)
Renders a list of block areas.
parent
- the parent block if the parent is a block, otherwise
a null value.blocks
- The block areas
renderBodyRegion
protected void renderBodyRegion(BodyRegion region)
Renders a body region area.
renderCharacter
protected void renderCharacter(Character ch)
Only TextArea should be used. This method will be removed eventually.
Render the given Character.
ch
- the character to render
renderContainer
protected void renderContainer(Container cont)
Tells the renderer to render an inline container.
cont
- The inline container area
renderFlow
protected void renderFlow(NormalFlow flow)
Renders a flow reference area.
flow
- The flow reference area
renderFootnote
protected void renderFootnote(Footnote footnote)
Renders a footnote
renderForeignObject
public void renderForeignObject(ForeignObject fo,
Rectangle2D pos)
Renders a foreign object area.
fo
- The foreign object areapos
- The target position of the foreign object
(todo) Make renderForeignObject() protected
renderImage
public void renderImage(Image image,
Rectangle2D pos)
Renders an image area.
image
- The imagepos
- The target position of the image
(todo) Make renderImage() protected
renderInlineArea
protected void renderInlineArea(InlineArea inlineArea)
Render the given InlineArea.
inlineArea
- inline area text to render
renderInlineAreaBackAndBorders
protected abstract void renderInlineAreaBackAndBorders(InlineArea area)
Common method to render the background and borders for any inline area.
The all borders and padding are drawn outside the specified area.
area
- the inline area for which the background, border and padding is to be
rendered
renderInlineBlockParent
protected void renderInlineBlockParent(InlineBlockParent ibp)
Render the given InlineBlockParent.
ibp
- the inline block parent to render
renderInlineParent
protected void renderInlineParent(InlineParent ip)
Render the given InlineParent.
ip
- the inline parent to render
renderInlineSpace
protected void renderInlineSpace(Space space)
Render the given Space.
space
- the space to render
renderLeader
protected void renderLeader(Leader area)
Render the given Leader.
area
- the leader to render
renderLineArea
protected void renderLineArea(LineArea line)
Renders a line area.
A line area may have grouped styling for its children such as underline,
background.
renderMainReference
protected void renderMainReference(MainReference mr)
Renders the main reference area.
The main reference area contains a list of spans that are
stacked on the page.
The spans contain a list of normal flow reference areas
that are positioned into columns.
mr
- The main reference area
renderPageAreas
protected void renderPageAreas(Page page)
Renders page areas.
page
- The page whos page areas are to be rendered
renderRegion
protected void renderRegion(RegionReference region)
Renders a region reference area.
region
- The region reference area
renderRegionViewport
protected void renderRegionViewport(RegionViewport port)
Renders a region viewport.
The region may clip the area and it establishes a position from where
the region is placed.
port
- The region viewport to be rendered
renderSpace
protected void renderSpace(SpaceArea space)
Render the given SpaceArea.
space
- the space to render
renderText
protected void renderText(TextArea text)
Render the given TextArea.
text
- the text to render
renderViewport
protected void renderViewport(Viewport viewport)
Render the given Viewport.
viewport
- the viewport to render
renderWord
protected void renderWord(WordArea word)
Render the given WordArea.
word
- the word to render
renderXML
public void renderXML(RendererContext ctx,
Document doc,
String namespace)
Render the xml document with the given xml namespace.
The Render Context is by the handle to render into the current
rendering target.
ctx
- rendering contextdoc
- DOM Document containing the source documentnamespace
- Namespace URI of the document
startRenderer
public void startRenderer(OutputStream outputStream)
throws IOException
- startRenderer in interface Renderer
startVParea
protected abstract void startVParea(CTM ctm,
Rectangle2D clippingRect)
Establishes a new viewport area.
ctm
- the coordinate transformation matrix to useclippingRect
- the clipping rectangle if the viewport should be clipping,
null if no clipping is performed.
supportsOutOfOrder
public boolean supportsOutOfOrder()
Check if this renderer supports out of order rendering. If this renderer
supports out of order rendering then it means that the pages that are
not ready will be prepared and a future page will be rendered.
- supportsOutOfOrder in interface Renderer
- True if the renderer supports out of order rendering