summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/lisp-esque.conf5
-rw-r--r--info/blueshift.texinfo5
-rw-r--r--src/curve.py16
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