PathBuilder

Trait PathBuilder 

Source
pub trait PathBuilder {
    type Path: SharedOwnership;

    // Required methods
    fn move_to(&mut self, x: f32, y: f32);
    fn line_to(&mut self, x: f32, y: f32);
    fn quad_to(&mut self, x1: f32, y1: f32, x: f32, y: f32);
    fn curve_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, x: f32, y: f32);
    fn close(&mut self);
    fn finish(self) -> Self::Path;
}
Expand description

The ResourceAllocator provides a path builder that defines how to build paths that can be used with the renderer.

Required Associated Types§

Source

type Path: SharedOwnership

The type of the path to build. This needs to be identical to the type of the path used by the ResourceAllocator.

Required Methods§

Source

fn move_to(&mut self, x: f32, y: f32)

Moves the cursor to a specific position and starts a new contour.

Source

fn line_to(&mut self, x: f32, y: f32)

Adds a line from the previous position to the position specified, while also moving the cursor along.

Source

fn quad_to(&mut self, x1: f32, y1: f32, x: f32, y: f32)

Adds a quadratic bézier curve from the previous position to the position specified, while also moving the cursor along. (x1, y1) specifies the control point.

Source

fn curve_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, x: f32, y: f32)

Adds a cubic bézier curve from the previous position to the position specified, while also moving the cursor along. (x1, y1) and (x2, y2) specify the two control points.

Source

fn close(&mut self)

Closes the current contour. The current position and the initial position get connected by a line, forming a continuous loop. Nothing if the path is empty or already closed.

Source

fn finish(self) -> Self::Path

Finishes building the path.

Implementors§