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() -> Path
Sourcepub fn from_floats(f: &[f32]) -> Result<Path, PathError>
pub fn from_floats(f: &[f32]) -> Result<Path, 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) -> Path
pub fn rotated(self, turns: f32) -> Path
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) -> Path
pub fn pivot(self, x: f32, y: f32) -> Path
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) -> Path
Sourcepub fn stroked(self, stroke: Stroke) -> Path
pub fn stroked(self, stroke: Stroke) -> Path
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) -> Path
pub fn line_to(self, x: f32, y: f32) -> Path
pub fn quad_to(self, cx: f32, cy: f32, x: f32, y: f32) -> Path
pub fn cubic_to( self, c1x: f32, c1y: f32, c2x: f32, c2y: f32, x: f32, y: f32, ) -> Path
Sourcepub fn arc_to(
self,
rx: f32,
ry: f32,
rotation: f32,
large: bool,
sweep: bool,
x: f32,
y: f32,
) -> Path
pub fn arc_to( self, rx: f32, ry: f32, rotation: f32, large: bool, sweep: bool, x: f32, y: f32, ) -> Path
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) -> Path
Sourcepub fn sector(
cx: f32,
cy: f32,
outer: f32,
inner: f32,
from: f32,
sweep: f32,
) -> Path
pub fn sector( cx: f32, cy: f32, outer: f32, inner: f32, from: f32, sweep: f32, ) -> Path
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.
Trait Implementations§
impl StructuralPartialEq for Path
Auto Trait Implementations§
impl Freeze for Path
impl RefUnwindSafe for Path
impl Send for Path
impl Sync for Path
impl Unpin for Path
impl UnsafeUnpin for Path
impl UnwindSafe for Path
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.