Struct kurbo::BezPath

source ·
pub struct BezPath(_);
Expand description

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

Implementations§

Create a new path.

Create a path from a vector of path elements.

Push a generic path element onto the path.

Push a moveto element onto the path.

Push a lineto element onto the path.

Push a quadto element onto the path.

Push a curveto element onto the path.

Push a closepath element onto the path.

Get the path elements.

Iterate over the path segments.

Get the segment at the given element index.

The element index counts PathEl elements, so for example includes an initial Moveto.

Returns true if the path contains no segments.

Apply an affine transform to the path.

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.

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).

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The resulting type after applying the * operator.
Performs the * operation. Read more

Signed area.

TODO: figure out sign convention, see #4.

Winding number of point.

TODO: figure out sign convention, see #4.

The iterator resulting from to_bez_path.
Convert to a Bézier path, as an iterator over path elements. Read more
Total length of perimeter.
The smallest rectangle that encloses the shape.
If the shape is stored as a slice of path elements, make that available. Read more
If the shape is a line, make it available.
If the shape is a rectangle, make it available.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.