pub trait PathBuilder {
Show 20 methods fn num_attributes(&self) -> usize; fn begin(
        &mut self,
        at: Point,
        custom_attributes: Attributes<'_>
    ) -> EndpointId; fn end(&mut self, close: bool); fn line_to(
        &mut self,
        to: Point,
        custom_attributes: Attributes<'_>
    ) -> EndpointId; fn quadratic_bezier_to(
        &mut self,
        ctrl: Point,
        to: Point,
        custom_attributes: Attributes<'_>
    ) -> EndpointId; fn cubic_bezier_to(
        &mut self,
        ctrl1: Point,
        ctrl2: Point,
        to: Point,
        custom_attributes: Attributes<'_>
    ) -> EndpointId; fn close(&mut self) { ... } fn reserve(&mut self, _endpoints: usize, _ctrl_points: usize) { ... } fn path_event(&mut self, event: PathEvent, attributes: Attributes<'_>) { ... } fn event(&mut self, event: Event<(Point, Attributes<'_>), Point>) { ... } fn add_polygon(
        &mut self,
        polygon: Polygon<'_, Point>,
        attributes: Attributes<'_>
    ) { ... } fn add_point(&mut self, at: Point, attributes: Attributes<'_>) -> EndpointId { ... } fn add_line_segment(
        &mut self,
        line: &LineSegment<f32>,
        attributes: Attributes<'_>
    ) -> (EndpointId, EndpointId) { ... } fn add_ellipse(
        &mut self,
        center: Point,
        radii: Vector,
        x_rotation: Angle,
        winding: Winding,
        attributes: Attributes<'_>
    ) { ... } fn add_circle(
        &mut self,
        center: Point,
        radius: f32,
        winding: Winding,
        attributes: Attributes<'_>
    )
    where
        Self: Sized
, { ... } fn add_rectangle(
        &mut self,
        rect: &Box2D,
        winding: Winding,
        attributes: Attributes<'_>
    ) { ... } fn add_rounded_rectangle(
        &mut self,
        rect: &Box2D,
        radii: &BorderRadii,
        winding: Winding,
        custom_attributes: Attributes<'_>
    )
    where
        Self: Sized
, { ... } fn flattened(self, tolerance: f32) -> Flattened<Self>
    where
        Self: Sized
, { ... } fn transformed<Transform>(
        self,
        transform: Transform
    ) -> Transformed<Self, Transform>
    where
        Self: Sized,
        Transform: Transformation<f32>
, { ... } fn with_svg(self) -> WithSvg<Self>
    where
        Self: Sized
, { ... }
}
Expand description

The base path building interface.

Unlike SvgPathBuilder, this interface strictly requires sub-paths to be manually started and ended (See the begin and end methods). All positions are provided in absolute coordinates.

The goal of this interface is to abstract over simple and fast implementations that do not deal with corner cases such as adding segments without starting a sub-path.

More elaborate interfaces are built on top of the provided primitives. In particular, the SvgPathBuilder trait providing more permissive and richer interface is automatically implemented via the WithSvg adapter (See the with_svg method).

Required Methods

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.

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.

Adds a line segment to the current sub-path.

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

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

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

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

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

Provided Methods

Closes the current sub path.

Shorthand for builder.end(true).

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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

Returns a builder that support SVG commands.

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

Implementors