wayland: implement wp_single_pixel_buffer_manager_v1
This commit is contained in:
parent
d814a8150a
commit
e21a95fb76
7 changed files with 183 additions and 2 deletions
12
src/theme.rs
12
src/theme.rs
|
|
@ -51,6 +51,18 @@ impl Color {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn from_u32_rgba_premultiplied(r: u32, g: u32, b: u32, a: u32) -> Self {
|
||||
fn to_f32(c: u32) -> f32 {
|
||||
((c as f64) / (u32::MAX as f64)) as f32
|
||||
}
|
||||
Self {
|
||||
r: to_f32(r),
|
||||
g: to_f32(g),
|
||||
b: to_f32(b),
|
||||
a: to_f32(a),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn from_rgba_straight(r: u8, g: u8, b: u8, a: u8) -> Self {
|
||||
let alpha = to_f32(a);
|
||||
Self {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue