@@ -152,24 +152,24 @@ function gam_ProPhoto(RGB) {
152152}
153153
154154function lin_ProPhoto_to_XYZ ( rgb ) {
155- // convert an array of linear-light prophoto-rgb values to CIE XYZ
156- // using D50 (so no chromatic adaptation needed afterwards)
157- // http ://www.brucelindbloom. com/index.html?Eqn_RGB_XYZ_Matrix.html
155+ // convert an array of linear-light prophoto-rgb values to CIE D50 XYZ
156+ // matrix cannot be expressed in rational form, but is calculated to 64 bit accuracy
157+ // see https ://github. com/w3c/csswg-drafts/issues/7675
158158 var M = [
159- [ 0.7977604896723027 , 0.13518583717574031 , 0.0313493495815248 ] ,
160- [ 0.2880711282292934 , 0.7118432178101014 , 0.00008565396060525902 ] ,
161- [ 0.0 , 0.0 , 0.8251046025104601 ]
159+ [ 0.79776664490064230 , 0.13518129740053308 , 0.03134773412839220 ] ,
160+ [ 0.28807482881940130 , 0.71183523424187300 , 0.00008993693872564 ] ,
161+ [ 0.00000000000000000 , 0.00000000000000000 , 0.82510460251046020 ]
162162 ] ;
163163
164164 return multiplyMatrices ( M , rgb ) ;
165165}
166166
167167function XYZ_to_lin_ProPhoto ( XYZ ) {
168- // convert XYZ to linear-light prophoto-rgb
168+ // convert D50 XYZ to linear-light prophoto-rgb
169169 var M = [
170- [ 1.3457989731028281 , - 0.25558010007997534 , - 0.05110628506753401 ] ,
171- [ - 0.5446224939028347 , 1.5082327413132781 , 0.02053603239147973 ] ,
172- [ 0.0 , 0.0 , 1.2119675456389454 ]
170+ [ 1.34578688164715830 , - 0.25557208737979464 , - 0.05110186497554526 ] ,
171+ [ - 0.54463070512490190 , 1.50824774284514680 , 0.02052744743642139 ] ,
172+ [ 0.00000000000000000 , 0.00000000000000000 , 1.21196754563894520 ]
173173 ] ;
174174
175175 return multiplyMatrices ( M , XYZ ) ;
0 commit comments