Optimized gradient data packing.
This commit is contained in:
parent
c15f1b5f65
commit
ea7f2626b1
6 changed files with 143 additions and 157 deletions
|
|
@ -145,6 +145,19 @@ impl From<[f32; 4]> for Color {
|
|||
}
|
||||
}
|
||||
|
||||
impl Into<u32> for Color {
|
||||
fn into(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
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a [`Color`] with shorter and cleaner syntax.
|
||||
///
|
||||
/// # Examples
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue