summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-10 17:18:49 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-10 17:18:49 +0100
commit9f40107edaee5f2980ecd39eefc41cf3254d150b (patch)
tree1da6486dd37334ce798ed46e800ca9039b3d8131 /src
parentdocument functions (diff)
downloadblueshift-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 'src')
-rw-r--r--src/curve.py16
1 files changed, 16 insertions, 0 deletions
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