pub struct Path { /* private fields */ }Expand description
A path as an app builds one: the ops, the fill rule, and an optional
stroke. The fill colour is the node’s bg; the stroke’s width and
colour are the crate::line::Stroke’s (curve is ignored).
Implementations§
Source§impl Path
impl Path
pub fn new() -> Self
Sourcepub fn from_floats(f: &[f32]) -> Result<Self, PathError>
pub fn from_floats(f: &[f32]) -> Result<Self, PathError>
A path from its flat wire form: a code, then its operands, per op.
pub fn ops(&self) -> &[PathOp]
pub fn into_ops(self) -> Vec<PathOp>
pub fn rule(&self) -> FillRule
pub fn stroke(&self) -> Option<Stroke>
pub fn turn(&self) -> Option<Turn>
Sourcepub fn rotated(self, turns: f32) -> Self
pub fn rotated(self, turns: f32) -> Self
Turns the path by turns (clockwise, y down) about its pivot —
the centre of its outline’s box unless Self::pivot names one.
The turn is the quad’s and not the mask’s: one raster, whatever
the angle.
Sourcepub fn pivot(self, x: f32, y: f32) -> Self
pub fn pivot(self, x: f32, y: f32) -> Self
The point the path turns about, in the path’s own coordinates. A spinner’s arc names its circle’s centre, which is not its own box’s.
pub fn fill_rule(self, rule: FillRule) -> Self
Sourcepub fn stroked(self, stroke: Stroke) -> Self
pub fn stroked(self, stroke: Stroke) -> Self
Strokes the outline stroke.width wide in stroke.color, over
the fill. Round joins and caps.
pub fn move_to(self, x: f32, y: f32) -> Self
pub fn line_to(self, x: f32, y: f32) -> Self
pub fn quad_to(self, cx: f32, cy: f32, x: f32, y: f32) -> Self
pub fn cubic_to( self, c1x: f32, c1y: f32, c2x: f32, c2y: f32, x: f32, y: f32, ) -> Self
Sourcepub fn arc_to(
self,
rx: f32,
ry: f32,
rotation: f32,
large: bool,
sweep: bool,
x: f32,
y: f32,
) -> Self
pub fn arc_to( self, rx: f32, ry: f32, rotation: f32, large: bool, sweep: bool, x: f32, y: f32, ) -> Self
An elliptical arc to (x, y), as SVG’s A: radii, the ellipse’s
rotation in degrees, whether the larger of the two arcs is taken,
whether it sweeps clockwise (y down).
pub fn close(self) -> Self
Sourcepub fn sector(
cx: f32,
cy: f32,
outer: f32,
inner: f32,
from: f32,
sweep: f32,
) -> Self
pub fn sector( cx: f32, cy: f32, outer: f32, inner: f32, from: f32, sweep: f32, ) -> Self
A sector of an annulus centred on (cx, cy): from from turns
(0 is east, turns run clockwise with y down) sweeping sweep turns,
between inner and outer radii. A pie wedge with inner 0, a
donut’s segment otherwise, a ring with sweep 1.