Struct scroll_phat_hd::scroller::Scroller
[−]
[src]
pub struct Scroller<'a> { /* fields omitted */ }
A virtual scrollable buffer with a scoll offset defining a visible window on the buffer itself. It is composed by a horizontally growable virtual buffer, and an offset that defines what portion of the buffer is actually visible.
┌─────────────────────────virtual buffer─────────────────────┐
┌───────────╔═════════════════╗──────────────────────────────┐
│▓▓▓▓▓▓▓▓▓▓▓║░░░░░░░░░░░░░░░░░║▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓│
│▓▓▓▓▓▓▓▓▓▓▓║░░░░░░░░░░░░░░░░░║▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓│
│▓▓▓▓▓▓▓▓▓▓▓║░░░░░░░░░░░░░░░░░║▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓│
└───────────╚═════════════════╝──────────────────────────────┘
└──offset───┴─visible buffer──┘
Methods
impl<'a> Scroller<'a>
[src]
pub fn new(display: &'a mut Display) -> Scroller<'a>
[src]
Create a new Scroller
using the provided Display
.
pub fn scroll(&mut self)
[src]
Moves the visible buffer one pixel to the right. When the right side of the visible buffer reaches the right side of the virtual buffer, it starts again from the beginning.
pub fn set_pixel(&mut self, x: usize, y: usize, value: u8)
[src]
Sets the value of an individual pixel in the virtual buffer.
Coordinates are zero-based, with the origin in the top left corner of the virtual buffer, and increasing down and to the right.
If the virtual buffer is not wide enough to contain the pixel, it is automatically extended up to that size.
pub fn set_text(&mut self, text: &str)
[src]
Clears the virtual buffer and sets the text to the specified value.
pub fn show(&mut self)
[src]
Sends the visible buffer to the output display.
pub fn clear(&mut self)
[src]
Clears the virtual buffer.