Trait hal_core::framebuffer::Draw
source · 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.
sourcefn into_draw_target(self) -> DrawTarget<Self>where
Self: Sized,
fn into_draw_target(self) -> DrawTarget<Self>where
Self: Sized,
embedded-graphics-core
only.sourcefn as_draw_target(&mut self) -> DrawTarget<&mut Self>where
Self: Sized,
fn as_draw_target(&mut self) -> DrawTarget<&mut Self>where
Self: Sized,
embedded-graphics-core
only.