java.lang.Object
org.jhotdraw8.geom.SvgPaths
Provides methods for parsing and generating SVG path strings from AWT paths.
-
Method Summary
Modifier and TypeMethodDescriptionConverts a Java AWT Shape iterator to a JavaFX Shape.Converts a Java AWT Shape iterator to a JavaFX Shape.Converts a Java Path iterator to a SVG path with double precision.Converts a Java Path iterator to a SVG path with double precision.Converts a Java Path iterator to a SVG path with float precision.Converts a Java Path iterator to a SVG path with double precision.static voidsvgStringReshapeToBuilder(@Nullable String pathstr, @NonNull javafx.geometry.Bounds b, @NonNull PathBuilder<?> builder) Fits the specified SVGPath into the given bounds.static @NonNull Path2D.DoubleReturns a value as a SvgPath2D.static <T> @NonNull PathBuilder<T> svgStringToBuilder(@NonNull String str, @NonNull PathBuilder<T> builder) Returns a value as a SvgPath2D.
-
Method Details
-
svgStringToBuilder
public static <T> @NonNull PathBuilder<T> svgStringToBuilder(@NonNull String str, @NonNull PathBuilder<T> builder) throws ParseException Returns a value as a SvgPath2D.Also supports elliptical arc commands 'a' and 'A' as specified in w3.org
- Parameters:
str- the SVG pathbuilder- the builder- Returns:
- the path builder
- Throws:
ParseException- if the String is not a valid path
-
awtPathIteratorToDoubleSvgString
Converts a Java AWT Shape iterator to a JavaFX Shape.- Parameters:
shape- AWT Shape- Returns:
- SVG Path
-
awtPathIteratorToDoubleSvgString
public static @NonNull String awtPathIteratorToDoubleSvgString(@NonNull Shape shape, AffineTransform at) Converts a Java AWT Shape iterator to a JavaFX Shape.- Parameters:
shape- AWT Shapeat- Optional transformation which is applied to the shape- Returns:
- SVG Path
-
awtPathIteratorToDoubleSvgString
Converts a Java Path iterator to a SVG path with double precision.- Parameters:
iter- AWT Path Iterator- Returns:
- SVG Path
-
awtShapeToDoubleRelativeSvgString
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
-
svgStringReshapeToBuilder
public static void svgStringReshapeToBuilder(@Nullable String pathstr, @NonNull javafx.geometry.Bounds b, @NonNull PathBuilder<?> builder) 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:
pathstr- an SVGPath Stringb- the desired boundsbuilder- the builder into which the path is output
-