lyon_path::path

Type Alias Builder

Source
pub type Builder = NoAttributes<BuilderImpl>;

Aliased Type§

struct Builder { /* private fields */ }

Implementations

Source§

impl<B: PathBuilder> NoAttributes<B>

Source

pub fn wrap(inner: B) -> Self

Source

pub fn new() -> Self
where B: Default,

Source

pub fn with_capacity(endpoints: usize, ctrl_points: usize) -> Self
where B: Default,

Source

pub fn begin(&mut self, at: Point) -> EndpointId

Starts a new sub-path at a given position.

There must be no sub-path in progress when this method is called. at becomes the current position of the sub-path.

Source

pub fn end(&mut self, close: bool)

Ends the current sub path.

A sub-path must be in progress when this method is called. After this method is called, there is no sub-path in progress until begin is called again.

Source

pub fn close(&mut self)

Closes the current sub path.

Shorthand for builder.end(true).

Source

pub fn line_to(&mut self, to: Point) -> EndpointId

Adds a line segment to the current sub-path.

A sub-path must be in progress when this method is called.

Source

pub fn quadratic_bezier_to(&mut self, ctrl: Point, to: Point) -> EndpointId

Adds a quadratic bézier curve to the current sub-path.

A sub-path must be in progress when this method is called.

Source

pub fn cubic_bezier_to( &mut self, ctrl1: Point, ctrl2: Point, to: Point, ) -> EndpointId

Adds a cubic bézier curve to the current sub-path.

A sub-path must be in progress when this method is called.

Source

pub fn reserve(&mut self, endpoints: usize, ctrl_points: usize)

Hints at the builder that a certain number of endpoints and control points will be added.

The Builder implementation may use this information to pre-allocate memory as an optimization.

Source

pub fn path_event(&mut self, event: PathEvent)

Applies the provided path event.

By default this calls one of begin, end, line, quadratic_bezier_segment, or cubic_bezier_segment according to the path event.

The requirements for each method apply to the corresponding event.

Source

