org.apache.batik.svggen

Class SVGPath

public class SVGPath extends SVGGraphicObjectConverter

Utility class that converts a Shape object into an SVG path element. Note that this class does not attempt to find out what type of object (e.g., whether the input Shape is a Rectangle or an Ellipse. This type of analysis is done by the SVGShape class). Note that this class assumes that the parent of the path element it generates defines the fill-rule as nonzero. This is not the SVG default value. However, because it is the GeneralPath's default, it is preferable to have this attribute specified once to set the default (in the parent element, e.g., a group) and then only in the rare instance where the winding rule is different than the default. Otherwise, the attribute would have to be specified in the majority of path elements.
Constructor Summary
SVGPath(SVGGeneratorContext generatorContext)
Method Summary
ElementtoSVG(Shape path)
static StringtoSVGPathData(Shape path, SVGGeneratorContext gc)

Constructor Detail

SVGPath

public SVGPath(SVGGeneratorContext generatorContext)

Parameters: generatorContext used to build Elements

Method Detail

toSVG

public Element toSVG(Shape path)

Parameters: path the Shape that should be converted to an SVG path element.

Returns: a path Element.

toSVGPathData

public static String toSVGPathData(Shape path, SVGGeneratorContext gc)

Parameters: path the GeneralPath to convert

Returns: the value of the corresponding d attribute

Copyright B) 2008 Apache Software Foundation. All Rights Reserved.