This crate includes utility functions to work with svg paths. Works on types from svgtypes crate.
This package exposes functions to manipulate svg paths with simplification purposes.
toml
[dependencies]
svg_path_ops = "0.1"
```rust use svgtypes::{PathParser, PathSegment};
let path: String = "m 0 0 c 3 -0.6667 6 -1.3333 9 -2 a 1 1 0 0 0 -8 -1 a 1 1 0 0 0 -2 0 l 0 4 v 2 h 8 q 4 -10 9 -5 t -6 8 z".into();
let pathparser = PathParser::from(path.asref());
let pathsegments: Vec
asserteq!( absolute.next().unwrap(), PathSegment::EllipticalArc { abs: true, rx: 1.0, ry: 1.0, xaxisrotation: 0.0, largearc: false, sweep: false, x: -1.0, y: -3.0 } ); asserteq!( absolute.next().unwrap(), PathSegment::LineTo { abs: true, x: -1.0, y: 1.0 } ); asserteq!( absolute.next().unwrap(), PathSegment::VerticalLineTo { abs: true, y: 3.0 } ); asserteq!( absolute.next().unwrap(), PathSegment::HorizontalLineTo { abs: true, x: 7.0 } ); asserteq!( absolute.next().unwrap(), PathSegment::Quadratic { abs: true, x1: 11.0, y1: -7.0, x: 16.0, y: -2.0 } ); asserteq!( absolute.next().unwrap(), PathSegment::SmoothQuadratic { abs: true, x: 10.0, y: 6.0 } ); asserteq!( absolute.next().unwrap(), PathSegment::ClosePath { abs: true } ); ```
Licensed under MIT License (LICENSE).
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the MIT license, shall be licensed as above, without any additional terms or conditions.