pub struct Color {
pub r: f32,
pub g: f32,
pub b: f32,
pub a: f32,
pub space: ColorSpace,
pub format: ColorFormat,
}Expand description
A colour, together with how to interpret its components.
Ink stores colour internally as linear, non-premultiplied sRGB, and converts
on the way in and out. The space and format here say what the r, g,
b and a fields mean, not how Ink will store them.
Fields§
§r: f32§g: f32§b: f32§a: f32§space: ColorSpace§format: ColorFormatImplementations§
Source§impl Color
impl Color
pub const BLACK: Color
pub const WHITE: Color
pub const TRANSPARENT: Color
Sourcepub const fn srgb(r: f32, g: f32, b: f32, a: f32) -> Self
pub const fn srgb(r: f32, g: f32, b: f32, a: f32) -> Self
A gamma-encoded sRGB colour, the usual way to spell a colour by hand.
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
A gamma-encoded sRGB colour from 8-bit components.
Sourcepub fn from_packed_rgba(rgba: u32) -> Self
pub fn from_packed_rgba(rgba: u32) -> Self
A gamma-encoded sRGB colour from a packed 0xRRGGBBAA value.
Sourcepub fn with_alpha(self, a: f32) -> Self
pub fn with_alpha(self, a: f32) -> Self
The same colour with a different alpha.
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