|
fop 0.94 | |||||||||
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.AbstractPathOrientedRenderer
org.apache.fop.render.ps.PSRenderer
public class PSRenderer
Renderer that renders to PostScript.
This class currently generates PostScript Level 2 code. The only exception
is the FlateEncode filter which is a Level 3 feature. The filters in use
are hardcoded at the moment.
This class follows the Document Structuring Conventions (DSC) version 3.0.
If anyone modifies this renderer please make
sure to also follow the DSC to make it simpler to programmatically modify
the generated Postscript files (ex. extract pages etc.).
This renderer inserts FOP-specific comments into the PostScript stream which
may help certain users to do certain types of post-processing of the output.
These comments all start with "%FOP".
Field Summary | |
---|---|
protected org.apache.xmlgraphics.ps.PSGenerator |
gen
The PostScript generator used to output the PostScript |
static java.lang.String |
MIME_TYPE
The MIME type for PostScript |
Fields inherited from class org.apache.fop.render.PrintRenderer |
---|
fontInfo, fontList, fontResolver |
Fields inherited from class org.apache.fop.render.AbstractRenderer |
---|
containingBPPosition, containingIPPosition, currentBPPosition, currentIPPosition, currentPageViewport, userAgent |
Fields inherited from interface org.apache.fop.render.Renderer |
---|
ROLE |
Constructor Summary | |
---|---|
PSRenderer()
|
Method Summary | |
---|---|
protected void |
beginTextObject()
Indicates the beginning of a text object. |
protected java.util.List |
breakOutOfStateStack()
Breaks out of the state stack to handle fixed block-containers. |
protected void |
clip()
Clip using the current path. |
protected void |
clipRect(float x,
float y,
float width,
float height)
Clip an area. |
protected void |
closePath()
Closes the current subpath by appending a straight line segment from the current point to the starting point of the subpath. |
protected void |
comment(java.lang.String comment)
Write out a comment |
protected void |
concatMatrix(double[] matrix)
Concats the transformations matrix. |
protected void |
concatMatrix(double a,
double b,
double c,
double d,
double e,
double f)
Concats the transformation matrix. |
protected RendererContext |
createRendererContext(int x,
int y,
int width,
int height,
java.util.Map foreignAttributes)
Creates a RendererContext for an image. |
protected void |
drawBackAndBorders(Area area,
float startx,
float starty,
float width,
float height)
Draw the background and borders. |
protected void |
drawBorderLine(float x1,
float y1,
float x2,
float y2,
boolean horz,
boolean startOrBefore,
int style,
java.awt.Color col)
Draw a border segment of an XSL-FO style border. |
protected void |
drawImage(java.lang.String uri,
java.awt.geom.Rectangle2D pos,
java.util.Map foreignAttributes)
Draw an image at the indicated location. |
protected void |
endTextObject()
Indicates the end of a text object. |
protected void |
endVParea()
Signals exit from a viewport area. |
protected void |
fillRect(float x,
float y,
float width,
float height)
Fill a rectangular area. |
protected org.apache.xmlgraphics.ps.PSResource |
getFormForImage(java.lang.String uri,
FopImage fopimage)
|
Graphics2DAdapter |
getGraphics2DAdapter()
|
ImageAdapter |
getImageAdapter()
|
java.lang.String |
getMimeType()
Get the MIME type of the renderer. |
protected org.apache.xmlgraphics.ps.PSResource |
getPSResourceForFontKey(java.lang.String key)
Returns the PSResource for the given font key. |
protected void |
handleIOTrouble(java.io.IOException ioe)
Central exception handler for I/O exceptions. |
boolean |
isAutoRotateLandscape()
|
protected boolean |
isImageInlined(java.lang.String uri,
FopImage image)
|
protected void |
lineTo(float x,
float y)
Appends a straight line segment from the current point to (x, y). |
protected void |
moveTo(float x,
float y)
Moves the current point to (x, y), omitting any connecting line segment. |
protected void |
movetoCurrPosition()
Make sure the cursor is in the right place. |
void |
paintImage(java.awt.image.RenderedImage image,
RendererContext context,
int x,
int y,
int width,
int height)
Paints an image at the given position. |
void |
processOffDocumentItem(OffDocumentItem oDI)
Tells the renderer to process an item not explicitly placed on the document (e.g., PDF bookmarks). |
protected void |
renderBlockViewport(BlockViewport bv,
java.util.List children)
Renders a block viewport. |
void |
renderImage(Image image,
java.awt.geom.Rectangle2D pos)
Renders an image area. |
protected void |
renderInlineParent(InlineParent ip)
Render the given InlineParent. |
void |
renderLeader(Leader area)
Render the given Leader. |
void |
renderPage(PageViewport page)
Tells the renderer to render a particular page. |
protected void |
renderRegionViewport(RegionViewport port)
Renders a region viewport. |
protected void |
renderSpace(SpaceArea space)
Render the given SpaceArea. |
void |
renderText(TextArea area)
Render the given TextArea. |
protected void |
renderWord(WordArea word)
Render the given WordArea. |
void |
restoreGraphicsState()
Restores the last graphics state of the rendering engine. |
protected void |
restoreStateStackAfterBreakOut(java.util.List breakOutList)
Restores the state stack after a break out. |
protected void |
rmoveTo(float x,
float y)
Moves the current point by (x, y) relative to the current position, omitting any connecting line segment. |
void |
saveGraphicsState()
Saves the graphics state of the rendering engine. |
void |
setAutoRotateLandscape(boolean value)
Sets the landscape mode for this renderer. |
void |
setUserAgent(FOUserAgent agent)
Set the User Agent. |
void |
startPageSequence(LineArea seqTitle)
Tells the renderer that a new page sequence starts. |
void |
startRenderer(java.io.OutputStream outputStream)
Initiates the rendering phase. |
protected void |
startVParea(CTM ctm,
java.awt.geom.Rectangle2D clippingRect)
Establishes a new viewport area. |
void |
stopRenderer()
Signals the end of the rendering phase. |
protected void |
updateColor(java.awt.Color col,
boolean fill)
Establishes a new foreground or fill color. |
protected void |
useFont(java.lang.String key,
int size)
Changes the currently used font. |
protected void |
writeln(java.lang.String cmd)
Write out a command |
Methods inherited from class org.apache.fop.render.AbstractPathOrientedRenderer |
---|
drawBorders, drawImage, handleBlockTraits, handleRegionTraits, renderForeignObject, renderInlineAreaBackAndBorders, renderTextDecoration, renderViewport |
Methods inherited from class org.apache.fop.render.PrintRenderer |
---|
addFontList, getFontFromArea, getFontResolver, getInternalFontNameForArea, lightenColor, renderDocument, setFontList, setupFontInfo |
Methods inherited from class org.apache.fop.render.AbstractRenderer |
---|
convertTitleToString, getCurrentPageViewport, getUserAgent, preparePage, renderBeforeFloat, renderBlock, renderBlocks, renderBodyRegion, renderCharacter, renderContainer, renderFlow, renderFootnote, renderInlineArea, renderInlineBlockParent, renderInlineSpace, renderLineArea, renderMainReference, renderPageAreas, renderRegion, renderXML, supportsOutOfOrder |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MIME_TYPE
protected org.apache.xmlgraphics.ps.PSGenerator gen
Constructor Detail |
---|
public PSRenderer()
Method Detail |
---|
public void setUserAgent(FOUserAgent agent)
Renderer
setUserAgent
in interface Renderer
setUserAgent
in class AbstractRenderer
agent
- The User AgentRenderer.setUserAgent(FOUserAgent)
public void setAutoRotateLandscape(boolean value)
value
- false will normally generate a "pseudo-portrait" page, true will rotate
a "wider-than-long" page by 90 degrees.public boolean isAutoRotateLandscape()
public Graphics2DAdapter getGraphics2DAdapter()
getGraphics2DAdapter
in interface Renderer
getGraphics2DAdapter
in class AbstractRenderer
Renderer.getGraphics2DAdapter()
public ImageAdapter getImageAdapter()
getImageAdapter
in interface Renderer
getImageAdapter
in class AbstractRenderer
Renderer.getImageAdapter()
protected void writeln(java.lang.String cmd)
cmd
- PostScript commandprotected void handleIOTrouble(java.io.IOException ioe)
ioe
- IOException to handleprotected void comment(java.lang.String comment)
comment
- Comment to writeprotected void movetoCurrPosition()
protected void clip()
AbstractPathOrientedRenderer
clip
in class AbstractPathOrientedRenderer
AbstractPathOrientedRenderer.clip()
protected void clipRect(float x, float y, float width, float height)
clipRect
in class AbstractPathOrientedRenderer
x
- the x coordinatey
- the y coordinatewidth
- the width of the areaheight
- the height of the areaprotected void moveTo(float x, float y)
AbstractPathOrientedRenderer
moveTo
in class AbstractPathOrientedRenderer
x
- x coordinatey
- y coordinateAbstractPathOrientedRenderer.moveTo(float, float)
protected void rmoveTo(float x, float y)
x
- x coordinatey
- y coordinateprotected void lineTo(float x, float y)
AbstractPathOrientedRenderer
lineTo
in class AbstractPathOrientedRenderer
x
- x coordinatey
- y coordinateAbstractPathOrientedRenderer.lineTo(float, float)
protected void closePath()
AbstractPathOrientedRenderer
closePath
in class AbstractPathOrientedRenderer
AbstractPathOrientedRenderer.closePath()
protected void fillRect(float x, float y, float width, float height)
AbstractPathOrientedRenderer
fillRect
in class AbstractPathOrientedRenderer
x
- the x coordinatey
- the y coordinatewidth
- the width of the rectangleheight
- the height of the rectangleAbstractPathOrientedRenderer
protected void updateColor(java.awt.Color col, boolean fill)
AbstractPathOrientedRenderer
updateColor
in class AbstractPathOrientedRenderer
col
- the color to apply (null skips this operation)fill
- true to set the fill color, false for the foreground colorAbstractPathOrientedRenderer
protected void drawImage(java.lang.String uri, java.awt.geom.Rectangle2D pos, java.util.Map foreignAttributes)
AbstractPathOrientedRenderer
drawImage
in class AbstractPathOrientedRenderer
uri
- the URI/URL of the imagepos
- the position of the imageforeignAttributes
- an optional Map with foreign attributes, may be nullAbstractPathOrientedRenderer
protected org.apache.xmlgraphics.ps.PSResource getFormForImage(java.lang.String uri, FopImage fopimage)
protected boolean isImageInlined(java.lang.String uri, FopImage image)
public void paintImage(java.awt.image.RenderedImage image, RendererContext context, int x, int y, int width, int height) throws java.io.IOException
ImageAdapter
paintImage
in interface ImageAdapter
image
- the image which will be paintedcontext
- the renderer context for the current rendererx
- X position of the imagey
- Y position of the imagewidth
- width of the imageheight
- height of the image
java.io.IOException
- In case of an I/O error while writing the output formatImageAdapter
public void saveGraphicsState()
saveGraphicsState
in class AbstractPathOrientedRenderer
public void restoreGraphicsState()
restoreGraphicsState
in class AbstractPathOrientedRenderer
protected void concatMatrix(double a, double b, double c, double d, double e, double f)
a
- A partb
- B partc
- C partd
- D parte
- E partf
- F partprotected void concatMatrix(double[] matrix)
matrix
- Matrix to useprotected org.apache.xmlgraphics.ps.PSResource getPSResourceForFontKey(java.lang.String key)
key
- the font key ("F*")
protected void useFont(java.lang.String key, int size)
key
- key of the font ("F*")size
- font sizeprotected void drawBackAndBorders(Area area, float startx, float starty, float width, float height)
AbstractPathOrientedRenderer
drawBackAndBorders
in class AbstractPathOrientedRenderer
area
- the area to get the traits fromstartx
- the start x positionstarty
- the start y positionwidth
- the width of the areaheight
- the height of the areaAbstractPathOrientedRenderer.drawBackAndBorders(
Area, float, float, float, float)
protected void drawBorderLine(float x1, float y1, float x2, float y2, boolean horz, boolean startOrBefore, int style, java.awt.Color col)
AbstractPathOrientedRenderer
drawBorderLine
in class AbstractPathOrientedRenderer
x1
- starting x coordinatey1
- starting y coordinatex2
- ending x coordinatey2
- ending y coordinatehorz
- true for horizontal border segments, false for vertical border segmentsstartOrBefore
- true for border segments on the start or before edge,
false for end or after.style
- the border style (one of Constants.EN_DASHED etc.)col
- the color for the border segmentAbstractPathOrientedRenderer
public void startRenderer(java.io.OutputStream outputStream) throws java.io.IOException
Renderer
startRenderer
in interface Renderer
startRenderer
in class AbstractRenderer
outputStream
- The OutputStream to use for output
java.io.IOException
- If an I/O error occursRenderer.startRenderer(OutputStream)
public void stopRenderer() throws java.io.IOException
Renderer
stopRenderer
in interface Renderer
stopRenderer
in class AbstractRenderer
java.io.IOException
- If an I/O error occursRenderer.stopRenderer()
public void processOffDocumentItem(OffDocumentItem oDI)
Renderer
processOffDocumentItem
in interface Renderer
processOffDocumentItem
in class AbstractRenderer
oDI
- The off-document item to be renderedRenderer
public void startPageSequence(LineArea seqTitle)
Renderer
startPageSequence
in interface Renderer
startPageSequence
in class AbstractRenderer
seqTitle
- The title of the page sequenceRenderer.startPageSequence(org.apache.fop.area.LineArea)
public void renderPage(PageViewport page) throws java.io.IOException, FOPException
Renderer
renderPage
in interface Renderer
renderPage
in class AbstractRenderer
page
- The page to be rendered
java.io.IOException
- if an I/O error occurs
FOPException
- if a FOP interal error occurs.Renderer.renderPage(PageViewport)
protected void renderRegionViewport(RegionViewport port)
AbstractRenderer
The region may clip the area and it establishes a position from where the region is placed.
renderRegionViewport
in class AbstractRenderer
port
- The region viewport to be renderedAbstractRenderer
protected void beginTextObject()
beginTextObject
in class AbstractPathOrientedRenderer
protected void endTextObject()
endTextObject
in class AbstractPathOrientedRenderer
public void renderText(TextArea area)
AbstractRenderer
renderText
in class AbstractRenderer
area
- the text to renderAbstractRenderer.renderText(TextArea)
protected void renderWord(WordArea word)
AbstractRenderer
renderWord
in class AbstractRenderer
word
- the word to renderAbstractRenderer.renderWord(org.apache.fop.area.inline.WordArea)
protected void renderSpace(SpaceArea space)
AbstractRenderer
renderSpace
in class AbstractRenderer
space
- the space to renderAbstractRenderer.renderSpace(org.apache.fop.area.inline.SpaceArea)
protected java.util.List breakOutOfStateStack()
AbstractPathOrientedRenderer
breakOutOfStateStack
in class AbstractPathOrientedRenderer
AbstractPathOrientedRenderer.breakOutOfStateStack()
protected void restoreStateStackAfterBreakOut(java.util.List breakOutList)
AbstractPathOrientedRenderer
restoreStateStackAfterBreakOut
in class AbstractPathOrientedRenderer
breakOutList
- the state stack to restore.AbstractPathOrientedRenderer
protected void startVParea(CTM ctm, java.awt.geom.Rectangle2D clippingRect)
AbstractRenderer
startVParea
in class AbstractRenderer
ctm
- the coordinate transformation matrix to useclippingRect
- the clipping rectangle if the viewport should be clipping,
null if no clipping is performed.AbstractRenderer.startVParea(CTM, Rectangle2D)
protected void endVParea()
AbstractRenderer
endVParea
in class AbstractRenderer
AbstractRenderer.endVParea()
protected void renderBlockViewport(BlockViewport bv, java.util.List children)
AbstractRenderer
renderBlockViewport
in class AbstractPathOrientedRenderer
bv
- The block viewportchildren
- The children to render within the block viewportAbstractRenderer
protected void renderInlineParent(InlineParent ip)
AbstractRenderer
renderInlineParent
in class AbstractRenderer
ip
- the inline parent to renderAbstractRenderer
public void renderLeader(Leader area)
AbstractRenderer
renderLeader
in class AbstractRenderer
area
- the leader to renderAbstractRenderer.renderLeader(org.apache.fop.area.inline.Leader)
public void renderImage(Image image, java.awt.geom.Rectangle2D pos)
AbstractRenderer
renderImage
in class AbstractRenderer
image
- The imagepos
- The target position of the image
(todo) Make renderImage() protectedAbstractRenderer.renderImage(Image, Rectangle2D)
protected RendererContext createRendererContext(int x, int y, int width, int height, java.util.Map foreignAttributes)
PrintRenderer
createRendererContext
in class PrintRenderer
x
- the x coordinate (in millipoints)y
- the y coordinate (in millipoints)width
- the width of the image (in millipoints)height
- the height of the image (in millipoints)foreignAttributes
- a Map or foreign attributes, may be null
PrintRenderer.createRendererContext(
int, int, int, int, java.util.Map)
public java.lang.String getMimeType()
AbstractRenderer
getMimeType
in interface Renderer
getMimeType
in class AbstractRenderer
AbstractRenderer
|
fop 0.94 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |