[][src]Struct footile::PathBuilder

pub struct PathBuilder { /* fields omitted */ }

Builder for Path2D.

Example

use footile::PathBuilder;
let path = PathBuilder::new()
                       .move_to(10.0, 10.0)
                       .line_to(90.0, 90.0)
                       .build();

Methods

impl PathBuilder[src]

pub fn new() -> PathBuilder[src]

Create a new PathBuilder.

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, bx: f32, by: f32) -> Self[src]

Move pen to a point.

  • bx X-position of point.
  • by Y-position of point.

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

Add a line from pen to a point.

  • bx X-position of end point.
  • by 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 A (current pen position), B (control point), and C (spline end point).

  • bx X-position of control point.
  • by Y-position of control point.
  • cx X-position of end point.
  • cy Y-position of end point.

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 A (current pen position), B (first control point), C (second control point) and D (spline end point).

  • bx X-position of first control point.
  • by Y-position of first control point.
  • cx X-position of second control point.
  • cy Y-position of second control point.
  • dx X-position of end point.
  • dy Y-position of end point.

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 build(self) -> Path2D[src]

Build path from specified operations.

Auto Trait Implementations

impl Send for PathBuilder

impl Sync for PathBuilder

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

The type returned in the event of a conversion error.

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