java.lang.Object
org.jhotdraw8.geom.SvgPaths
Provides methods for parsing and generating SVG path strings from AWT paths.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringConverts a Java Path iterator to a SVG path with double precision.static StringConverts a Java Path iterator to a SVG path with double precision.static StringConverts a Java Path iterator to a SVG path with double precision.static StringConverts a Java Path iterator to a SVG path with float precision.static voidbuildReshapedSvgString(PathBuilder<?> builder, @Nullable String pathstr, javafx.geometry.Bounds b) Fits the specified SVGPath into the given bounds.static <T> PathBuilder<T> buildSvgString(PathBuilder<T> builder, String str) Returns a value as a SvgPath2D.static Path2D.DoubleReturns a value as a SvgPath2D.
-
Method Details
-
buildSvgString
public static <T> PathBuilder<T> buildSvgString(PathBuilder<T> builder, String str) throws ParseException Returns a value as a SvgPath2D.Also supports elliptical arc commands 'a' and 'A' as specified in w3.org
- Parameters:
builder- the builderstr- the SVG path- Returns:
- the path builder
- Throws:
ParseException- if the String is not a valid path
-
awtPathIteratorToDoubleSvgString
Converts a Java Path iterator to a SVG path with double precision.- Parameters:
iter- AWT Path Iterator- Returns:
- SVG Path
-
awtPathIteratorToDoubleRelativeSvgString
Converts a Java Path iterator to a SVG path with double precision.- Parameters:
iter- AWT Path Iterator- Returns:
- SVG Path
-
awtPathIteratorToFloatRelativeSvgString
Converts a Java Path iterator to a SVG path with double precision.- Parameters:
iter- AWT Path Iterator- Returns:
- SVG Path
-
awtPathIteratorToFloatSvgString
Converts a Java Path iterator to a SVG path with float precision.- Parameters:
iter- AWT Path Iterator- Returns:
- SVG Path
-
svgStringToAwtShape
Returns a value as a SvgPath2D.Also supports elliptical arc commands 'a' and 'A' as specified in w3.org
- Parameters:
str- the SVG path- Returns:
- the SvgPath2D
- Throws:
ParseException- if the String is not a valid path
-
buildReshapedSvgString
public static void buildReshapedSvgString(PathBuilder<?> builder, @Nullable String pathstr, javafx.geometry.Bounds b) Fits the specified SVGPath into the given bounds.If parsing the SVG Path fails, logs a warning message and fits a rectangle into the bounds.
- Parameters:
builder- the builder into which the path is outputpathstr- an SVGPath Stringb- the desired bounds
-