From a63b75696de54b7342501e35230b373453ee6d81 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 26 Mar 2014 08:53:53 +0100 Subject: m + add cie_temperature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/curve.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/curve.py b/src/curve.py index cca8a5a..4be11fc 100644 --- a/src/curve.py +++ b/src/curve.py @@ -53,15 +53,36 @@ def curves(r, g, b): def temperature(temperature, algorithm): ''' - Change colour temperature according to the CIE illuminant series D + Change colour temperature according to the CIE illuminant series D using CIE sRBG + + @param temperature:float The blackbody temperature in kelvins + @param algorithm:(float)→(float, float, float) Algorithm for calculating a white point, for example `cmf_10deg` + ''' + rgb_temperature(temperature, algorithm) + + +def rgb_temperature(temperature, algorithm): + ''' + Change colour temperature according to the CIE illuminant series D using CIE sRBG + + @param temperature:float The blackbody temperature in kelvins + @param algorithm:(float)→(float, float, float) Algorithm for calculating a white point, for example `cmf_10deg` + ''' + if temperature == 6500: + return + rgb_brightness(*(algorithm(temperature))) + + +def cie_temperature(temperature, algorithm): + ''' + Change colour temperature according to the CIE illuminant series D using CIE xyY @param temperature:float The blackbody temperature in kelvins @param algorithm:(float)→(float, float, float) Algorithm for calculating a white point, for example `cmf_10deg` ''' if temperature == 6500: return - (r, g, b) = algorithm(temperature) - rgb_brightness(r, g, b) + cie_brightness(*(algorithm(temperature))) def rgb_contrast(r, g = ..., b = ...): -- cgit v1.2.3-70-g09d2