Fix RGB<->XYZ conversion master
authorMartin Lambers <marlam@marlam.de>
Tue, 3 Dec 2019 11:23:28 +0000 (12:23 +0100)
committerMartin Lambers <marlam@marlam.de>
Tue, 3 Dec 2019 11:23:28 +0000 (12:23 +0100)
colormap.cpp

index 4ec341f..c6c4757 100644 (file)
@@ -233,16 +233,16 @@ static triplet xyz_to_lab(triplet xyz)
 static triplet rgb_to_xyz(triplet rgb)
 {
     // values from http://terathon.com/blog/rgb-xyz-conversion-matrix-accuracy/
-    return 100.0f * vec3(
-            (0.412391f * rgb.r + 0.357584f * rgb.b + 0.180481f * rgb.b),
-            (0.212639f * rgb.r + 0.715169f * rgb.b + 0.072192f * rgb.b),
-            (0.019331f * rgb.r + 0.119195f * rgb.b + 0.950532f * rgb.b));
+    return 100.0f * triplet(
+            (0.412391f * rgb.r + 0.357584f * rgb.g + 0.180481f * rgb.b),
+            (0.212639f * rgb.r + 0.715169f * rgb.g + 0.072192f * rgb.b),
+            (0.019331f * rgb.r + 0.119195f * rgb.g + 0.950532f * rgb.b));
 }
 
 static triplet xyz_to_rgb(triplet xyz)
 {
     // values from http://terathon.com/blog/rgb-xyz-conversion-matrix-accuracy/
-    return 0.01f * vec3(
+    return 0.01f * triplet(
             (+3.240970f * xyz.x - 1.537383f * xyz.y - 0.498611f * xyz.z),
             (-0.969244f * xyz.x + 1.875968f * xyz.y + 0.041555f * xyz.z),
             (+0.055630f * xyz.x - 0.203977f * xyz.y + 1.056972f * xyz.z));