Trait libremarkable::framebuffer::FramebufferIO
source · pub trait FramebufferIO {
fn write_frame(&mut self, frame: &[u8]);
fn write_pixel(&mut self, pos: Point2<i32>, v: color);
fn read_pixel(&self, pos: Point2<u32>) -> color;
fn read_offset(&self, ofst: isize) -> u8;
fn dump_region(&self, rect: mxcfb_rect) -> Result<Vec<u8>, &'static str>;
fn restore_region(
&mut self,
rect: mxcfb_rect,
data: &[u8]
) -> Result<u32, &'static str>;
}
Required Methods§
sourcefn write_frame(&mut self, frame: &[u8])
fn write_frame(&mut self, frame: &[u8])
Writes an arbitrary length frame into the framebuffer
sourcefn write_pixel(&mut self, pos: Point2<i32>, v: color)
fn write_pixel(&mut self, pos: Point2<i32>, v: color)
Writes a single pixel at pos
with value v
sourcefn read_pixel(&self, pos: Point2<u32>) -> color
fn read_pixel(&self, pos: Point2<u32>) -> color
Reads the value of the pixel at pos
sourcefn read_offset(&self, ofst: isize) -> u8
fn read_offset(&self, ofst: isize) -> u8
Reads the value at offset ofst
from the mmapp’ed framebuffer region
sourcefn dump_region(&self, rect: mxcfb_rect) -> Result<Vec<u8>, &'static str>
fn dump_region(&self, rect: mxcfb_rect) -> Result<Vec<u8>, &'static str>
Dumps the contents of the specified rectangle into a Vec<u8>
from which
you can later create a CompressedCanvasState or pass to restore_region().
The pixel format is rgb565_le.
sourcefn restore_region(
&mut self,
rect: mxcfb_rect,
data: &[u8]
) -> Result<u32, &'static str>
fn restore_region(
&mut self,
rect: mxcfb_rect,
data: &[u8]
) -> Result<u32, &'static str>
Restores into the framebuffer the contents of the specified rectangle from a u8 slice