Package org.apache.fop.render.pcl
Class PCLGraphics2D
- java.lang.Object
-
- java.awt.Graphics
-
- java.awt.Graphics2D
-
- org.apache.xmlgraphics.java2d.AbstractGraphics2D
-
- org.apache.fop.render.pcl.PCLGraphics2D
-
- All Implemented Interfaces:
java.lang.Cloneable
public class PCLGraphics2D extends org.apache.xmlgraphics.java2d.AbstractGraphics2DGraphics2D implementation implementing PCL and HP GL/2. Note: This class cannot be used stand-alone to create full PCL documents.
-
-
Field Summary
Fields Modifier and Type Field Description private booleanclippingDisabledprivate static booleanFAIL_ON_UNSUPPORTED_FEATUREprivate java.awt.Graphics2DfmgUsed to create proper font metricsprotected PCLGeneratorgenThe PCL generator
-
Constructor Summary
Constructors Constructor Description PCLGraphics2D(PCLGenerator gen)Create a new PCLGraphics2D.PCLGraphics2D(PCLGraphics2D g)Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplyPaint(java.awt.Paint paint)Applies a new Paint object.protected voidapplyStroke(java.awt.Stroke stroke)Applies a new Stroke object.private voidbezierAbsolute(double x1, double y1, double x2, double y2, double x3, double y3, java.lang.StringBuffer sb)protected java.awt.image.BufferedImagebuildBufferedImage(java.awt.Dimension size)Creates a buffered image.voidcopyArea(int x, int y, int width, int height, int dx, int dy)java.awt.Graphicscreate()voiddispose()voiddraw(java.awt.Shape s)booleandrawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)booleandrawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)voiddrawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)voiddrawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)voiddrawString(java.lang.String s, float x, float y)voiddrawString(java.text.AttributedCharacterIterator iterator, float x, float y)voidfill(java.awt.Shape s)private voidfillPolygon(int windingRule, java.lang.StringBuffer sb)java.awt.GraphicsConfigurationgetDeviceConfiguration()java.awt.FontMetricsgetFontMetrics(java.awt.Font f)voidhandleIOException(java.io.IOException ioe)Central handler for IOExceptions for this class.protected voidhandleUnsupportedFeature(java.lang.String msg)Raises an UnsupportedOperationException if this instance is configured to do so and an unsupported feature has been requested.private voidpenDown(java.lang.StringBuffer sb)private voidpenUp(java.lang.StringBuffer sb)private voidplotAbsolute(double x, double y, java.lang.StringBuffer sb)voidprocessPathIteratorFill(java.awt.geom.PathIterator iter)Processes a path iterator generating the nexessary painting operations.voidprocessPathIteratorStroke(java.awt.geom.PathIterator iter)Processes a path iterator generating the nexessary painting operations.private voidquadraticBezierAbsolute(double originX, double originY, double x1, double y1, double x2, double y2, java.lang.StringBuffer sb)voidsetClippingDisabled(boolean value)Allows to disable all clipping operations.voidsetGraphicContext(org.apache.xmlgraphics.java2d.GraphicContext c)Sets the GraphicContextvoidsetXORMode(java.awt.Color c1)private voidwriteClip(java.awt.Shape imclip)-
Methods inherited from class org.apache.xmlgraphics.java2d.AbstractGraphics2D
addRenderingHints, clearRect, clip, clipRect, drawArc, drawGlyphVector, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, drawString, fillArc, fillOval, fillPolygon, fillRect, fillRoundRect, getBackground, getClip, getClipBounds, getColor, getComposite, getFont, getFontRenderContext, getGraphicContext, getPaint, getRenderingHint, getRenderingHints, getStroke, getTransform, hit, rotate, rotate, scale, setBackground, setClip, setClip, setColor, setComposite, setFont, setPaint, setPaintMode, setRenderingHint, setRenderingHints, setStroke, setTransform, shear, transform, translate, translate
-
-
-
-
Field Detail
-
gen
protected PCLGenerator gen
The PCL generator
-
FAIL_ON_UNSUPPORTED_FEATURE
private static final boolean FAIL_ON_UNSUPPORTED_FEATURE
- See Also:
- Constant Field Values
-
clippingDisabled
private boolean clippingDisabled
-
fmg
private java.awt.Graphics2D fmg
Used to create proper font metrics
-
-
Constructor Detail
-
PCLGraphics2D
public PCLGraphics2D(PCLGenerator gen)
Create a new PCLGraphics2D.- Parameters:
gen- the PCL Generator to paint with
-
PCLGraphics2D
public PCLGraphics2D(PCLGraphics2D g)
Copy constructor- Parameters:
g- parent PCLGraphics2D
-
-
Method Detail
-
create
public java.awt.Graphics create()
- Specified by:
createin classjava.awt.Graphics
-
dispose
public void dispose()
- Specified by:
disposein classjava.awt.Graphics
-
setGraphicContext
public void setGraphicContext(org.apache.xmlgraphics.java2d.GraphicContext c)
Sets the GraphicContext- Parameters:
c- GraphicContext to use
-
setClippingDisabled
public void setClippingDisabled(boolean value)
Allows to disable all clipping operations.- Parameters:
value- true if clipping should be disabled.
-
handleIOException
public void handleIOException(java.io.IOException ioe)
Central handler for IOExceptions for this class.- Parameters:
ioe- IOException to handle
-
handleUnsupportedFeature
protected void handleUnsupportedFeature(java.lang.String msg)
Raises an UnsupportedOperationException if this instance is configured to do so and an unsupported feature has been requested. Clients can make use of this to fall back to a more compatible way of painting a PCL graphic.- Parameters:
msg- the error message to be displayed
-
getDeviceConfiguration
public java.awt.GraphicsConfiguration getDeviceConfiguration()
- Specified by:
getDeviceConfigurationin classjava.awt.Graphics2D
-
applyStroke
protected void applyStroke(java.awt.Stroke stroke) throws java.io.IOExceptionApplies a new Stroke object.- Parameters:
stroke- Stroke object to use- Throws:
java.io.IOException- In case of an I/O problem
-
applyPaint
protected void applyPaint(java.awt.Paint paint) throws java.io.IOExceptionApplies a new Paint object.- Parameters:
paint- Paint object to use- Throws:
java.io.IOException- In case of an I/O problem
-
writeClip
private void writeClip(java.awt.Shape imclip) throws java.io.IOException- Throws:
java.io.IOException
-
draw
public void draw(java.awt.Shape s)
- Specified by:
drawin classjava.awt.Graphics2D
-
fill
public void fill(java.awt.Shape s)
- Specified by:
fillin classjava.awt.Graphics2D
-
processPathIteratorStroke
public void processPathIteratorStroke(java.awt.geom.PathIterator iter) throws java.io.IOExceptionProcesses a path iterator generating the nexessary painting operations.- Parameters:
iter- PathIterator to process- Throws:
java.io.IOException- In case of an I/O problem.
-
processPathIteratorFill
public void processPathIteratorFill(java.awt.geom.PathIterator iter) throws java.io.IOExceptionProcesses a path iterator generating the nexessary painting operations.- Parameters:
iter- PathIterator to process- Throws:
java.io.IOException- In case of an I/O problem.
-
fillPolygon
private void fillPolygon(int windingRule, java.lang.StringBuffer sb)
-
plotAbsolute
private void plotAbsolute(double x, double y, java.lang.StringBuffer sb)
-
bezierAbsolute
private void bezierAbsolute(double x1, double y1, double x2, double y2, double x3, double y3, java.lang.StringBuffer sb)
-
quadraticBezierAbsolute
private void quadraticBezierAbsolute(double originX, double originY, double x1, double y1, double x2, double y2, java.lang.StringBuffer sb)
-
penDown
private void penDown(java.lang.StringBuffer sb)
-
penUp
private void penUp(java.lang.StringBuffer sb)
-
drawString
public void drawString(java.lang.String s, float x, float y)- Specified by:
drawStringin classjava.awt.Graphics2D
-
drawString
public void drawString(java.text.AttributedCharacterIterator iterator, float x, float y)- Overrides:
drawStringin classorg.apache.xmlgraphics.java2d.AbstractGraphics2D
-
drawRenderedImage
public void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)- Specified by:
drawRenderedImagein classjava.awt.Graphics2D
-
drawRenderableImage
public void drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)- Specified by:
drawRenderableImagein classjava.awt.Graphics2D
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)- Specified by:
drawImagein classjava.awt.Graphics
-
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy)- Specified by:
copyAreain classjava.awt.Graphics
-
setXORMode
public void setXORMode(java.awt.Color c1)
- Specified by:
setXORModein classjava.awt.Graphics
-
buildBufferedImage
protected java.awt.image.BufferedImage buildBufferedImage(java.awt.Dimension size)
Creates a buffered image.- Parameters:
size- dimensions of the image to be created- Returns:
- the buffered image
-
getFontMetrics
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
- Specified by:
getFontMetricsin classjava.awt.Graphics
-
-