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§
Sourcefn set_pixel(&mut self, x: usize, y: usize, color: RgbColor) -> &mut Self
fn set_pixel(&mut self, x: usize, y: usize, color: RgbColor) -> &mut Self
Set the pixel at position (x
, y
) to the provided color
.
fn scroll_vert(&mut self, px: isize) -> &mut Self
Provided Methods§
Sourcefn line_horiz(&mut self, y: usize, len: usize, color: RgbColor) -> &mut Self
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.
Sourcefn line_vert(&mut self, x: usize, len: usize, color: RgbColor) -> &mut Self
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.
fn fill_row(&mut self, y: usize, color: RgbColor) -> &mut Self
fn fill_col(&mut self, x: usize, color: RgbColor) -> &mut Self
Sourcefn fill(&mut self, color: RgbColor) -> &mut Self
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.
Sourcefn clear(&mut self) -> &mut Self
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.
fn into_draw_target(self) -> DrawTarget<Self>where
Self: Sized,
embedded-graphics-core
only.fn as_draw_target(&mut self) -> DrawTarget<&mut Self>where
Self: Sized,
embedded-graphics-core
only.Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.