summaryrefslogtreecommitdiffstats
path: root/src/monitor.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-03-19 03:37:29 +0100
committerMattias Andrée <maandree@operamail.com>2014-03-19 03:37:29 +0100
commit0806af8ce7e47652adaecb08b52cbfe59d1c5f16 (patch)
tree2ce63d0ba1c64e46c49763871451ccd77daaa72e /src/monitor.py
parentadd modes example (diff)
downloadblueshift-0806af8ce7e47652adaecb08b52cbfe59d1c5f16.tar.gz
blueshift-0806af8ce7e47652adaecb08b52cbfe59d1c5f16.tar.bz2
blueshift-0806af8ce7e47652adaecb08b52cbfe59d1c5f16.tar.xz
move translate_to_integers and ramps_to_function to aux.py
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/monitor.py')
-rw-r--r--src/monitor.py38
1 files changed, 1 insertions, 37 deletions
diff --git a/src/monitor.py b/src/monitor.py
index 90ae603..499864f 100644
--- a/src/monitor.py
+++ b/src/monitor.py
@@ -18,6 +18,7 @@
import sys
from subprocess import Popen, PIPE
+from aux import *
from curve import *
# /usr/lib
@@ -36,22 +37,6 @@ except:
pass ## Not compiled with DRM support
-def translate_to_integers():
- '''
- Translate the curves from float to integer
-
- @param :(list<int>, list<int>, list<int>) The red curve, the green curve and,
- the blue curve mapped to integers
- '''
- R_curve, G_curve, B_curve = [0] * i_size, [0] * i_size, [0] * i_size
- for i_curve, o_curve in ((r_curve, R_curve), (g_curve, G_curve), (b_curve, B_curve)):
- for i in range(i_size):
- o_curve[i] = int(i_curve[i] * (o_size - 1) + 0.5)
- if clip_result:
- o_curve[i] = min(max(0, o_curve[i]), (o_size - 1))
- return (R_curve, G_curve, B_curve)
-
-
def close_c_bindings():
'''
Close all C bindings and let them free resources and close connections
@@ -68,27 +53,6 @@ def close_c_bindings():
drm_manager.close()
-def ramps_to_function(r, g, b):
- '''
- Convert a three colour curves to a function that applies those adjustments
-
- @param r:int The red colour curves as [0, 65535] integers
- @param g:int The green colour curves as [0, 65535] integers
- @param b:int The blue colour curves as [0, 65535] integers
- @return :()→void Function to invoke to apply the curves that the parameters [r, g and b] represents
- '''
- r = [y / 65535 for y in r]
- g = [y / 65535 for y in g]
- b = [y / 65535 for y in b]
- 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)
-
-
def randr_get(crtc = 0, screen = 0):
'''
Gets the current colour curves using the X11 extension RandR