|
||||||||||
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
public abstract class Renderer
Abstract base class for all renderers. Subclasses produce output in some format from an AreaTree or AreaTree fragment.
Field Summary | |
---|---|
protected static float |
SHADING_WEIGHT_BLUE
Magic-number constant used in the conversion of color to gray. |
protected static float |
SHADING_WEIGHT_GREEN
Magic-number constant used in the conversion of color to gray. |
protected static float |
SHADING_WEIGHT_RED
Magic-number constant used in the conversion of color to gray. |
Constructor Summary | |
---|---|
Renderer(org.apache.commons.logging.Log logger)
Constructor. |
Method Summary | |
---|---|
protected static float |
colorToFloat(int integralColorComponent)
Converts a color value in the range 0 - 255 to its floating-point equivalant, that is, a value in the range 0 - 1. |
static Rectangle2D.Float |
convertMillipointRectangle(Rectangle input)
Converts a Rectangle storing millipoints to one storing points. |
protected abstract 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 abstract 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 abstract void |
drawRectangle(int x,
int y,
int w,
int h,
Color strokeColor,
Color fillColor)
Draw a rectangle in the output document. |
protected org.axsl.galley.Galley |
getAreaTree()
Returns the area tree being rendered. |
int |
getPixelsPerInch()
The pixel density, per inch, that should be used to compute image sizes when only the number of pixels is known. |
protected void |
markBackground(org.axsl.galley.BackgroundArea area)
Renders an area's background, both image and color. |
protected abstract void |
markBorder(org.axsl.galley.BorderPaddingArea area)
Marks the border, if any, for the given area. |
void |
render(org.axsl.galley.Area node)
|
void |
render(org.axsl.galley.AreaNode node)
|
void |
render(org.axsl.galley.BeforeFloatArea area)
|
void |
render(org.axsl.galley.BlockContainerArea area)
|
abstract void |
render(org.axsl.galley.BookmarkTree bookmarkTree)
Render the bookmark tree for this document. |
void |
render(org.axsl.galley.ExternalGraphicArea area)
|
void |
render(org.axsl.galley.FootnoteArea area)
|
abstract void |
render(org.axsl.galley.ForeignContentMath mathContent)
Render the MathML content of a ForeignObjectArea . |
abstract void |
render(org.axsl.galley.ForeignContentSvg svgContent)
Render the SVG content of a ForeignObjectArea . |
void |
render(org.axsl.galley.ForeignObjectArea area)
|
void |
render(org.axsl.galley.InlineArea area)
|
void |
render(org.axsl.galley.LineArea area)
|
void |
render(org.axsl.galley.MainReferenceArea area)
|
void |
render(org.axsl.galley.NormalBlockArea area)
|
abstract void |
render(org.axsl.galley.Page page)
|
void |
render(org.axsl.galley.RegionArea area)
|
void |
render(org.axsl.galley.TableArea area)
|
void |
render(org.axsl.galley.TableCellArea area)
|
void |
renderChildren(org.axsl.galley.AreaNode area)
Render the children of a given node. |
protected void |
renderDocumentNodes()
Renders all of the non-area AreaNodes, i.e. |
protected void |
renderRegions(org.axsl.galley.Page page)
Render a page's region areas. |
abstract void |
renderTextSegment(org.axsl.galley.TextArea area,
CharSequence text)
Renders an arbitrary text chunk with attributes from an arbitrary Area. |
abstract void |
resetTextCursor()
Provides the Renderer with an opportunity to close any text objects that are in progress. |
void |
setGalley(org.axsl.galley.Galley areaTree)
Sets the AreaTree to be rendered. |
protected static int |
shadingPercent(Color color)
Converts a color to a percentage of black. |
static float |
toPoints(int millipoints)
Converts millipoints to points. |
Methods inherited from class org.foray.output.OutputTarget |
---|
getApplicationName, getApplicationNameShort, getApplicationVersion, getDeveloperURLShort, getFontConsumer, getLogger, getOutputConfiguration, 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 |
---|
getFontSources, outputStreamRequired, setApplicationName, setApplicationNameShort, setApplicationVersion, setDeveloperUrlShort, setFontConsumer, setOutputStream, setStrokeText, startOutput, stopOutput |
Methods inherited from interface org.axsl.galley.RenderVisitor |
---|
render, render |
Field Detail |
---|
protected static final float SHADING_WEIGHT_RED
protected static final float SHADING_WEIGHT_GREEN
protected static final float SHADING_WEIGHT_BLUE
Constructor Detail |
---|
public Renderer(org.apache.commons.logging.Log logger)
logger
- The logger.Method Detail |
---|
public void setGalley(org.axsl.galley.Galley areaTree)
setGalley
in interface org.axsl.output.Renderer
areaTree
- The AreaTree to be rendered.public abstract void render(org.axsl.galley.Page page) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.output.Renderer
org.axsl.galley.GalleyVisitorException
protected abstract void markBorder(org.axsl.galley.BorderPaddingArea area) throws org.axsl.galley.GalleyVisitorException
area
- The area whose border is to be drawn.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.protected void markBackground(org.axsl.galley.BackgroundArea area) throws org.axsl.galley.GalleyVisitorException
area
- The area whose background should be rendered.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public int getPixelsPerInch()
protected abstract void drawLine(int startX, int startY, int endX, int endY, int thickness, org.axsl.common.value.RuleStyle ruleStyle, Color strokeColor) throws org.axsl.galley.GalleyVisitorException
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.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.protected abstract void drawRectangle(int x, int y, int w, int h, Color strokeColor, Color fillColor) throws org.axsl.galley.GalleyVisitorException
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.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.protected abstract void drawGraphic(org.axsl.galley.GraphicArea area, org.axsl.graphic.Graphic image, Rectangle contentRectangle, Rectangle clipRectangle) throws org.axsl.galley.GalleyVisitorException
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.drawGraphic(GraphicArea, Graphic, Rectangle, Rectangle)
public void render(org.axsl.galley.AreaNode node) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public void render(org.axsl.galley.Area node) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
protected void renderRegions(org.axsl.galley.Page page) throws org.axsl.galley.GalleyVisitorException
page
- The page whose regions should be rendered.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public void render(org.axsl.galley.BlockContainerArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public void render(org.axsl.galley.RegionArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public void renderChildren(org.axsl.galley.AreaNode area) throws org.axsl.galley.GalleyVisitorException
area
- The area whose children should be rendered.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public void render(org.axsl.galley.NormalBlockArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public abstract void render(org.axsl.galley.ForeignContentSvg svgContent) throws org.axsl.galley.GalleyVisitorException
ForeignObjectArea
.
svgContent
- The SVG content to be rendered.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public abstract void render(org.axsl.galley.ForeignContentMath mathContent) throws org.axsl.galley.GalleyVisitorException
ForeignObjectArea
.
mathContent
- The MathML content to be rendered.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public void render(org.axsl.galley.ForeignObjectArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public void render(org.axsl.galley.ExternalGraphicArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public void render(org.axsl.galley.TableArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public void render(org.axsl.galley.TableCellArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public abstract void renderTextSegment(org.axsl.galley.TextArea area, CharSequence text) throws org.axsl.galley.GalleyVisitorException
area
- An Area instance that contains the traits that should be
used to render the text.text
- The text content to be rendered.
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public void render(org.axsl.galley.LineArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public abstract void render(org.axsl.galley.BookmarkTree bookmarkTree)
bookmarkTree
- The bookmark tree to be rendered.public void render(org.axsl.galley.FootnoteArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public void render(org.axsl.galley.BeforeFloatArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public void render(org.axsl.galley.MainReferenceArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
public void render(org.axsl.galley.InlineArea area) throws org.axsl.galley.GalleyVisitorException
render
in interface org.axsl.galley.RenderVisitor
org.axsl.galley.GalleyVisitorException
protected void renderDocumentNodes() throws org.axsl.galley.GalleyVisitorException
org.axsl.galley.GalleyVisitorException
- For errors during rendering.public abstract void resetTextCursor()
public static Rectangle2D.Float convertMillipointRectangle(Rectangle input)
input
- A rectangle whose dimensions are stored as millipoints.
public static float toPoints(int millipoints)
millipoints
- The millipoint value to be converted to points.
protected static float colorToFloat(int integralColorComponent)
integralColorComponent
- The integral color value to be converted, a
value in the range 0 - 255.
protected static int shadingPercent(Color color)
color
- The color to be converted.
protected org.axsl.galley.Galley getAreaTree()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |