@@ -3043,7 +3043,7 @@ Default Style Rules</h2>
30433043<em> This section is not normative.</em>
30443044
30453045<pre class="lang-javascript">
3046- <!-- imported 25 Feb 2019-->
3046+ <!-- imported 4 Mar 2019-->
30473047 // sRGB-related functions
30483048
30493049 function lin_sRGB(RGB) {
@@ -3143,16 +3143,26 @@ Default Style Rules</h2>
31433143 function lin_ProPhoto(RGB) {
31443144 // convert an array of ProPhotoRGB values in the range 0.0 - 1.0
31453145 // to linear light (un-companded) form.
3146+ // Transfer curve is gamma 1.0 with a small linear portion
31463147 return RGB.map(function (val) {
3147- return Math.pow(val, 1.8);
3148+ if (val < 0.031248) {
3149+ return val / 16;
3150+ }
3151+
3152+ return Math.pow(val, 1.8);
31483153 });
31493154 }
31503155
31513156 function gam_ProPhoto(RGB) {
31523157 // convert an array of linear-light ProPhotoRGB in the range 0.0-1.0
31533158 // to gamma corrected form
3159+ // Transfer curve is gamma 1.0 with a small linear portion
31543160 return RGB.map(function (val) {
3155- return Math.pow(val, 1/1.8);
3161+ if (val > 0.001953) {
3162+ return Math.pow(val, 1/1.8);
3163+ }
3164+
3165+ return 16 * val;
31563166 });
31573167 }
31583168
@@ -3172,9 +3182,9 @@ Default Style Rules</h2>
31723182 function XYZ_to_lin_ProPhoto(XYZ) {
31733183 // convert XYZ to linear-light ProPhotoRGB
31743184 var M = Math.matrix([
3175- [ 1.3457989731028281, -0.25558010007997534, -0.05110628506753401 ] ,
3176- [ -0.5446224939028347, 1.5082327413132781, 0.02053603239147973 ] ,
3177- [ 0.0, 0.0, 1.2119675456389454 ]
3185+ [ 1.3457989731028281, -0.25558010007997534, -0.05110628506753401 ] ,
3186+ [ -0.5446224939028347, 1.5082327413132781, 0.02053603239147973 ] ,
3187+ [ 0.0, 0.0, 1.2119675456389454 ]
31783188 ]);
31793189
31803190 return Math.multiply(M, XYZ).valueOf();
@@ -3186,7 +3196,7 @@ Default Style Rules</h2>
31863196 // convert an array of a98rgb values in the range 0.0 - 1.0
31873197 // to linear light (un-companded) form.
31883198 return RGB.map(function (val) {
3189- return Math.pow(val, 563/256);
3199+ return Math.pow(val, 563/256);
31903200 });
31913201 }
31923202
@@ -3204,7 +3214,7 @@ Default Style Rules</h2>
32043214 // http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
32053215 var M = Math.matrix([
32063216 [ 0.5766690429101305, 0.1855582379065463, 0.1882286462349947 ] ,
3207- [ 0.29734497525053605, 0.6273635662554661, 0.07529145849399788 ] ,
3217+ [ 0.29734497525053605, 0.6273635662554661, 0.07529145849399788 ] ,
32083218 [ 0.02703136138641234, 0.07068885253582723, 0.9913375368376388 ]
32093219 ]);
32103220
@@ -3215,8 +3225,8 @@ Default Style Rules</h2>
32153225 // convert XYZ to linear-light ProPhotoRGB
32163226 var M = Math.matrix([
32173227 [ 2.0415879038107465, -0.5650069742788596, -0.34473135077832956 ] ,
3218- [ -0.9692436362808795, 1.8759675015077202, 0.04155505740717557 ] ,
3219- [ 0.013444280632031142, -0.11836239223101838, 1.0151749943912054 ]
3228+ [ -0.9692436362808795, 1.8759675015077202, 0.04155505740717557 ] ,
3229+ [ 0.013444280632031142, -0.11836239223101838, 1.0151749943912054 ]
32203230 ]);
32213231
32223232 return Math.multiply(M, XYZ).valueOf();
0 commit comments