#[non_exhaustive]pub enum PixelLayout {
Xrgb8888,
Rgb565,
}Expand description
How pixels are laid out in the mapped framebuffer.
sysfs reports the depth but not the channel order, so this is inferred. The
assumptions hold for every mainline framebuffer driver and for DRM’s fbdev
emulation, which is what almost every modern /dev/fb0 actually is; a device
with an exotic byte order will render with its channels swapped rather than
fail, and that is the trade a legacy fallback should make.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Xrgb8888
32 bits per pixel, 0xXXRRGGBB. Matches Denise’s own word layout, so
presenting is a copy.
Rgb565
16 bits per pixel, 5 red / 6 green / 5 blue. Common on SPI panels, and needs a conversion on the way out.
Implementations§
Source§impl PixelLayout
impl PixelLayout
Sourcepub const fn bytes_per_pixel(self) -> usize
pub const fn bytes_per_pixel(self) -> usize
Bytes each pixel occupies.
Sourcepub const fn from_bits_per_pixel(bpp: u32) -> Option<Self>
pub const fn from_bits_per_pixel(bpp: u32) -> Option<Self>
Infers the layout from a bit depth.
Trait Implementations§
Source§impl Clone for PixelLayout
impl Clone for PixelLayout
Source§fn clone(&self) -> PixelLayout
fn clone(&self) -> PixelLayout
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PixelLayout
Source§impl Debug for PixelLayout
impl Debug for PixelLayout
impl Eq for PixelLayout
Source§impl PartialEq for PixelLayout
impl PartialEq for PixelLayout
impl StructuralPartialEq for PixelLayout
Auto Trait Implementations§
impl Freeze for PixelLayout
impl RefUnwindSafe for PixelLayout
impl Send for PixelLayout
impl Sync for PixelLayout
impl Unpin for PixelLayout
impl UnsafeUnpin for PixelLayout
impl UnwindSafe for PixelLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more