com.jinsight.svg
Class SVGGraphics

java.lang.Object
  |
  +--java.awt.Graphics
        |
        +--com.jinsight.svg.SVGGraphics
All Implemented Interfaces:
java.lang.Cloneable

public class SVGGraphics
extends java.awt.Graphics
implements java.lang.Cloneable

This class extends the abstract class java.awt.Graphics, implementing painting methods to achieve the corresponding drawing effects with the SVG language. SVG stands for Scalable Vector Graphics and it consists of a sequence of XML elements describing two-dimensional graphics. More in-depth information can be obtained in the W3C(World Wide Web Consortium) web site(http://www.w3.org/TR/SVG).
Being an extension of java.awt.Graphics, an instance of this class can be passed to the paint(java.awt.Graphics) method of Component objects. Each of the drawing methods invoked from the paint method generates one or more strings adhering to the equivalent SVG syntax to the AWT methods. The strings are sequentially concatenated to make up the whole SVG compliant set of XML elements. The encoded string can be retrieved with the method SVGGraphics.getSVG() and be outputted to a file with the '.svg' extension.

See Also:
SVGEncoder

Method Summary
 void addSVGListener(SVGListener svgListener)
          Adds an SVGListener object to this SVG graphic context.
 void clearRect(int x, int y, int width, int height)
          Clears the specified rectangle by filling it with the background color of the current drawing surface.
 void clipRect(int x, int y, int width, int height)
          Intersects the current clip with the specified rectangle.
 void copyArea(int x, int y, int width, int height, int dx, int dy)
          Copies an area of the component by a distance specified by dx and dy.
 java.awt.Graphics create()
          Creates a new Graphics object that is a copy of this SVGGraphics object.
 void dispose()
          Disposes of an internal BufferedImage's graphics context and resets this graphics context.
 void draw3DRect(int x, int y, int width, int height, boolean raised)
          Draws a 3-D highlighted outline of the specified rectangle.
 void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
          Draws the outline of a circular or elliptical arc covering the specified rectangle.
 void drawBytes(byte[] data, int offset, int length, int x, int y)
          Draws the text given by the specified byte array, using this graphics context's current font and color.
 void drawChars(char[] data, int offset, int length, int x, int y)
          Draws the text given by the specified character array, using this graphics context's current font and color.
 boolean drawImage(java.awt.Image img, int x, int y, java.awt.Color bgColor, java.awt.image.ImageObserver observer)
          Draws an image at the specified rectangle.
 boolean drawImage(java.awt.Image img, int x, int y, java.awt.image.ImageObserver observer)
          Draws an image at the specified coordinates.The image is drawn with its top-left corner at (x, y) in this graphics context's coordinate space.
 boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.Color bgColor, java.awt.image.ImageObserver observer)
          Draws an image inside the specified rectangle, scaling it if necessary.
 boolean drawImage(java.awt.Image img, int x, int y, int width, int height, java.awt.image.ImageObserver observer)
          Draws an image inside the specified rectangle, scaling it if necessary.
 boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.Color bgColor, java.awt.image.ImageObserver observer)
          Draws an image inside the specified area of the destination drawable surface, scaling it if necessary.
 boolean drawImage(java.awt.Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, java.awt.image.ImageObserver observer)
          Draws an image inside the specified area of the destination drawable surface, scaling it if necessary.
 void drawLine(int x1, int y1, int x2, int y2)
          Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.
 void drawOval(int x, int y, int width, int height)
          Draws the outline of an oval.
 void drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
          Draws a closed polygon defined by arrays of x and y coordinates.
 void drawPolygon(java.awt.Polygon p)
          Draws the outline of a polygon defined by the specified Polygon object.
 void drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
          Draws a sequence of connected lines defined by arrays of x and y coordinates.
 void drawRect(int x, int y, int width, int height)
          Draws the outline of the specified rectangle.
 void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
          Draws an outlined round-cornered rectangle using this graphics context's current color.
 void drawString(java.text.AttributedCharacterIterator aci, int x, int y)
          This method has not been implemented yet.
 void drawString(java.lang.String str, int x, int y)
          Draws the text given by the specified string, using this graphics context's current font and color.
 void fill3DRect(int x, int y, int width, int height, boolean raised)
          Paints a 3-D highlighted rectangle filled with the current color.
 void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
          Fills a circular or elliptical arc covering the specified rectangle.
 void fillOval(int x, int y, int width, int height)
          Fills an oval bounded by the specified rectangle with the current color.
 void fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
          Fills a closed polygon defined by arrays of x and y coordinates.
 void fillPolygon(java.awt.Polygon p)
          Fills the polygon defined by the specified Polygon object with the graphics context's current color.
 void fillRect(int x, int y, int width, int height)
          Fills the specified rectangle.
 void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
          Fills the specified rounded corner rectangle with the current color.
 java.awt.Shape getClip()
          Gets the current clipping area.
 java.awt.Rectangle getClipBounds()
          Returns the bounding rectangle of the current clipping area.
 java.awt.Rectangle getClipBounds(java.awt.Rectangle r)
          Returns the bounding rectangle of the current clipping area.
 java.awt.Color getColor()
          Gets this graphics context's current color.
 java.awt.Font getFont()
          Gets the current font.
 java.awt.FontMetrics getFontMetrics()
          Gets the font metrics of the current font.
 java.awt.FontMetrics getFontMetrics(java.awt.Font f)
          Gets the font metrics for the specified font.
 java.lang.String getSVG()
          Returns the svg encoded string.
 int getSVGLinesCount()
          Returns the number of SVG lines processed.
 boolean hitClip(int x, int y, int width, int height)
          Returns true if the specified rectangular area might intersect the current clipping area.
 void removeAllSVGListeners()
          Removes all SVGListener objects from this SVG graphic context.
 void removeSVGListener(SVGListener svgListener)
          Removes an SVGListener object from this SVG graphic context.
 void setBackground(java.awt.Color bg)
          Sets the background color.
 void setClip(int x, int y, int width, int height)
          Sets the current clip to the rectangle specified by the given coordinates.
 void setClip(java.awt.Shape clip)
          Sets the current clipping area to an arbitrary clip shape.
 void setColor(java.awt.Color c)
          Sets this graphic context's current color to the specified color.
 void setCountEnabled(boolean isCountEnabled)
          Enables/disables count of SVG processed lines.
 void setDTD(java.lang.String dtd)
          Sets the SVG DTD.
 void setFont(java.awt.Font font)
          Sets this graphics context's font to the specified font.
 void setIdentifier(java.lang.String identifier)
          Sets the XML SVG identifier.
 void setOpeningInstruction(java.lang.String openingInstruction)
          Sets the XML opening instruction.
 void setPaintMode()
          This method has not been implemented.
 void setSVGNameSpace(java.lang.String svgNameSpace)
          Sets the SVG name space.
 void setXLinkNameSpace(java.lang.String xlinkNameSpace)
          Sets the XLink name space.
 void setXORMode(java.awt.Color c)
          This method has not been implemented.
 java.lang.String toString()
          Returns a string representation of this graphics context.
 void translate(int x, int y)
          Translates the origin of the graphics context to the point (x, y) in the current coordinate system.
 
