[][src]Struct draw::shape::LineBuilder

pub struct LineBuilder { /* fields omitted */ }

Helper object for building lines; provides a better syntax than building a Shape::Line from scratch.

Example

use draw::shape::LineBuilder;
use draw::{Position, Shape};
let mut line = LineBuilder::new(Position::new(0.0, 0.0));

line.line_to(Position{x: 50.0 ,y: 50.0 });
line.curve_to(Position::new(50.0, 50.0), Position::new(20.0, 30.0));

// Consume the builder, turn the line into a shape for use with the display list
let shape: Shape = line.into();

Methods

impl LineBuilder[src]

pub fn new(start: Position) -> LineBuilder[src]

Create a new LineBuilder with start as the origin

pub fn line_to(&mut self, point: Position)[src]

Draw a straight line to point

pub fn curve_to(&mut self, point: Position, curve: Position)[src]

Draw a curve to point, with a single control point at curve

pub fn to_shape(self) -> Shape[src]

Consume the LineBuilder, return a Shape::Line

Trait Implementations

impl From<LineBuilder> for Shape[src]

Auto Trait Implementations

Blanket Implementations

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.

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

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

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,