pub struct BezPath(_);
Expand description
A path that can Bézier segments up to cubic, possibly with multiple subpaths.
Implementations§
source§impl BezPath
impl BezPath
sourcepub fn curveto<V: Into<Vec2>>(&mut self, p1: V, p2: V, p3: V)
pub fn curveto<V: Into<Vec2>>(&mut self, p1: V, p2: V, p3: V)
Push a curveto element onto the path.
sourcepub fn segments<'a>(&'a self) -> impl Iterator<Item = (usize, PathSeg)> + 'a
pub fn segments<'a>(&'a self) -> impl Iterator<Item = (usize, PathSeg)> + 'a
Iterate over the path segments.
The iterator returns the index within the path and the segment.
sourcepub fn apply_affine(&mut self, affine: Affine)
pub fn apply_affine(&mut self, affine: Affine)
Apply an affine transform to the path.
sourcepub fn arclen(&self, accuracy: f64) -> f64
pub fn arclen(&self, accuracy: f64) -> f64
Compute the total arclength.
Here, accuracy
specifies the accuracy for each Bézier segment. At worst,
the total error is accuracy
times the number of Bézier segments.
Note: this is one of the methods that could be implemented on an iterator
of PathEl
, to save allocation.
Trait Implementations§
source§impl<'a> IntoIterator for &'a BezPath
impl<'a> IntoIterator for &'a BezPath
source§impl Shape for BezPath
impl Shape for BezPath
source§fn area(&self) -> f64
fn area(&self) -> f64
Signed area.
TODO: figure out sign convention, see #4.
TODO: clean up duplication with impl method.
source§fn winding(&self, pt: Vec2) -> i32
fn winding(&self, pt: Vec2) -> i32
Winding number of point.
TODO: figure out sign convention, see #4.
TODO: clean up duplication with impl method.
§type BezPathIter = IntoIter<PathEl, Global>
type BezPathIter = IntoIter<PathEl, Global>
The iterator resulting from
to_bez_path
.source§fn to_bez_path(&self, _tolerance: f64) -> Self::BezPathIter
fn to_bez_path(&self, _tolerance: f64) -> Self::BezPathIter
Convert to a Bézier path, as an iterator over path elements. Read more
source§fn bounding_box(&self) -> Rect
fn bounding_box(&self) -> Rect
The smallest rectangle that encloses the shape.