Methods inherited from class java.awt.Graphics
create, finalize, getClipRect
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

addSVGListener

public void addSVGListener(SVGListener svgListener)
Adds an SVGListener object to this SVG graphic context. SVGEvent objects are dispatched to SVG listeners each time a new XML line is generated.
Parameters:
svgListener - An SVGListener object.
See Also:
removeSVGListener(com.jinsight.svg.SVGListener), removeAllSVGListeners(), SVGEvent

removeSVGListener

public void removeSVGListener(SVGListener svgListener)
Removes an SVGListener object from this SVG graphic context. SVGEvent objects are dispatched to SVG listeners each time a new XML line is generated.
Parameters:
svgListener - An SVGListener object.
See Also:
addSVGListener(com.jinsight.svg.SVGListener), removeAllSVGListeners(), SVGEvent

removeAllSVGListeners

public void removeAllSVGListeners()
Removes all SVGListener objects from this SVG graphic context. SVGEvent objects are dispatched to SVG listeners each time a new XML line is generated.
Parameters:
svgListener - An SVGListener object.
See Also:
addSVGListener(com.jinsight.svg.SVGListener), removeSVGListener(com.jinsight.svg.SVGListener), SVGEvent

setCountEnabled

public void setCountEnabled(boolean isCountEnabled)
Enables/disables count of SVG processed lines. If enabled, the painting methods return immediately without processing SVG encoding. Rather, an internal counter is incremented, registering how many SVG lines are generated.
The count number can be used as the maximum value of a gauge or any other type of visual tracking mechanism, so users can follow the course of the encoding process using an SVGListener to count the number of lines processed.
Parameters:
isCountEnabled - A boolean value(true/false).
See Also:
SVGListener

