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§

source

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 given framebuffer where this displayable should render itself. The coordinate is relative to the top-left point of the framebuffer.
  • framebuffer: the framebuffer to display onto.

Returns a rectangle that represents the region of the framebuffer that was updated.

source

fn set_size(&mut self, width: usize, height: usize)

Resizes the displayable area, but does not automatically refresh its display.

source

fn get_size(&self) -> (usize, usize)

Gets the size of the area occupied by the displayable.

Implementors§