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 = PathSeg> + 'a
pub fn segments<'a>(&'a self) -> impl Iterator<Item = PathSeg> + 'a
Iterate over the path segments.
sourcepub fn get_seg(&self, ix: usize) -> Option<PathSeg>
pub fn get_seg(&self, ix: usize) -> Option<PathSeg>
Get the segment at the given element index.
The element index counts PathEl
elements, so
for example includes an initial Moveto
.
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 nearest(&self, p: Vec2, accuracy: f64) -> (usize, f64, f64)
pub fn nearest(&self, p: Vec2, accuracy: f64) -> (usize, f64, f64)
Find the nearest point.
Panics if path is empty or invalid.
Note that the returned index counts segments, not elements. Thus, the
initial Moveto
is not counted. For a simple path consisting of a Moveto
followed by Lineto/Quadto/Cubicto
elements, the element index is the
segment index + 1.
Returns the index of the segment, the parameter within that segment, and the square of the distance to the point.
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 winding(&self, pt: Vec2) -> i32
fn winding(&self, pt: Vec2) -> i32
Winding number of point.
TODO: figure out sign convention, see #4.
§type BezPathIter = IntoIter<PathEl, Global>
type BezPathIter = IntoIter<PathEl, Global>
to_bez_path
.