pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
}Expand description
Straight (unpremultiplied) sRGB color, components 0..=1.
Premultiplication happens at the GPU boundary (premultiplied()), and valo
blends in sRGB space — the CSS/Skia-compatible look. Linear-light blending
and wide gamut are deliberately deferred: when they land, this type stays and
the conversion moves into the uniform-fill path.
Fields§
§r: f32§g: f32§b: f32§a: f32Implementations§
Source§impl Color
impl Color
pub const TRANSPARENT: Color
pub const BLACK: Color
pub const WHITE: Color
pub const fn rgba(r: f32, g: f32, b: f32, a: f32) -> Self
pub const fn rgb(r: f32, g: f32, b: f32) -> Self
Sourcepub fn from_rgba8(r: u8, g: u8, b: u8, a: u8) -> Self
pub fn from_rgba8(r: u8, g: u8, b: u8, a: u8) -> Self
From 8-bit sRGB (the CSS #rrggbbaa layout).
pub fn with_alpha(self, a: f32) -> Self
Sourcepub fn components(self) -> [f32; 4]
pub fn components(self) -> [f32; 4]
Straight components in draw order [r, g, b, a].
Sourcepub fn premultiplied(self) -> [f32; 4]
pub fn premultiplied(self) -> [f32; 4]
Alpha-premultiplied components in draw order [r, g, b, a] — what the
uniform fill hands the blender.
pub fn is_opaque(self) -> bool
Trait Implementations§
impl Copy 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 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