1.1 --- a/optimiser.py Fri Oct 09 22:16:49 2015 +0200
1.2 +++ b/optimiser.py Sat Oct 10 14:53:29 2015 +0200
1.3 @@ -47,13 +47,16 @@
1.4 return math.sqrt(pow(r1 - r2, 2) + pow(g1 - g2, 2) + pow(b1 - b2, 2))
1.5
1.6 def restore(srgb):
1.7 - return tuple(map(lambda x: int(x * 255.0), srgb))
1.8 + r, g, b = srgb
1.9 + return int(r * 255.0), int(g * 255.0), int(b * 255.0)
1.10
1.11 def scale(rgb):
1.12 - return tuple(map(lambda x: x / 255.0, rgb))
1.13 + r, g, b = rgb
1.14 + return r / 255.0, g / 255.0, b / 255.0
1.15
1.16 def invert(srgb):
1.17 - return tuple(map(lambda x: 1.0 - x, srgb))
1.18 + r, g, b = srgb
1.19 + return 1.0 - r, 1.0 - g, 1.0 - b
1.20
1.21 # Colour distribution functions.
1.22