From e71ff4d62dc4ca7c6a134d24ce4ef829670c23cb Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 15 Feb 2014 21:31:30 +0100 Subject: add negative MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/__main__.py | 1 + src/curve.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/__main__.py b/src/__main__.py index 6ad21ce..cee2f85 100755 --- a/src/__main__.py +++ b/src/__main__.py @@ -55,6 +55,7 @@ def periodically(year, month, day, hour, minute, second, weekday, fade): (**) See https://en.wikipedia.org/wiki/Leap_second ''' if fade is None: + negative(False, False, False) temperature(6500, lambda T : divide_by_maximum(series_d(T)), True) temperature(6500, lambda T : clip_whitepoint(simple_whitepoint(T)), True) temperature(6500, cmf_2deg, True) diff --git a/src/curve.py b/src/curve.py index 8a6b28c..34adf29 100644 --- a/src/curve.py +++ b/src/curve.py @@ -263,6 +263,20 @@ def gamma(r, g, b): curve[i] **= level +def negative(r, g, b): + ''' + Invert the colour curves (negative image) + + @param r:bool Whether to invert the red curve + @param g:bool Whether to invert the green curve + @param b:bool Whether to invert the blue curve + ''' + for (curve, setting) in curves(r, g, b): + if setting: + for i in range(i_size): + curve[i] = 1 - curve[i] + + def sigmoid(r, g, b): ''' Apply S-curve correction on the colour curves -- cgit v1.2.3-70-g09d2