Struct sensehat_screen::color::Rgb565
[−]
[src]
pub struct Rgb565(_);
RGB color stored as 16-bit digit, using RGB565 encoding/decoding.
// convert directly from u16 let red: Rgb565 = 0xF800.into(); // convert from a 3-byte tuple let green: Rgb565 = (0, 0xFF, 0).into(); assert_eq!(green, 0x07E0.into()); // convert from a 2-byte array if cfg!(not(feature = "big-endian")) { let blue: Rgb565 = [0x1F, 0x00].into(); assert_eq!(blue, 0x001F.into()); } if cfg!(feature = "big-endian") { let blue: Rgb565 = [0x00, 0x1F].into(); assert_eq!(blue, 0x001F.into()); }
Methods
impl Rgb565
[src]
pub fn from_rgb(red: u8, green: u8, blue: u8) -> Self
[src]
Create Rgb565
instance from red, green, and blue u8
values.
pub fn to_rgb(self) -> (u8, u8, u8)
[src]
Create (u8, u8, u8)
instance from a Rgb565
instance.
Trait Implementations
impl From<Rgb565> for PixelColor
[src]
impl Copy for Rgb565
[src]
impl Clone for Rgb565
[src]
fn clone(&self) -> Rgb565
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Rgb565
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Default for Rgb565
[src]
impl PartialEq for Rgb565
[src]
fn eq(&self, __arg_0: &Rgb565) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Rgb565) -> bool
[src]
This method tests for !=
.
impl Into<u16> for Rgb565
[src]
impl From<u16> for Rgb565
[src]
impl Into<[u8; 2]> for Rgb565
[src]
impl From<[u8; 2]> for Rgb565
[src]
impl From<(u8, u8, u8)> for Rgb565
[src]
impl Into<(u8, u8, u8)> for Rgb565
[src]
impl From<PixelColor> for Rgb565
[src]
fn from(color: PixelColor) -> Self
[src]
Performs the conversion.
impl<'a> From<&'a PixelColor> for Rgb565
[src]
fn from(color: &'a PixelColor) -> Self
[src]
Performs the conversion.