html2canvas-pro 2.4.5 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -13
- package/dist/html2canvas-pro.cjs +3058 -1607
- package/dist/html2canvas-pro.cjs.map +1 -1
- package/dist/html2canvas-pro.esm.js +3058 -1607
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +3055 -1604
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +5 -5
- package/dist/types/core/cache-storage.d.ts +4 -1
- package/dist/types/core/context.d.ts +10 -1
- package/dist/types/core/render-element.d.ts +11 -0
- package/dist/types/core/util.d.ts +6 -0
- package/dist/types/css/index.d.ts +77 -46
- package/dist/types/css/parse.d.ts +15 -0
- package/dist/types/css/property-descriptors/accent-color.d.ts +5 -0
- package/dist/types/css/property-descriptors/backdrop-filter.d.ts +9 -0
- package/dist/types/css/property-descriptors/background-blend-mode.d.ts +16 -16
- package/dist/types/css/property-descriptors/border-image-width.d.ts +36 -0
- package/dist/types/css/property-descriptors/clip-path.d.ts +16 -2
- package/dist/types/css/property-descriptors/isolation.d.ts +6 -0
- package/dist/types/css/property-descriptors/mask.d.ts +25 -0
- package/dist/types/css/property-descriptors/mix-blend-mode.d.ts +16 -16
- package/dist/types/css/property-descriptors/outline.d.ts +15 -0
- package/dist/types/css/property-descriptors/text-emphasis.d.ts +22 -0
- package/dist/types/css/property-descriptors/text-shadow.d.ts +1 -1
- package/dist/types/css/property-descriptors/webkit-box-reflect.d.ts +19 -0
- package/dist/types/css/property-descriptors/webkit-text-fill-color.d.ts +9 -0
- package/dist/types/css/syntax/token-constants.d.ts +1 -1
- package/dist/types/css/types/color-math.d.ts +7 -1
- package/dist/types/css/types/color-spaces/a98.d.ts +2 -1
- package/dist/types/css/types/color-spaces/p3.d.ts +5 -4
- package/dist/types/css/types/color-spaces/pro-photo.d.ts +5 -4
- package/dist/types/css/types/color-spaces/rec2020.d.ts +5 -4
- package/dist/types/css/types/color-spaces/srgb.d.ts +5 -4
- package/dist/types/css/types/color-utilities.d.ts +11 -11
- package/dist/types/css/types/color.d.ts +1 -0
- package/dist/types/css/types/functions/conic-gradient.d.ts +11 -0
- package/dist/types/css/types/functions/image-set.d.ts +11 -0
- package/dist/types/css/types/functions/repeating-radial-gradient.d.ts +8 -0
- package/dist/types/css/types/image.d.ts +15 -2
- package/dist/types/css/types/safe-eval.d.ts +0 -6
- package/dist/types/dom/copy-css-styles.d.ts +8 -0
- package/dist/types/dom/document-cloner.d.ts +3 -13
- package/dist/types/dom/iframe-mount.d.ts +37 -0
- package/dist/types/dom/pseudo-content.d.ts +33 -0
- package/dist/types/dom/replaced-elements/iframe-element-container.d.ts +2 -2
- package/dist/types/options.d.ts +8 -2
- package/dist/types/render/canvas/background-renderer.d.ts +19 -0
- package/dist/types/render/canvas/border-image-renderer.d.ts +50 -1
- package/dist/types/render/canvas/canvas-renderer.d.ts +21 -15
- package/dist/types/render/canvas/mask-renderer.d.ts +36 -0
- package/dist/types/render/canvas/text-clip-renderer.d.ts +36 -0
- package/dist/types/render/canvas/text-renderer.d.ts +22 -0
- package/dist/types/render/stacking-context.d.ts +4 -1
- package/package.json +39 -40
- package/dist/lib/config.js +0 -49
- package/dist/lib/core/abort-helper.js +0 -20
- package/dist/lib/core/background-parser.js +0 -41
- package/dist/lib/core/bitwise.js +0 -5
- package/dist/lib/core/cache-storage.js +0 -283
- package/dist/lib/core/config-assembler.js +0 -88
- package/dist/lib/core/constants.js +0 -25
- package/dist/lib/core/context.js +0 -19
- package/dist/lib/core/debugger.js +0 -27
- package/dist/lib/core/features.js +0 -190
- package/dist/lib/core/logger.js +0 -56
- package/dist/lib/core/lru-map.js +0 -66
- package/dist/lib/core/origin-checker.js +0 -53
- package/dist/lib/core/performance-monitor.js +0 -185
- package/dist/lib/core/render-element.js +0 -131
- package/dist/lib/core/util.js +0 -4
- package/dist/lib/core/validator.js +0 -500
- package/dist/lib/css/grouped/background-styles.js +0 -36
- package/dist/lib/css/grouped/border-styles.js +0 -75
- package/dist/lib/css/grouped/font-styles.js +0 -93
- package/dist/lib/css/grouped/layout-styles.js +0 -127
- package/dist/lib/css/index.js +0 -339
- package/dist/lib/css/layout/bounds.js +0 -52
- package/dist/lib/css/layout/text.js +0 -133
- package/dist/lib/css/property-descriptor.js +0 -2
- package/dist/lib/css/property-descriptors/background-blend-mode.js +0 -41
- package/dist/lib/css/property-descriptors/background-clip.js +0 -25
- package/dist/lib/css/property-descriptors/background-color.js +0 -10
- package/dist/lib/css/property-descriptors/background-image.js +0 -24
- package/dist/lib/css/property-descriptors/background-origin.js +0 -23
- package/dist/lib/css/property-descriptors/background-position.js +0 -19
- package/dist/lib/css/property-descriptors/background-repeat.js +0 -33
- package/dist/lib/css/property-descriptors/background-size.js +0 -23
- package/dist/lib/css/property-descriptors/border-color.js +0 -14
- package/dist/lib/css/property-descriptors/border-image-repeat.js +0 -42
- package/dist/lib/css/property-descriptors/border-image-slice.js +0 -45
- package/dist/lib/css/property-descriptors/border-image-source.js +0 -22
- package/dist/lib/css/property-descriptors/border-radius.js +0 -15
- package/dist/lib/css/property-descriptors/border-style.js +0 -26
- package/dist/lib/css/property-descriptors/border-width.js +0 -20
- package/dist/lib/css/property-descriptors/box-decoration-break.js +0 -18
- package/dist/lib/css/property-descriptors/box-shadow.js +0 -54
- package/dist/lib/css/property-descriptors/clip-path.js +0 -189
- package/dist/lib/css/property-descriptors/color.js +0 -10
- package/dist/lib/css/property-descriptors/content.js +0 -19
- package/dist/lib/css/property-descriptors/counter-increment.js +0 -35
- package/dist/lib/css/property-descriptors/counter-reset.js +0 -18
- package/dist/lib/css/property-descriptors/direction.js +0 -18
- package/dist/lib/css/property-descriptors/display.js +0 -81
- package/dist/lib/css/property-descriptors/duration.js +0 -14
- package/dist/lib/css/property-descriptors/filter.js +0 -86
- package/dist/lib/css/property-descriptors/float.js +0 -22
- package/dist/lib/css/property-descriptors/font-family.js +0 -47
- package/dist/lib/css/property-descriptors/font-size.js +0 -10
- package/dist/lib/css/property-descriptors/font-style.js +0 -20
- package/dist/lib/css/property-descriptors/font-variant-ligatures.js +0 -34
- package/dist/lib/css/property-descriptors/font-variant.js +0 -13
- package/dist/lib/css/property-descriptors/font-weight.js +0 -25
- package/dist/lib/css/property-descriptors/image-rendering.js +0 -33
- package/dist/lib/css/property-descriptors/letter-spacing.js +0 -21
- package/dist/lib/css/property-descriptors/line-break.js +0 -23
- package/dist/lib/css/property-descriptors/line-height.js +0 -24
- package/dist/lib/css/property-descriptors/list-style-image.js +0 -17
- package/dist/lib/css/property-descriptors/list-style-position.js +0 -18
- package/dist/lib/css/property-descriptors/list-style-type.js +0 -122
- package/dist/lib/css/property-descriptors/margin.js +0 -13
- package/dist/lib/css/property-descriptors/mix-blend-mode.js +0 -31
- package/dist/lib/css/property-descriptors/object-fit.js +0 -28
- package/dist/lib/css/property-descriptors/object-position.js +0 -42
- package/dist/lib/css/property-descriptors/opacity.js +0 -16
- package/dist/lib/css/property-descriptors/overflow-wrap.js +0 -18
- package/dist/lib/css/property-descriptors/overflow.js +0 -27
- package/dist/lib/css/property-descriptors/padding.js +0 -14
- package/dist/lib/css/property-descriptors/paint-order.js +0 -33
- package/dist/lib/css/property-descriptors/position.js +0 -22
- package/dist/lib/css/property-descriptors/quotes.js +0 -41
- package/dist/lib/css/property-descriptors/rotate.js +0 -27
- package/dist/lib/css/property-descriptors/text-align.js +0 -21
- package/dist/lib/css/property-descriptors/text-decoration-color.js +0 -10
- package/dist/lib/css/property-descriptors/text-decoration-line.js +0 -28
- package/dist/lib/css/property-descriptors/text-decoration-style.js +0 -24
- package/dist/lib/css/property-descriptors/text-decoration-thickness.js +0 -26
- package/dist/lib/css/property-descriptors/text-overflow.js +0 -18
- package/dist/lib/css/property-descriptors/text-shadow.js +0 -46
- package/dist/lib/css/property-descriptors/text-transform.js +0 -20
- package/dist/lib/css/property-descriptors/text-underline-offset.js +0 -23
- package/dist/lib/css/property-descriptors/transform-origin.js +0 -24
- package/dist/lib/css/property-descriptors/transform.js +0 -57
- package/dist/lib/css/property-descriptors/visibility.js +0 -20
- package/dist/lib/css/property-descriptors/webkit-line-clamp.js +0 -26
- package/dist/lib/css/property-descriptors/webkit-text-stroke-color.js +0 -10
- package/dist/lib/css/property-descriptors/webkit-text-stroke-width.js +0 -16
- package/dist/lib/css/property-descriptors/white-space.js +0 -32
- package/dist/lib/css/property-descriptors/word-break.js +0 -26
- package/dist/lib/css/property-descriptors/writing-mode.js +0 -28
- package/dist/lib/css/property-descriptors/z-index.js +0 -19
- package/dist/lib/css/property-descriptors/zoom.js +0 -18
- package/dist/lib/css/syntax/parser.js +0 -141
- package/dist/lib/css/syntax/token-constants.js +0 -214
- package/dist/lib/css/syntax/token-singletons.js +0 -36
- package/dist/lib/css/syntax/token-types.js +0 -10
- package/dist/lib/css/syntax/tokenizer.js +0 -502
- package/dist/lib/css/type-descriptor.js +0 -2
- package/dist/lib/css/types/angle.js +0 -80
- package/dist/lib/css/types/color-math.js +0 -25
- package/dist/lib/css/types/color-spaces/a98.js +0 -78
- package/dist/lib/css/types/color-spaces/p3.js +0 -86
- package/dist/lib/css/types/color-spaces/pro-photo.js +0 -83
- package/dist/lib/css/types/color-spaces/rec2020.js +0 -85
- package/dist/lib/css/types/color-spaces/srgb.js +0 -79
- package/dist/lib/css/types/color-utilities.js +0 -342
- package/dist/lib/css/types/color.js +0 -400
- package/dist/lib/css/types/functions/-prefix-linear-gradient.js +0 -32
- package/dist/lib/css/types/functions/-prefix-radial-gradient.js +0 -83
- package/dist/lib/css/types/functions/-webkit-gradient.js +0 -59
- package/dist/lib/css/types/functions/counter.js +0 -367
- package/dist/lib/css/types/functions/gradient.js +0 -163
- package/dist/lib/css/types/functions/linear-gradient.js +0 -27
- package/dist/lib/css/types/functions/radial-gradient.js +0 -90
- package/dist/lib/css/types/functions/repeating-linear-gradient.js +0 -9
- package/dist/lib/css/types/image.js +0 -62
- package/dist/lib/css/types/index.js +0 -2
- package/dist/lib/css/types/length-percentage.js +0 -197
- package/dist/lib/css/types/length.js +0 -5
- package/dist/lib/css/types/safe-eval.js +0 -80
- package/dist/lib/css/types/time.js +0 -17
- package/dist/lib/dom/document-cloner.js +0 -618
- package/dist/lib/dom/dom-normalizer.js +0 -115
- package/dist/lib/dom/element-container.js +0 -71
- package/dist/lib/dom/elements/li-element-container.js +0 -11
- package/dist/lib/dom/elements/ol-element-container.js +0 -12
- package/dist/lib/dom/elements/select-element-container.js +0 -12
- package/dist/lib/dom/elements/textarea-element-container.js +0 -11
- package/dist/lib/dom/node-parser.js +0 -125
- package/dist/lib/dom/node-type-guards.js +0 -81
- package/dist/lib/dom/replaced-elements/canvas-element-container.js +0 -13
- package/dist/lib/dom/replaced-elements/iframe-element-container.js +0 -38
- package/dist/lib/dom/replaced-elements/image-element-container.js +0 -14
- package/dist/lib/dom/replaced-elements/index.js +0 -2
- package/dist/lib/dom/replaced-elements/input-element-container.js +0 -89
- package/dist/lib/dom/replaced-elements/svg-element-container.js +0 -57
- package/dist/lib/dom/slot-cloner.js +0 -176
- package/dist/lib/dom/text-container.js +0 -35
- package/dist/lib/index.js +0 -49
- package/dist/lib/options.js +0 -2
- package/dist/lib/render/background.js +0 -188
- package/dist/lib/render/bezier-curve.js +0 -34
- package/dist/lib/render/border.js +0 -104
- package/dist/lib/render/bound-curves.js +0 -188
- package/dist/lib/render/box-sizing.js +0 -20
- package/dist/lib/render/canvas/background-renderer.js +0 -338
- package/dist/lib/render/canvas/border-image-renderer.js +0 -153
- package/dist/lib/render/canvas/border-renderer.js +0 -184
- package/dist/lib/render/canvas/box-shadow-geometry.js +0 -52
- package/dist/lib/render/canvas/box-shadow-painter.js +0 -194
- package/dist/lib/render/canvas/box-shadow-transform.js +0 -42
- package/dist/lib/render/canvas/canvas-path.js +0 -25
- package/dist/lib/render/canvas/canvas-renderer.js +0 -610
- package/dist/lib/render/canvas/content-renderer.js +0 -270
- package/dist/lib/render/canvas/effects-renderer.js +0 -171
- package/dist/lib/render/canvas/filter-surface.js +0 -270
- package/dist/lib/render/canvas/font-utils.js +0 -46
- package/dist/lib/render/canvas/foreignobject-renderer.js +0 -38
- package/dist/lib/render/canvas/surface-bounds.js +0 -64
- package/dist/lib/render/canvas/text/text-decoration-renderer.js +0 -99
- package/dist/lib/render/canvas/text-renderer.js +0 -486
- package/dist/lib/render/effects.js +0 -231
- package/dist/lib/render/font-metrics.js +0 -53
- package/dist/lib/render/object-fit.js +0 -91
- package/dist/lib/render/path.js +0 -26
- package/dist/lib/render/renderer-interface.js +0 -2
- package/dist/lib/render/stacking-context.js +0 -341
- package/dist/lib/render/vector.js +0 -16
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* A98-RGB related functions
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.convertA98rgb = exports.a98FromXYZ = exports.a98Linear2a98 = exports.a982a98Linear = exports.a98Linear2xyz = exports.xyz2a98Linear = void 0;
|
|
7
|
-
const color_utilities_1 = require("../color-utilities");
|
|
8
|
-
const srgb_1 = require("./srgb");
|
|
9
|
-
/**
|
|
10
|
-
* Convert XYZ to a98 linear
|
|
11
|
-
*
|
|
12
|
-
* @param xyz
|
|
13
|
-
*/
|
|
14
|
-
const xyz2a98Linear = (xyz) => {
|
|
15
|
-
return (0, color_utilities_1.multiplyMatrices)([
|
|
16
|
-
2.0415879038107465, -0.5650069742788596, -0.34473135077832956, -0.9692436362808795, 1.8759675015077202,
|
|
17
|
-
0.04155505740717557, 0.013444280632031142, -0.11836239223101838, 1.0151749943912054
|
|
18
|
-
], xyz);
|
|
19
|
-
};
|
|
20
|
-
exports.xyz2a98Linear = xyz2a98Linear;
|
|
21
|
-
/**
|
|
22
|
-
* Convert XYZ to a98 linear
|
|
23
|
-
*
|
|
24
|
-
* @param a98
|
|
25
|
-
*/
|
|
26
|
-
const a98Linear2xyz = (a98) => {
|
|
27
|
-
return (0, color_utilities_1.multiplyMatrices)([
|
|
28
|
-
0.5766690429101305, 0.1855582379065463, 0.1882286462349947, 0.29734497525053605, 0.6273635662554661,
|
|
29
|
-
0.0752914584939978, 0.02703136138641234, 0.07068885253582723, 0.9913375368376388
|
|
30
|
-
], a98);
|
|
31
|
-
};
|
|
32
|
-
exports.a98Linear2xyz = a98Linear2xyz;
|
|
33
|
-
/**
|
|
34
|
-
* Convert A98 RGB to rgb linear
|
|
35
|
-
*
|
|
36
|
-
* @param rgb
|
|
37
|
-
*/
|
|
38
|
-
const a982a98Linear = (rgb) => {
|
|
39
|
-
const mapped = rgb.map((c) => {
|
|
40
|
-
const sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
41
|
-
return sign * abs ** (563 / 256);
|
|
42
|
-
});
|
|
43
|
-
return [mapped[0], mapped[1], mapped[2]];
|
|
44
|
-
};
|
|
45
|
-
exports.a982a98Linear = a982a98Linear;
|
|
46
|
-
/**
|
|
47
|
-
* Convert A98 RGB Linear to A98
|
|
48
|
-
*
|
|
49
|
-
* @param rgb
|
|
50
|
-
*/
|
|
51
|
-
const a98Linear2a98 = (rgb) => {
|
|
52
|
-
const mapped = rgb.map((c) => {
|
|
53
|
-
const sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
54
|
-
return sign * abs ** (256 / 563);
|
|
55
|
-
});
|
|
56
|
-
return [mapped[0], mapped[1], mapped[2]];
|
|
57
|
-
};
|
|
58
|
-
exports.a98Linear2a98 = a98Linear2a98;
|
|
59
|
-
/**
|
|
60
|
-
* Convert XYZ to A98
|
|
61
|
-
*
|
|
62
|
-
* @param args
|
|
63
|
-
*/
|
|
64
|
-
const a98FromXYZ = (args) => {
|
|
65
|
-
const [r, g, b] = (0, exports.a98Linear2a98)((0, exports.xyz2a98Linear)([args[0], args[1], args[2]]));
|
|
66
|
-
return [r, g, b, args[3]];
|
|
67
|
-
};
|
|
68
|
-
exports.a98FromXYZ = a98FromXYZ;
|
|
69
|
-
/**
|
|
70
|
-
* Convert A98 to XYZ and Pack
|
|
71
|
-
*
|
|
72
|
-
* @param args
|
|
73
|
-
*/
|
|
74
|
-
const convertA98rgb = (args) => {
|
|
75
|
-
const srgb_linear = (0, srgb_1.xyz2rgbLinear)((0, exports.a98Linear2xyz)((0, exports.a982a98Linear)([args[0], args[1], args[2]])));
|
|
76
|
-
return (0, color_utilities_1.packSrgbLinear)([srgb_linear[0], srgb_linear[1], srgb_linear[2], args[3]]);
|
|
77
|
-
};
|
|
78
|
-
exports.convertA98rgb = convertA98rgb;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Display-P3 related functions
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.convertP3 = exports.p3FromXYZ = exports.p3ToXYZ = exports.p3Linear2p3 = exports.p32p3Linear = exports.xyzToP3Linear = exports.p3LinearToXyz = void 0;
|
|
7
|
-
const srgb_1 = require("./srgb");
|
|
8
|
-
const color_utilities_1 = require("../color-utilities");
|
|
9
|
-
/**
|
|
10
|
-
* Convert P3 Linear to xyz
|
|
11
|
-
*
|
|
12
|
-
* @param p3l
|
|
13
|
-
*/
|
|
14
|
-
const p3LinearToXyz = (p3l) => {
|
|
15
|
-
return (0, color_utilities_1.multiplyMatrices)([
|
|
16
|
-
0.4865709486482162, 0.26566769316909306, 0.1982172852343625, 0.2289745640697488, 0.6917385218365064,
|
|
17
|
-
0.079286914093745, 0.0, 0.04511338185890264, 1.043944368900976
|
|
18
|
-
], p3l);
|
|
19
|
-
};
|
|
20
|
-
exports.p3LinearToXyz = p3LinearToXyz;
|
|
21
|
-
/**
|
|
22
|
-
* Convert XYZ to P3 Linear
|
|
23
|
-
*
|
|
24
|
-
* @param xyz
|
|
25
|
-
*/
|
|
26
|
-
const xyzToP3Linear = (xyz) => {
|
|
27
|
-
return (0, color_utilities_1.multiplyMatrices)([
|
|
28
|
-
2.493496911941425, -0.9313836179191239, -0.40271078445071684, -0.8294889695615747, 1.7626640603183463,
|
|
29
|
-
0.023624685841943577, 0.03584583024378447, -0.07617238926804182, 0.9568845240076872
|
|
30
|
-
], xyz);
|
|
31
|
-
};
|
|
32
|
-
exports.xyzToP3Linear = xyzToP3Linear;
|
|
33
|
-
/**
|
|
34
|
-
* Convert P3 to P3 linear
|
|
35
|
-
*
|
|
36
|
-
* @param p3
|
|
37
|
-
*/
|
|
38
|
-
const p32p3Linear = (p3) => {
|
|
39
|
-
return p3.map((c) => {
|
|
40
|
-
const sign = c < 0 ? -1 : 1, abs = c * sign;
|
|
41
|
-
if (abs <= 0.04045) {
|
|
42
|
-
return c / 12.92;
|
|
43
|
-
}
|
|
44
|
-
return sign * ((c + 0.055) / 1.055) ** 2.4 || 0;
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
exports.p32p3Linear = p32p3Linear;
|
|
48
|
-
/**
|
|
49
|
-
* Convert P3 Linear to P3
|
|
50
|
-
*
|
|
51
|
-
* @param p3l
|
|
52
|
-
*/
|
|
53
|
-
const p3Linear2p3 = (p3l) => {
|
|
54
|
-
return (0, srgb_1.srgbLinear2rgb)(p3l);
|
|
55
|
-
};
|
|
56
|
-
exports.p3Linear2p3 = p3Linear2p3;
|
|
57
|
-
/**
|
|
58
|
-
* Convert P3 to XYZ
|
|
59
|
-
*
|
|
60
|
-
* @param args
|
|
61
|
-
*/
|
|
62
|
-
const p3ToXYZ = (args) => {
|
|
63
|
-
const p3_linear = (0, exports.p32p3Linear)([args[0], args[1], args[2]]);
|
|
64
|
-
return (0, exports.p3LinearToXyz)([p3_linear[0], p3_linear[1], p3_linear[2]]);
|
|
65
|
-
};
|
|
66
|
-
exports.p3ToXYZ = p3ToXYZ;
|
|
67
|
-
/**
|
|
68
|
-
* Convert XYZ to P3
|
|
69
|
-
*
|
|
70
|
-
* @param args
|
|
71
|
-
*/
|
|
72
|
-
const p3FromXYZ = (args) => {
|
|
73
|
-
const [r, g, b] = (0, exports.p3Linear2p3)((0, exports.xyzToP3Linear)([args[0], args[1], args[2]]));
|
|
74
|
-
return [r, g, b, args[3]];
|
|
75
|
-
};
|
|
76
|
-
exports.p3FromXYZ = p3FromXYZ;
|
|
77
|
-
/**
|
|
78
|
-
* Convert P3 to SRGB and Pack
|
|
79
|
-
*
|
|
80
|
-
* @param args
|
|
81
|
-
*/
|
|
82
|
-
const convertP3 = (args) => {
|
|
83
|
-
const xyz = (0, exports.p3ToXYZ)([args[0], args[1], args[2]]);
|
|
84
|
-
return (0, color_utilities_1.packXYZ)([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
85
|
-
};
|
|
86
|
-
exports.convertP3 = convertP3;
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Pro Photo related functions
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.convertProPhoto = exports.proPhotoFromXYZ = exports.proPhotoToXYZ = exports.proPhotoLinearToProPhoto = exports.proPhotoToProPhotoLinear = exports.xyzToProPhotoLinear = exports.proPhotoLinearToXyz = void 0;
|
|
7
|
-
const color_utilities_1 = require("../color-utilities");
|
|
8
|
-
/**
|
|
9
|
-
* Convert linear-light display-p3 to XYZ D65
|
|
10
|
-
*
|
|
11
|
-
* @param p3
|
|
12
|
-
*/
|
|
13
|
-
const proPhotoLinearToXyz = (p3) => {
|
|
14
|
-
return (0, color_utilities_1.multiplyMatrices)([
|
|
15
|
-
0.7977666449006423, 0.13518129740053308, 0.0313477341283922, 0.2880748288194013, 0.711835234241873,
|
|
16
|
-
0.00008993693872564, 0.0, 0.0, 0.8251046025104602
|
|
17
|
-
], p3);
|
|
18
|
-
};
|
|
19
|
-
exports.proPhotoLinearToXyz = proPhotoLinearToXyz;
|
|
20
|
-
/**
|
|
21
|
-
* Convert XYZ D65 to linear-light display-p3
|
|
22
|
-
*
|
|
23
|
-
* @param xyz
|
|
24
|
-
*/
|
|
25
|
-
const xyzToProPhotoLinear = (xyz) => {
|
|
26
|
-
return (0, color_utilities_1.multiplyMatrices)([
|
|
27
|
-
1.3457868816471583, -0.25557208737979464, -0.05110186497554526, -0.5446307051249019, 1.5082477428451468,
|
|
28
|
-
0.02052744743642139, 0.0, 0.0, 1.2119675456389452
|
|
29
|
-
], xyz);
|
|
30
|
-
};
|
|
31
|
-
exports.xyzToProPhotoLinear = xyzToProPhotoLinear;
|
|
32
|
-
/**
|
|
33
|
-
* Convert Pro-Photo to Pro-Photo Linear
|
|
34
|
-
*
|
|
35
|
-
* @param p3
|
|
36
|
-
*/
|
|
37
|
-
const proPhotoToProPhotoLinear = (p3) => {
|
|
38
|
-
return p3.map((c) => {
|
|
39
|
-
return c < 16 / 512 ? c / 16 : c ** 1.8;
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
exports.proPhotoToProPhotoLinear = proPhotoToProPhotoLinear;
|
|
43
|
-
/**
|
|
44
|
-
* Convert Pro-Photo Linear to Pro-Photo
|
|
45
|
-
*
|
|
46
|
-
* @param p3
|
|
47
|
-
*/
|
|
48
|
-
const proPhotoLinearToProPhoto = (p3) => {
|
|
49
|
-
return p3.map((c) => {
|
|
50
|
-
return c > 1 / 512 ? c ** (1 / 1.8) : c * 16;
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
exports.proPhotoLinearToProPhoto = proPhotoLinearToProPhoto;
|
|
54
|
-
/**
|
|
55
|
-
* Convert Pro-Photo to XYZ
|
|
56
|
-
*
|
|
57
|
-
* @param args
|
|
58
|
-
*/
|
|
59
|
-
const proPhotoToXYZ = (args) => {
|
|
60
|
-
const prophoto_linear = (0, exports.proPhotoToProPhotoLinear)([args[0], args[1], args[2]]);
|
|
61
|
-
return (0, color_utilities_1.d50toD65)((0, exports.proPhotoLinearToXyz)([prophoto_linear[0], prophoto_linear[1], prophoto_linear[2]]));
|
|
62
|
-
};
|
|
63
|
-
exports.proPhotoToXYZ = proPhotoToXYZ;
|
|
64
|
-
/**
|
|
65
|
-
* Convert XYZ to Pro-Photo
|
|
66
|
-
*
|
|
67
|
-
* @param args
|
|
68
|
-
*/
|
|
69
|
-
const proPhotoFromXYZ = (args) => {
|
|
70
|
-
const [r, g, b] = (0, exports.proPhotoLinearToProPhoto)((0, exports.xyzToProPhotoLinear)((0, color_utilities_1.d65toD50)([args[0], args[1], args[2]])));
|
|
71
|
-
return [r, g, b, args[3]];
|
|
72
|
-
};
|
|
73
|
-
exports.proPhotoFromXYZ = proPhotoFromXYZ;
|
|
74
|
-
/**
|
|
75
|
-
* Convert Pro-Photo to XYZ and Pack
|
|
76
|
-
*
|
|
77
|
-
* @param args
|
|
78
|
-
*/
|
|
79
|
-
const convertProPhoto = (args) => {
|
|
80
|
-
const xyz = (0, exports.proPhotoToXYZ)([args[0], args[1], args[2]]);
|
|
81
|
-
return (0, color_utilities_1.packXYZ)([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
82
|
-
};
|
|
83
|
-
exports.convertProPhoto = convertProPhoto;
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* REC2020 related functions
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.convertRec2020 = exports.rec2020FromXYZ = exports.rec2020ToXYZ = exports.xyzToRec2020Linear = exports.rec2020LinearToXyz = exports.rec2020Linear2rec2020 = exports.rec20202rec2020Linear = void 0;
|
|
7
|
-
const color_utilities_1 = require("../color-utilities");
|
|
8
|
-
const _a = 1.09929682680944;
|
|
9
|
-
const _b = 0.018053968510807;
|
|
10
|
-
/**
|
|
11
|
-
* Convert rec2020 to rec2020 linear
|
|
12
|
-
*
|
|
13
|
-
* @param rgb
|
|
14
|
-
*/
|
|
15
|
-
const rec20202rec2020Linear = (rgb) => {
|
|
16
|
-
return rgb.map(function (c) {
|
|
17
|
-
return c < _b * 4.5 ? c / 4.5 : Math.pow((c + _a - 1) / _a, 1 / 0.45);
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
exports.rec20202rec2020Linear = rec20202rec2020Linear;
|
|
21
|
-
/**
|
|
22
|
-
* Convert rec2020 linear to rec2020
|
|
23
|
-
*
|
|
24
|
-
* @param rgb
|
|
25
|
-
*/
|
|
26
|
-
const rec2020Linear2rec2020 = (rgb) => {
|
|
27
|
-
return rgb.map(function (c) {
|
|
28
|
-
return c >= _b ? _a * Math.pow(c, 0.45) - (_a - 1) : 4.5 * c;
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
exports.rec2020Linear2rec2020 = rec2020Linear2rec2020;
|
|
32
|
-
/**
|
|
33
|
-
* Convert rec2020 linear to XYZ D65
|
|
34
|
-
*
|
|
35
|
-
* @param rec
|
|
36
|
-
*/
|
|
37
|
-
const rec2020LinearToXyz = (rec) => {
|
|
38
|
-
return (0, color_utilities_1.multiplyMatrices)([
|
|
39
|
-
0.6369580483012914, 0.14461690358620832, 0.1688809751641721, 0.2627002120112671, 0.6779980715188708,
|
|
40
|
-
0.05930171646986196, 0.0, 0.028072693049087428, 1.060985057710791
|
|
41
|
-
], rec);
|
|
42
|
-
};
|
|
43
|
-
exports.rec2020LinearToXyz = rec2020LinearToXyz;
|
|
44
|
-
/**
|
|
45
|
-
* Convert XYZ D65 to rec2020 linear
|
|
46
|
-
*
|
|
47
|
-
* @param xyz
|
|
48
|
-
*/
|
|
49
|
-
const xyzToRec2020Linear = (xyz) => {
|
|
50
|
-
return (0, color_utilities_1.multiplyMatrices)([
|
|
51
|
-
1.716651187971268, -0.355670783776392, -0.25336628137366, -0.666684351832489, 1.616481236634939,
|
|
52
|
-
0.0157685458139111, 0.017639857445311, -0.042770613257809, 0.942103121235474
|
|
53
|
-
], xyz);
|
|
54
|
-
};
|
|
55
|
-
exports.xyzToRec2020Linear = xyzToRec2020Linear;
|
|
56
|
-
/**
|
|
57
|
-
* Convert Rec2020 to XYZ
|
|
58
|
-
*
|
|
59
|
-
* @param args
|
|
60
|
-
*/
|
|
61
|
-
const rec2020ToXYZ = (args) => {
|
|
62
|
-
const rec2020_linear = (0, exports.rec20202rec2020Linear)([args[0], args[1], args[2]]);
|
|
63
|
-
return (0, exports.rec2020LinearToXyz)([rec2020_linear[0], rec2020_linear[1], rec2020_linear[2]]);
|
|
64
|
-
};
|
|
65
|
-
exports.rec2020ToXYZ = rec2020ToXYZ;
|
|
66
|
-
/**
|
|
67
|
-
* Convert XYZ to Rec2020
|
|
68
|
-
*
|
|
69
|
-
* @param args
|
|
70
|
-
*/
|
|
71
|
-
const rec2020FromXYZ = (args) => {
|
|
72
|
-
const [r, g, b] = (0, exports.rec2020Linear2rec2020)((0, exports.xyzToRec2020Linear)([args[0], args[1], args[2]]));
|
|
73
|
-
return [r, g, b, args[3]];
|
|
74
|
-
};
|
|
75
|
-
exports.rec2020FromXYZ = rec2020FromXYZ;
|
|
76
|
-
/**
|
|
77
|
-
* Convert Rec2020 to SRGB and Pack
|
|
78
|
-
*
|
|
79
|
-
* @param args
|
|
80
|
-
*/
|
|
81
|
-
const convertRec2020 = (args) => {
|
|
82
|
-
const xyz = (0, exports.rec2020ToXYZ)([args[0], args[1], args[2]]);
|
|
83
|
-
return (0, color_utilities_1.packXYZ)([xyz[0], xyz[1], xyz[2], args[3]]);
|
|
84
|
-
};
|
|
85
|
-
exports.convertRec2020 = convertRec2020;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* SRGB related functions
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.srgbLinearFromXYZ = exports.srgbFromXYZ = exports.rgb2rgbLinear = exports.srgbLinear2rgb = exports.rgbLinear2xyz = exports.xyz2rgbLinear = void 0;
|
|
7
|
-
const color_math_1 = require("../color-math");
|
|
8
|
-
/**
|
|
9
|
-
* Convert XYZ to linear-light sRGB
|
|
10
|
-
*
|
|
11
|
-
* @param xyz
|
|
12
|
-
*/
|
|
13
|
-
const xyz2rgbLinear = (xyz) => {
|
|
14
|
-
return (0, color_math_1.multiplyMatrices)([
|
|
15
|
-
3.2409699419045226, -1.537383177570094, -0.4986107602930034, -0.9692436362808796, 1.8759675015077202,
|
|
16
|
-
0.04155505740717559, 0.05563007969699366, -0.20397695888897652, 1.0569715142428786
|
|
17
|
-
], xyz);
|
|
18
|
-
};
|
|
19
|
-
exports.xyz2rgbLinear = xyz2rgbLinear;
|
|
20
|
-
/**
|
|
21
|
-
* Convert XYZ to linear-light sRGB
|
|
22
|
-
*
|
|
23
|
-
* @param xyz
|
|
24
|
-
*/
|
|
25
|
-
const rgbLinear2xyz = (xyz) => {
|
|
26
|
-
return (0, color_math_1.multiplyMatrices)([
|
|
27
|
-
0.41239079926595934, 0.357584339383878, 0.1804807884018343, 0.21263900587151027, 0.715168678767756,
|
|
28
|
-
0.07219231536073371, 0.01933081871559182, 0.11919477979462598, 0.9505321522496607
|
|
29
|
-
], xyz);
|
|
30
|
-
};
|
|
31
|
-
exports.rgbLinear2xyz = rgbLinear2xyz;
|
|
32
|
-
/**
|
|
33
|
-
* Convert sRGB to RGB
|
|
34
|
-
*
|
|
35
|
-
* @param rgb
|
|
36
|
-
*/
|
|
37
|
-
const srgbLinear2rgb = (rgb) => {
|
|
38
|
-
return rgb.map((c) => {
|
|
39
|
-
const sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
40
|
-
return abs > 0.0031308 ? sign * (1.055 * abs ** (1 / 2.4) - 0.055) : 12.92 * c;
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
|
-
exports.srgbLinear2rgb = srgbLinear2rgb;
|
|
44
|
-
/**
|
|
45
|
-
* Convert RGB to sRGB
|
|
46
|
-
*
|
|
47
|
-
* @param rgb
|
|
48
|
-
*/
|
|
49
|
-
const rgb2rgbLinear = (rgb) => {
|
|
50
|
-
return rgb.map((c) => {
|
|
51
|
-
const sign = c < 0 ? -1 : 1, abs = Math.abs(c);
|
|
52
|
-
return abs <= 0.04045 ? c / 12.92 : sign * ((abs + 0.055) / 1.055) ** 2.4;
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
exports.rgb2rgbLinear = rgb2rgbLinear;
|
|
56
|
-
/**
|
|
57
|
-
* XYZ to SRGB
|
|
58
|
-
*
|
|
59
|
-
* @param args
|
|
60
|
-
*/
|
|
61
|
-
const srgbFromXYZ = (args) => {
|
|
62
|
-
const [r, g, b] = (0, exports.srgbLinear2rgb)((0, exports.xyz2rgbLinear)([args[0], args[1], args[2]]));
|
|
63
|
-
return [r, g, b, args[3]];
|
|
64
|
-
};
|
|
65
|
-
exports.srgbFromXYZ = srgbFromXYZ;
|
|
66
|
-
/**
|
|
67
|
-
* XYZ to SRGB-Linear
|
|
68
|
-
* @param args
|
|
69
|
-
*/
|
|
70
|
-
const srgbLinearFromXYZ = (args) => {
|
|
71
|
-
const [r, g, b] = (0, exports.xyz2rgbLinear)([args[0], args[1], args[2]]);
|
|
72
|
-
return [
|
|
73
|
-
(0, color_math_1.clamp)(Math.round(r * 255), 0, 255),
|
|
74
|
-
(0, color_math_1.clamp)(Math.round(g * 255), 0, 255),
|
|
75
|
-
(0, color_math_1.clamp)(Math.round(b * 255), 0, 255),
|
|
76
|
-
args[3]
|
|
77
|
-
];
|
|
78
|
-
};
|
|
79
|
-
exports.srgbLinearFromXYZ = srgbLinearFromXYZ;
|