Struct drawille::Canvas
[−]
[src]
pub struct Canvas { /* fields omitted */ }
A canvas object that can be used to draw to the terminal using Braille characters.
Methods
impl Canvas
[src]
fn new(width: u32, height: u32) -> Canvas
Creates a new Canvas
with the given width and height.
Note that the Canvas
can still draw outside the given dimensions (expanding the canvas)
if a pixel is set outside the dimensions.
fn clear(&mut self)
Clears the canvas.
fn set(&mut self, x: u32, y: u32)
Sets a pixel at the specified coordinates.
fn unset(&mut self, x: u32, y: u32)
Deletes a pixel at the specified coordinates.
fn toggle(&mut self, x: u32, y: u32)
Toggles a pixel at the specified coordinates.
fn get(&self, x: u32, y: u32) -> bool
Detects whether the pixel at the given coordinates is set.
fn rows(&self) -> Vec<String>
Returns a Vec
of each row of the Canvas
.
Note that each row is actually four pixels high due to the fact that a single Braille character spans two by four pixels.
fn frame(&self) -> String
Draws the canvas to a String
and returns it.
fn line(&mut self, x1: u32, y1: u32, x2: u32, y2: u32)
Draws a line from (x1, y1)
to (x2, y2)
onto the Canvas
.
Trait Implementations
impl Clone for Canvas
[src]
fn clone(&self) -> Canvas
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for Canvas
[src]
impl PartialEq for Canvas
[src]
fn eq(&self, __arg_0: &Canvas) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Canvas) -> bool
This method tests for !=
.