Trait IntoRawBytes

Source
pub trait IntoRawBytes: PixelColor + Sized {
    type Raw: AsRef<[u8]> + AsMut<[u8]> + Copy + Default;

    const BYTES_PER_PIXEL: usize;

    // Required method
    fn into_raw_bytes(self) -> <Self as IntoRawBytes>::Raw;
}
Expand description

A trait for converting a PixelColor into its raw byte representation.

This trait is the bridge between embedded-graphics color types and a raw byte buffer. By implementing this trait for a color, you define how it should be serialized into bytes for the display.

Required Associated Constants§

Source

const BYTES_PER_PIXEL: usize

The number of bytes used to represent one pixel of this color.

Required Associated Types§

Source

type Raw: AsRef<[u8]> + AsMut<[u8]> + Copy + Default

The fixed-size array type that holds the raw byte data for a single pixel.

Required Methods§

Source

fn into_raw_bytes(self) -> <Self as IntoRawBytes>::Raw

Converts the color instance into its raw byte representation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl IntoRawBytes for Rgb565

Source§

const BYTES_PER_PIXEL: usize = 2usize

Source§

type Raw = [u8; 2]

Source§

fn into_raw_bytes(self) -> <Self as IntoRawBytes>::Raw

Source§

impl IntoRawBytes for Rgb666

Source§

const BYTES_PER_PIXEL: usize = 3usize

Source§

type Raw = [u8; 3]

Source§

fn into_raw_bytes(self) -> <Self as IntoRawBytes>::Raw

Source§

impl IntoRawBytes for Rgb888

Source§

const BYTES_PER_PIXEL: usize = 3usize

Source§

type Raw = [u8; 3]

Source§

fn into_raw_bytes(self) -> <Self as IntoRawBytes>::Raw

Implementors§