diff options
author | 2023-06-07 10:47:57 -0700 | |
---|---|---|
committer | 2023-06-07 11:18:26 -0700 | |
commit | 677f564f087b009842207e6df74aed343454ea17 (patch) | |
tree | c241fd569e1eacc07850618423c8d052c8405c77 /core | |
parent | 9554c78f3adc9846b76e9d3b96af06e98fb69aa0 (diff) | |
download | iced-677f564f087b009842207e6df74aed343454ea17.tar.gz iced-677f564f087b009842207e6df74aed343454ea17.tar.bz2 iced-677f564f087b009842207e6df74aed343454ea17.zip |
Switched to packing using f16s to maintain acceptable precision.
Diffstat (limited to '')
-rw-r--r-- | core/src/color.rs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/core/src/color.rs b/core/src/color.rs index 9ef66b28..1392f28b 100644 --- a/core/src/color.rs +++ b/core/src/color.rs @@ -120,37 +120,6 @@ impl Color { ] } - /// Converts the [`Color`] into a `u32` value containing its RGBA8 components. - pub fn into_u32(self) -> u32 { - let [r, g, b, a] = self.into_rgba8(); - - let r = (r as u32) << 24; - let g = (g as u32) << 16; - let b = (b as u32) << 8; - let a = a as u32; - - r | g | b | a - } - - /// Converts the [`Color`] into a `u32` value containing its linear RGBA8 components. - pub fn into_linear_u32(self) -> u32 { - let [r, g, b, a] = self.into_linear(); - - let [r, g, b, a] = [ - (r * 255.0).round() as u8, - (g * 255.0).round() as u8, - (b * 255.0).round() as u8, - (a * 255.0).round() as u8, - ]; - - let r = (r as u32) << 24; - let g = (g as u32) << 16; - let b = (b as u32) << 8; - let a = a as u32; - - r | g | b | a - } - /// Inverts the [`Color`] in-place. pub fn invert(&mut self) { self.r = 1.0f32 - self.r; |