public final class SVGUtilities extends Object
| Modifier and Type | Method and Description |
|---|---|
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.
|
static Element |
createImage(Document doc,
String ref,
float width,
float height)
Create and svg image element.
|
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 Document |
createSVGDocument(float width,
float height)
Create a new svg document with batik.
|
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 string bounds for a particular string given the font.
|
static float |
getStringHeight(String str,
Font font)
Get the string height for a particular string given the font.
|
static float |
getStringWidth(String str,
Font font)
Get the string width for a particular string given the font.
|
static Element |
wrapText(Document doc,
String str,
Font font,
float width)
Create some SVG text that is wrapped into a specified width.
|
public static Document createSVGDocument(float width, float height)
width - the width of the root svg elementheight - the height of the root svg elementpublic static float getStringWidth(String str, Font font)
str - the stringfont - the fontpublic static float getStringHeight(String str, Font font)
str - the stringfont - the fontpublic static Rectangle2D getStringBounds(String str, Font font)
str - the stringfont - the fontpublic static Element createLine(Document doc, float x, float y, float x2, float y2)
doc - the document to create the elementx - the start x positiony - the start y positionx2 - the end x positiony2 - the end y positionpublic static Element createEllipse(Document doc, float cx, float cy, float rx, float ry)
doc - the document to create the elementcx - the centre x positioncy - the centre y positionrx - the x axis radiusry - the y axis radiuspublic static Element createPath(Document doc, String str)
doc - the document to create the elementstr - the string for the d attribute on the pathpublic static Element createText(Document doc, float x, float y, String str)
doc - the document to create the elementx - the start x positiony - the start y positionstr - the stringpublic static Element createRect(Document doc, float x, float y, float width, float height)
doc - the document to create the elementx - the start x positiony - the start y positionwidth - the width of the rectangleheight - the height of the rectanglepublic static Element createG(Document doc)
doc - the document to create the elementpublic static Element createClip(Document doc, Element els, String id)
doc - the document to create the elementels - the child elements that make the clipid - the id of the clipping pathpublic static Element createImage(Document doc, String ref, float width, float height)
doc - the document to create the elementref - the href link to the imagewidth - the width to set on the imageheight - the height to set on the imagepublic static Element wrapText(Document doc, String str, Font font, float width)
doc - the document to create the elementsstr - the string to wrapfont - the fontwidth - the width to wrapCopyright © 2023 Apache Software Foundation. All rights reserved.