Class PDFGraphics2D
- java.lang.Object
-
- java.awt.Graphics
-
- java.awt.Graphics2D
-
- org.apache.xmlgraphics.java2d.AbstractGraphics2D
-
- org.apache.fop.svg.PDFGraphics2D
-
- All Implemented Interfaces:
java.lang.Cloneable
,NativeImageHandler
- Direct Known Subclasses:
PDFDocumentGraphics2D
public class PDFGraphics2D extends org.apache.xmlgraphics.java2d.AbstractGraphics2D implements NativeImageHandler
PDF Graphics 2D. Used for drawing into a pdf document as if it is a graphics object. This takes a pdf document and draws into it.
This work was authored by Keiron Liddle (keiron@aftexsw.com).
- See Also:
AbstractGraphics2D
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PDFGraphics2D.TransparencyIgnoredEventListener
May be used to give proper feedback to the user when a particular PDF profile is being used that disallows transparency.
-
Field Summary
Fields Modifier and Type Field Description protected int
baseLevel
The PDF graphics state level that this svg is being drawn into.protected PDFColorHandler
colorHandler
the PDF color handlerprotected java.lang.String
currentFontName
the current (internal) font nameprotected float
currentFontSize
the current font size in millipointsprotected java.io.StringWriter
currentStream
the current stream to add PDF commands toprivate static int
DEC
The number of decimal places.private java.awt.Graphics2D
fmg
Used to create proper font metricsprotected FontInfo
fontInfo
The current font information.private static java.awt.geom.AffineTransform
IDENTITY_TRANSFORM
protected int
nativeCount
The count of natively handled images added to document so they receive unique keys.(package private) static int
OPAQUE
Convenience constant for full opacityprotected java.io.OutputStream
outputStream
The output stream for the pdf document.protected Font
ovFontState
The override font state used when drawing text and the font cannot be set using java fonts.protected PDFReference
pageRef
The PDF reference of the current page.protected PDFPaintingState
paintingState
The PDF painting stateprotected PDFDocument
pdfDoc
the PDF Document being createdprotected PDFResourceContext
resourceContext
The current resource context for adding fonts, patterns etc.private PDFGraphics2D.TransparencyIgnoredEventListener
transparencyIgnoredEventListener
-
Constructor Summary
Constructors Modifier Constructor Description protected
PDFGraphics2D(boolean textAsShapes)
Create a new PDFGraphics2D.PDFGraphics2D(boolean textAsShapes, FontInfo fi, PDFDocument doc, PDFResourceContext page, PDFReference pref, java.lang.String font, float size, PDFGraphics2D.TransparencyIgnoredEventListener listener)
Create a new PDFGraphics2D with the given pdf document info.PDFGraphics2D(PDFGraphics2D g)
This constructor supports the create method.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private void
addKerning(java.io.StringWriter buf, java.lang.Integer ch1, java.lang.Integer ch2, java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> kerning, java.lang.String startText, java.lang.String endText)
void
addLink(java.awt.geom.Rectangle2D bounds, java.awt.geom.AffineTransform trans, java.lang.String dest, int linkType)
This is a pdf specific method used to add a link to the pdf document.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 PDF document.private PDFXObject
addRenderedImage(java.lang.String key, java.awt.image.RenderedImage img)
protected void
applyAlpha(int fillAlpha, int strokeAlpha)
Applies the given alpha values for filling and stroking.protected void
applyColor(java.awt.Color col, boolean fill)
Apply the java Color to PDF.protected boolean
applyPaint(java.awt.Paint paint, boolean fill)
Apply the java paint to the PDF.protected void
applyStroke(java.awt.Stroke stroke)
Apply the stroke to the PDF.protected boolean
applyUnknownPaint(java.awt.Paint paint, java.awt.Shape shape)
private java.awt.image.BufferedImage
buildBufferedImage(java.awt.Dimension size)
private void
concatMatrix(double[] matrix)
Restore the PDF graphics state to the starting state level.private void
concatMatrix(java.awt.geom.AffineTransform transform)
void
copyArea(int x, int y, int width, int height, int dx, int dy)
Copies an area of the component by a distance specified bydx
anddy
.java.awt.Graphics
create()
Creates a newGraphics
object that is a copy of thisGraphics
object.private boolean
createPattern(org.apache.batik.gvt.PatternPaint pp, boolean fill)
private PDFPattern
createPDFPattern(Pattern pattern)
void
dispose()
Disposes of this graphics context and releases any system resources that it is using.protected void
doDrawing(boolean fill, boolean stroke, boolean nonzero)
Do the PDF drawing command.void
draw(java.awt.Shape s)
Strokes the outline of aShape
using the settings of the currentGraphics2D
context.boolean
drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
boolean
drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
Draws as much of the specified image as is currently available.void
drawInnerRenderedImage(java.lang.String key, java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
void
drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)
void
drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
void
drawString(java.lang.String s, float x, float y)
Renders the text specified by the specifiedString
, using the currentFont
andPaint
attributes in theGraphics2D
context.void
fill(java.awt.Shape s)
Fills the interior of aShape
using the settings of theGraphics2D
context.private void
flushPDFDocument()
protected java.awt.geom.AffineTransform
getBaseTransform()
This is mainly used for shading patterns which use the document-global coordinate system instead of the local one.java.lang.StringBuffer
getBuffer()
Get the string buffer from the currentStream, containing all the commands written into this Graphics so far.java.awt.GraphicsConfiguration
getDeviceConfiguration()
Returns the device configuration associated with thisGraphics2D
.java.awt.FontMetrics
getFontMetrics(java.awt.Font f)
Gets the font metrics for the specified font.protected Font
getInternalFontForAWTFont(java.awt.Font awtFont)
Deprecated.use FontInfo.getFontInstanceForAWTFont(java.awt.Font awtFont) insteadPDFReference
getPageReference()
Gets the PDF reference of the current page.java.lang.String
getString()
Get the string containing all the commands written into this Graphics.private boolean
gradientContainsTransparency(org.apache.batik.ext.awt.MultipleGradientPaint gradient)
private boolean
gradientIsRepeated(org.apache.batik.ext.awt.MultipleGradientPaint gradient)
private boolean
gradientSupported(org.apache.batik.ext.awt.MultipleGradientPaint gradient)
protected void
handleIOException(java.io.IOException ioe)
Central handler for IOExceptions for this class.protected boolean
isMultiByteFont(java.lang.String name)
Determines whether the font with the given name is a multi-byte font.protected java.lang.Object
isTransparencyAllowed()
Checks whether the use of transparency is allowed.protected void
preparePainting()
This method is used by PDFDocumentGraphics2D to prepare a new page if necessary.void
processPathIterator(java.awt.geom.PathIterator iter)
Processes a path iterator generating the necessary painting operations.PDFFunction
registerFunction(PDFFunction function)
Registers a function object against the output format documentPDFPattern
registerPattern(PDFPattern pattern)
Registers a pattern object against the output format documentPDFShading
registerShading(PDFShading shading)
Registers a shading object against the otuput format document(package private) void
restoreGraphicsState()
(package private) void
saveGraphicsState()
void
setGraphicContext(org.apache.xmlgraphics.java2d.GraphicContext c)
Set the Graphics context.void
setOutputStream(java.io.OutputStream os)
Set the output stream that this PDF document is being drawn to.void
setOverrideFontState(Font infont)
Set the override font state for drawing text.void
setPaintingState(PDFPaintingState state)
Set the PDF state to use when starting to draw into the PDF graphics.private void
setPrivateHints()
void
setXORMode(java.awt.Color c1)
Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color.protected void
updateCurrentFont(Font font)
Updates the currently selected font.private void
useXObject(PDFXObject xObject, java.awt.geom.AffineTransform xform, float width, float height)
protected void
writeClip(java.awt.Shape s)
Set the clipping shape for future PDF drawing in the current graphics state.-
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, 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
-
IDENTITY_TRANSFORM
private static final java.awt.geom.AffineTransform IDENTITY_TRANSFORM
-
DEC
private static final int DEC
The number of decimal places.- See Also:
- Constant Field Values
-
OPAQUE
static final int OPAQUE
Convenience constant for full opacity- See Also:
- Constant Field Values
-
pdfDoc
protected PDFDocument pdfDoc
the PDF Document being created
-
resourceContext
protected PDFResourceContext resourceContext
The current resource context for adding fonts, patterns etc.
-
pageRef
protected PDFReference pageRef
The PDF reference of the current page.
-
paintingState
protected PDFPaintingState paintingState
The PDF painting state
-
colorHandler
protected PDFColorHandler colorHandler
the PDF color handler
-
baseLevel
protected int baseLevel
The PDF graphics state level that this svg is being drawn into.
-
nativeCount
protected int nativeCount
The count of natively handled images added to document so they receive unique keys.
-
fontInfo
protected FontInfo fontInfo
The current font information.
-
ovFontState
protected Font ovFontState
The override font state used when drawing text and the font cannot be set using java fonts.
-
currentStream
protected java.io.StringWriter currentStream
the current stream to add PDF commands to
-
currentFontName
protected java.lang.String currentFontName
the current (internal) font name
-
currentFontSize
protected float currentFontSize
the current font size in millipoints
-
outputStream
protected java.io.OutputStream outputStream
The output stream for the pdf document. If this is set then it can progressively output the pdf document objects to reduce memory. Especially with images.
-
transparencyIgnoredEventListener
private PDFGraphics2D.TransparencyIgnoredEventListener transparencyIgnoredEventListener
-
fmg
private java.awt.Graphics2D fmg
Used to create proper font metrics
-
-
Constructor Detail
-
PDFGraphics2D
public PDFGraphics2D(boolean textAsShapes, FontInfo fi, PDFDocument doc, PDFResourceContext page, PDFReference pref, java.lang.String font, float size, PDFGraphics2D.TransparencyIgnoredEventListener listener)
Create a new PDFGraphics2D with the given pdf document info. This is used to create a Graphics object for use inside an already existing document.- Parameters:
textAsShapes
- if true then draw text as shapesfi
- the current font informationdoc
- the pdf document for creating pdf objectspage
- the current resource context or pagepref
- the PDF reference of the current pagefont
- the current font namesize
- the current font size
-
PDFGraphics2D
protected PDFGraphics2D(boolean textAsShapes)
Create a new PDFGraphics2D.- Parameters:
textAsShapes
- true if drawing text as shapes
-
PDFGraphics2D
public PDFGraphics2D(PDFGraphics2D g)
This constructor supports the create method. This is not implemented properly.- Parameters:
g
- the PDF graphics to make a copy of
-
-
Method Detail
-
create
public java.awt.Graphics create()
Creates a newGraphics
object that is a copy of thisGraphics
object.- Specified by:
create
in classjava.awt.Graphics
- Returns:
- a new graphics context that is a copy of this graphics context.
-
handleIOException
protected void handleIOException(java.io.IOException ioe)
Central handler for IOExceptions for this class.- Parameters:
ioe
- IOException to handle
-
preparePainting
protected void preparePainting()
This method is used by PDFDocumentGraphics2D to prepare a new page if necessary.
-
setPaintingState
public void setPaintingState(PDFPaintingState state)
Set the PDF state to use when starting to draw into the PDF graphics.- Parameters:
state
- the PDF state
-
setOutputStream
public void setOutputStream(java.io.OutputStream os)
Set the output stream that this PDF document is being drawn to. This is so that it can progressively use the PDF document to output data such as images. This results in a significant saving on memory.- Parameters:
os
- the output stream that is being used for the PDF document
-
getString
public java.lang.String getString()
Get the string containing all the commands written into this Graphics.- Returns:
- the string containing the PDF markup
-
getBuffer
public java.lang.StringBuffer getBuffer()
Get the string buffer from the currentStream, containing all the commands written into this Graphics so far.- Returns:
- the StringBuffer containing the PDF markup
-
getPageReference
public PDFReference getPageReference()
Gets the PDF reference of the current page.- Returns:
- the PDF reference of the current page
-
setGraphicContext
public void setGraphicContext(org.apache.xmlgraphics.java2d.GraphicContext c)
Set the Graphics context.- Parameters:
c
- the graphics context to use
-
setPrivateHints
private void setPrivateHints()
-
setOverrideFontState
public void setOverrideFontState(Font infont)
Set the override font state for drawing text. This is used by the PDF text painter so that it can temporarily set the font state when a java font cannot be used. The next drawString will use this font state.- Parameters:
infont
- the font state to use
-
concatMatrix
private void concatMatrix(double[] matrix)
Restore the PDF graphics state to the starting state level.
-
concatMatrix
private void concatMatrix(java.awt.geom.AffineTransform transform)
-
getBaseTransform
protected java.awt.geom.AffineTransform getBaseTransform()
This is mainly used for shading patterns which use the document-global coordinate system instead of the local one.- Returns:
- the transformation matrix that established the basic user space for this document
-
addLink
public void addLink(java.awt.geom.Rectangle2D bounds, java.awt.geom.AffineTransform trans, java.lang.String dest, int linkType)
This is a pdf specific method used to add a link to the pdf document.- Parameters:
bounds
- the bounds of the link in user coordinatestrans
- the transform of the current drawing positiondest
- the PDF destinationlinkType
- the type of link, internal or external
-
addNativeImage
public 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 PDF document. This is used by the PDFImageElementBridge to draw a natively handled image (like JPEG or CCITT images) directly into the PDF document rather than converting the image into a bitmap and increasing the size.- Specified by:
addNativeImage
in interfaceNativeImageHandler
- Parameters:
image
- the image to drawx
- the x positiony
- the y positionwidth
- the width to draw the imageheight
- the height to draw the image
-
flushPDFDocument
private void flushPDFDocument()
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
Draws as much of the specified image as is currently available. The image is drawn with its top-left corner at (x, y) in this graphics context's coordinate space. Transparent pixels in the image do not affect whatever pixels are already there.This method returns immediately in all cases, even if the complete image has not yet been loaded, and it has not been dithered and converted for the current output device.
If the image has not yet been completely loaded, then
drawImage
returnsfalse
. As more of the image becomes available, the process that draws the image notifies the specified image observer.- Specified by:
drawImage
in classjava.awt.Graphics
- Parameters:
img
- the specified image to be drawn.x
- the x coordinate.y
- the y coordinate.observer
- object to be notified as more of the image is converted.- Returns:
- true if the image was drawn
- See Also:
Image
,ImageObserver
,ImageObserver.imageUpdate(java.awt.Image, int, int, int, int, int)
-
buildBufferedImage
private java.awt.image.BufferedImage buildBufferedImage(java.awt.Dimension size)
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
- Specified by:
drawImage
in classjava.awt.Graphics
-
dispose
public void dispose()
Disposes of this graphics context and releases any system resources that it is using. AGraphics
object cannot be used afterdispose
has been called.When a Java program runs, a large number of
Graphics
objects can be created within a short time frame. Although the finalization process of the garbage collector also disposes of the same system resources, it is preferable to manually free the associated resources by calling this method rather than to rely on a finalization process which may not run to completion for a long period of time.Graphics objects which are provided as arguments to the
paint
andupdate
methods of components are automatically released by the system when those methods return. For efficiency, programmers should calldispose
when finished using aGraphics
object only if it was created directly from a component or anotherGraphics
object.- Specified by:
dispose
in classjava.awt.Graphics
- See Also:
Graphics.finalize()
,Component.paint(java.awt.Graphics)
,Component.update(java.awt.Graphics)
,Component.getGraphics()
,Graphics.create()
-
draw
public void draw(java.awt.Shape s)
Strokes the outline of aShape
using the settings of the currentGraphics2D
context. The rendering attributes applied include theClip
,Transform
,Paint
,Composite
andStroke
attributes.- Specified by:
draw
in classjava.awt.Graphics2D
- Parameters:
s
- theShape
to be rendered- See Also:
AbstractGraphics2D.setStroke(java.awt.Stroke)
,AbstractGraphics2D.setPaint(java.awt.Paint)
,Graphics.setColor(java.awt.Color)
,AbstractGraphics2D.transform(java.awt.geom.AffineTransform)
,AbstractGraphics2D.setTransform(java.awt.geom.AffineTransform)
,AbstractGraphics2D.clip(java.awt.Shape)
,AbstractGraphics2D.setClip(int, int, int, int)
,AbstractGraphics2D.setComposite(java.awt.Composite)
-
writeClip
protected void writeClip(java.awt.Shape s)
Set the clipping shape for future PDF drawing in the current graphics state. This sets creates and writes a clipping shape that will apply to future drawings in the current graphics state.- Parameters:
s
- the clipping shape
-
applyColor
protected void applyColor(java.awt.Color col, boolean fill)
Apply the java Color to PDF. This converts the java colour to a PDF colour and sets it for the next drawing.- Parameters:
col
- the java colourfill
- true if the colour will be used for filling
-
applyPaint
protected boolean applyPaint(java.awt.Paint paint, boolean fill)
Apply the java paint to the PDF. This takes the java paint sets up the appropraite PDF commands for the drawing with that paint. Currently this supports the gradients and patterns from batik.- Parameters:
paint
- the paint to convert to PDFfill
- true if the paint should be set for filling- Returns:
- true if the paint is handled natively, false if the paint should be rasterized
-
createPDFPattern
private PDFPattern createPDFPattern(Pattern pattern)
-
gradientSupported
private boolean gradientSupported(org.apache.batik.ext.awt.MultipleGradientPaint gradient)
-
gradientContainsTransparency
private boolean gradientContainsTransparency(org.apache.batik.ext.awt.MultipleGradientPaint gradient)
-
gradientIsRepeated
private boolean gradientIsRepeated(org.apache.batik.ext.awt.MultipleGradientPaint gradient)
-
createPattern
private boolean createPattern(org.apache.batik.gvt.PatternPaint pp, boolean fill)
-
applyUnknownPaint
protected boolean applyUnknownPaint(java.awt.Paint paint, java.awt.Shape shape)
- Parameters:
paint
- some paintshape
- a shape- Returns:
- true (always)
-
applyStroke
protected void applyStroke(java.awt.Stroke stroke)
Apply the stroke to the PDF. This takes the java stroke and outputs the appropriate settings to the PDF so that the stroke attributes are handled.- Parameters:
stroke
- the java stroke
-
drawRenderedImage
public void drawRenderedImage(java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
- Specified by:
drawRenderedImage
in classjava.awt.Graphics2D
-
drawInnerRenderedImage
public void drawInnerRenderedImage(java.lang.String key, java.awt.image.RenderedImage img, java.awt.geom.AffineTransform xform)
- Parameters:
key
- a keyimg
- an imagexform
- a transform
-
useXObject
private void useXObject(PDFXObject xObject, java.awt.geom.AffineTransform xform, float width, float height)
-
addRenderedImage
private PDFXObject addRenderedImage(java.lang.String key, java.awt.image.RenderedImage img)
-
drawRenderableImage
public void drawRenderableImage(java.awt.image.renderable.RenderableImage img, java.awt.geom.AffineTransform xform)
- Specified by:
drawRenderableImage
in classjava.awt.Graphics2D
-
drawString
public void drawString(java.lang.String s, float x, float y)
Renders the text specified by the specifiedString
, using the currentFont
andPaint
attributes in theGraphics2D
context. The baseline of the first character is at position (x, y) in the User Space. The rendering attributes applied include theClip
,Transform
,Paint
,Font
andComposite
attributes. For characters in script systems such as Hebrew and Arabic, the glyphs can be rendered from right to left, in which case the coordinate supplied is the location of the leftmost character on the baseline.- Specified by:
drawString
in classjava.awt.Graphics2D
- Parameters:
s
- theString
to be renderedx
- the coordinate where theString
should be renderedy
- the coordinate where theString
should be rendered- See Also:
AbstractGraphics2D.setPaint(java.awt.Paint)
,Graphics.setColor(java.awt.Color)
,Graphics.setFont(java.awt.Font)
,AbstractGraphics2D.setTransform(java.awt.geom.AffineTransform)
,AbstractGraphics2D.setComposite(java.awt.Composite)
,AbstractGraphics2D.setClip(int, int, int, int)
-
applyAlpha
protected void applyAlpha(int fillAlpha, int strokeAlpha)
Applies the given alpha values for filling and stroking.- Parameters:
fillAlpha
- A value between 0 and 255 (=OPAQUE) for fillingstrokeAlpha
- A value between 0 and 255 (=OPAQUE) for stroking
-
updateCurrentFont
protected void updateCurrentFont(Font font)
Updates the currently selected font.- Parameters:
font
- the new font to use
-
getInternalFontForAWTFont
@Deprecated protected Font getInternalFontForAWTFont(java.awt.Font awtFont)
Deprecated.use FontInfo.getFontInstanceForAWTFont(java.awt.Font awtFont) insteadReturns a suitable internal font given an AWT Font instance.- Parameters:
awtFont
- the AWT font- Returns:
- the internal Font
-
isMultiByteFont
protected boolean isMultiByteFont(java.lang.String name)
Determines whether the font with the given name is a multi-byte font.- Parameters:
name
- the name of the font- Returns:
- true if it's a multi-byte font
-
addKerning
private void addKerning(java.io.StringWriter buf, java.lang.Integer ch1, java.lang.Integer ch2, java.util.Map<java.lang.Integer,java.util.Map<java.lang.Integer,java.lang.Integer>> kerning, java.lang.String startText, java.lang.String endText)
-
fill
public void fill(java.awt.Shape s)
Fills the interior of aShape
using the settings of theGraphics2D
context. The rendering attributes applied include theClip
,Transform
,Paint
, andComposite
.- Specified by:
fill
in classjava.awt.Graphics2D
- Parameters:
s
- theShape
to be filled- See Also:
AbstractGraphics2D.setPaint(java.awt.Paint)
,Graphics.setColor(java.awt.Color)
,AbstractGraphics2D.transform(java.awt.geom.AffineTransform)
,AbstractGraphics2D.setTransform(java.awt.geom.AffineTransform)
,AbstractGraphics2D.setComposite(java.awt.Composite)
,AbstractGraphics2D.clip(java.awt.Shape)
,AbstractGraphics2D.setClip(int, int, int, int)
-
saveGraphicsState
void saveGraphicsState()
-
restoreGraphicsState
void restoreGraphicsState()
-
isTransparencyAllowed
protected java.lang.Object isTransparencyAllowed()
Checks whether the use of transparency is allowed.
-
processPathIterator
public void processPathIterator(java.awt.geom.PathIterator iter)
Processes a path iterator generating the necessary painting operations.- Parameters:
iter
- PathIterator to process
-
doDrawing
protected void doDrawing(boolean fill, boolean stroke, boolean nonzero)
Do the PDF drawing command. This does the PDF drawing command according to fill stroke and winding rule.- Parameters:
fill
- true if filling the pathstroke
- true if stroking the pathnonzero
- true if using the non-zero winding rule
-
getDeviceConfiguration
public java.awt.GraphicsConfiguration getDeviceConfiguration()
Returns the device configuration associated with thisGraphics2D
.- Specified by:
getDeviceConfiguration
in classjava.awt.Graphics2D
- Returns:
- the PDF graphics configuration
-
getFontMetrics
public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
Gets the font metrics for the specified font.- Specified by:
getFontMetrics
in classjava.awt.Graphics
- Parameters:
f
- the specified font- Returns:
- the font metrics for the specified font.
- See Also:
Graphics.getFont()
,FontMetrics
,Graphics.getFontMetrics()
-
setXORMode
public void setXORMode(java.awt.Color c1)
Sets the paint mode of this graphics context to alternate between this graphics context's current color and the new specified color. This specifies that logical pixel operations are performed in the XOR mode, which alternates pixels between the current color and a specified XOR color.When drawing operations are performed, pixels which are the current color are changed to the specified color, and vice versa.
Pixels that are of colors other than those two colors are changed in an unpredictable but reversible manner; if the same figure is drawn twice, then all pixels are restored to their original values.
- Specified by:
setXORMode
in classjava.awt.Graphics
- Parameters:
c1
- the XOR alternation color
-
copyArea
public void copyArea(int x, int y, int width, int height, int dx, int dy)
Copies an area of the component by a distance specified bydx
anddy
. From the point specified byx
andy
, this method copies downwards and to the right. To copy an area of the component to the left or upwards, specify a negative value fordx
ordy
. If a portion of the source rectangle lies outside the bounds of the component, or is obscured by another window or component,copyArea
will be unable to copy the associated pixels. The area that is omitted can be refreshed by calling the component'spaint
method.- Specified by:
copyArea
in classjava.awt.Graphics
- Parameters:
x
- the x coordinate of the source rectangle.y
- the y coordinate of the source rectangle.width
- the width of the source rectangle.height
- the height of the source rectangle.dx
- the horizontal distance to copy the pixels.dy
- the vertical distance to copy the pixels.
-
registerFunction
public PDFFunction registerFunction(PDFFunction function)
Registers a function object against the output format document- Parameters:
function
- The function object to register- Returns:
- Returns either the function which has already been registered or the current new registered object.
-
registerShading
public PDFShading registerShading(PDFShading shading)
Registers a shading object against the otuput format document- Parameters:
shading
- The shading object to register- Returns:
- Returs either the shading which has already been registered or the current new registered object
-
registerPattern
public PDFPattern registerPattern(PDFPattern pattern)
Registers a pattern object against the output format document- Parameters:
pattern
- The pattern object to register- Returns:
- Returns either the pattern which has already been registered or the current new registered object
-
-