Trait embedded_graphics::pixelcolor::IntoStorage[][src]

pub trait IntoStorage {
    type Storage;
    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);

Associated Types

The underlying storage type for the pixel color

Required methods

Convert the PixelColor into its raw storage form

Implementors