pub struct Pixel(/* private fields */);
Implementations§
Source§impl Pixel
impl Pixel
pub const BLACK: Self
pub const DARK_GRAY: Self
pub const LIGHT_GRAY: Self
pub const WHITE: Self
pub const RED: Self
pub const GREEN: Self
pub const BLUE: Self
pub const YELLOW: Self
pub const MAGENTA: Self
pub const CYAN: Self
pub fn add(&self, other: &Self) -> Self
pub fn subtract(&self, other: &Self) -> Self
pub fn xor(&self, other: &Self) -> Self
pub fn from_rgba(r: u8, g: u8, b: u8, a: u8) -> Self
Sourcepub fn to_rgba(&self) -> (u8, u8, u8, u8)
pub fn to_rgba(&self) -> (u8, u8, u8, u8)
r
,g
andb
are returned by their encoded valuex85
- 0 -> 0,
- 1 -> 85 (33.3%),
- 2 -> 170 (66.6%),
- 3 -> 255 (100%),
a
is multiplied by 85 too, but,if a == 0 && {r, g, b} != 0
,- then
a = 38
(15%).
pub fn split(&self) -> (u8, u8, u8, u8)
pub const fn raw(byte: u8) -> Self
pub fn from_word(word: Word) -> [Pixel; 8]
pub fn pixels_to_word(from: &[Pixel; 8]) -> Word
pub const fn get(&self) -> u8
Sourcepub fn create_all_colors() -> Vec<Self>
pub fn create_all_colors() -> Vec<Self>
Creates all combinations of 256 (4x4x4x4) colors.
Trait Implementations§
impl Copy for Pixel
Auto Trait Implementations§
impl Freeze for Pixel
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more