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§
sourcefn current_point(&self) -> Point
fn current_point(&self) -> Point
Returns the current point of the path.
sourcefn move_to(&mut self, to: impl Into<Point>) -> &mut Self
fn move_to(&mut self, to: impl Into<Point>) -> &mut Self
Moves to the specified point, beginning a new subpath.
sourcefn line_to(&mut self, to: impl Into<Point>) -> &mut Self
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.
sourcefn curve_to(
&mut self,
control1: impl Into<Point>,
control2: impl Into<Point>,
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
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.
Provided Methods§
sourcefn rel_move_to(&mut self, to: impl Into<Point>) -> &mut Self
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.
sourcefn rel_line_to(&mut self, to: impl Into<Point>) -> &mut Self
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.
sourcefn rel_curve_to(
&mut self,
control1: impl Into<Point>,
control2: impl Into<Point>,
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
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.
sourcefn rel_quad_to(
&mut self,
control: 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
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.
sourcefn arc_to(
&mut self,
rx: f32,
ry: f32,
angle: Angle,
size: ArcSize,
sweep: ArcSweep,
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
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.
sourcefn rel_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
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.
sourcefn add_rect(&mut self, xy: impl Into<Point>, w: f32, h: f32) -> &mut Self
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.
sourcefn add_round_rect(
&mut self,
xy: impl Into<Point>,
w: f32,
h: f32,
rx: f32,
ry: f32,
) -> &mut Self
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.
sourcefn add_ellipse(
&mut self,
center: impl Into<Point>,
rx: f32,
ry: f32,
) -> &mut Self
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.
sourcefn add_circle(&mut self, center: impl Into<Point>, r: f32) -> &mut Self
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.