pub struct ScreenARGB8888ToMono8BitPage<'a, S: Screen<'a>> { /* private fields */ }Expand description
Expose an underlying ARGB8888-formatted screen as a Mono VLSB
(a.k.a. Mono_8BitPage) screen of the same resolution.
§Mono VLSB source layout
Mono VLSB packs 8 vertically-adjacent pixels into a single byte,
from top to bottom, grouped into width-sized “pages”, from left to
right. A page is a row of width N and height 8 pixels, formed by
N successive bytes. So, bit k of byte col + (row / 8) * width is the pixel at (col, row-within-frame row).
For a write frame of height h, the source needs width * ceil(h / 8) bytes; if the height is not a multiple of 8, the high bits
of each column in the last page are unused.
§ARGB8888 output layout
One pixel per four bytes, in byte order [A, R, G, B] with A =
0xFF.
§Chunking and draw-buffer sizing
The Screen HIL allows large writes to be split across multiple
write(_, continue_write=true) calls. This adapter accepts any
chunk size (in Mono VLSB bytes); internally it processes one
sub-rectangle at a time on the underlying screen, so the draw
buffer only needs to hold one sub-op’s ARGB output. A larger draw
buffer lets one client write be satisfied in fewer underlying
set_write_frame + write round-trips (at most one per full-width
page held by the buffer) at the cost of more static RAM.
The buffer must be able to hold at least one row of the widest
sub-op the adapter will ever emit — i.e. one row of the client’s
write-frame width (frame.width * 4 bytes). Boards that expect
full-width writes should size it to at least resource_width * 8 * 4 (one full-width page) so head/tail partial sub-ops always fit
in a single underlying write.
Implementations§
Trait Implementations§
Source§impl<'a, S: Screen<'a>> Screen<'a> for ScreenARGB8888ToMono8BitPage<'a, S>
impl<'a, S: Screen<'a>> Screen<'a> for ScreenARGB8888ToMono8BitPage<'a, S>
Source§fn set_client(&self, client: &'a dyn ScreenClient)
fn set_client(&self, client: &'a dyn ScreenClient)
Source§fn get_resolution(&self) -> (usize, usize)
fn get_resolution(&self) -> (usize, usize)
(width, height) with the current resolution (in pixels). Read moreSource§fn get_pixel_format(&self) -> ScreenPixelFormat
fn get_pixel_format(&self) -> ScreenPixelFormat
Source§fn get_rotation(&self) -> ScreenRotation
fn get_rotation(&self) -> ScreenRotation
Source§fn set_write_frame(
&self,
x: usize,
y: usize,
width: usize,
height: usize,
) -> Result<(), ErrorCode>
fn set_write_frame( &self, x: usize, y: usize, width: usize, height: usize, ) -> Result<(), ErrorCode>
Source§fn write(
&self,
buffer: SubSliceMut<'static, u8>,
continue_write: bool,
) -> Result<(), ErrorCode>
fn write( &self, buffer: SubSliceMut<'static, u8>, continue_write: bool, ) -> Result<(), ErrorCode>
buffer to the selected write frame. Read moreSource§fn set_brightness(&self, brightness: u16) -> Result<(), ErrorCode>
fn set_brightness(&self, brightness: u16) -> Result<(), ErrorCode>
Source§impl<'a, S: Screen<'a>> ScreenClient for ScreenARGB8888ToMono8BitPage<'a, S>
impl<'a, S: Screen<'a>> ScreenClient for ScreenARGB8888ToMono8BitPage<'a, S>
Source§fn screen_is_ready(&self)
fn screen_is_ready(&self)
Source§fn command_complete(&self, result: Result<(), ErrorCode>)
fn command_complete(&self, result: Result<(), ErrorCode>)
Source§fn write_complete(
&self,
buffer: SubSliceMut<'static, u8>,
result: Result<(), ErrorCode>,
)
fn write_complete( &self, buffer: SubSliceMut<'static, u8>, result: Result<(), ErrorCode>, )
command_complete as it has to pass
back the write buffer