Skip to content

PathCommand

One command of SVG path data: its letter (uppercase is absolute, lowercase relative to the current point) and its numbers, as written in the d attribute.

LetterCommandNumbers
M L Tmove, line, smooth quadraticx y
H Vhorizontal, vertical linex or y
Ccubic Bézierx1 y1 x2 y2 x y
S Qsmooth cubic, quadraticx2 y2 x y or x1 y1 x y
Aelliptical arcrx ry rotation large-arc sweep x y
Zclose the subpathnone
use helpers4::geometry::PathCommand;

Cargo feature geometry (enabled by default). To compile only this module:

cargo add helpers4 --no-default-features --features geometry

or in Cargo.toml:

[dependencies]
helpers4 = { version = "0.0.11", default-features = false, features = ["geometry"] }
pub struct PathCommand { /* private fields */ }
use helpers4::geometry::PathCommand;

let line = PathCommand::new('L', vec![10.0, 5.0]);
assert_eq!(line.letter, 'L');
assert_eq!(line.values, [10.0, 5.0]);

src/geometry/path_command.rs