[]Struct piet_common::kurbo::BezPath

pub struct BezPath(_);

A path that can Bézier segments up to cubic, possibly with multiple subpaths.

Methods

impl BezPath

pub fn new() -> BezPath

Create a new path.

pub fn from_vec(v: Vec<PathEl>) -> BezPath

Create a path from a vector of path elements.

pub fn push(&mut self, el: PathEl)

Push a generic path element onto the path.

pub fn move_to<P>(&mut self, p: P) where
    P: Into<Point>, 

Push a "move to" element onto the path.

pub fn line_to<P>(&mut self, p: P) where
    P: Into<Point>, 

Push a "line to" element onto the path.

pub fn quad_to<P>(&mut self, p1: P, p2: P) where
    P: Into<Point>, 

Push a "quad to" element onto the path.

pub fn curve_to<P>(&mut self, p1: P, p2: P, p3: P) where
    P: Into<Point>, 

Push a "curPe to" element onto the path.

pub fn close_path(&mut self)

Push a "close path" element onto the path.

pub fn elements(&self) -> &[PathEl]

Get the path elements.

pub fn segments(&'a self) -> impl Iterator<Item = PathSeg> + 'a

Iterate over the path segments.

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.

pub fn is_empty(&self) -> bool

Returns true if the path contains no segments.

pub fn apply_affine(&mut self, affine: Affine)

Apply an affine transform to the path.

pub fn nearest(&self, p: Point, 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.

impl BezPath

pub fn to_svg(&self) -> String

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>

Trait Implementations

impl<'a> IntoIterator for &'a BezPath

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?

impl<'a> Mul<&'a BezPath> for Affine

type Output = BezPath

The resulting type after applying the * operator.

impl Mul<BezPath> for Affine

type Output = BezPath

The resulting type after applying the * operator.

impl Mul<BezPath> for TranslateScale

type Output = BezPath

The resulting type after applying the * operator.

impl<'a> Mul<&'a BezPath> for TranslateScale

type Output = BezPath

The resulting type after applying the * operator.

impl Default for BezPath

impl Debug for BezPath

impl Shape for BezPath

type BezPathIter = IntoIter<PathEl>

The iterator resulting from to_bez_path.

fn area(&self) -> f64

Signed area.

fn winding(&self, pt: Point) -> i32

Winding number of point.

fn into_bez_path(self, tolerance: f64) -> BezPath

Convert into a Bézier path. Read more

fn as_line(&self) -> Option<Line>

If the shape is a line, make it available.

fn as_rect(&self) -> Option<Rect>

If the shape is a rectangle, make it available.

fn as_rounded_rect(&self) -> Option<RoundedRect>

If the shape is a rounded rectangle, make it available.

fn as_circle(&self) -> Option<Circle>

If the shape is a circle, make it available.

impl Clone for BezPath

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Sync for BezPath

impl Send for BezPath

impl Unpin for BezPath

impl RefUnwindSafe for BezPath

impl UnwindSafe for BezPath

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> RoundFrom<T> for T[src]

impl<T, U> RoundInto<U> for T where
    U: RoundFrom<T>, 
[src]