getSVGLinesCount

public int getSVGLinesCount()
Returns the number of SVG lines processed.
Returns:
An integer number.
See Also:
setCountEnabled(boolean)

setOpeningInstruction

public void setOpeningInstruction(java.lang.String openingInstruction)
Sets the XML opening instruction. The default opening instruction is <?xml version="1.0" standalone="no"?>.
Parameters:
openingInstruction - A String object.

setIdentifier

public void setIdentifier(java.lang.String identifier)
Sets the XML SVG identifier. The default identifier is PUBLIC "-//W3C//DTD SVG 1.0//EN".
Parameters:
identifier - A String object.

setDTD

public void setDTD(java.lang.String dtd)
Sets the SVG DTD. The default DTD is "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd".
Parameters:
dtd - A String object.

setSVGNameSpace

public void setSVGNameSpace(java.lang.String svgNameSpace)
Sets the SVG name space. The default SVG name space is "http://www.w3.org/2000/svg".
Parameters:
svgNameSpace - A String object.

setXLinkNameSpace

public void setXLinkNameSpace(java.lang.String xlinkNameSpace)
Sets the XLink name space. The default XLink name space is "http://www.w3.org/1999/xlink".
Parameters:
xlinkNameSpace - A String object.

setColor

public void setColor(java.awt.Color c)
Sets this graphic context's current color to the specified color. All subsequent graphic operations using this graphic context use the specified color.
Overrides:
setColor in class java.awt.Graphics
Parameters:
c - The new rendering color.

setBackground

public void setBackground(java.awt.Color bg)
Sets the background color. The default background color is white.
Parameters:
bg - A Color object.

clearRect

public void clearRect(int x,
                      int y,
                      int width,
                      int height)
Clears the specified rectangle by filling it with the background color of the current drawing surface.
Overrides:
clearRect in class java.awt.Graphics
Parameters:
x - The x coordinate of the rectangle to clear.
y - The y coordinate of the rectangle to clear.
width - The width of the rectangle to clear.
height - The height of the rectangle to clear.
See Also:
drawRect(int, int, int, int), fillRect(int, int, int, int), setColor(java.awt.Color)

clipRect

public void clipRect(int x,
                     int y,
                     int width,
                     int height)
Intersects the current clip with the specified rectangle. The resulting clipping area is the intersection of the current clipping area and the specified rectangle. If there is no current clipping area, either because the clip has never been set, or the clip has been cleared using setClip(null), the specified rectangle becomes the new clip. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility. This method can only be used to make the current clip smaller. To set the current clip larger, use any of the setClip methods. Rendering operations have no effect outside of the clipping area.
Overrides:
clipRect in class java.awt.Graphics
Parameters:
x - The x coordinate of the rectangle to intersect the clip with.
y - The y coordinate of the rectangle to intersect the clip with.
width - The width of the rectangle to intersect the clip with.
height - The height of the rectangle to intersect the clip with.

setClip

public void setClip(int x,
                    int y,
                    int width,
                    int height)
Sets the current clip to the rectangle specified by the given coordinates. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility. Rendering operations have no effect outside of the clipping area.
Overrides:
setClip in class java.awt.Graphics
Parameters:
x - The x coordinate of the new clip rectangle.
y - The y coordinate of the new clip rectangle.
width - The width of the new clip rectangle.
height - The height of the new clip rectangle.

setClip

public void setClip(java.awt.Shape clip)
Sets the current clipping area to an arbitrary clip shape. This method sets the user clip, which is independent of the clipping associated with device bounds and window visibility.
Overrides:
setClip in class java.awt.Graphics
Parameters:
clip - The Shape to use to set the clip.

getClip

public java.awt.Shape getClip()
Gets the current clipping area. This method returns the user clip, which is independent of the clipping associated with device bounds and window visibility. If no clip has previously been set, or if the clip has been cleared using setClip(null), this method returns null.
Overrides:
getClip in class java.awt.Graphics
Parameters:
A - Shape object representing the current clipping area, or null if no clip is set.

getClipBounds

