Trait displayable::Displayable
source · pub trait Displayable {
// Required methods
fn display<P: Pixel + From<Color>>(
&mut self,
coordinate: Coord,
framebuffer: &mut Framebuffer<P>
) -> Result<Rectangle, &'static str>;
fn set_size(&mut self, width: usize, height: usize);
fn get_size(&self) -> (usize, usize);
}
Expand description
The Displayable
trait is an abstraction for any object that can display itself onto a framebuffer.
Examples include a text box, button, window border, etc.
Required Methods§
sourcefn display<P: Pixel + From<Color>>(
&mut self,
coordinate: Coord,
framebuffer: &mut Framebuffer<P>
) -> Result<Rectangle, &'static str>
fn display<P: Pixel + From<Color>>( &mut self, coordinate: Coord, framebuffer: &mut Framebuffer<P> ) -> Result<Rectangle, &'static str>
Displays this Displayable
’s content in the given framebuffer.
Arguments
coordinate
: the coordinate within the givenframebuffer
where this displayable should render itself. Thecoordinate
is relative to the top-left point of theframebuffer
.framebuffer
: the framebuffer to display onto.
Returns a rectangle that represents the region of the framebuffer that was updated.