diff options
author | Jon Lund Steffensen <jonlst@gmail.com> | 2014-03-23 00:00:54 +0100 |
---|---|---|
committer | Jon Lund Steffensen <jonlst@gmail.com> | 2014-03-23 00:00:54 +0100 |
commit | ee7252e6fd7bc5e343b628059a865dee3f50603f (patch) | |
tree | b01fd4b9b510a2f818581aced9bca21ae3fb333f | |
parent | Merge pull request #42 from maandree/gamma-drm (diff) | |
parent | Apply gamma after brightness and termperature (diff) | |
download | redshift-ng-ee7252e6fd7bc5e343b628059a865dee3f50603f.tar.gz redshift-ng-ee7252e6fd7bc5e343b628059a865dee3f50603f.tar.bz2 redshift-ng-ee7252e6fd7bc5e343b628059a865dee3f50603f.tar.xz |
Merge pull request #46 from maandree/gamma
Apply gamma after brightness and temperature
-rw-r--r-- | src/colorramp.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/colorramp.c b/src/colorramp.c index cd43e7b..f1988d4 100644 --- a/src/colorramp.c +++ b/src/colorramp.c @@ -291,12 +291,11 @@ colorramp_fill(uint16_t *gamma_r, uint16_t *gamma_g, uint16_t *gamma_b, interpolate_color(alpha, &blackbody_color[temp_index], &blackbody_color[temp_index+3], white_point); +#define F(Y, C) pow((Y) * brightness * white_point[C], 1.0/gamma[C]) + for (int i = 0; i < size; i++) { - gamma_r[i] = pow((float)i/size, 1.0/gamma[0]) * - (UINT16_MAX+1) * brightness * white_point[0]; - gamma_g[i] = pow((float)i/size, 1.0/gamma[1]) * - (UINT16_MAX+1) * brightness * white_point[1]; - gamma_b[i] = pow((float)i/size, 1.0/gamma[2]) * - (UINT16_MAX+1) * brightness * white_point[2]; + gamma_r[i] = F((float)i/size, 0) * (UINT16_MAX+1); + gamma_g[i] = F((float)i/size, 1) * (UINT16_MAX+1); + gamma_b[i] = F((float)i/size, 2) * (UINT16_MAX+1); } } |