summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-19 03:40:09 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-19 03:40:09 +0100
commitf059cb5902e7f98ef988aab040a85404692d99e4 (patch)
tree4c60f054d3fc35bf5e60c3a25a27438e7dda1736 /src
parentmove translate_to_integers and ramps_to_function to aux.py (diff)
downloadblueshift-f059cb5902e7f98ef988aab040a85404692d99e4.tar.gz
blueshift-f059cb5902e7f98ef988aab040a85404692d99e4.tar.bz2
blueshift-f059cb5902e7f98ef988aab040a85404692d99e4.tar.xz
split ramps_to_function into ramps_to_function and functionise
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src')
-rw-r--r--src/aux.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/aux.py b/src/aux.py
index ec94549..cc91ef7 100644
--- a/src/aux.py
+++ b/src/aux.py
@@ -46,11 +46,21 @@ def ramps_to_function(r, g, b):
r = [y / 65535 for y in r]
g = [y / 65535 for y in g]
b = [y / 65535 for y in b]
+ return functionise((r, g, b))
+
+
+def functionise(rgb):
+ '''
+ Convert a three colour curves to a function that applies those adjustments
+
+ @param rgb:(:float, :float, :float) The colour curves as [0, 1] values
+ @return :()→void Function to invoke to apply the curves that the parameters [r, g and b] represents
+ '''
def fcurve(R_curve, G_curve, B_curve):
for curve, cur in curves(R_curve, G_curve, B_curve):
for i in range(i_size):
y = int(curve[i] * (len(cur) - 1) + 0.5)
y = min(max(0, y), len(cur) - 1)
curve[i] = cur[y]
- return lambda : fcurve(r, g, b)
+ return lambda : fcurve(*rgb)