1
0
Fork 0
forked from wry/wry

render: implement a vulkan renderer

This commit is contained in:
Julian Orth 2024-02-03 15:19:20 +01:00
parent 4ba8550da8
commit cf332e8436
66 changed files with 4287 additions and 239 deletions

View file

@ -84,6 +84,27 @@ impl Color {
pub fn to_rgba_premultiplied(self) -> [u8; 4] {
[to_u8(self.r), to_u8(self.g), to_u8(self.b), to_u8(self.a)]
}
#[allow(dead_code)]
pub fn to_array_srgb(self) -> [f32; 4] {
[self.r, self.g, self.b, self.a]
}
pub fn to_array_linear(self) -> [f32; 4] {
fn to_linear(srgb: f32) -> f32 {
if srgb <= 0.04045 {
srgb / 12.92
} else {
(srgb + 0.055 / 1.055).powf(2.4)
}
}
[
to_linear(self.r),
to_linear(self.g),
to_linear(self.b),
self.a,
]
}
}
impl From<jay_config::theme::Color> for Color {