public java.awt.Rectangle getClipBounds()
Returns the bounding rectangle of the current clipping area. If no clip has previously been set, or if the clip has been cleared using setClip(null), this method returns null.
Overrides:
getClipBounds in class java.awt.Graphics
Returns:
The bounding rectangle of the current clipping area, or null if no clip is set.

getClipBounds

public java.awt.Rectangle getClipBounds(java.awt.Rectangle r)
Returns the bounding rectangle of the current clipping area. This method differs from getClipBounds() in that an existing rectangle is used instead of allocating a new one. If no clip has previously been set, or if the clip has been cleared using setClip(null), this method returns the specified Rectangle.
Overrides:
getClipBounds in class java.awt.Graphics
Parameters:
The - rectangle where the current clipping area is copied to. Any current values in this rectangle are overwritten.
Returns:
The bounding rectangle of the current clipping area.

hitClip

public boolean hitClip(int x,
                       int y,
                       int width,
                       int height)
Returns true if the specified rectangular area might intersect the current clipping area.
Overrides:
hitClip in class java.awt.Graphics
Parameters:
x - The x coordinate of the rectangle to test against the clip.
y - The y coordinate of the rectangle to test against the clip.
width - The width of the rectangle to test against the clip.
height - The height of the rectangle to test against the clip.

draw3DRect

public void draw3DRect(int x,
                       int y,
                       int width,
                       int height,
                       boolean raised)
Draws a 3-D highlighted outline of the specified rectangle. The edges of the rectangle are highlighted so that they appear to be beveled and lit from the upper left corner.

The colors used for the highlighting effect are determined based on the current color. The resulting rectangle covers an area that is width + 1 pixels wide by height + 1 pixels tall.
Overrides:
draw3DRect in class java.awt.Graphics
Parameters:
x - The x coordinate of the rectangle to be drawn.
y - The y coordinate of the rectangle to be drawn.
width - The width of the rectangle to be drawn.
height - The height of the rectangle to be drawn.
raised - a boolean that determines whether the rectangle appears to be raised above the surface or sunk into the surface.
See Also:
fill3DRect(int, int, int, int, boolean)

fill3DRect

public void fill3DRect(int x,
                       int y,
                       int width,
                       int height,
                       boolean raised)
Paints a 3-D highlighted rectangle filled with the current color. The edges of the rectangle will be highlighted so that it appears as if the edges were beveled and lit from the upper left corner. The colors used for the highlighting effect will be determined from the current color.
Overrides:
fill3DRect in class java.awt.Graphics
Parameters:
x - The x coordinate of the rectangle to be filled.
y - The y coordinate of the rectangle to be filled.
width - The width of the rectangle to be filled.
height - The height of the rectangle to be filled.
raised - A boolean value that determines whether the rectangle appears to be raised above the surface or etched into the surface.

drawArc

public void drawArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)
Draws the outline of a circular or elliptical arc covering the specified rectangle. The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.
Overrides:
drawArc in class java.awt.Graphics
Parameters:
x - The x coordinate of the upper-left corner of the arc to be drawn.
y - The y coordinate of the upper-left corner of the arc to be drawn.
width - The width of the arc to be drawn.
height - The height of the arc to be drawn.
startAngle - The beginning angle.
endAngle - The angular extend of the arc, relative to the start angle.
See Also:
fillArc(int, int, int, int, int, int)

fillArc

public void fillArc(int x,
                    int y,
                    int width,
                    int height,
                    int startAngle,
                    int arcAngle)
Fills a circular or elliptical arc covering the specified rectangle. The resulting arc begins at startAngle and extends for arcAngle degrees, using the current color. Angles are interpreted such that 0 degrees is at the 3 o'clock position. A positive value indicates a counter-clockwise rotation while a negative value indicates a clockwise rotation.

The center of the arc is the center of the rectangle whose origin is (x, y) and whose size is specified by the width and height arguments.

The resulting arc covers an area width + 1 pixels wide by height + 1 pixels tall.
Overrides:
fillArc in class java.awt.Graphics
Parameters:
x - The x coordinate of the upper-left corner of the arc to be drawn.
y - The y coordinate of the upper-left corner of the arc to be drawn.
width - The width of the arc to be drawn.
height - The height of the arc to be drawn.
startAngle - The beginning angle.
endAngle - The angular extend of the arc, relative to the start angle.
See Also:
fillArc(int, int, int, int, int, int)

