pub struct Color {
pub rgb_linear: [f32; 3],
pub primaries: Primaries,
}Expand description
Single-pixel color value used for explicit alpha matting and fills.
Fields§
§rgb_linear: [f32; 3]Relative linear-light RGB in primaries. A neutral value of 1.0
represents diffuse white at the conversion’s luminance anchor.
primaries: PrimariesPrimaries of rgb_linear.
Implementations§
Source§impl Color
impl Color
Sourcepub const WHITE: Color
pub const WHITE: Color
Diffuse white in linear sRGB primaries ([1.0; 3], D65).
For alpha compositing, the conversion transforms the matte into its working primaries. Its luminance follows the conversion’s white anchor.
Sourcepub const fn linear(rgb: [f32; 3], primaries: Primaries) -> Color
pub const fn linear(rgb: [f32; 3], primaries: Primaries) -> Color
Construct from linear RGB values in primaries.
Sourcepub fn to_primaries(self, dst: Primaries) -> Option<[f32; 3]>
pub fn to_primaries(self, dst: Primaries) -> Option<[f32; 3]>
Convert this color’s linear RGB into dst primaries.
Sourcepub fn to_custom_primaries(self, dst: CustomPrimaries) -> Option<[f32; 3]>
pub fn to_custom_primaries(self, dst: CustomPrimaries) -> Option<[f32; 3]>
Convert this linear matte color into validated CustomPrimaries, applying Bradford
chromatic adaptation automatically if white points differ.
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