From 778ff35c7984abe0a927a116674e509de3048ced Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 25 Mar 2014 13:31:05 +0100 Subject: fix interpolation at calculate of correlated colour temperature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/blackbody.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/blackbody.py') diff --git a/src/blackbody.py b/src/blackbody.py index 42fc6ff..bd29318 100644 --- a/src/blackbody.py +++ b/src/blackbody.py @@ -92,8 +92,8 @@ def cmf_2deg(temperature): (x1, y1) = cmf_2deg_cache[int(temp // 100)] (x2, y2) = cmf_2deg_cache[int(temp // 100 + 1)] temp = (temp % 100) / 100 - x = x1 * temp + x2 * (1 - temp) - y = y1 * temp + y2 * (1 - temp) + x = x1 * (1 - temp) + x2 * temp + y = y1 * (1 - temp) + y2 * temp return ciexyy_to_srgb(x, y, 1.0) @@ -123,8 +123,8 @@ def cmf_10deg(temperature): (x1, y1) = cmf_10deg_cache[int(temp // 100)] (x2, y2) = cmf_10deg_cache[int(temp // 100 + 1)] temp = (temp % 100) / 100 - x = x1 * temp + x2 * (1 - temp) - y = y1 * temp + y2 * (1 - temp) + x = x1 * (1 - temp) + x2 * temp + y = y1 * (1 - temp) + y2 * temp return ciexyy_to_srgb(x, y, 1) @@ -168,9 +168,9 @@ def redshift(temperature, old_version = False, linear_interpolation = False): temp = (temp % 100) / 100 if linear_interpolation: (r, g, b) = standard_to_linear(r, g, b) - r = r1 * temp + r2 * (1 - temp) - g = g1 * temp + g2 * (1 - temp) - b = b1 * temp + b2 * (1 - temp) + r = r1 * (1 - temp) + r2 * temp + g = g1 * (1 - temp) + g2 * temp + b = b1 * (1 - temp) + b2 * temp if linear_interpolation: (r, g, b) = linear_to_standard(r, g, b) return (r, g, b) -- cgit v1.2.3-70-g09d2