@@ -3043,7 +3043,7 @@ Default Style Rules</h2>
3043
3043
<em> This section is not normative.</em>
3044
3044
3045
3045
<pre class="lang-javascript">
3046
- <!-- imported 25 Feb 2019-->
3046
+ <!-- imported 4 Mar 2019-->
3047
3047
// sRGB-related functions
3048
3048
3049
3049
function lin_sRGB(RGB) {
@@ -3143,16 +3143,26 @@ Default Style Rules</h2>
3143
3143
function lin_ProPhoto(RGB) {
3144
3144
// convert an array of ProPhotoRGB values in the range 0.0 - 1.0
3145
3145
// to linear light (un-companded) form.
3146
+ // Transfer curve is gamma 1.0 with a small linear portion
3146
3147
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);
3148
3153
});
3149
3154
}
3150
3155
3151
3156
function gam_ProPhoto(RGB) {
3152
3157
// convert an array of linear-light ProPhotoRGB in the range 0.0-1.0
3153
3158
// to gamma corrected form
3159
+ // Transfer curve is gamma 1.0 with a small linear portion
3154
3160
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;
3156
3166
});
3157
3167
}
3158
3168
@@ -3172,9 +3182,9 @@ Default Style Rules</h2>
3172
3182
function XYZ_to_lin_ProPhoto(XYZ) {
3173
3183
// convert XYZ to linear-light ProPhotoRGB
3174
3184
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 ]
3178
3188
]);
3179
3189
3180
3190
return Math.multiply(M, XYZ).valueOf();
@@ -3186,7 +3196,7 @@ Default Style Rules</h2>
3186
3196
// convert an array of a98rgb values in the range 0.0 - 1.0
3187
3197
// to linear light (un-companded) form.
3188
3198
return RGB.map(function (val) {
3189
- return Math.pow(val, 563/256);
3199
+ return Math.pow(val, 563/256);
3190
3200
});
3191
3201
}
3192
3202
@@ -3204,7 +3214,7 @@ Default Style Rules</h2>
3204
3214
// http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
3205
3215
var M = Math.matrix([
3206
3216
[ 0.5766690429101305, 0.1855582379065463, 0.1882286462349947 ] ,
3207
- [ 0.29734497525053605, 0.6273635662554661, 0.07529145849399788 ] ,
3217
+ [ 0.29734497525053605, 0.6273635662554661, 0.07529145849399788 ] ,
3208
3218
[ 0.02703136138641234, 0.07068885253582723, 0.9913375368376388 ]
3209
3219
]);
3210
3220
@@ -3215,8 +3225,8 @@ Default Style Rules</h2>
3215
3225
// convert XYZ to linear-light ProPhotoRGB
3216
3226
var M = Math.matrix([
3217
3227
[ 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 ]
3220
3230
]);
3221
3231
3222
3232
return Math.multiply(M, XYZ).valueOf();
0 commit comments