|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.output.OutputTarget
org.foray.render.Renderer
org.foray.render.PrintRenderer
org.foray.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 PostScript code
generated follows the Document Structuring Conventions (DSC) version 3.0.
Field Summary |
---|
Fields inherited from class org.foray.render.Renderer |
---|
SHADING_WEIGHT_BLUE, SHADING_WEIGHT_GREEN, SHADING_WEIGHT_RED |
Constructor Summary | |
---|---|
PSRenderer(org.apache.commons.logging.Log logger,
org.axsl.output.DocumentConfiguration renderConfig,
org.axsl.ps.PsServer psServer)
Constructor. |
Method Summary | |
---|---|
protected void |
addFilledRect(int x,
int y,
int w,
int h,
Color col)
Draw a filled rectangle. |
protected void |
comment(String comment)
Write out a comment, iff comments are enabled. |
protected void |
drawGraphic(org.axsl.galley.GraphicArea area,
org.axsl.graphic.Graphic image,
Rectangle contentRectangle,
Rectangle clipRectangle)
Renders a Graphic to a given contentRectangle, and clipping it to a given clip rectangle. |
protected void |
drawImageClipped(org.axsl.galley.GraphicArea area,
org.axsl.graphic.Graphic image,
int x,
int y,
int clipW,
int clipH)
Draw a given image, clipping it to a given rectangle. |
protected void |
drawLine(int startX,
int startY,
int endX,
int endY,
int thickness,
org.axsl.common.value.RuleStyle ruleStyle,
Color strokeColor)
Draw a line in the output document. |
protected void |
drawRectangle(int x,
int y,
int w,
int h,
Color strokeColor,
Color fillColor)
Draw a rectangle in the output document. |
byte[] |
epsToPostScript(org.axsl.graphic.EpsGraphic image,
int x,
int y,
int w,
int h)
Converts an EPS graphic to the bytes that represent it in PostScript. |
String |
getFontName(org.axsl.font.FontUse fontUse)
|
String |
getGradientName(org.axsl.common.Gradient gradient)
|
org.axsl.output.DocumentConfiguration |
getOutputConfiguration()
Returns the output configuration for this renderer. |
int |
getPSLevel()
Returns the PostScript level being used. |
boolean |
isAutoRotateLandscape()
Indicates whether auto-rotate landscape is active. |
protected void |
markBorder(org.axsl.galley.BorderPaddingArea area)
Marks the border, if any, for the given area. |
void |
render(org.axsl.galley.BookmarkTree area)
Render the bookmark tree for this document. |
void |
render(org.axsl.galley.ForeignContentMath area)
Render the MathML content of a ForeignObjectArea . |
void |
render(org.axsl.galley.ForeignContentSvg area)
Render the SVG content of a ForeignObjectArea . |
void |
render(org.axsl.galley.LeaderArea area)
Render a line area to PostScript. |
void |
render(org.axsl.galley.Page page)
|
void |
renderBitmap(org.axsl.graphic.Graphic img,
int x,
int y,
int w,
int h)
Renders a raster image to PostScript. |
void |
renderEPS(org.axsl.graphic.EpsGraphic img,
int x,
int y,
int w,
int h)
Write an EPS graphic. |
protected void |
renderSVGDocument(org.axsl.graphic.SvgGraphic svgGraphic,
Rectangle2D contentRectangle,
org.axsl.galley.Area area)
Render an SVG document to PostScript. |
void |
renderTextSegment(org.axsl.galley.TextArea area,
CharSequence text)
render an image area to PostScript |
void |
resetTextCursor()
Provides the Renderer with an opportunity to close any text objects that are in progress. |
void |
setAutoRotateLandscape(boolean value)
Sets the flag indicating whether auto-rotate landscape is active. |
void |
setPSLevel(int level)
Sets the PostScript Level to generate. |
void |
startOutput()
|
void |
stopOutput()
|
void |
useFont(PSFont psFont,
int size)
Sets the font and/or font size to be used. |
protected void |
write(String cmd)
Write out a command, appending a linefeed. |
protected void |
writeFontDict()
Write the font dictionary. |
protected void |
writeProcs()
Write the document procedures. |
protected void |
writeRaw(CharSequence cmd)
Write out a command (with no linefeed appended). |
Methods inherited from class org.foray.render.PrintRenderer |
---|
getFontSources, getOverlineYPosition, getThroughYPosition, getUnderlineYPosition, render, renderGenericSpace |
Methods inherited from class org.foray.render.Renderer |
---|
colorToFloat, convertMillipointRectangle, getAreaTree, getPixelsPerInch, markBackground, render, render, render, render, render, render, render, render, render, render, render, render, render, render, renderChildren, renderDocumentNodes, renderRegions, setGalley, shadingPercent, toPoints |
Methods inherited from class org.foray.output.OutputTarget |
---|
getApplicationName, getApplicationNameShort, getApplicationVersion, getDeveloperURLShort, getFontConsumer, getLogger, getOutputStream, getStrokeSVGText, outputStreamRequired, setApplicationName, setApplicationNameShort, setApplicationVersion, setDeveloperUrlShort, setFontConsumer, setOutputStream, setStrokeText |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.axsl.output.OutputTarget |
---|
outputStreamRequired, setApplicationName, setApplicationNameShort, setApplicationVersion, setDeveloperUrlShort, setFontConsumer, setOutputStream, setStrokeText |
Constructor Detail |
---|
public PSRenderer(org.apache.commons.logging.Log logger, org.axsl.output.DocumentConfiguration renderConfig, org.axsl.ps.PsServer psServer)
logger
- The logger.renderConfig
- The configuration for this renderer.psServer
- The PostScript server to be used for this render process.Method Detail |
---|
public void setPSLevel(int level)
level
- You can specify either 2 or 3 for the PostScript Levelpublic int getPSLevel()
public void setAutoRotateLandscape(boolean value)
value
- The new auto-rotate landscape mode.public boolean isAutoRotateLandscape()
protected void write(String cmd) throws IOException
cmd
- The PostScript command to write.
IOException
- For errors writing to output.protected void writeRaw(CharSequence cmd) throws IOException
cmd
- The PostScript command to write.
IOException
- For errors writing to output.protected void comment(String comment) throws IOException
comment
- The comment to be written.
IOException
- For errors writing to output.protected void writeProcs() throws IOException
IOException
- For errors writing to output.protected void writeFontDict() throws IOException
IOException
- For errors writing to output.protected void drawLine(int startX, int startY, int endX, int endY, int thickness, org.axsl.common.value.RuleStyle ruleStyle, Color strokeColor)
Renderer
drawLine
in class Renderer
startX
- The start x location in millipoints.startY
- The start y location in millipoints.endX
- The end x location in millipoints.endY
- The end y location in millipoints.thickness
- The thickness in millipoints.ruleStyle
- The rule style.strokeColor
- The stroke color.protected void drawRectangle(int x, int y, int w, int h, Color strokeColor, Color fillColor)
Renderer
drawRectangle
in class Renderer
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.strokeColor
- The color to be used for the stroke.
Stroked means a box will be drawn around the rectangle.
Set to null if the rectangle should not be stroked.fillColor
- The color to be used for the fill.
Set to null if the rectangle should not be filled.protected void addFilledRect(int x, int y, int w, int h, Color col) throws IOException
x
- The x coordinate of the rectangle.y
- The y coordinate of the rectangle.w
- The width of the rectangle.h
- The height of the rectangle.col
- The fill color.
IOException
- For errors writing to output.public void render(org.axsl.galley.ForeignContentSvg area) throws org.axsl.galley.GalleyVisitorException
Renderer
ForeignObjectArea
.
render
in class Renderer
area
- The SVG content to be rendered.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.protected void renderSVGDocument(org.axsl.graphic.SvgGraphic svgGraphic, Rectangle2D contentRectangle, org.axsl.galley.Area area) throws IOException
svgGraphic
- The SVG graphic to be rendered.contentRectangle
- The rectangle in which the content of the SVG
should be rendered.area
- The area containing the graphic to be rendered.
IOException
- For errors writing to output.public void render(org.axsl.galley.ForeignContentMath area)
Renderer
ForeignObjectArea
.
render
in class Renderer
area
- The MathML content to be rendered.protected void drawGraphic(org.axsl.galley.GraphicArea area, org.axsl.graphic.Graphic image, Rectangle contentRectangle, Rectangle clipRectangle) throws org.axsl.galley.GalleyVisitorException
Renderer
drawGraphic
in class Renderer
area
- The Area instance from which to obtain traits.image
- The graphic to be rendered.contentRectangle
- The rectangle to which the graphic should be
scaled during drawing.clipRectangle
- The rectangle to which the content should be clipped
after any scaling.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.Renderer.drawGraphic(GraphicArea, Graphic, Rectangle, Rectangle)
protected void drawImageClipped(org.axsl.galley.GraphicArea area, org.axsl.graphic.Graphic image, int x, int y, int clipW, int clipH) throws org.axsl.galley.GalleyVisitorException
area
- The area containing the graphic.image
- The image to be drawn.x
- The x coordinate of the image.y
- The y coordinate of the image.clipW
- The width to which the image should be clipped.clipH
- The height to which the image should be clipped.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public void renderEPS(org.axsl.graphic.EpsGraphic img, int x, int y, int w, int h) throws org.axsl.galley.GalleyVisitorException
img
- The EPS graphic to be drawn.x
- The x coordinate of the rectangle in which the graphic should
be drawn.y
- The y coordinate of the rectangle in which the graphic should
be drawn.w
- The width of the rectangle in which the graphic should be drawn.h
- The height of the rectangle in which the graphic should be
drawn.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public byte[] epsToPostScript(org.axsl.graphic.EpsGraphic image, int x, int y, int w, int h) throws org.axsl.graphic.GraphicException
image
- The EPS graphic to be converted.x
- The x coordinate of the rectangle in which the graphic should
be drawn.y
- The y coordinate of the rectangle in which the graphic should
be drawn.w
- The width of the rectangle in which the graphic should be drawn.h
- The height of the rectangle in which the graphic should be
drawn.
org.axsl.graphic.GraphicException
- For errors processing the graphic.public void renderBitmap(org.axsl.graphic.Graphic img, int x, int y, int w, int h) throws IOException
img
- The image to be rendered.x
- The x coordinate of the rectangle in which the graphic should
be drawn.y
- The y coordinate of the rectangle in which the graphic should
be drawn.w
- The width of the rectangle in which the graphic should be drawn.h
- The height of the rectangle in which the graphic should be
drawn.
IOException
- For errors writing to output.public void renderTextSegment(org.axsl.galley.TextArea area, CharSequence text) throws org.axsl.galley.GalleyVisitorException
renderTextSegment
in class Renderer
area
- the area to rendertext
- The text content to be rendered.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public void useFont(PSFont psFont, int size) throws IOException
psFont
- The font to be used.size
- The font size to be used.
IOException
- For errors writing to output.public void render(org.axsl.galley.LeaderArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
render
in class PrintRenderer
area
- the area to render
org.axsl.galley.GalleyVisitorException
public void render(org.axsl.galley.BookmarkTree area)
Renderer
render
in class Renderer
area
- The bookmark tree to be rendered.protected void markBorder(org.axsl.galley.BorderPaddingArea area) throws org.axsl.galley.GalleyVisitorException
Renderer
markBorder
in class PrintRenderer
area
- The area whose border is to be drawn.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public void startOutput() throws org.axsl.output.OutputException
startOutput
in interface org.axsl.output.OutputTarget
org.axsl.output.OutputException
public void stopOutput() throws org.axsl.output.OutputException
stopOutput
in interface org.axsl.output.OutputTarget
org.axsl.output.OutputException
public void render(org.axsl.galley.Page page) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.output.Renderer
render
in class Renderer
org.axsl.galley.GalleyVisitorException
public void resetTextCursor()
Renderer
resetTextCursor
in class Renderer
public String getFontName(org.axsl.font.FontUse fontUse)
getFontName
in interface org.axsl.graphic.output.GraphicOutputContext
public String getGradientName(org.axsl.common.Gradient gradient)
getGradientName
in interface org.axsl.graphic.output.GraphicOutputContext
public org.axsl.output.DocumentConfiguration getOutputConfiguration()
OutputTarget
getOutputConfiguration
in class PrintRenderer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |