pub struct SrgbaTuple(pub f32, pub f32, pub f32, pub f32);Expand description
A pixel value encoded as SRGBA RGBA values in f32 format (range: 0.0-1.0)
Tuple Fields§
§0: f32§1: f32§2: f32§3: f32Implementations§
Source§impl SrgbaTuple
impl SrgbaTuple
pub fn premultiply(self) -> SrgbaTuple
pub fn demultiply(self) -> SrgbaTuple
pub fn to_tuple_rgba(self) -> (f32, f32, f32, f32)
pub fn as_rgba_u8(self) -> (u8, u8, u8, u8)
pub fn interpolate(self, other: SrgbaTuple, k: f64) -> SrgbaTuple
Source§impl SrgbaTuple
impl SrgbaTuple
Sourcepub fn from_named(name: &str) -> Option<SrgbaTuple>
pub fn from_named(name: &str) -> Option<SrgbaTuple>
Construct a color from an X11/SVG/CSS3 color name. Returns None if the supplied name is not recognized. The list of names can be found here: https://en.wikipedia.org/wiki/X11_color_names
Sourcepub fn mul_alpha(self, alpha: f32) -> SrgbaTuple
pub fn mul_alpha(self, alpha: f32) -> SrgbaTuple
Returns self multiplied by the supplied alpha value. We don’t need to linearize for this, as alpha is defined as being linear even in srgba!
pub fn to_linear(self) -> LinearRgba
pub fn to_srgb_u8(self) -> (u8, u8, u8, u8)
pub fn to_string(self) -> String
Sourcepub fn to_rgb_string(self) -> String
pub fn to_rgb_string(self) -> String
Returns a string of the form #RRGGBB
pub fn to_rgba_string(self) -> String
Sourcepub fn to_x11_16bit_rgb_string(self) -> String
pub fn to_x11_16bit_rgb_string(self) -> String
Returns a string of the form rgb:RRRR/GGGG/BBBB
pub fn to_laba(self) -> (f64, f64, f64, f64)
pub fn to_hsla(self) -> (f64, f64, f64, f64)
pub fn from_hsla(h: f64, s: f64, l: f64, a: f64) -> SrgbaTuple
Sourcepub fn saturate(&self, factor: f64) -> SrgbaTuple
pub fn saturate(&self, factor: f64) -> SrgbaTuple
Scale the color towards the maximum saturation by factor, a value ranging from 0.0 to 1.0.
Sourcepub fn saturate_fixed(&self, amount: f64) -> SrgbaTuple
pub fn saturate_fixed(&self, amount: f64) -> SrgbaTuple
Increase the saturation by amount, a value ranging from 0.0 to 1.0.
Sourcepub fn lighten(&self, factor: f64) -> SrgbaTuple
pub fn lighten(&self, factor: f64) -> SrgbaTuple
Scale the color towards the maximum lightness by factor, a value ranging from 0.0 to 1.0
Sourcepub fn lighten_fixed(&self, amount: f64) -> SrgbaTuple
pub fn lighten_fixed(&self, amount: f64) -> SrgbaTuple
Lighten the color by amount, a value ranging from 0.0 to 1.0
Sourcepub fn adjust_hue_fixed(&self, amount: f64) -> SrgbaTuple
pub fn adjust_hue_fixed(&self, amount: f64) -> SrgbaTuple
Rotate the hue angle by the specified number of degrees
pub fn complement(&self) -> SrgbaTuple
pub fn complement_ryb(&self) -> SrgbaTuple
pub fn triad(&self) -> (SrgbaTuple, SrgbaTuple)
pub fn square(&self) -> (SrgbaTuple, SrgbaTuple, SrgbaTuple)
Sourcepub fn adjust_hue_fixed_ryb(&self, amount: f64) -> SrgbaTuple
pub fn adjust_hue_fixed_ryb(&self, amount: f64) -> SrgbaTuple
Rotate the hue angle by the specified number of degrees, using the RYB color wheel
pub fn delta_e(&self, other: &SrgbaTuple) -> f32
pub fn contrast_ratio(&self, other: &SrgbaTuple) -> f64
Trait Implementations§
Source§impl Clone for SrgbaTuple
impl Clone for SrgbaTuple
Source§fn clone(&self) -> SrgbaTuple
fn clone(&self) -> SrgbaTuple
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more