pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}
Expand description
Struct representing an RGBA color value in un-premultiplied non-linear sRGB space
Fields§
§r: u8
Red
g: u8
Green
b: u8
Blue
a: u8
Alpha
Implementations§
Source§impl Color
impl Color
Sourcepub fn from_hash_code(hash_code: &str) -> Result<Color, Error>
pub fn from_hash_code(hash_code: &str) -> Result<Color, Error>
Create a color from a six or height hexadecimal digit string like ‘#EBD5B3’
Sourcepub fn make_color_rgba(&self) -> ColorRgba
pub fn make_color_rgba(&self) -> ColorRgba
Create a Scenic-compatible ColorRgba
Sourcepub fn to_linear_premult_rgba(&self) -> [f32; 4]
pub fn to_linear_premult_rgba(&self) -> [f32; 4]
Create a linear, premultiplied RGBA representation
Sourcepub fn to_linear_bgra(&self) -> [f32; 4]
pub fn to_linear_bgra(&self) -> [f32; 4]
Create a linear BGRA representation
Sourcepub fn to_srgb_premult_rgba(&self) -> [f32; 4]
pub fn to_srgb_premult_rgba(&self) -> [f32; 4]
Create a premultiplied SRGB representation
Trait Implementations§
impl Copy for Color
impl Eq for Color
impl StructuralPartialEq for Color
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)