transform_path
Transforms SVG path data by a matrix. The result is written with absolute M, L, C, Q
and Z only: relative commands are made absolute, H/V/S/T are expanded, and arcs
become cubic curves (so any matrix works, skews included). Moving a path is the common case.
Import
Section titled “Import”Cargo feature geometry (enabled by default). To compile only this module:
or in Cargo.toml:
Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
d | &str | The path data. |
matrix | Matrix | The matrix, in the CSS/SVG layout. |
precision | usize | Decimals kept per number; 6 is a good default. |
Returns
Section titled “Returns”Result<String, ParsePathError> — The transformed path data.
Errors
Section titled “Errors”A ParsePathError if d is not valid path data.
Examples
Section titled “Examples”Error type: ParsePathError
Section titled “Error type: ParsePathError”Why SVG path data could not be parsed.