drawRect

public void drawRect(int x,
                     int y,
                     int width,
                     int height)
Draws the outline of the specified rectangle. The left and right edges of the rectangle are at x and x + width. The top and bottom edges are at y and y + height. The rectangle is drawn using the graphics context's current color.
Overrides:
drawRect in class java.awt.Graphics
Parameters:
x - The x coordinate of the rectangle to be drawn.
y - The y coordinate of the rectangle to be drawn.
width - The width of the rectangle to be drawn.
height - The height of the rectangle to be drawn.
See Also:
fillRect(int, int, int, int), clearRect(int, int, int, int)

fillRect

public void fillRect(int x,
                     int y,
                     int width,
                     int height)
Fills the specified rectangle. The left and right edges of the rectangle are at x and x + width - 1. The top and bottom edges are at y and y + height - 1. The resulting rectangle covers an area width pixels wide by height pixels tall. The rectangle is filled using the graphics context's current color.
Overrides:
fillRect in class java.awt.Graphics
Parameters:
x - The x coordinate of the rectangle to be filled.
y - The y coordinate of the rectangle to be filled.
width - The width of the rectangle to be filled.
height - The height of the rectangle to be filled.
See Also:
clearRect(int, int, int, int), drawRect(int, int, int, int)

drawLine

public void drawLine(int x1,
                     int y1,
                     int x2,
                     int y2)
Draws a line, using the current color, between the points (x1, y1) and (x2, y2) in this graphics context's coordinate system.
Overrides:
drawLine in class java.awt.Graphics
Parameters:
x1 - The first point's x coordinate.
y1 - The first point's y coordinate.
x2 - The second point's x coordinate.
y2 - The second point's y coordinate.

drawOval

public void drawOval(int x,
                     int y,
                     int width,
                     int height)
Draws the outline of an oval. The result is a circle or ellipse that fits within the rectangle specified by the x, y, width, and height arguments.

The oval covers an area that is width + 1 pixels wide and height + 1 pixels tall.
Overrides:
drawOval in class java.awt.Graphics
Parameters:
x - The x coordinate of the upper left corner of the oval to be drawn.
y - The y coordinate of the upper left corner of the oval to be drawn.
width - The width of the oval to be drawn.
height - The height of the oval to be drawn.
See Also:
fillOval(int, int, int, int)

fillOval

public void fillOval(int x,
                     int y,
                     int width,
                     int height)
Fills an oval bounded by the specified rectangle with the current color.
Overrides:
fillOval in class java.awt.Graphics
Parameters:
x - The x coordinate of the upper left corner of the oval to be drawn.
y - The y coordinate of the upper left corner of the oval to be drawn.
width - The width of the oval to be drawn.
height - The height of the oval to be drawn.
See Also:
drawOval(int, int, int, int)

drawPolygon

public void drawPolygon(java.awt.Polygon p)
Draws the outline of a polygon defined by the specified Polygon object.
Overrides:
drawPolygon in class java.awt.Graphics
Parameters:
p - The polygon to draw.
See Also:
drawPolygon(int[] xPoints,int[] yPoints,int nPoints)

drawPolygon

public void drawPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Draws a closed polygon defined by arrays of x and y coordinates. Each pair of (x,y) coordinates defines a point.

This method draws the polygon defined by nPoint line segments, where the first nPoint - 1 line segments are line segments from (xPoints[i - 1], yPoints[i - 1]) to (xPoints[i], yPoints[i]), for 1 ≤ i  ≤  nPoints. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.
Overrides:
drawPolygon in class java.awt.Graphics
Parameters:
xPoints - An array of x coordinates.
yPoints - An array of y coordinates.
nPoints - The total number of points.
See Also:
drawPolygon(Polygon p)

fillPolygon

public void fillPolygon(java.awt.Polygon p)
Fills the polygon defined by the specified Polygon object with the graphics context's current color.
Overrides:
fillPolygon in class java.awt.Graphics
Parameters:
p - The polygon to fill.
See Also:
fillPolygon(int[] xPoints,int[] yPoints, int nPoints)

fillPolygon

public void fillPolygon(int[] xPoints,
                        int[] yPoints,
                        int nPoints)
