1
0
Fork 0
forked from wry/wry

wayland: implement wp_single_pixel_buffer_manager_v1

This commit is contained in:
Julian Orth 2024-02-06 14:39:55 +01:00
parent d814a8150a
commit e21a95fb76
7 changed files with 183 additions and 2 deletions

View file

@ -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 {