Struct blinkt::Pixel

source ·
pub struct Pixel { /* private fields */ }
Expand description

A pixel on an LED strip or board.

Implementations§

source§

impl Pixel

source

pub fn rgb(&self) -> (u8, u8, u8)

Returns a tuple containing the values for red, green and blue.

source

pub fn set_rgb(&mut self, red: u8, green: u8, blue: u8)

Sets the values for red, green and blue.

red, green and blue are specified as 8-bit values between 0 (0%) and 255 (100%).

source

pub fn rgbb(&self) -> (u8, u8, u8, f32)

Returns a tuple containing the values for red, green, blue and brightness.

source

pub fn set_rgbb(&mut self, red: u8, green: u8, blue: u8, brightness: f32)

Sets the values for red, green, blue and brightness.

red, green and blue are specified as 8-bit values between 0 (0%) and 255 (100%). brightness is specified as a floating point value between 0.0 (0%) and 1.0 (100%), and is converted to a 5-bit value.

source

pub fn red(&self) -> u8

Returns the red value.

source

pub fn set_red(&mut self, red: u8)

Sets the red value.

red is specified as an 8-bit value between 0 (0%) and 255 (100%).

source

pub fn green(&self) -> u8

Returns the green value.

source

pub fn set_green(&mut self, green: u8)

Sets the green value.

green is specified as an 8-bit value between 0 (0%) and 255 (100%).

source

pub fn blue(&self) -> u8

Returns the blue value.

source

pub fn set_blue(&mut self, blue: u8)

Sets the blue value.

blue is specified as an 8-bit value between 0 (0%) and 255 (100%).

source

pub fn brightness(&self) -> f32

Returns the brightness value.

source

pub fn set_brightness(&mut self, brightness: f32)

Sets the brightness value.

brightness is specified as a floating point value between 0.0 (0%) and 1.0 (100%), and is converted to a 5-bit value.

source

pub fn clear(&mut self)

Sets the red, green and blue values to 0.

Trait Implementations§

source§

impl Clone for Pixel

source§

fn clone(&self) -> Pixel

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Pixel

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Pixel

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Copy for Pixel

Auto Trait Implementations§

§

impl RefUnwindSafe for Pixel

§

impl Send for Pixel

§

impl Sync for Pixel

§

impl Unpin for Pixel

§

impl UnwindSafe for Pixel

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.