From 1c1b00991116242c499d2d36619efe099789ecd2 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 14 Feb 2014 18:56:49 +0100 Subject: whitespace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/colour.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/colour.py') diff --git a/src/colour.py b/src/colour.py index b71f325..ee61c59 100644 --- a/src/colour.py +++ b/src/colour.py @@ -25,6 +25,7 @@ def linear_to_standard(*colour): ''' return [12.92 * c if c <= 0.0031308 else (1 + 0.055) * c ** (1 / 2.4) - 0.055 for c in colour] + def standard_to_linear(*colour): ''' Convert [0, 1] sRGB to linear [0, 1] RGB @@ -34,6 +35,7 @@ def standard_to_linear(*colour): ''' return [c / 12.92 if c <= 0.04045 else ((c + 0.055) / (1 + 0.055)) ** 2.4 for c in colour] + def ciexyy_to_ciexyz(x, y, Y): ''' Convert CIE xyY to CIE XYZ @@ -45,6 +47,7 @@ def ciexyy_to_ciexyz(x, y, Y): ''' return [Y * x / y, Y, Y * (1 - x - y) / y] + def ciexyz_to_ciexyy(X, Y, Z): ''' Convert CIE XYZ to CIE xyY @@ -60,6 +63,7 @@ def ciexyz_to_ciexyy(X, Y, Z): x = X * y / Y return [x, y, Y] + def ciexyz_to_linear(X, Y, Z): ''' Convert CIE XYZ to [0, 1] linear RGB @@ -74,6 +78,7 @@ def ciexyz_to_linear(X, Y, Z): b = 0.0557 * X - 0.2040 * Y + 1.0570 * Z return [r, g, b] + def linear_to_ciexyz(r, g, b): ''' Convert [0, 1] linear RGB to CIE XYZ @@ -88,6 +93,7 @@ def linear_to_ciexyz(r, g, b): Z = 0.0193 * r + 0.1192 * g + 1.9502 * b return [X, Y, Z] + def srgb_to_ciexyy(r, g, b): ''' Convert [0, 1] sRGB to CIE xyY @@ -101,6 +107,7 @@ def srgb_to_ciexyy(r, g, b): (X, Y, Z) = linear_to_ciexyz(r, g, b) return ciexyz_to_ciexyy(X, Y, Z) + def ciexyy_to_srgb(x, y, Y): ''' Convert CIE xyY to [0, 1] sRGB -- cgit v1.2.3-70-g09d2