|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.render.svg.SVGUtilities
public final class SVGUtilities
Some utilities for creating svg DOM documents and elements.
Method Summary | |
---|---|
static Element |
createClip(Document doc,
Element els,
String id)
Create an SVG Clip. |
static Element |
createEllipse(Document doc,
float cx,
float cy,
float rx,
float ry)
Create an SVG Ellipse. |
static Element |
createG(Document doc)
Create an SVG G (group) element. |
static Element |
createImage(Document doc,
String ref,
float width,
float height)
Create an SVG Image. |
static Element |
createLine(Document doc,
float x,
float y,
float x2,
float y2)
Create an SVG Line. |
static Element |
createPath(Document doc,
String str)
Create an SVG Path. |
static Element |
createRect(Document doc,
float x,
float y,
float width,
float height)
Create an SVG Rectangle. |
static Element |
createText(Document doc,
float x,
float y,
String str)
Create an SVG Text object. |
static Rectangle2D |
getStringBounds(String str,
Font font)
Get the bounds for a particular string, given the font. |
static float |
getStringHeight(String str,
Font font)
Get the height of a particular string for a given font. |
static float |
getStringWidth(String str,
Font font)
Get the width of a particular string for a given font. |
static Element |
wrapText(Document doc,
String str,
Font font,
float width)
Create some SVG text that is wrapped into a specified width. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static float getStringWidth(String str, Font font)
str
- The String whose width is needed.font
- The AWT Font which should be used to compute the width.
public static float getStringHeight(String str, Font font)
str
- The String whose width is needed.font
- The AWT Font which should be used to compute the height.
public static Rectangle2D getStringBounds(String str, Font font)
str
- The String whose bounds are needed.font
- The AWT Font which should be used to compute the bounds.
public static Element createLine(Document doc, float x, float y, float x2, float y2)
doc
- The parent DOM.x
- The x coordinate of the start of the line, in points (??).y
- The y coordinate of the start of the line, in points (??).x2
- The x coordinate of the end of the line, in points (??).y2
- The y coordinate of the end of the line, in points (??).
public static Element createEllipse(Document doc, float cx, float cy, float rx, float ry)
doc
- The parent DOM.cx
- The x coordinate of the center of the ellipse, in points (??).cy
- The y coordinate of the center of the ellipse, in points (??).rx
- The x radius of the ellipse, in points (??).ry
- The y radius of the ellipse, in points (??).
public static Element createPath(Document doc, String str)
doc
- The parent DOM.str
- The String containing the attributes of the path.
public static Element createText(Document doc, float x, float y, String str)
doc
- The parent DOM.x
- The x coordinate of the start of the text, in points (??).y
- The y coordinate of the start of the text, in points (??).str
- The text to be written.
public static Element createRect(Document doc, float x, float y, float width, float height)
doc
- The parent DOM.x
- The x coordinate of the start of the rectangle, in points (??).y
- The y coordinate of the start of the rectangle, in points (??).width
- The width of the rectangle, in points (??).height
- The height of the rectangle, in points (??).
public static Element createG(Document doc)
doc
- The parent DOM.
public static Element createClip(Document doc, Element els, String id)
doc
- The parent DOM.els
- The elements to be clipped (??).id
- The "id" attribute for the clip.
public static Element createImage(Document doc, String ref, float width, float height)
doc
- The parent DOM.ref
- The URL to the image.width
- The width, in pixels (??), of the image.height
- The height, in pixels (??), of the image.
public static Element wrapText(Document doc, String str, Font font, float width)
doc
- The parent DOM.str
- The text to be written.font
- The AWT font which should be used to write the text.width
- The constraining width into which the text should be made
to fit.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |