Trait zeno::PathBuilder

source ·
pub trait PathBuilder: Sized {
Show 16 methods // Required methods fn current_point(&self) -> Point; fn move_to(&mut self, to: impl Into<Point>) -> &mut Self; fn line_to(&mut self, to: impl Into<Point>) -> &mut Self; fn curve_to( &mut self, control1: impl Into<Point>, control2: impl Into<Point>, to: impl Into<Point> ) -> &mut Self; fn quad_to( &mut self, control1: impl Into<Point>, to: impl Into<Point> ) -> &mut Self; fn close(&mut self) -> &mut Self; // Provided methods fn rel_move_to(&mut self, to: impl Into<Point>) -> &mut Self { ... } fn rel_line_to(&mut self, to: impl Into<Point>) -> &mut Self { ... } fn rel_curve_to( &mut self, control1: impl Into<Point>, control2: impl Into<Point>, to: impl Into<Point> ) -> &mut Self { ... } fn rel_quad_to( &mut self, control: impl Into<Point>, to: impl Into<Point> ) -> &mut Self { ... } fn arc_to( &mut self, rx: f32, ry: f32, angle: Angle, size: ArcSize, sweep: ArcSweep, to: impl Into<Point> ) -> &mut Self { ... } fn rel_arc_to( &mut self, rx: f32, ry: f32, angle: Angle, size: ArcSize, sweep: ArcSweep, to: impl Into<Point> ) -> &mut Self { ... } fn add_rect(&mut self, xy: impl Into<Point>, w: f32, h: f32) -> &mut Self { ... } fn add_round_rect( &mut self, xy: impl Into<Point>, w: f32, h: f32, rx: f32, ry: f32 ) -> &mut Self { ... } fn add_ellipse( &mut self, center: impl Into<Point>, rx: f32, ry: f32 ) -> &mut Self { ... } fn add_circle(&mut self, center: impl Into<Point>, r: f32) -> &mut Self { ... }
}
Expand description

Trait for types that accept path commands.

Required Methods§

source

fn current_point(&self) -> Point

Returns the current point of the path.

source

fn move_to(&mut self, to: impl Into<Point>) -> &mut Self

Moves to the specified point, beginning a new subpath.

source

fn line_to(&mut self, to: impl Into<Point>) -> &mut Self

Adds a line to the specified point. This will begin a new subpath if the path is empty or the previous subpath was closed.

source

fn curve_to( &mut self, control1: impl Into<Point>, control2: impl Into<Point>, to: impl Into<Point> ) -> &mut Self

Adds a cubic bezier curve from the current point through the specified control points to the final point. This will begin a new subpath if the path is empty or the previous subpath was closed.

source

fn quad_to( &mut self, control1: impl Into<Point>, to: impl Into<Point> ) -> &mut Self

Adds a quadratic bezier curve from the current point through the specified control point to the final point. This will begin a new subpath if the path is empty or the previous subpath was closed.

source

fn close(&mut self) -> &mut Self

Closes the current subpath.

Provided Methods§

source

fn rel_move_to(&mut self, to: impl Into<Point>) -> &mut Self

Moves to the specified point, relative to the current point, beginning a new subpath.

source

fn rel_line_to(&mut self, to: impl Into<Point>) -> &mut Self

Adds a line to the specified point, relative to the current point. This will begin a new subpath if the path is empty or the previous subpath was closed.

source

fn rel_curve_to( &mut self, control1: impl Into<Point>, control2: impl Into<Point>, to: impl Into<Point> ) -> &mut Self

Adds a cubic bezier curve from the current point through the specified control points to the final point. All points are considered relative to the current point. This will begin a new subpath if the path is empty or the previous subpath was closed.

source

fn rel_quad_to( &mut self, control: impl Into<Point>, to: impl Into<Point> ) -> &mut Self

Adds a quadratic bezier curve from the current point through the specified control point to the final point. All points are considered relative to the current point. This will begin a new subpath if the path is empty or the previous subpath was closed.

source

fn arc_to( &mut self, rx: f32, ry: f32, angle: Angle, size: ArcSize, sweep: ArcSweep, to: impl Into<Point> ) -> &mut Self

Adds an arc with the specified x- and y-radius, rotation angle, arc size, and arc sweep from the current point to the specified end point. The center point of the arc will be computed from the parameters. This will begin a new subpath if the path is empty or the previous subpath was closed.

source

fn rel_arc_to( &mut self, rx: f32, ry: f32, angle: Angle, size: ArcSize, sweep: ArcSweep, to: impl Into<Point> ) -> &mut Self

Adds an arc with the specified x- and y-radius, rotation angle, arc size, and arc sweep from the current point to the specified end point. The end point is considered relative to the current point. The center point of the arc will be computed from the parameters. This will begin a new subpath if the path is empty or the previous subpath was closed.

source

fn add_rect(&mut self, xy: impl Into<Point>, w: f32, h: f32) -> &mut Self

Adds a rectangle with the specified position and size to the path. This will create a new closed subpath.

source

fn add_round_rect( &mut self, xy: impl Into<Point>, w: f32, h: f32, rx: f32, ry: f32 ) -> &mut Self

Adds a rounded rectangle with the specified position, size and radii to the path. This will create a new closed subpath.

source

fn add_ellipse( &mut self, center: impl Into<Point>, rx: f32, ry: f32 ) -> &mut Self

Adds an ellipse with the specified center and radii to the path. This will create a new closed subpath.

source

fn add_circle(&mut self, center: impl Into<Point>, r: f32) -> &mut Self

Adds a circle with the specified center and radius to the path. This will create a new closed subpath.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl PathBuilder for Vec<Command>

source§

fn current_point(&self) -> Point

source§

fn move_to(&mut self, to: impl Into<Point>) -> &mut Self

source§

fn line_to(&mut self, to: impl Into<Point>) -> &mut Self

source§

fn quad_to( &mut self, control: impl Into<Point>, to: impl Into<Point> ) -> &mut Self

source§

fn curve_to( &mut self, control1: impl Into<Point>, control2: impl Into<Point>, to: impl Into<Point> ) -> &mut Self

source§

fn close(&mut self) -> &mut Self

Implementors§