pub trait Draw {
    // Required methods
    fn width(&self) -> usize;
    fn height(&self) -> usize;
    fn set_pixel(&mut self, x: usize, y: usize, color: RgbColor) -> &mut Self;
    fn scroll_vert(&mut self, px: isize) -> &mut Self;

    // Provided methods
    fn line_horiz(&mut self, y: usize, len: usize, color: RgbColor) -> &mut Self { ... }
    fn line_vert(&mut self, x: usize, len: usize, color: RgbColor) -> &mut Self { ... }
    fn fill_row(&mut self, y: usize, color: RgbColor) -> &mut Self { ... }
    fn fill_col(&mut self, x: usize, color: RgbColor) -> &mut Self { ... }
    fn fill(&mut self, color: RgbColor) -> &mut Self { ... }
    fn clear(&mut self) -> &mut Self { ... }
    fn into_draw_target(self) -> DrawTarget<Self>
       where Self: Sized { ... }
    fn as_draw_target(&mut self) -> DrawTarget<&mut Self>
       where Self: Sized { ... }
}

Required Methods§

source

fn width(&self) -> usize

Return the width of the framebuffer in pixels.

source

fn height(&self) -> usize

Returns the height of the framebuffer in pixels.

source

fn set_pixel(&mut self, x: usize, y: usize, color: RgbColor) -> &mut Self

Set the pixel at position (x, y) to the provided color.

source

fn scroll_vert(&mut self, px: isize) -> &mut Self

Provided Methods§

source

fn line_horiz(&mut self, y: usize, len: usize, color: RgbColor) -> &mut Self

Draw a horizontal line of length len at height y.

By default, this method calls set_pixel in a loop. This works, but implementations can almost certainly provide a more optimal implementation, and are thus encouraged to override this method.

source

fn line_vert(&mut self, x: usize, len: usize, color: RgbColor) -> &mut Self

Draw a vertical line of length len at column y.

By default, this method calls set_pixel in a loop. This works, but implementations can almost certainly provide a more optimal implementation, and are thus encouraged to override this method.

source

fn fill_row(&mut self, y: usize, color: RgbColor) -> &mut Self

source

fn fill_col(&mut self, x: usize, color: RgbColor) -> &mut Self

source

fn fill(&mut self, color: RgbColor) -> &mut Self

Fill the entire framebuffer with the provided color.

By default, this method calls set_pixel in a loop. This works, but implementations can almost certainly provide a more optimal implementation, and are thus encouraged to override this method.

source

fn clear(&mut self) -> &mut Self

Clear the entire framebuffer.

By default, this method calls set_pixel in a loop. This works, but implementations can almost certainly provide a more optimal implementation, and are thus encouraged to override this method.

source

fn into_draw_target(self) -> DrawTarget<Self>
where Self: Sized,

Available on crate feature embedded-graphics-core only.
source

fn as_draw_target(&mut self) -> DrawTarget<&mut Self>
where Self: Sized,

Available on crate feature embedded-graphics-core only.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'draw, D> Draw for &'draw mut D
where D: Draw,

source§

fn width(&self) -> usize

source§

fn height(&self) -> usize

source§

fn set_pixel(&mut self, x: usize, y: usize, color: RgbColor) -> &mut Self

source§

fn line_horiz(&mut self, y: usize, len: usize, color: RgbColor) -> &mut Self

source§

fn line_vert(&mut self, x: usize, len: usize, color: RgbColor) -> &mut Self

source§

fn fill_row(&mut self, y: usize, color: RgbColor) -> &mut Self

source§

fn fill_col(&mut self, x: usize, color: RgbColor) -> &mut Self

source§

fn scroll_vert(&mut self, px: isize) -> &mut Self

source§

fn fill(&mut self, color: RgbColor) -> &mut Self

source§

fn clear(&mut self) -> &mut Self

source§

impl<'lock, D, L> Draw for MutexGuard<'lock, D, L>
where D: Draw, L: RawMutex,

source§

fn width(&self) -> usize

source§

fn height(&self) -> usize

source§

fn set_pixel(&mut self, x: usize, y: usize, color: RgbColor) -> &mut Self

source§

fn line_horiz(&mut self, y: usize, len: usize, color: RgbColor) -> &mut Self

source§

fn line_vert(&mut self, x: usize, len: usize, color: RgbColor) -> &mut Self

source§

fn fill_row(&mut self, y: usize, color: RgbColor) -> &mut Self

source§

fn fill_col(&mut self, x: usize, color: RgbColor) -> &mut Self

source§

fn scroll_vert(&mut self, px: isize) -> &mut Self

source§

fn fill(&mut self, color: RgbColor) -> &mut Self

source§

fn clear(&mut self) -> &mut Self

Implementors§