[][src]Struct footile::Path2D

pub struct Path2D { /* fields omitted */ }

Path builder.

Example

use footile::Path2D;

let path = Path2D::default()
    .move_to(10.0, 10.0)
    .line_to(90.0, 90.0)
    .finish();

Implementations

impl Path2D[src]

pub fn absolute(self) -> Self[src]

Use absolute coordinates for subsequent operations.

pub fn relative(self) -> Self[src]

Use relative coordinates for subsequent operations.

This is the default setting.

pub fn close(self) -> Self[src]

Close current sub-path and move pen to origin.

pub fn move_to(self, x: f32, y: f32) -> Self[src]

Move the pen to a point.

  • x X-position of point.
  • y Y-position of point.

pub fn line_to(self, x: f32, y: f32) -> Self[src]

Add a line from pen to a point.

  • x X-position of end point.
  • y Y-position of end point.

pub fn quad_to(self, bx: f32, by: f32, cx: f32, cy: f32) -> Self[src]

Add a quadratic bézier spline.

The points are:

  • Current pen position: Pa
  • Control point: Pb (bx / by)
  • Spline end point: Pc (cx / cy)

pub fn cubic_to(
    self,
    bx: f32,
    by: f32,
    cx: f32,
    cy: f32,
    dx: f32,
    dy: f32
) -> Self
[src]

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)

pub fn pen_width(self, width: f32) -> Self[src]

Set pen stroke width.

All subsequent path points will be affected, until the stroke width is changed again.

  • width Pen stroke width.

pub fn finish(self) -> Vec<PathOp>[src]

Finish path with specified operations.

Trait Implementations

impl Default for Path2D[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.