Struct drawille::Turtle[][src]

pub struct Turtle {
    pub x: f32,
    pub y: f32,
    pub brush: bool,
    pub use_color: bool,
    pub brush_color: PixelColor,
    pub rotation: f32,
    pub cvs: Canvas,
}
Expand description

A ‘turtle’ that can walk around a canvas drawing lines.

Fields

x: f32y: f32brush: booluse_color: boolbrush_color: PixelColorrotation: f32cvs: Canvas

Implementations

Create a new Turtle, starting at the given coordinates.

The turtle starts with its brush down, facing right.

Creates a new Turtle with the provided Canvas, starting at the given coordinates.

The turtle starts with its brush down, facing right.

Sets the width of a Turtle’s Canvas, and return it for use again.

Sets the height of a Turtle’s Canvas, and return it for use again.

Lifts the Turtle’s brush.

Puts down the Turtle’s brush.

Toggles the Turtle’s brush.

Use specific color the the brush.

Remove color from brush.

Moves the Turtle forward by dist steps.

Moves the Turtle backward by dist steps.

Teleports the Turtle to the given coordinates.

Note that this draws a line between the old position and the new one if the Turtle’s brush is down.

Turns the Turtle right (clockwise) by angle degrees.

Turns the Turtle left (clockwise) by angle degrees.

Writes the Turtle’s Canvas to a String and returns it.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.