pub struct Color { /* private fields */ }Expand description
A color.
Implementations§
Source§impl Color
impl Color
Sourcepub fn to_rgba(&self) -> AlphaColor
pub fn to_rgba(&self) -> AlphaColor
Return the color as an RGBA color.
Sourcepub fn from_rgba(rgba: AlphaColor) -> Self
pub fn from_rgba(rgba: AlphaColor) -> Self
Create a color from RGBA.
Sourcepub fn from_device_rgb(r: f32, g: f32, b: f32) -> Self
pub fn from_device_rgb(r: f32, g: f32, b: f32) -> Self
Create a color in the DeviceRGB color space.
Sourcepub fn from_device_rgb_with_opacity(
r: f32,
g: f32,
b: f32,
opacity: f32,
) -> Self
pub fn from_device_rgb_with_opacity( r: f32, g: f32, b: f32, opacity: f32, ) -> Self
Create a color in the DeviceRGB color space with custom opacity.
Sourcepub fn opacity(&self) -> f32
pub fn opacity(&self) -> f32
Returns the opacity of this color (0.0 = fully transparent, 1.0 = fully opaque).
Sourcepub fn is_device_cmyk(&self) -> bool
pub fn is_device_cmyk(&self) -> bool
Return true if this color is expressed in the DeviceCMYK color space.
Sourcepub fn device_cmyk_components(&self) -> Option<[f32; 4]>
pub fn device_cmyk_components(&self) -> Option<[f32; 4]>
Return the raw DeviceCMYK components, if this color is DeviceCMYK.
Trait Implementations§
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