Trait embedded_graphics::pixelcolor::IntoStorage

source ·
pub trait IntoStorage {
    type Storage;

    // Required method
    fn into_storage(self) -> Self::Storage;
}
Expand description

Convert a PixelColor into its underlying storage type

This trait provides the into_storage method for implementors of PixelColor. This method exposes the underlying storage value of a pixel color type.

§Examples

§Get the u16 representing an Rgb565 color

This example converts an Rgb565 color into its underlying u16 representation.

use embedded_graphics::{pixelcolor::Rgb565, prelude::*};

let color = Rgb565::new(0x1f, 0x00, 0x0a);

let raw = color.into_storage();

assert_eq!(raw, 0b11111_000000_01010u16);

Required Associated Types§

source

type Storage

The underlying storage type for the pixel color

Required Methods§

source

fn into_storage(self) -> Self::Storage

Convert the PixelColor into its raw storage form

Implementors§

source§

impl<C> IntoStorage for C
where C: PixelColor, <C as PixelColor>::Raw: From<C>,

§

type Storage = <<C as PixelColor>::Raw as RawData>::Storage