diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-03-10 17:18:49 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-03-10 17:18:49 +0100 |
commit | 9f40107edaee5f2980ecd39eefc41cf3254d150b (patch) | |
tree | 1da6486dd37334ce798ed46e800ca9039b3d8131 | |
parent | document functions (diff) | |
download | blueshift-9f40107edaee5f2980ecd39eefc41cf3254d150b.tar.gz blueshift-9f40107edaee5f2980ecd39eefc41cf3254d150b.tar.bz2 blueshift-9f40107edaee5f2980ecd39eefc41cf3254d150b.tar.xz |
add cie_manipulate
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | examples/lisp-esque.conf | 5 | ||||
-rw-r--r-- | info/blueshift.texinfo | 5 | ||||
-rw-r--r-- | src/curve.py | 16 |
3 files changed, 26 insertions, 0 deletions
diff --git a/examples/lisp-esque.conf b/examples/lisp-esque.conf index 8e1e383..dbf7a68 100644 --- a/examples/lisp-esque.conf +++ b/examples/lisp-esque.conf @@ -325,5 +325,10 @@ ; nil ; Do nothing on the second monitor ; ) ; (standardise yes no) + ; You can also use (manipulate) on the Y component of the CIE xyY + ; colour space: + ; (manipulate:cie 'lambda x : math.log(x + 1, 2)' + ; nil ; Do nothing on the second monitor + ; ) ) diff --git a/info/blueshift.texinfo b/info/blueshift.texinfo index 7b2c3fc..44cdea7 100644 --- a/info/blueshift.texinfo +++ b/info/blueshift.texinfo @@ -542,6 +542,11 @@ Applies the functions @code{r}, @code{g} and @code{b} : float @click{} float to red, green and blue colour curves, respectively. +@item cie_manipulate(f) +Applies the function @code{f} : float @click{} +float to Y component (illumination) colour curves +converted to CIE xyY. + @item temperature(temperature, algorithm) Applies the a blackbody colour temperature of @code{temperature}@footnote{Actually multiplied diff --git a/src/curve.py b/src/curve.py index 4ef52a4..cac2b53 100644 --- a/src/curve.py +++ b/src/curve.py @@ -473,6 +473,22 @@ def manipulate(r, g = None, b = None): curve[i] = f(curve[i]) +def cie_manipulate(f): + ''' + Manipulate the colour curves using a lambda function on the CIE xyY colour space + + @param f:(float)?→float Lambda function to manipulate the Y component, nothing is done if `f` is `None` + + The lambda functions thats a colour value and maps it to a new illumination value. + For example, if the value 0.5 is already mapped to 0.25, then if the function + maps 0.25 to 0.5, the value 0.5 will revert back to being mapped to 0.5. + ''' + if f is not None: + for i in range(i_size): + (x, y, Y) = srgb_to_ciexyy(r_curve[i], g_curve[i], b_curve[i]) + (r_curve[i], g_curve[i], b_curve[i]) = ciexyy_to_srgb(x, y, f(Y)) + + def lower_resolution(rx_colours = None, ry_colours = None, gx_colours = None, gy_colours = None, bx_colours = None, by_colours = None): ''' Emulates low colour resolution |