diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-02-21 02:57:28 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-02-21 02:57:28 +0100 |
commit | bb1332aa418415eab6b5d731d8a4c1b84b36db77 (patch) | |
tree | 4368e1671459b61c122f42fdcd5610089cb69dcb | |
parent | doc 0 param negative (diff) | |
download | blueshift-bb1332aa418415eab6b5d731d8a4c1b84b36db77.tar.gz blueshift-bb1332aa418415eab6b5d731d8a4c1b84b36db77.tar.bz2 blueshift-bb1332aa418415eab6b5d731d8a4c1b84b36db77.tar.xz |
rename negative to invert (mirror y) and add negative that reverses (mirror x)
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | examples/comprehensive | 3 | ||||
-rw-r--r-- | info/blueshift.texinfo | 18 | ||||
-rw-r--r-- | src/curve.py | 19 |
3 files changed, 36 insertions, 4 deletions
diff --git a/examples/comprehensive b/examples/comprehensive index 9b9bf36..bcb20c1 100644 --- a/examples/comprehensive +++ b/examples/comprehensive @@ -3,7 +3,8 @@ # This example is complete with exceptions for less normal colour # curve modifiers: nothing else than CIE 1964 10 degree CMF for # colour temperature, not use of temporarly linear RGB curves, -# negative image, sigmoid correction, or free function modifier. +# negative image, inverted image, sigmoid correction, or free +# function modifier. # Geographical coodinates. diff --git a/info/blueshift.texinfo b/info/blueshift.texinfo index d32aba6..0360956 100644 --- a/info/blueshift.texinfo +++ b/info/blueshift.texinfo @@ -321,13 +321,27 @@ and @code{b} on the red, green and blue curves, respectively. @item negative() -Inverts the all values on the colour curves. +Reverse the colour curves on the encoding axis. +This creates a negative image with preserved gamma. @item negative(rgb) -Inverts the all values on the colour curves +Reverse the colour curves on the encoding axis if @code{rgb} is @code{True}. @item negative(r, g, b) +Reverse the red, green and blue curves on the +encoding axis if @code{r}, @code{g} and @code{b} +are @code{True}, respectively. + +@item invert() +Inverts the all values on the colour curves. +This creates a negative image with inverted gamma. + +@item invert(rgb) +Inverts the all values on the colour curves +if @code{rgb} is @code{True}. + +@item invert(r, g, b) Inverts the all values on the red, green and blue curves if @code{r}, @code{g} and @code{b} are @code{True}, respectively. 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` |