1
0
Fork 0
forked from wry/wry

color-management: implement gamma functions for negative values

This commit is contained in:
Julian Orth 2025-09-05 12:34:22 +02:00
parent 050515d2ed
commit 48a36a9feb
2 changed files with 12 additions and 12 deletions

View file

@ -113,13 +113,13 @@ impl Color {
c.powf(2.6) * 52.37 / 48.0
}
fn gamma22(c: f32) -> f32 {
c.powf(2.2)
c.signum() * c.abs().powf(2.2)
}
fn gamma24(c: f32) -> f32 {
c.powf(2.4)
c.signum() * c.abs().powf(2.4)
}
fn gamma28(c: f32) -> f32 {
c.powf(2.8)
c.signum() * c.abs().powf(2.8)
}
macro_rules! convert {
($tf:ident) => {{
@ -274,13 +274,13 @@ impl Color {
(48.0 * c / 52.37).powf(1.0 / 2.6)
}
fn gamma22(c: f32) -> f32 {
c.powf(1.0 / 2.2)
c.signum() * c.abs().powf(1.0 / 2.2)
}
fn gamma24(c: f32) -> f32 {
c.powf(1.0 / 2.4)
c.signum() * c.abs().powf(1.0 / 2.4)
}
fn gamma28(c: f32) -> f32 {
c.powf(1.0 / 2.8)
c.signum() * c.abs().powf(1.0 / 2.8)
}
macro_rules! convert {
($tf:ident) => {{