diff options
author | Jon Lund Steffensen <jonlst@gmail.com> | 2014-12-27 20:35:00 -0500 |
---|---|---|
committer | Jon Lund Steffensen <jonlst@gmail.com> | 2014-12-27 20:35:00 -0500 |
commit | 87cec6b3661d9367b1d59935a41d3eab2e32c5b3 (patch) | |
tree | 767475829fda9b9856532535e06dcb3ad02a5b32 /src/colorramp.c | |
parent | redshift: Use double for interpolation function (diff) | |
parent | redshift: Simplify set_temperature by passing color_setting_t (diff) | |
download | redshift-ng-87cec6b3661d9367b1d59935a41d3eab2e32c5b3.tar.gz redshift-ng-87cec6b3661d9367b1d59935a41d3eab2e32c5b3.tar.bz2 redshift-ng-87cec6b3661d9367b1d59935a41d3eab2e32c5b3.tar.xz |
Merge branch 'color-settings-struct'
Diffstat (limited to '')
-rw-r--r-- | src/colorramp.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/colorramp.c b/src/colorramp.c index 3521195..d732a18 100644 --- a/src/colorramp.c +++ b/src/colorramp.c @@ -21,6 +21,7 @@ #include <stdint.h> #include <math.h> +#include "redshift.h" /* Whitepoint values for temperatures at 100K intervals. These will be interpolated for the actual temperature. @@ -281,16 +282,17 @@ interpolate_color(float a, const float *c1, const float *c2, float *c) } /* Helper macro used in the fill functions */ -#define F(Y, C) pow((Y) * brightness * white_point[C], 1.0/gamma[C]) +#define F(Y, C) pow((Y) * setting->brightness * \ + white_point[C], 1.0/setting->gamma[C]) void colorramp_fill(uint16_t *gamma_r, uint16_t *gamma_g, uint16_t *gamma_b, - int size, int temp, float brightness, const float gamma[3]) + int size, const color_setting_t *setting) { /* Approximate white point */ float white_point[3]; - float alpha = (temp % 100) / 100.0; - int temp_index = ((temp - 1000) / 100)*3; + float alpha = (setting->temperature % 100) / 100.0; + int temp_index = ((setting->temperature - 1000) / 100)*3; interpolate_color(alpha, &blackbody_color[temp_index], &blackbody_color[temp_index+3], white_point); @@ -303,13 +305,12 @@ colorramp_fill(uint16_t *gamma_r, uint16_t *gamma_g, uint16_t *gamma_b, void colorramp_fill_float(float *gamma_r, float *gamma_g, float *gamma_b, - int size, int temp, float brightness, - const float gamma[3]) + int size, const color_setting_t *setting) { /* Approximate white point */ float white_point[3]; - float alpha = (temp % 100) / 100.0; - int temp_index = ((temp - 1000) / 100)*3; + float alpha = (setting->temperature % 100) / 100.0; + int temp_index = ((setting->temperature - 1000) / 100)*3; interpolate_color(alpha, &blackbody_color[temp_index], &blackbody_color[temp_index+3], white_point); |