Fills a closed polygon defined by arrays of x and y coordinates. This method draws the polygon defined by nPoint line segments, where the first nPoint - 1 line segments are line segments from (xPoints[i - 1], yPoints[i - 1]) to (xPoints[i], yPoints[i]), for 1 ≤ i  ≤ nPoints. The figure is automatically closed by drawing a line connecting the final point to the first point, if those points are different.
Overrides:
fillPolygon in class java.awt.Graphics
Parameters:
xPoints - An array of x coordinates.
yPoints - An array of y coordinates.
nPoints - The total number of points.
See Also:
fillPolygon(Polygon p)

drawPolyline

public void drawPolyline(int[] xPoints,
                         int[] yPoints,
                         int nPoints)
Draws a sequence of connected lines defined by arrays of x and y coordinates. Each pair of (x, y) coordinates defines a point. The figure is not closed if the first point differs from the last point.
Overrides:
drawPolyline in class java.awt.Graphics
Parameters:
xPoints - An array of x points.
yPoints - An array of y points.
nPoints - The total number of points.

drawRoundRect

public void drawRoundRect(int x,
                          int y,
                          int width,
                          int height,
                          int arcWidth,
                          int arcHeight)
Draws an outlined round-cornered rectangle using this graphics context's current color. The left and right edges of the rectangle are at x and x + width, respectively. The top and bottom edges of the rectangle are at y and y + height.
Overrides:
drawRoundRect in class java.awt.Graphics
Parameters:
x - The x coordinate of the rectangle to be drawn.
y - The y coordinate of the rectangle to be drawn.
width - The width of the rectangle to be drawn.
height - The height of the rectangle to be drawn.
arcWidth - The horizontal diameter of the arc at the four corners.
archeight - The vertical diameter of the arc at the four corners.
See Also:
fillRoundRect(int, int, int, int, int, int)

fillRoundRect

public void fillRoundRect(int x,
                          int y,
                          int width,
                          int height,
                          int arcWidth,
                          int arcHeight)
Fills the specified rounded corner rectangle with the current color. The left and right edges of the rectangle are at x and x + width - 1, respectively. The top and bottom edges of the rectangle are at y and y + height - 1.
Overrides:
fillRoundRect in class java.awt.Graphics
Parameters:
x - The x coordinate of the rectangle to be filled.
y - The y coordinate of the rectangle to be filled.
width - The width of the rectangle to be filled.
height - The height of the rectangle to be filled.
arcWidth - The horizontal diameter of the arc at the four corners.
archeight - The vertical diameter of the arc at the four corners.
See Also:
drawRoundRect(int, int, int, int, int, int)

drawString

public void drawString(java.lang.String str,
                       int x,
                       int y)
Draws the text given by the specified string, using this graphics context's current font and color. The baseline of the leftmost character is at position (x, y) in this graphics context's coordinate system.
Overrides:
drawString in class java.awt.Graphics
Parameters:
str - The string to be drawn.
x - The x coordinate.
y - The y coordinate.
See Also:
drawBytes(byte[], int, int, int, int), drawChars(char[], int, int, int, int)

drawBytes

public void drawBytes(byte[] data,
                      int offset,
                      int length,
                      int x,
                      int y)
Draws the text given by the specified byte array, using this graphics context's current font and color. The baseline of the first character is at position (x, y) in this graphics context's coordinate system.
Overrides:
drawBytes in class java.awt.Graphics
Parameters:
data - The data to be drawn.
offset - The start offset in the data.
length - The number of bytes that are drawn.
x - The x coordinate of the baseline of the text.
y - The y coordinate of the baseline of the text.
See Also:
drawString(java.lang.String, int, int), drawChars(char[], int, int, int, int)

drawChars

public void drawChars(char[] data,
                      int offset,
                      int length,
                      int x,
                      int y)
