From 38af3a0d5e22399b515ceb037870c3ef22662bb7 Mon Sep 17 00:00:00 2001 From: Jon Lund Steffensen Date: Thu, 21 Apr 2011 00:23:50 +0200 Subject: Allow brightness to be adjusted (between 10% and 100%, the latter being the default). --- src/colorramp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/colorramp.c') diff --git a/src/colorramp.c b/src/colorramp.c index 7241a8d..ed399f8 100644 --- a/src/colorramp.c +++ b/src/colorramp.c @@ -128,7 +128,7 @@ interpolate_color(float a, const float *c1, const float *c2, float *c) void colorramp_fill(uint16_t *gamma_r, uint16_t *gamma_g, uint16_t *gamma_b, - int size, int temp, float gamma[3]) + int size, int temp, float brightness, float gamma[3]) { /* Approximate white point */ float white_point[3]; @@ -139,10 +139,10 @@ colorramp_fill(uint16_t *gamma_r, uint16_t *gamma_g, uint16_t *gamma_b, for (int i = 0; i < size; i++) { gamma_r[i] = pow((float)i/size, 1.0/gamma[0]) * - UINT16_MAX * white_point[0]; + UINT16_MAX * brightness * white_point[0]; gamma_g[i] = pow((float)i/size, 1.0/gamma[1]) * - UINT16_MAX * white_point[1]; + UINT16_MAX * brightness * white_point[1]; gamma_b[i] = pow((float)i/size, 1.0/gamma[2]) * - UINT16_MAX * white_point[2]; + UINT16_MAX * brightness * white_point[2]; } } -- cgit v1.2.3-70-g09d2