public class AFPGraphics2D extends org.apache.xmlgraphics.java2d.AbstractGraphics2D implements NativeImageHandler
AbstractGraphics2D
(and
therefore of Graphics2D
) which is able to generate GOCA byte
codes.AbstractGraphics2D
Modifier and Type | Field and Description |
---|---|
protected org.apache.xmlgraphics.java2d.TextHandler |
customTextHandler
Custom text handler
|
protected org.apache.xmlgraphics.java2d.TextHandler |
fallbackTextHandler
Fallback text handler
|
Constructor and Description |
---|
AFPGraphics2D(AFPGraphics2D g2d)
Copy Constructor
|
AFPGraphics2D(boolean textAsShapes,
AFPPaintingState paintingState,
AFPResourceManager resourceManager,
AFPResourceInfo resourceInfo,
FontInfo fontInfo)
Main constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addNativeImage(org.apache.xmlgraphics.image.loader.Image image,
float x,
float y,
float width,
float height)
Add a natively handled image directly to the document.
|
protected void |
applyStroke(Stroke stroke)
Apply the stroke to the AFP graphics object.
|
void |
clearRect(int x,
int y,
int width,
int height) |
double |
convertToAbsoluteLength(double length)
Converts a length value to an absolute value.
|
void |
copyArea(int x,
int y,
int width,
int height,
int dx,
int dy) |
Graphics |
create() |
void |
dispose() |
void |
draw(Shape shape) |
boolean |
drawImage(Image img,
int x,
int y,
ImageObserver observer) |
boolean |
drawImage(Image img,
int x,
int y,
int width,
int height,
ImageObserver observer) |
void |
drawRenderableImage(RenderableImage img,
AffineTransform xform) |
void |
drawRenderedImage(RenderedImage img,
AffineTransform xform) |
void |
drawString(String str,
float x,
float y) |
void |
fill(Shape shape) |
GraphicsConfiguration |
getDeviceConfiguration() |
FontInfo |
getFontInfo()
Returns the FontInfo
|
FontMetrics |
getFontMetrics(Font f) |
GraphicsObject |
getGraphicsObject()
Returns the GOCA graphics object
|
AFPPaintingState |
getPaintingState()
Returns the AFP painting state
|
AFPResourceManager |
getResourceManager()
Returns the AFP resource manager associated with this
Graphics2D instance. |
void |
handleIOException(IOException ioe)
Central handler for IOExceptions for this class.
|
void |
setCustomTextHandler(org.apache.xmlgraphics.java2d.TextHandler handler)
Sets a custom TextHandler implementation that is responsible for painting
text.
|
void |
setGraphicContext(org.apache.xmlgraphics.java2d.GraphicContext gc)
Sets the GraphicContext
|
void |
setGraphicsObject(GraphicsObject obj)
Sets the GOCA graphics object
|
void |
setXORMode(Color col) |
addRenderingHints, clip, clipRect, drawArc, drawGlyphVector, drawImage, drawImage, drawImage, drawImage, drawImage, drawImage, drawLine, drawOval, drawPolygon, drawPolyline, drawRect, drawRoundRect, drawString, 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
draw3DRect, fill3DRect
create, drawBytes, drawChars, drawPolygon, fillPolygon, finalize, getClipBounds, getClipRect, getFontMetrics, hitClip, toString
protected org.apache.xmlgraphics.java2d.TextHandler fallbackTextHandler
protected org.apache.xmlgraphics.java2d.TextHandler customTextHandler
public AFPGraphics2D(boolean textAsShapes, AFPPaintingState paintingState, AFPResourceManager resourceManager, AFPResourceInfo resourceInfo, FontInfo fontInfo)
textAsShapes
- if true, all text is turned into shapes in the convertion. No
text is output.paintingState
- painting stateresourceManager
- resource managerresourceInfo
- resource infofontInfo
- font infopublic AFPGraphics2D(AFPGraphics2D g2d)
g2d
- a AFPGraphics2D whose properties should be copiedpublic AFPResourceManager getResourceManager()
Graphics2D
instance.public GraphicsObject getGraphicsObject()
public void setGraphicsObject(GraphicsObject obj)
obj
- the GOCA graphics objectpublic AFPPaintingState getPaintingState()
public FontInfo getFontInfo()
public void setGraphicContext(org.apache.xmlgraphics.java2d.GraphicContext gc)
gc
- GraphicContext to usepublic double convertToAbsoluteLength(double length)
length
- the lengthprotected void applyStroke(Stroke stroke)
stroke
- the java strokepublic void draw(Shape shape)
draw
in class Graphics2D
public void fill(Shape shape)
fill
in class Graphics2D
public void handleIOException(IOException ioe)
ioe
- IOException to handlepublic void drawString(String str, float x, float y)
drawString
in class Graphics2D
public GraphicsConfiguration getDeviceConfiguration()
getDeviceConfiguration
in class Graphics2D
public boolean drawImage(Image img, int x, int y, ImageObserver observer)
public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer)
public void drawRenderedImage(RenderedImage img, AffineTransform xform)
drawRenderedImage
in class Graphics2D
public void setCustomTextHandler(org.apache.xmlgraphics.java2d.TextHandler handler)
handler
- the custom TextHandler implementationpublic void drawRenderableImage(RenderableImage img, AffineTransform xform)
drawRenderableImage
in class Graphics2D
public FontMetrics getFontMetrics(Font f)
getFontMetrics
in class Graphics
public void setXORMode(Color col)
setXORMode
in class Graphics
public void addNativeImage(org.apache.xmlgraphics.image.loader.Image image, float x, float y, float width, float height)
addNativeImage
in interface NativeImageHandler
image
- the image to drawx
- the x positiony
- the y positionwidth
- the width to draw the imageheight
- the height to draw the imagepublic void copyArea(int x, int y, int width, int height, int dx, int dy)
public void clearRect(int x, int y, int width, int height)
clearRect
in class org.apache.xmlgraphics.java2d.AbstractGraphics2D
Copyright © 2025 Apache Software Foundation. All rights reserved.