Draws the text given by the specified character array, using this graphics context's current font and color. The baseline of the first character is at position (x, y) in this graphics context's coordinate system.
Overrides:
drawChars in class java.awt.Graphics
Parameters:
data - The array of characters to be drawn.
offset - The start offset in the data.
length - The number of characters to be drawn.
x - The x coordinate of the baseline of the text.
y - The y coordinate of the baseline of the text.
See Also:
drawString(java.lang.String, int, int), drawBytes(byte[], int, int, int, int)

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         java.awt.image.ImageObserver observer)
Draws an image at the specified coordinates.The image is drawn with its top-left corner at (x, y) in this graphics context's coordinate space. This method only accepts images that have been completely loaded. The image width and height are checked and if any is invalid the method returns immediately.
Observers are not notified during the SVG encoding process, therefore passing an ImageObserver to this method has the same effect as passing null.
Overrides:
drawImage in class java.awt.Graphics
Parameters:
img - The specified image to be drawn.
x - The x coordinate.
y - The y coordinate.
observer - An ImageObserver object.

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         java.awt.image.ImageObserver observer)
Draws an image inside the specified rectangle, scaling it if necessary. This method only accepts images that have been completely loaded. The image width and height are checked and if any is invalid the method returns immediately.
Observers are not notified during the SVG encoding process, therefore passing an ImageObserver to this method has the same effect as passing null.
Overrides:
drawImage in class java.awt.Graphics
Parameters:
img - The specified image to be drawn.
x - The x coordinate.
y - The y coordinate.
width - The width of the rectangle.
height - The height of the rectangle.
observer - An ImageObserver object.

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         java.awt.Color bgColor,
                         java.awt.image.ImageObserver observer)
Draws an image at the specified rectangle. The image is drawn with its top-left corner at (x, y) in this graphics context's coordinate space. Transparent pixels are drawn in the specified background color.
This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it.
This method only accepts images that have been completely loaded. The image width and height are checked and if any is invalid the method returns immediately.
Observers are not notified during the SVG encoding process, therefore passing an ImageObserver to this method has the same effect as passing null.
Overrides:
drawImage in class java.awt.Graphics
Parameters:
img - The specified image to be drawn.
x - The x coordinate.
y - The y coordinate.
bgColor - The background color to paint under the non-opaque portions of the image.
observer - An ImageObserver object.

drawImage

public boolean drawImage(java.awt.Image img,
                         int x,
                         int y,
                         int width,
                         int height,
                         java.awt.Color bgColor,
                         java.awt.image.ImageObserver observer)
Draws an image inside the specified rectangle, scaling it if necessary. Transparent pixels are drawn in the specified background color.
This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it.
This method only accepts images that have been completely loaded. The image width and height are checked and if any is invalid the method returns immediately.
Observers are not notified during the SVG encoding process, therefore passing an ImageObserver to this method has the same effect as passing null.
Overrides:
drawImage in class java.awt.Graphics
Parameters:
img - The specified image to be drawn.
x - The x coordinate.
y - The y coordinate.
width - The width of the rectangle.
height - The height of the rectangle.
bgColor - The background color to paint under the non-opaque portions of the image.
observer - An ImageObserver object.

drawImage

public boolean drawImage(java.awt.Image img,
                         int dx1,
                         int dy1,
                         int dx2,
                         int dy2,
                         int sx1,
                         int sy1,
                         int sx2,
                         int sy2,
                         java.awt.image.ImageObserver observer)
Draws an image inside the specified area of the destination drawable surface, scaling it if necessary. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle, and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings.
This method only accepts images that have been completely loaded. The image width and height are checked and if any is invalid the method returns immediately.
Observers are not notified during the SVG encoding process, therefore passing an ImageObserver to this method has the same effect as passing null.
Overrides:
drawImage in class java.awt.Graphics
Parameters:
img - The specified image to be drawn.
dx1 - The x coordinate of the first corner of the destination rectangle.
dy1 - The y coordinate of the first corner of the destination rectangle.
dx2 - The x coordinate of the second corner of the destination rectangle.
dy2 - the y coordinate of the second corner of the destination rectangle.
sx1 - The x coordinate of the first corner of the source rectangle.
sy1 - The y coordinate of the first corner of the source rectangle.
sx2 - The x coordinate of the second corner of the source rectangle.
sy2 - The y coordinate of the second corner of the source rectangle.
observer - An ImageObserver object.

drawImage

public boolean drawImage(java.awt.Image img,
                         int dx1,
                         int dy1,
                         int dx2,
                         int dy2,
                         int sx1,
                         int sy1,
                         int sx2,
                         int sy2,
                         java.awt.Color bgColor,
                         java.awt.image.ImageObserver observer)
