|
fop 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.render.intermediate.AbstractIFPainter<T>
public abstract class AbstractIFPainter<T extends IFDocumentHandler>
Abstract base class for IFPainter implementations.
Field Summary | |
---|---|
protected static java.lang.String |
INSTREAM_OBJECT_URI
non-URI that can be used in feedback messages that an image is an instream-object |
protected IFState |
state
Holds the intermediate format state |
Constructor Summary | |
---|---|
AbstractIFPainter(T documentHandler)
Default constructor. |
Method Summary | |
---|---|
protected java.util.Map |
createDefaultImageProcessingHints(org.apache.xmlgraphics.image.loader.ImageSessionContext sessionContext)
Creates the default map of processing hints for the image loading framework. |
protected abstract RenderingContext |
createRenderingContext()
Creates a new RenderingContext instance. |
void |
drawBorderRect(java.awt.Rectangle rect,
BorderProps top,
BorderProps bottom,
BorderProps left,
BorderProps right,
java.awt.Color innerBackgroundColor)
Draws a border rectangle. |
protected void |
drawImage(org.apache.xmlgraphics.image.loader.Image image,
java.awt.Rectangle rect,
RenderingContext context)
Draws an image using a suitable image handler. |
protected void |
drawImage(org.apache.xmlgraphics.image.loader.Image image,
java.awt.Rectangle rect,
RenderingContext context,
boolean convert,
java.util.Map additionalHints)
Draws an image using a suitable image handler. |
protected void |
drawImageUsingDocument(org.w3c.dom.Document doc,
java.awt.Rectangle rect)
Default drawing method for handling a foreign object in the form of a DOM document. |
protected void |
drawImageUsingImageHandler(org.apache.xmlgraphics.image.loader.ImageInfo info,
java.awt.Rectangle rect)
Loads a preloaded image and draws it using a suitable image handler. |
protected void |
drawImageUsingURI(java.lang.String uri,
java.awt.Rectangle rect)
Default drawing method for handling an image referenced by a URI. |
void |
drawLine(java.awt.Point start,
java.awt.Point end,
int width,
java.awt.Color color,
RuleStyle style)
Draws a line. |
protected IFContext |
getContext()
Returns the intermediate format context object. |
protected T |
getDocumentHandler()
|
protected FontInfo |
getFontInfo()
|
protected java.lang.String |
getFontKey(FontTriplet triplet)
|
protected org.apache.xmlgraphics.image.loader.ImageInfo |
getImageInfo(java.lang.String uri)
Returns an ImageInfo instance for the given URI. |
protected java.awt.Rectangle |
getLineBoundingBox(java.awt.Point start,
java.awt.Point end,
int width)
Calculates the bounding box for a line. |
protected FOUserAgent |
getUserAgent()
Returns the user agent. |
protected boolean |
hasOnlySolidBorders(BorderProps top,
BorderProps bottom,
BorderProps left,
BorderProps right)
Indicates whether the given border segments (if present) have only solid borders, i.e. |
boolean |
isBackgroundRequired(BorderProps bpsBefore,
BorderProps bpsAfter,
BorderProps bpsStart,
BorderProps bpsEnd)
TODO Painter-specific rounded borders logic required background drawing to be made optional. |
void |
setFont(java.lang.String family,
java.lang.String style,
java.lang.Integer weight,
java.lang.String variant,
java.lang.Integer size,
java.awt.Color color)
Updates the current font. |
void |
startGroup(java.awt.geom.AffineTransform[] transforms,
java.lang.String layer)
Starts a new group of graphical elements. |
void |
startViewport(java.awt.geom.AffineTransform[] transforms,
java.awt.Dimension size,
java.awt.Rectangle clipRect)
Starts a new viewport, establishing a new coordinate system. |
static java.awt.geom.AffineTransform |
toPoints(java.awt.geom.AffineTransform transform)
Converts a transformation matrix from millipoints to points. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.fop.render.intermediate.IFPainter |
---|
clipBackground, clipRect, drawImage, drawImage, drawText, endGroup, endViewport, fillRect, startGroup, startViewport |
Field Detail |
---|
protected static final java.lang.String INSTREAM_OBJECT_URI
protected IFState state
Constructor Detail |
---|
public AbstractIFPainter(T documentHandler)
Method Detail |
---|
protected java.lang.String getFontKey(FontTriplet triplet) throws IFException
IFException
protected IFContext getContext()
protected FontInfo getFontInfo()
protected T getDocumentHandler()
protected FOUserAgent getUserAgent()
public void startViewport(java.awt.geom.AffineTransform[] transforms, java.awt.Dimension size, java.awt.Rectangle clipRect) throws IFException
startViewport
in interface IFPainter
transforms
- a series of transformation matrices establishing the new coordinate systemsize
- the size of the viewportclipRect
- the clipping rectangle (may be null)
IFException
- if an error occurs while handling this elementpublic void startGroup(java.awt.geom.AffineTransform[] transforms, java.lang.String layer) throws IFException
startGroup
in interface IFPainter
transforms
- a series of transformation matrices establishing the new coordinate systemlayer
- an optional layer label (or null if none)
IFException
- if an error occurs while handling this elementprotected abstract RenderingContext createRenderingContext()
protected void drawImageUsingImageHandler(org.apache.xmlgraphics.image.loader.ImageInfo info, java.awt.Rectangle rect) throws org.apache.xmlgraphics.image.loader.ImageException, java.io.IOException
info
- the information object of the preloaded imagerect
- the rectangle in which to paint the image
org.apache.xmlgraphics.image.loader.ImageException
- if there's an error while processing the image
java.io.IOException
- if there's an I/O error while loading the imageprotected java.util.Map createDefaultImageProcessingHints(org.apache.xmlgraphics.image.loader.ImageSessionContext sessionContext)
sessionContext
- the session context for access to resolution information
protected void drawImage(org.apache.xmlgraphics.image.loader.Image image, java.awt.Rectangle rect, RenderingContext context) throws java.io.IOException, org.apache.xmlgraphics.image.loader.ImageException
image
- the image to be painted (it needs to of a supported image flavor)rect
- the rectangle in which to paint the imagecontext
- a suitable rendering context
java.io.IOException
- in case of an I/O error while handling/writing the image
org.apache.xmlgraphics.image.loader.ImageException
- if an error occurs while converting the image to a suitable formatprotected void drawImage(org.apache.xmlgraphics.image.loader.Image image, java.awt.Rectangle rect, RenderingContext context, boolean convert, java.util.Map additionalHints) throws java.io.IOException, org.apache.xmlgraphics.image.loader.ImageException
image
- the image to be painted (it needs to of a supported image flavor)rect
- the rectangle in which to paint the imagecontext
- a suitable rendering contextconvert
- true to run the image through image conversion if that is necessaryadditionalHints
- additional image processing hints
java.io.IOException
- in case of an I/O error while handling/writing the image
org.apache.xmlgraphics.image.loader.ImageException
- if an error occurs while converting the image to a suitable formatprotected org.apache.xmlgraphics.image.loader.ImageInfo getImageInfo(java.lang.String uri)
uri
- the URI identifying the image
protected void drawImageUsingURI(java.lang.String uri, java.awt.Rectangle rect)
uri
- the image's URIrect
- the rectangle in which to paint the imageprotected void drawImageUsingDocument(org.w3c.dom.Document doc, java.awt.Rectangle rect)
doc
- the DOM document containing the foreign objectrect
- the rectangle in which to paint the imagepublic void drawBorderRect(java.awt.Rectangle rect, BorderProps top, BorderProps bottom, BorderProps left, BorderProps right, java.awt.Color innerBackgroundColor) throws IFException
BorderProps
instances.
drawBorderRect
in interface IFPainter
rect
- the rectangle's coordinates and extenttop
- the border segment on the top edgebottom
- the border segment on the bottom edgeleft
- the border segment on the left edgeright
- the border segment on the right edgeinnerBackgroundColor
- the color of the inner background
IFException
- if an error occurs while handling this eventprotected boolean hasOnlySolidBorders(BorderProps top, BorderProps bottom, BorderProps left, BorderProps right)
top
- the border segment on the top edgebottom
- the border segment on the bottom edgeleft
- the border segment on the left edgeright
- the border segment on the right edge
public void drawLine(java.awt.Point start, java.awt.Point end, int width, java.awt.Color color, RuleStyle style) throws IFException
drawLine
in interface IFPainter
start
- the start point of the lineend
- the end point of the linewidth
- the line widthcolor
- the line colorstyle
- the line style (using the Constants.EN_* constants for the rule-style property)
IFException
- if an error occurs while handling this eventprotected java.awt.Rectangle getLineBoundingBox(java.awt.Point start, java.awt.Point end, int width)
start
- the starting point of the line (coordinates in mpt)end
- the ending point of the line (coordinates in mpt)width
- the line width (in mpt)
public void setFont(java.lang.String family, java.lang.String style, java.lang.Integer weight, java.lang.String variant, java.lang.Integer size, java.awt.Color color) throws IFException
setFont
in interface IFPainter
family
- the font family (or null if there's no change)style
- the font style (or null if there's no change)weight
- the font weight (or null if there's no change)variant
- the font variant (or null if there's no change)size
- the font size (or null if there's no change)color
- the text color (or null if there's no change)
IFException
- if an error occurs while handling this eventpublic static java.awt.geom.AffineTransform toPoints(java.awt.geom.AffineTransform transform)
transform
- the transformation matrix (in millipoints)
public boolean isBackgroundRequired(BorderProps bpsBefore, BorderProps bpsAfter, BorderProps bpsStart, BorderProps bpsEnd)
isBackgroundRequired
in interface IFPainter
bpsBefore
- the before borderbpsAfter
- the after borderbpsStart
- the start borderbpsEnd
- the end border
|
fop 2.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |