diff options
author | 2020-04-01 16:15:29 -0500 | |
---|---|---|
committer | 2020-04-24 15:13:22 -0500 | |
commit | a95d494f707b9492d180b41bd93565b21c729dd8 (patch) | |
tree | 1a352499d37d44eda1b761a141c631479cdc313c /core/src | |
parent | 408e9e566f740a4a9eb564492e96714dd5db4cc3 (diff) | |
download | iced-a95d494f707b9492d180b41bd93565b21c729dd8.tar.gz iced-a95d494f707b9492d180b41bd93565b21c729dd8.tar.bz2 iced-a95d494f707b9492d180b41bd93565b21c729dd8.zip |
Remove redundant from_srgba and into_srgba methods
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/color.rs | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/core/src/color.rs b/core/src/color.rs index 67433ded..57765df0 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -116,24 +116,6 @@ impl Color { ] } - #[cfg(feature = "palette")] - /// Convert from palette's [`Srgba`] type to a [`Color`] - /// - /// [`Srgba`]: ../palette/rgb/type.Srgba.html - /// [`Color`]: struct.Color.html - pub fn from_srgba(srgba: Srgba) -> Color { - Color::new(srgba.red, srgba.green, srgba.blue, srgba.alpha) - } - - #[cfg(feature = "palette")] - /// Convert from [`Color`] to palette's [`Srgba`] type - /// - /// [`Color`]: struct.Color.html - /// [`Srgba`]: ../palette/rgb/type.Srgba.html - pub fn into_srgba(self) -> Srgba { - Srgba::new(self.r, self.g, self.b, self.a) - } - /// Invert the Color in-place pub fn invert(&mut self) { self.r = 1.0f32 - self.r; @@ -202,8 +184,8 @@ mod tests { let c2 = Color::from_rgb(0.2, 0.5, 0.3); // Convert to linear color for manipulation - let l1 = c1.into_srgba().into_linear(); - let l2 = c2.into_srgba().into_linear(); + let l1 = Srgba::from(c1).into_linear(); + let l2 = Srgba::from(c2).into_linear(); // Take the lighter of each of the RGB components let lighter = l1.lighten(l2); |