From 6ac8df052ab2519f755240f71c2a6712453a54ba Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 12 Jan 2016 23:43:40 +0100 Subject: simple_whitepoint: truncate values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/blackbody.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/blackbody.py b/src/blackbody.py index 5f5bfc4..4974b7e 100644 --- a/src/blackbody.py +++ b/src/blackbody.py @@ -526,6 +526,9 @@ def simple_whitepoint(temperature): g = 0.390081579 * math.log(temp) - 0.631841444 if temp < 66: b = 0 if temp <= 19 else 0.543206789 * math.log(temp - 10) - 1.196254089 + r = min(max(0, r), 1) + g = min(max(0, g), 1) + b = min(max(0, b), 1) return (r, g, b) -- cgit v1.2.3-70-g09d2