[−][src]Struct kurbo::BezPath
A path that can Bézier segments up to cubic, possibly with multiple subpaths.
Methods
impl BezPath
[src]
pub fn new() -> BezPath
[src]
Create a new path.
pub fn from_vec(v: Vec<PathEl>) -> BezPath
[src]
Create a path from a vector of path elements.
pub fn push(&mut self, el: PathEl)
[src]
Push a generic path element onto the path.
pub fn moveto<V: Into<Vec2>>(&mut self, p: V)
[src]
Push a moveto element onto the path.
pub fn lineto<V: Into<Vec2>>(&mut self, p: V)
[src]
Push a lineto element onto the path.
pub fn quadto<V: Into<Vec2>>(&mut self, p1: V, p2: V)
[src]
Push a quadto element onto the path.
pub fn curveto<V: Into<Vec2>>(&mut self, p1: V, p2: V, p3: V)
[src]
Push a curveto element onto the path.
pub fn closepath(&mut self)
[src]
Push a closepath element onto the path.
pub fn elements(&self) -> &[PathEl]
[src]
Get the path elements.
pub fn segments<'a>(&'a self) -> impl Iterator<Item = PathSeg> + 'a
[src]
Iterate over the path segments.
pub fn get_seg(&self, ix: usize) -> Option<PathSeg>
[src]
Get the segment at the given element index.
The element index counts PathEl
elements, so
for example includes an initial Moveto
.
pub fn is_empty(&self) -> bool
[src]
Returns true
if the path contains no segments.
pub fn apply_affine(&mut self, affine: Affine)
[src]
Apply an affine transform to the path.
pub fn nearest(&self, p: Vec2, accuracy: f64) -> (usize, f64, f64)
[src]
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.
impl BezPath
[src]
pub fn to_svg(&self) -> String
[src]
Convert the path to an SVG path string representation.
The current implementation doesn't take any special care to produce a short string (reducing precision, using relative movement).
pub fn from_svg(data: &str) -> Result<BezPath, SvgParseError>
[src]
Trait Implementations
impl Shape for BezPath
[src]
type BezPathIter = IntoIter<PathEl>
The iterator resulting from to_bez_path
.
fn to_bez_path(&self, _tolerance: f64) -> Self::BezPathIter
[src]
fn area(&self) -> f64
[src]
Signed area.
TODO: figure out sign convention, see #4.
fn perimeter(&self, accuracy: f64) -> f64
[src]
fn winding(&self, pt: Vec2) -> i32
[src]
Winding number of point.
TODO: figure out sign convention, see #4.
fn bounding_box(&self) -> Rect
[src]
fn as_path_slice(&self) -> Option<&[PathEl]>
[src]
fn into_bez_path(self, tolerance: f64) -> BezPath
[src]
fn as_line(&self) -> Option<Line>
[src]
If the shape is a line, make it available.
fn as_rect(&self) -> Option<Rect>
[src]
If the shape is a rectangle, make it available.
fn as_circle(&self) -> Option<Circle>
[src]
If the shape is a circle, make it available.
impl Default for BezPath
[src]
impl Clone for BezPath
[src]
fn clone(&self) -> BezPath
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<'a> IntoIterator for &'a BezPath
[src]
type Item = PathEl
The type of the elements being iterated over.
type IntoIter = Cloned<Iter<'a, PathEl>>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl Debug for BezPath
[src]
impl Mul<BezPath> for Affine
[src]
type Output = BezPath
The resulting type after applying the *
operator.
fn mul(self, other: BezPath) -> BezPath
[src]
impl<'a> Mul<&'a BezPath> for Affine
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,