Class SVGUtilities
java.lang.Object
org.apache.fop.svg.SVGUtilities
Some utilities for creating svg DOM documents and elements.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ElementcreateClip(Document doc, Element els, String id) Create an SVG Clip.static ElementcreateEllipse(Document doc, float cx, float cy, float rx, float ry) Create an SVG Ellipsestatic ElementCreate an SVG G.static ElementcreateImage(Document doc, String ref, float width, float height) Create and svg image element.static ElementcreateLine(Document doc, float x, float y, float x2, float y2) Create an SVG Linestatic ElementcreatePath(Document doc, String str) Create an SVG Path.static ElementcreateRect(Document doc, float x, float y, float width, float height) Create an SVG Rectangle.static DocumentcreateSVGDocument(float width, float height) Create a new svg document with batik.static ElementcreateText(Document doc, float x, float y, String str) Create an SVG Text object.static Rectangle2DgetStringBounds(String str, Font font) Get the string bounds for a particular string given the font.static floatgetStringHeight(String str, Font font) Get the string height for a particular string given the font.static floatgetStringWidth(String str, Font font) Get the string width for a particular string given the font.static ElementCreate some SVG text that is wrapped into a specified width.
-
Field Details
-
SVG_NS
- See Also:
-
-
Constructor Details
-
SVGUtilities
private SVGUtilities()
-
-
Method Details
-
createSVGDocument
Create a new svg document with batik.- Parameters:
width- the width of the root svg elementheight- the height of the root svg element- Returns:
- a new SVG Document
-
getStringWidth
-
getStringHeight
-
getStringBounds
Get the string bounds for a particular string given the font.- Parameters:
str- the stringfont- the font- Returns:
- the bounds of the string
-
createLine
-
createEllipse
-
createPath
-
createText
-
createRect
Create an SVG Rectangle.- Parameters:
doc- the document to create the elementx- the start x positiony- the start y positionwidth- the width of the rectangleheight- the height of the rectangle- Returns:
- the new rectangle element
-
createG
-
createClip
-
createImage
Create and svg image element.- Parameters:
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 image- Returns:
- a new image element
-
wrapText
Create some SVG text that is wrapped into a specified width.- Parameters:
doc- the document to create the elementsstr- the string to wrapfont- the fontwidth- the width to wrap- Returns:
- the new element containing the wrapped text
-