This implementation of the java.awt.Graphics2D abstract class
allows users to generate SVG (Scalable Vector Graphics) content
from Java code.
SVGGraphics2D generates a DOM tree whose root is obtained through
the getRoot method. Refer to the DOMTreeManager and DOMGroupManager
documentation for details on the structure of the generated
DOM tree.
The SVGGraphics2D class can produce a DOM tree using any implementation
that conforms to the W3C DOM 1.0 specification (see http://www.w3.org).
At construction time, the SVGGraphics2D must be given a org.w3.dom.Document
instance that is used as a factory to create the various nodes in the
DOM tree it generates.
The various graphic context attributes (e.g., AffineTransform,
Paint) are managed by a GraphicContext object.

setUnsupportedAttributes(Set attrs)
This method let's users indicate that they don't care that
certain text attributes will not be properly converted to
SVG, in exchange when those attributes are used they will
get real SVG text instead of paths.

void

setXORMode(Color c1)
Sets the paint mode of this graphics context to alternate between
this graphics context's current color and the new specified color.

domTreeManager

The DOMTreeManager manages the process of creating
and growing the SVG tree. This SVGGraphics2D relies on
the DOMTreeManager to process attributes based on the
GraphicContext state and create groups when needed.

domGroupManager

The DOMGroupManager manages additions to the current group
node associated for this Graphics2D object. Once a group
is complete, the group manager appends it to the DOM tree
through the DOMTreeManager.
Note that each SVGGraphics2D instance has its own DOMGroupManager
(i.e., its own current group) but that all SVGGraphics2D
originating from the same SVGGraphics2D through various
createGraphics calls share the same DOMTreeManager.

setXORMode

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.

copyArea

Copies an area of the component by a distance specified by
dx and dy. From the point specified
by x and y, this method
copies downwards and to the right. To copy an area of the
component to the left or upwards, specify a negative value for
dx or dy.
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's paint method.

drawImage

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 returns false. As more of
the image becomes available, the process that draws the image notifies
the specified image observer.

drawImage

Draws as much of the specified image as has already been scaled
to fit inside the specified rectangle.

The image is drawn inside the specified rectangle of this
graphics context's coordinate space, and is scaled if
necessary. Transparent pixels do not affect whatever pixels
are already there.

This method returns immediately in all cases, even if the
entire image has not yet been scaled, dithered, and converted
for the current output device.
If the current output representation is not yet complete, then
drawImage returns false. As more of
the image becomes available, the process that draws the image notifies
the image observer by calling its imageUpdate method.

A scaled version of an image will not necessarily be
available immediately just because an unscaled version of the
image has been constructed for this output device. Each size of
the image may be cached separately and generated from the original
data in a separate image production sequence.

dispose

public void dispose()

Disposes of this graphics context and releases
any system resources that it is using.
A Graphics object cannot be used after
disposehas 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 and update methods
of components are automatically released by the system when
those methods return. For efficiency, programmers should
call dispose when finished using
a Graphics object only if it was created
directly from a component or another Graphics object.

drawImage

Renders an image, applying a transform from image space into user space
before drawing.
The transformation from user space into device space is done with
the current Transform in the Graphics2D.
The specified transformation is applied to the image before the
transform attribute in the Graphics2D context is applied.
The rendering attributes applied include the Clip,
Transform, and Composite attributes.
Note that no rendering is done if the specified transform is
noninvertible.

drawRenderedImage

Renders a RenderedImage,
applying a transform from image
space into user space before drawing.
The transformation from user space into device space is done with
the current Transform in the Graphics2D.
The specified transformation is applied to the image before the
transform attribute in the Graphics2D context is applied.
The rendering attributes applied include the Clip,
Transform, and Composite attributes. Note
that no rendering is done if the specified transform is
noninvertible.

drawRenderableImage

Renders a
RenderableImage,
applying a transform from image space into user space before drawing.
The transformation from user space into device space is done with
the current Transform in the Graphics2D.
The specified transformation is applied to the image before the
transform attribute in the Graphics2D context is applied.
The rendering attributes applied include the Clip,
Transform, and Composite attributes. Note
that no rendering is done if the specified transform is
noninvertible.

Rendering hints set on the Graphics2D object might
be used in rendering the RenderableImage.
If explicit control is required over specific hints recognized by a
specific RenderableImage, or if knowledge of which hints
are used is required, then a RenderedImage should be
obtained directly from the RenderableImage
and rendered using
drawRenderedImage(RenderedImage, AffineTransform).

drawString

Renders the text specified by the specified String,
using the current Font and Paint attributes
in the Graphics2D context.
The baseline of the first character is at position
(x, y) in the User Space.
The rendering attributes applied include the Clip,
Transform, Paint, Font and
Composite 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.

drawString

Renders the text of the specified iterator, using the
Graphics2D context's current Paint. The
iterator must specify a font
for each character. The baseline of the
first character is at position (x, y) in the
User Space.
The rendering attributes applied include the Clip,
Transform, Paint, and
Composite 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.

setUnsupportedAttributes

This method let's users indicate that they don't care that
certain text attributes will not be properly converted to
SVG, in exchange when those attributes are used they will
get real SVG text instead of paths.

Parameters:

attrs - The set of attrs to treat as unsupported, and
if present cause text to be drawn as paths.
If null ACI text will be rendered as text
(unless 'textAsShapes' is set).