pub fn add_polygon(&mut self, polygon: Polygon<'_, Point>)

Adds a sub-path from a polygon.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

Source

pub fn add_point(&mut self, at: Point) -> EndpointId

Adds a sub-path containing a single point.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

Source

pub fn add_line_segment( &mut self, line: &LineSegment<f32>, ) -> (EndpointId, EndpointId)

Adds a sub-path containing a single line segment.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

Source

pub fn add_ellipse( &mut self, center: Point, radii: Vector, x_rotation: Angle, winding: Winding, )

Adds a sub-path containing an ellipse.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

Source

pub fn add_circle(&mut self, center: Point, radius: f32, winding: Winding)
where B: Sized,

Adds a sub-path containing a circle.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

Source

pub fn add_rectangle(&mut self, rect: &Box2D, winding: Winding)

Adds a sub-path containing a rectangle.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

Source

pub fn add_rounded_rectangle( &mut self, rect: &Box2D, radii: &BorderRadii, winding: Winding, )
where B: Sized,

Adds a sub-path containing a rectangle.

There must be no sub-path in progress when this method is called. No sub-path is in progress after the method is called.

Source

pub fn flattened(self, tolerance: f32) -> NoAttributes<Flattened<B>>
where B: Sized,

Returns a builder that approximates all curves with sequences of line segments.

Source

pub fn transformed<Transform>( self, transform: Transform, ) -> NoAttributes<Transformed<B, Transform>>
where B: Sized, Transform: Transformation<f32>,

Returns a builder that applies the given transformation to all positions.

Source

pub fn with_svg(self) -> WithSvg<B>
where B: Sized,

Returns a builder that support SVG commands.

This must be called before starting to add any sub-path.

Source

pub fn build<P>(self) -> P
where B: Build<PathType = P>,

Builds a path object, consuming the builder.

Source

pub fn inner(&self) -> &B

Source

pub fn inner_mut(&mut self) -> &mut B

Source

pub fn into_inner(self) -> B

Source§

impl NoAttributes<BuilderImpl>

Source

pub fn extend_from_paths(&mut self, paths: &[PathSlice<'_>])

Trait Implementations

Source§

impl<B: PathBuilder + Build> Build for NoAttributes<B>

Source§

type PathType = <B as Build>::PathType

The type of object that is created by this builder.
Source§

fn build(self) -> B::PathType

Builds a path object, consuming the builder.
Source§

impl<B: Clone + PathBuilder> Clone for NoAttributes<B>

Source§

fn clone(&self) -> NoAttributes<B>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Debug + PathBuilder> Debug for NoAttributes<B>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B: PathBuilder + Default> Default for NoAttributes<B>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<B: Hash + PathBuilder> Hash for NoAttributes<B>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<B: PartialEq + PathBuilder> PartialEq for NoAttributes<B>

Source§

fn eq(&self, other: &NoAttributes<B>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<B: PathBuilder> PathBuilder for NoAttributes<B>

Source§

fn num_attributes(&self) -> usize

Source§

fn begin(&mut self, at: Point, _attributes: Attributes<'_>) -> EndpointId

Starts a new sub-path at a given position. Read more
Source§

fn end(&mut self, close: bool)

Ends the current sub path. Read more
Source§

fn line_to(&mut self, to: Point, _attributes: Attributes<'_>) -> EndpointId

Adds a line segment to the current sub-path. Read more
Source§

fn quadratic_bezier_to( &mut self, ctrl: Point, to: Point, _attributes: Attributes<'_>, ) -> EndpointId

Adds a quadratic bézier curve to the current sub-path. Read more
Source§

fn cubic_bezier_to( &mut self, ctrl1: Point, ctrl2: Point, to: Point, _attributes: Attributes<'_>, ) -> EndpointId

Adds a cubic bézier curve to the current sub-path. Read more
Source§

fn reserve(&mut self, endpoints: usize, ctrl_points: usize)

Hints at the builder that a certain number of endpoints and control points will be added. Read more
Source§

fn close(&mut self)

Closes the current sub path. Read more
Source§

fn path_event(&mut self, event: PathEvent, attributes: Attributes<'_>)

Applies the provided path event. Read more
Source§

fn event(&mut self, event: Event<(Point, Attributes<'_>), Point>)

Source§

fn add_polygon( &mut self, polygon: Polygon<'_, Point>, attributes: Attributes<'_>, )

Adds a sub-path from a polygon. Read more
Source§

fn add_point(&mut self, at: Point, attributes: Attributes<'_>) -> EndpointId

Adds a sub-path containing a single point. Read more
Source§

fn add_line_segment( &mut self, line: &LineSegment<f32>, attributes: Attributes<'_>, ) -> (EndpointId, EndpointId)

Adds a sub-path containing a single line segment. Read more
Source§

fn add_ellipse( &mut self, center: Point, radii: Vector, x_rotation: Angle, winding: Winding, attributes: Attributes<'_>, )

Adds a sub-path containing an ellipse. Read more
Source§

fn add_circle( &mut self, center: Point, radius: f32, winding: Winding, attributes: Attributes<'_>, )
where Self: Sized,

Adds a sub-path containing a circle. Read more
Source§

fn add_rectangle( &mut self, rect: &Box2D, winding: Winding, attributes: Attributes<'_>, )

Adds a sub-path containing a rectangle. Read more
Source§

fn add_rounded_rectangle( &mut self, rect: &Box2D, radii: &BorderRadii, winding: Winding, custom_attributes: Attributes<'_>, )
where Self: Sized,

Adds a sub-path containing a rectangle. Read more
Source§

fn flattened(self, tolerance: f32) -> Flattened<Self>
where Self: Sized,

Returns a builder that approximates all curves with sequences of line segments.
Source§

fn transformed<Transform>( self, transform: Transform, ) -> Transformed<Self, Transform>
where Self: Sized, Transform: Transformation<f32>,

Returns a builder that applies the given transformation to all positions.
Source§

fn with_svg(self) -> WithSvg<Self>
where Self: Sized,

Returns a builder that support SVG commands. Read more
Source§

impl<B: PathBuilder> StructuralPartialEq for NoAttributes<B>