Struct kernel::services::emb_display::MonoChunk
source · pub struct MonoChunk {
meta: FrameChunkMetadata,
data: Buf8,
mask: Buf8,
}
Fields§
§meta: FrameChunkMetadata
§data: Buf8
§mask: Buf8
Implementations§
source§impl MonoChunk
impl MonoChunk
sourcepub async fn allocate_mono(size: FrameLocSize) -> Self
pub async fn allocate_mono(size: FrameLocSize) -> Self
Allocate a monochrome framebuffer with the given metadata
sourcepub fn invert_masked(&mut self)
pub fn invert_masked(&mut self)
Invert all pixels that are NOT currently transparent
This can be used to “unblit” an image
sourcepub fn meta(&self) -> &FrameChunkMetadata
pub fn meta(&self) -> &FrameChunkMetadata
Get the metadata of this FrameChunk
sourcepub fn meta_mut(&mut self) -> &mut FrameChunkMetadata
pub fn meta_mut(&mut self) -> &mut FrameChunkMetadata
Get the metadatae of this FrameChunk as a mutable reference
sourcepub fn data(&self) -> &[u8] ⓘ
pub fn data(&self) -> &[u8] ⓘ
Get the raw pixel data
This is currently one byte per pixel, with 0x00 representing “OFF” and 0xFF representing “ON”. All other values are invalid.
sourcepub fn mask(&self) -> &[u8] ⓘ
pub fn mask(&self) -> &[u8] ⓘ
Get the raw mask data
This is currently one byte per pixel, with 0x00 representing “Transparent” and 0xFF representing “Solid”. All other values are invalid.
sourcepub fn draw_pixel(&mut self, x: u32, y: u32, state: bool)
pub fn draw_pixel(&mut self, x: u32, y: u32, state: bool)
Draw the given pixel, and mark the pixel as not transparent
If you want to instead mark the pixel as transparent, see MonoChunk::clear_pixel().
sourcepub fn clear_pixel(&mut self, x: u32, y: u32)
pub fn clear_pixel(&mut self, x: u32, y: u32)
Clear the given pixel by marking it as transparent
NOTE: This is not used for setting the pixel as “off”, instead use MonoChunk::draw_pixel().
Trait Implementations§
source§impl DrawTarget for MonoChunk
impl DrawTarget for MonoChunk
FrameChunk implements embedded-graphics’s DrawTarget
trait so that clients
can directly use embedded-graphics primitives for drawing into the framebuffer.