diff options
-rw-r--r-- | src/curve.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/curve.py b/src/curve.py index c88b02d..c98f454 100644 --- a/src/curve.py +++ b/src/curve.py @@ -455,6 +455,24 @@ def manipulate(r, g = None, b = None): curve[i] = f(curve[i]) +# TODO document this elsewhere, and make it possible to have non-round x_colours +def lower_resolution(x_colours, y_colours): + ''' + Emulates low colour resolution + + @param x_colours:int The number of colours to emulate on the encoding axis + @param y_colours:int The number of colours to emulate on the output axis + ''' + x_r = i_size / x_colours + y_r = o_size / y_colours + for curve in (r_curve, g_curve, b_curve): + for i in range(i_size): + x = int(x_r * int(i / x_r)) + y = curve[x] * 2 ** 16 + y = int(y_r * int(y / y_r)) + curve[i] = y / 2 ** 16 + + def start_over(): ''' Reverts all colours curves to identity mappings. |