PathParser
class PathParser
Parses SVG path strings.
Summary
Nested types |
|---|
class PathParser.PathDataNodeEach PathDataNode represents one command in the "d" attribute of the svg file. |
Public functions |
|
|---|---|
java-static Boolean |
canMorph( |
java-static Array<PathParser.PathDataNode!> |
createNodesFromPathData(pathData: String) |
java-static Path |
createPathFromPathData(pathData: String)Takes a string representation of an SVG path and converts it to a |
java-static Array<PathParser.PathDataNode!> |
deepCopyNodes(source: Array<PathParser.PathDataNode!>) |
java-static Unit |
interpolatePathDataNodes(Interpolate between two arrays of PathDataNodes with the given fraction, and store the results in the first parameter. |
java-static Unit |
nodesToPath(node: Array<PathParser.PathDataNode!>, path: Path)Convert an array of PathDataNode to Path. |
java-static Unit |
updateNodes(Update the target's data to match the source. |
Public functions
canMorph
java-static fun canMorph(
nodesFrom: Array<PathParser.PathDataNode!>?,
nodesTo: Array<PathParser.PathDataNode!>?
): Boolean
| Parameters | |
|---|---|
nodesFrom: Array<PathParser.PathDataNode!>? |
The source path represented in an array of PathDataNode |
nodesTo: Array<PathParser.PathDataNode!>? |
The target path represented in an array of PathDataNode |
| Returns | |
|---|---|
Boolean |
whether the |
createNodesFromPathData
java-static fun createNodesFromPathData(pathData: String): Array<PathParser.PathDataNode!>
| Parameters | |
|---|---|
pathData: String |
The string representing a path, the same as "d" string in svg file. |
| Returns | |
|---|---|
Array<PathParser.PathDataNode!> |
an array of the PathDataNode. |
createPathFromPathData
java-static fun createPathFromPathData(pathData: String): Path
Takes a string representation of an SVG path and converts it to a Path.
| Parameters | |
|---|---|
pathData: String |
The string representing a path, the same as "d" string in svg file. |
| Returns | |
|---|---|
Path |
the generated Path object. |
deepCopyNodes
java-static fun deepCopyNodes(source: Array<PathParser.PathDataNode!>): Array<PathParser.PathDataNode!>
| Parameters | |
|---|---|
source: Array<PathParser.PathDataNode!> |
The array of PathDataNode to be duplicated. |
| Returns | |
|---|---|
Array<PathParser.PathDataNode!> |
a deep copy of the |
interpolatePathDataNodes
java-static fun interpolatePathDataNodes(
target: Array<PathParser.PathDataNode!>,
fraction: Float,
from: Array<PathParser.PathDataNode!>,
to: Array<PathParser.PathDataNode!>
): Unit
Interpolate between two arrays of PathDataNodes with the given fraction, and store the results in the first parameter.
| Parameters | |
|---|---|
target: Array<PathParser.PathDataNode!> |
The resulting array of |
fraction: Float |
A float fraction value in the range of 0 to 1 |
from: Array<PathParser.PathDataNode!> |
The array of |
to: Array<PathParser.PathDataNode!> |
The array of |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
When the arrays of nodes are incompatible for interpolation. |
| See also | |
|---|---|
canMorph |
nodesToPath
java-static fun nodesToPath(node: Array<PathParser.PathDataNode!>, path: Path): Unit
Convert an array of PathDataNode to Path.
| Parameters | |
|---|---|
node: Array<PathParser.PathDataNode!> |
The source array of PathDataNode. |
path: Path |
The target Path object. |
updateNodes
java-static fun updateNodes(
target: Array<PathParser.PathDataNode!>,
source: Array<PathParser.PathDataNode!>
): Unit
Update the target's data to match the source. Before calling this, make sure canMorph(target, source) is true.
| Parameters | |
|---|---|
target: Array<PathParser.PathDataNode!> |
The target path represented in an array of PathDataNode |
source: Array<PathParser.PathDataNode!> |
The source path represented in an array of PathDataNode |