From bb1332aa418415eab6b5d731d8a4c1b84b36db77 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 21 Feb 2014 02:57:28 +0100 Subject: rename negative to invert (mirror y) and add negative that reverses (mirror x) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/curve.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/curve.py b/src/curve.py index 6446a2a..001108f 100644 --- a/src/curve.py +++ b/src/curve.py @@ -336,7 +336,24 @@ def gamma(r, g = None, b = None): def negative(r = True, g = None, b = None): ''' - Invert the colour curves (negative image) + Revese the colour curves (negative image with gamma preservation) + + @param r:bool Whether to invert the red curve + @param g:bool? Whether to invert the green curve, defaults to `r` if `None` + @param b:bool? Whether to invert the blue curve, defaults to `r` if `None` + ''' + if g is None: g = r + if b is None: b = r + for (curve, setting) in curves(r, g, b): + if setting: + for i in range(i_size // 2): + j = i_size - 1 - i + curve[i], curve[j] = curve[j], curve[i] + + +def invert(r = True, g = None, b = None): + ''' + Invert the colour curves (negative image with gamma invertion) @param r:bool Whether to invert the red curve @param g:bool? Whether to invert the green curve, defaults to `r` if `None` -- cgit v1.2.3-70-g09d2