Struct sensehat::Colour [−][src]
24-bit RGB color pixel.
This is the fundamental representation for RGB colors.
Fields
red: u8
green: u8
blue: u8
Methods
impl PixelColor
[src]
impl PixelColor
pub const BLACK: PixelColor
BLACK: PixelColor = PixelColor{red: 0, green: 0, blue: 0,}
pub const RED: PixelColor
RED: PixelColor = PixelColor{red: 255, green: 0, blue: 0,}
pub const BLUE: PixelColor
BLUE: PixelColor = PixelColor{red: 0, green: 0, blue: 255,}
pub const GREEN: PixelColor
GREEN: PixelColor = PixelColor{red: 0, green: 255, blue: 0,}
pub const WHITE: PixelColor
WHITE: PixelColor = PixelColor{red: 255, green: 255, blue: 255,}
pub const YELLOW: PixelColor
YELLOW: PixelColor = PixelColor{red: 255, green: 255, blue: 0,}
pub const CYAN: PixelColor
CYAN: PixelColor = PixelColor{red: 0, green: 255, blue: 255,}
pub const MAGENTA: PixelColor
MAGENTA: PixelColor = PixelColor{red: 255, green: 0, blue: 255,}
pub fn new(red: u8, green: u8, blue: u8) -> PixelColor
[src]
pub fn new(red: u8, green: u8, blue: u8) -> PixelColor
Create a new LED pixel color.
pub fn from_rgb565_bytes(color: [u8; 2]) -> PixelColor
[src]
pub fn from_rgb565_bytes(color: [u8; 2]) -> PixelColor
Create a new LED pixel color from a pair of RGB565-encoded bytes.
pub fn rgb565(&self) -> [u8; 2]
[src]
pub fn rgb565(&self) -> [u8; 2]
Encodes the current LED pixel color into a pair of RGB565-encoded bytes.
pub fn dim(self, scale: f32) -> PixelColor
[src]
pub fn dim(self, scale: f32) -> PixelColor
Sets the brightness of this colour.
The scale
value should be between 0 and 1. Values outside this range
are clamped.
Trait Implementations
impl Into<(u8, u8, u8)> for PixelColor
[src]
impl Into<(u8, u8, u8)> for PixelColor
impl Clone for PixelColor
[src]
impl Clone for PixelColor
fn clone(&self) -> PixelColor
[src]
fn clone(&self) -> PixelColor
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for PixelColor
[src]
impl Default for PixelColor
fn default() -> PixelColor
[src]
fn default() -> PixelColor
Returns the "default value" for a type. Read more
impl Debug for PixelColor
[src]
impl Debug for PixelColor
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl Copy for PixelColor
[src]
impl Copy for PixelColor
impl Serialize for PixelColor
[src]
impl Serialize for PixelColor
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for PixelColor
[src]
impl<'de> Deserialize<'de> for PixelColor
fn deserialize<__D>(
__deserializer: __D
) -> Result<PixelColor, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(
__deserializer: __D
) -> Result<PixelColor, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl PartialEq<PixelColor> for PixelColor
[src]
impl PartialEq<PixelColor> for PixelColor
fn eq(&self, other: &PixelColor) -> bool
[src]
fn eq(&self, other: &PixelColor) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &PixelColor) -> bool
[src]
fn ne(&self, other: &PixelColor) -> bool
This method tests for !=
.
impl From<PixelColor> for Rgb565
[src]
impl From<PixelColor> for Rgb565
fn from(color: PixelColor) -> Rgb565
[src]
fn from(color: PixelColor) -> Rgb565
Performs the conversion.
impl From<(u8, u8, u8)> for PixelColor
[src]
impl From<(u8, u8, u8)> for PixelColor
impl<'a> From<&'a PixelColor> for Rgb565
[src]
impl<'a> From<&'a PixelColor> for Rgb565
fn from(color: &'a PixelColor) -> Rgb565
[src]
fn from(color: &'a PixelColor) -> Rgb565
Performs the conversion.
impl From<Rgb565> for PixelColor
[src]
impl From<Rgb565> for PixelColor
fn from(color: Rgb565) -> PixelColor
[src]
fn from(color: Rgb565) -> PixelColor
Performs the conversion.
Auto Trait Implementations
impl Send for PixelColor
impl Send for PixelColor
impl Sync for PixelColor
impl Sync for PixelColor