Draws an image inside the specified area of the destination drawable surface, scaling it if necessary. Scaling of the image from source to destination is performed such that the first coordinate of the source rectangle is mapped to the first coordinate of the destination rectangle, and the second source coordinate is mapped to the second destination coordinate. The subimage is scaled and flipped as needed to preserve those mappings.
Transparent pixels are drawn in the specified background color. This operation is equivalent to filling a rectangle of the width and height of the specified image with the given color and then drawing the image on top of it.
This method only accepts images that have been completely loaded. The image width and height are checked and if any is invalid the method returns immediately.
Observers are not notified during the SVG encoding process, therefore passing an ImageObserver to this method has the same effect as passing null.
Overrides:
drawImage in class java.awt.Graphics
Parameters:
img - The specified image to be drawn.
dx1 - The x coordinate of the first corner of the destination rectangle.
dy1 - The y coordinate of the first corner of the destination rectangle.
dx2 - The x coordinate of the second corner of the destination rectangle.
dy2 - the y coordinate of the second corner of the destination rectangle.
sx1 - The x coordinate of the first corner of the source rectangle.
sy1 - The y coordinate of the first corner of the source rectangle.
sx2 - The x coordinate of the second corner of the source rectangle.
sy2 - The y coordinate of the second corner of the source rectangle.
observer - An ImageObserver object.

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 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.
Overrides:
copyArea in class java.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.

translate

public void translate(int x,
                      int y)
Translates the origin of the graphics context to the point (x, y) in the current coordinate system. Modifies this graphics context so that its new origin corresponds to the point (x, y) in this graphics context's original coordinate system. All coordinates used in subsequent rendering operations on this graphics context will be relative to this new origin.
Overrides:
translate in class java.awt.Graphics
Parameters:
x - The x coordinate.
y - The y coordinate.

getColor

public java.awt.Color getColor()
Gets this graphics context's current color.
Overrides:
getColor in class java.awt.Graphics
Returns:
This graphics context's current color.
See Also:
setColor(java.awt.Color)

getFont

public java.awt.Font getFont()
Gets the current font.
Overrides:
getFont in class java.awt.Graphics
Returns:
This graphics context's current font.
See Also:
setFont(java.awt.Font)

getFontMetrics

public java.awt.FontMetrics getFontMetrics()
Gets the font metrics of the current font.
Overrides:
getFontMetrics in class java.awt.Graphics
Returns:
The font metrics of this graphics context's current font.
See Also:
getFont(), getFontMetrics(Font f)

getFontMetrics

public java.awt.FontMetrics getFontMetrics(java.awt.Font f)
Gets the font metrics for the specified font.
Overrides:
getFontMetrics in class java.awt.Graphics
Returns:
The font metrics for the specified font.
See Also:
getFontMetrics(), getFont()

setFont

public void setFont(java.awt.Font font)
Sets this graphics context's font to the specified font.
Overrides:
setFont in class java.awt.Graphics
Parameters:
font - The font.
See Also:
getFont()

toString

public java.lang.String toString()
Returns a string representation of this graphics context.
Overrides:
toString in class java.awt.Graphics
Returns:
A String object.

create

public java.awt.Graphics create()
Creates a new Graphics object that is a copy of this SVGGraphics object.
Overrides:
create in class java.awt.Graphics
Returns:
A new graphics context that is a copy of this graphics context.

dispose

public void dispose()
Disposes of an internal BufferedImage's graphics context and resets this graphics context. The BufferedImage is internally used to keep track of all painting performed on this graphics context, playing a role on the implementation of methods like copyArea. Different from the overriden method, a call to dispose simply resets this graphics context, making it possible to reuse it after an SVG encoding process has ended.
Overrides:
dispose in class java.awt.Graphics

getSVG

public java.lang.String getSVG()
Returns the svg encoded string. This method must only be invoked after the paint(Graphics g) method of the encoded component has returned.
Returns:
A String object.

drawString

public void drawString(java.text.AttributedCharacterIterator aci,
                       int x,
                       int y)
This method has not been implemented yet.
Overrides:
drawString in class java.awt.Graphics

setXORMode

public void setXORMode(java.awt.Color c)
This method has not been implemented. We haven't found so far the equivalent in the SVG language to the XOR mode implemented in the Java language. We have even tested the feComposite filter with the operator set to 'xor', but the source graphics is not painted on the background in the same way as it is using the Java language.
Overrides:
setXORMode in class java.awt.Graphics

setPaintMode

public void setPaintMode()
This method has not been implemented.
Overrides:
setPaintMode in class java.awt.Graphics