pub struct Path2D { /* private fields */ }
Expand description
A Path2D
is a builder for Vec<PathOp>
.
Example
use footile::Path2D;
let path = Path2D::default()
.move_to(10.0, 10.0)
.line_to(90.0, 90.0)
.finish();
Implementations
sourceimpl Path2D
impl Path2D
sourcepub fn relative(self) -> Self
pub fn relative(self) -> Self
Use relative coordinates for subsequent operations.
This is the default setting.
sourcepub fn move_to(self, x: f32, y: f32) -> Self
pub fn move_to(self, x: f32, y: f32) -> Self
Move the pen to a point.
x
X-position of point.y
Y-position of point.
sourcepub fn line_to(self, x: f32, y: f32) -> Self
pub fn line_to(self, x: f32, y: f32) -> Self
Add a line from pen to a point.
x
X-position of end point.y
Y-position of end point.
sourcepub fn quad_to(self, bx: f32, by: f32, cx: f32, cy: f32) -> Self
pub fn quad_to(self, bx: f32, by: f32, cx: f32, cy: f32) -> Self
Add a quadratic bézier spline.
The points are:
- Current pen position: Pa
- Control point: Pb (
bx
/by
) - Spline end point: Pc (
cx
/cy
)
sourcepub fn cubic_to(
self,
bx: f32,
by: f32,
cx: f32,
cy: f32,
dx: f32,
dy: f32
) -> Self
pub fn cubic_to(
self,
bx: f32,
by: f32,
cx: f32,
cy: f32,
dx: f32,
dy: f32
) -> Self
Add a cubic bézier spline.
The points are:
- Current pen position: Pa
- First control point: Pb (
bx
/by
) - Second control point: Pc (
cx
/cy
) - Spline end point: Pd (
dx
/dy
)
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Path2D
impl Send for Path2D
impl Sync for Path2D
impl Unpin for Path2D
impl UnwindSafe for Path2D
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more