pub struct Color { /* private fields */ }Expand description
Compact 32-bit sRGB color with 8-bit red, green, blue, and alpha channels.
Implementations§
Source§impl Color
Color constructors, packing, and blending operations.
impl Color
Color constructors, packing, and blending operations.
Sourcepub const fn mul_channel_u8(a: u8, b: u8) -> u8
pub const fn mul_channel_u8(a: u8, b: u8) -> u8
Sourcepub fn with_alpha(&self, alpha: u8) -> Self
pub fn with_alpha(&self, alpha: u8) -> Self
Sourcepub const fn multiply_alpha_u8(&self, alpha_scale: u8) -> Self
pub const fn multiply_alpha_u8(&self, alpha_scale: u8) -> Self
Sourcepub fn multiply_alpha(&self, opacity: f32) -> Self
pub fn multiply_alpha(&self, opacity: f32) -> Self
Sourcepub fn to_f32_array(&self) -> [f32; 4]
pub fn to_f32_array(&self) -> [f32; 4]
Sourcepub fn to_rgba_bytes(&self) -> [u8; 4]
pub fn to_rgba_bytes(&self) -> [u8; 4]
Sourcepub fn to_bgra_bytes(&self) -> [u8; 4]
pub fn to_bgra_bytes(&self) -> [u8; 4]
Sourcepub fn blend_over(&self, dst: Self) -> Self
pub fn blend_over(&self, dst: Self) -> Self
Source§impl Color
impl Color
pub fn get_r(&self) -> u8
pub fn get_mut_r(&mut self) -> &mut u8
pub fn set_r(&mut self, val: u8) -> &mut Self
pub fn get_g(&self) -> u8
pub fn get_mut_g(&mut self) -> &mut u8
pub fn set_g(&mut self, val: u8) -> &mut Self
pub fn get_b(&self) -> u8
pub fn get_mut_b(&mut self) -> &mut u8
pub fn set_b(&mut self, val: u8) -> &mut Self
pub fn get_a(&self) -> u8
pub fn get_mut_a(&mut self) -> &mut u8
pub fn set_a(&mut self, val: u8) -> &mut Self
Trait Implementations§
impl Copy for Color
impl Eq for Color
Source§impl Ord for Color
impl Ord for Color
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Color
impl PartialOrd for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Forget for Color
impl Freeze for Color
impl Move for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnsafeUnpin for Color
impl UnwindSafe for Color
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