public class SvgGraphics
extends java.awt.Graphics
| Constructor and Description |
|---|
SvgGraphics()
Instantiates a new svg graphics.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> attributes,
java.lang.String data)
Adds the SVG element to the current document
|
void |
addFunction(java.lang.String function)
Adds a Javascript function to the SVG document.
|
void |
beginGroup(java.util.Map<java.lang.String,java.lang.String> attributes)
Begin a group of elements within the SVG document.
|
void |
beginLink(java.lang.String urlString)
Begin a hyperlink reference.
|
void |
clear()
Clear the current SVG document, and rebuild.
|
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 Graphics object.
|
void |
dispose()
Disposes of this graphics context and releases any system resources that
it is using.
|
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.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
Draws as much of the specified image as is currently available.
|
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.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
Draws as much of the specified image as has already been scaled to fit
inside the specified rectangle.
|
boolean |
drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
Draws as much of the specified image as has already been scaled to fit
inside the specified rectangle.
|
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 as much of the specified area of the specified image as is
currently available, scaling it on the fly to fit inside the specified
area of the destination drawable surface.
|
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 as much of the specified area of the specified image as is
currently available, scaling it on the fly to fit inside the specified
area of the destination drawable surface.
|
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 |
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 iterator,
int x,
int y)
Draws the text given by the specified iterator, using this graphics
context's current color.
|
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 |
endGroup()
End the current group.
|
void |
endLink()
End the current hyperlink element.
|
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 |
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.Color |
getColor()
Gets this graphics context's current color.
|
java.awt.Font |
getFont()
Gets the font metrics of the current font.
|
java.awt.FontMetrics |
getFontMetrics(java.awt.Font font)
Gets the font metrics of the specified font.
|
java.lang.String |
getSvg()
Gets the svg.
|
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 col)
Sets this graphics context's current color to the specified color.
|
void |
setFont(java.awt.Font font)
Sets this graphics context's font to the specified font.
|
void |
setPaintMode()
Sets the paint mode of this graphics context to overwrite the
destination with this graphics context's current color.
|
void |
setSize(int width,
int height)
Sets the size.
|
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.
|
void |
translate(int x,
int y)
Translates the origin of the graphics context to the point (x, y) in the
current coordinate system.
|
void |
writeSvg(java.io.Writer writer)
Write the current SVG content to a writer.
|
public void addElement(java.lang.String name,
java.util.Map<java.lang.String,java.lang.String> attributes,
java.lang.String data)
name - the name of the elementattributes - the attributes for the elementdata - the textual data to include with the SVGpublic void addFunction(java.lang.String function)
function - the functionpublic void beginGroup(java.util.Map<java.lang.String,java.lang.String> attributes)
attributes - the map of attributespublic void beginLink(java.lang.String urlString)
urlString - the url string for the hyperlink destinationpublic void clear()
public void clearRect(int x,
int y,
int width,
int height)
clearRect in class java.awt.Graphicsx - 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.public void clipRect(int x,
int y,
int width,
int height)
clipRect in class java.awt.Graphicsx - the x coordinate of the rectangle to intersect the clip withy - the y coordinate of the rectangle to intersect the clip withwidth - the width of the rectangle to intersect the clip withheight - the height of the rectangle to intersect the clip withpublic void copyArea(int x,
int y,
int width,
int height,
int dx,
int dy)
copyArea in class java.awt.Graphicsx - 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.public java.awt.Graphics create()
create in class java.awt.Graphicspublic void dispose()
dispose in class java.awt.Graphicspublic void drawArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
drawArc in class java.awt.Graphicsx - 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.arcAngle - the angular extent of the arc, relative to the start
angle.public boolean drawImage(java.awt.Image img,
int x,
int y,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicsimg - the specified image to be drawn. This method does nothing if
img is null.x - the x coordinate.y - the y coordinate.bgcolor - the background color to paint under the non-opaque
portions of the image.observer - object to be notified as more of the image is converted.public boolean drawImage(java.awt.Image img,
int x,
int y,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicsimg - the specified image to be drawn. This method does nothing if
img is null.x - the x coordinate.y - the y coordinate. portions of the image.observer - object to be notified as more of the image is converted.public boolean drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.Color bgcolor,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicsimg - the specified image to be drawn. This method does nothing if
img is null.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 - object to be notified as more of the image is converted.public boolean drawImage(java.awt.Image img,
int x,
int y,
int width,
int height,
java.awt.image.ImageObserver observer)
drawImage in class java.awt.Graphicsimg - the specified image to be drawn. This method does nothing if
img is null.x - the x coordinate.y - the y coordinate.width - the width of the rectangle.height - the height of the rectangle.observer - object to be notified as more of the image is converted.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)
drawImage in class java.awt.Graphicsimg - the specified image to be drawn. This method does nothing if
img is null.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.bgcolor - the background color to paint under the non-opaque
portions of the image.observer - object to be notified as more of the image is scaled and
converted.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)
drawImage in class java.awt.Graphicsimg - the specified image to be drawn. This method does nothing if
img is null.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 - object to be notified as more of the image is scaled and
converted.public void drawLine(int x1,
int y1,
int x2,
int y2)
drawLine in class java.awt.Graphicsx1 - 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.public void drawOval(int x,
int y,
int width,
int height)
drawOval in class java.awt.Graphicsx - 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.public void drawPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
drawPolygon in class java.awt.GraphicsxPoints - a an array of x coordinates.yPoints - a an array of y coordinates.nPoints - a the total number of points.public void drawPolyline(int[] xPoints,
int[] yPoints,
int nPoints)
drawPolyline in class java.awt.GraphicsxPoints - an array of x pointsyPoints - an array of y pointsnPoints - the total number of pointspublic void drawRect(int x,
int y,
int width,
int height)
drawRect in class java.awt.Graphicsx - 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.public void drawRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
drawRoundRect in class java.awt.Graphicsx - 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.public void drawString(java.text.AttributedCharacterIterator iterator,
int x,
int y)
drawString in class java.awt.Graphicsiterator - the iterator whose text is to be drawnx - the x coordinate.y - the y coordinate.public void drawString(java.lang.String str,
int x,
int y)
drawString in class java.awt.Graphicsstr - the string to be drawn.x - the x coordinate.y - the y coordinate.public void endGroup()
public void endLink()
public void fillArc(int x,
int y,
int width,
int height,
int startAngle,
int arcAngle)
fillArc in class java.awt.Graphicsx - 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.arcAngle - the angular extent of the arc, relative to the start
angle.public void fillOval(int x,
int y,
int width,
int height)
fillOval in class java.awt.Graphicsx - 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.public void fillPolygon(int[] xPoints,
int[] yPoints,
int nPoints)
fillPolygon in class java.awt.GraphicsxPoints - a an array of x coordinates.yPoints - a an array of y coordinates.nPoints - a the total number of points.public void fillRect(int x,
int y,
int width,
int height)
fillRect in class java.awt.Graphicsx - 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.public void fillRoundRect(int x,
int y,
int width,
int height,
int arcWidth,
int arcHeight)
fillRoundRect in class java.awt.Graphicsx - 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.public java.awt.Shape getClip()
getClip in class java.awt.Graphicspublic java.awt.Rectangle getClipBounds()
getClipBounds in class java.awt.Graphicspublic java.awt.Color getColor()
getColor in class java.awt.Graphicspublic java.awt.Font getFont()
getFont in class java.awt.Graphicspublic java.awt.FontMetrics getFontMetrics(java.awt.Font font)
getFontMetrics in class java.awt.Graphicsfont - the specified fontpublic java.lang.String getSvg()
public void setClip(int x,
int y,
int width,
int height)
setClip in class java.awt.Graphicsx - 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.public void setClip(java.awt.Shape clip)
setClip in class java.awt.Graphicsclip - the Shape to use to set the clippublic void setColor(java.awt.Color col)
setColor in class java.awt.Graphicscol - the new rendering color.public void setFont(java.awt.Font font)
setFont in class java.awt.Graphicsfont - the fontpublic void setPaintMode()
setPaintMode in class java.awt.Graphicspublic void setSize(int width,
int height)
width - the widthheight - the heightpublic void setXORMode(java.awt.Color c1)
setXORMode in class java.awt.Graphicsc1 - the XOR alternation colorpublic void translate(int x,
int y)
translate in class java.awt.Graphicsx - the x coordinatey - the y coordinatepublic void writeSvg(java.io.Writer writer)
writer - the writer to write the SVG to.