pdfjs-dist 2.2.228 → 2.6.347
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.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/README.md +4 -0
- package/bower.json +1 -1
- package/build/pdf.js +8816 -19300
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +22 -1
- package/build/pdf.worker.entry.js +5 -3
- package/build/pdf.worker.js +27185 -35746
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +22 -1
- package/es5/build/pdf.js +26665 -0
- package/es5/build/pdf.js.map +1 -0
- package/es5/build/pdf.min.js +22 -0
- package/{lib/shared/global_scope.js → es5/build/pdf.worker.entry.js} +5 -10
- package/es5/build/pdf.worker.js +61231 -0
- package/es5/build/pdf.worker.js.map +1 -0
- package/es5/build/pdf.worker.min.js +22 -0
- package/es5/image_decoders/pdf.image_decoders.js +12529 -0
- package/es5/image_decoders/pdf.image_decoders.js.map +1 -0
- package/es5/image_decoders/pdf.image_decoders.min.js +22 -0
- package/es5/web/images/annotation-check.svg +11 -0
- package/es5/web/images/annotation-comment.svg +16 -0
- package/es5/web/images/annotation-help.svg +26 -0
- package/es5/web/images/annotation-insert.svg +10 -0
- package/es5/web/images/annotation-key.svg +11 -0
- package/es5/web/images/annotation-newparagraph.svg +11 -0
- package/es5/web/images/annotation-noicon.svg +7 -0
- package/es5/web/images/annotation-note.svg +42 -0
- package/es5/web/images/annotation-paragraph.svg +16 -0
- package/es5/web/images/loading-icon.gif +0 -0
- package/es5/web/images/shadow.png +0 -0
- package/es5/web/pdf_viewer.css +406 -0
- package/es5/web/pdf_viewer.js +7886 -0
- package/es5/web/pdf_viewer.js.map +1 -0
- package/image_decoders/pdf.image_decoders.js +1498 -4832
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +22 -1
- package/lib/README.md +7 -0
- package/lib/core/annotation.js +1144 -927
- package/lib/core/arithmetic_decoder.js +81 -97
- package/lib/core/bidi.js +54 -46
- package/lib/core/ccitt.js +88 -81
- package/lib/core/ccitt_stream.js +15 -14
- package/lib/core/cff_parser.js +747 -716
- package/lib/core/charsets.js +4 -4
- package/lib/core/chunked_stream.js +462 -553
- package/lib/core/cmap.js +231 -277
- package/lib/core/colorspace.js +715 -857
- package/lib/core/core_utils.js +57 -52
- package/lib/core/crypto.js +416 -437
- package/lib/core/document.js +629 -670
- package/lib/core/encodings.js +15 -15
- package/lib/core/evaluator.js +3229 -2800
- package/lib/core/font_renderer.js +135 -178
- package/lib/core/fonts.js +602 -534
- package/lib/core/function.js +355 -279
- package/lib/core/glyphlist.js +4527 -4526
- package/lib/core/image.js +442 -439
- package/lib/core/image_utils.js +221 -61
- package/lib/core/jbig2.js +325 -316
- package/lib/core/jbig2_stream.js +18 -17
- package/lib/core/jpeg_stream.js +21 -26
- package/lib/core/jpg.js +289 -233
- package/lib/core/jpx.js +161 -143
- package/lib/core/jpx_stream.js +28 -28
- package/lib/core/metrics.js +2928 -2928
- package/lib/core/murmurhash3.js +87 -102
- package/lib/core/obj.js +1343 -1300
- package/lib/core/operator_list.js +90 -67
- package/lib/core/parser.js +990 -987
- package/lib/core/pattern.js +105 -77
- package/lib/core/pdf_manager.js +149 -316
- package/lib/core/primitives.js +156 -104
- package/lib/core/ps_parser.js +175 -214
- package/lib/core/standard_fonts.js +237 -236
- package/lib/core/stream.js +94 -74
- package/lib/core/type1_parser.js +89 -69
- package/lib/core/unicode.js +1654 -1654
- package/lib/core/worker.js +275 -290
- package/lib/core/worker_stream.js +101 -210
- package/lib/core/writer.js +242 -0
- package/lib/display/annotation_layer.js +772 -1041
- package/lib/display/annotation_storage.js +89 -0
- package/lib/display/api.js +1575 -1868
- package/lib/display/api_compatibility.js +12 -17
- package/lib/display/canvas.js +370 -222
- package/lib/display/content_disposition.js +40 -59
- package/lib/display/display_utils.js +341 -536
- package/lib/display/fetch_stream.js +188 -304
- package/lib/display/font_loader.js +282 -414
- package/lib/display/metadata.js +81 -99
- package/lib/display/network.js +362 -511
- package/lib/display/network_utils.js +25 -18
- package/lib/display/node_stream.js +283 -465
- package/lib/display/node_utils.js +87 -0
- package/lib/display/optional_content_config.js +184 -0
- package/lib/display/pattern_helper.js +93 -44
- package/lib/display/svg.js +1163 -1401
- package/lib/display/text_layer.js +154 -137
- package/lib/display/transport_stream.js +237 -375
- package/lib/display/webgl.js +70 -83
- package/lib/display/worker_options.js +3 -3
- package/lib/display/xml_parser.js +303 -392
- package/lib/examples/node/domstubs.js +37 -37
- package/lib/pdf.js +220 -58
- package/lib/pdf.worker.js +14 -6
- package/lib/shared/compatibility.js +3 -246
- package/lib/shared/is_node.js +7 -6
- package/lib/shared/message_handler.js +327 -332
- package/lib/shared/util.js +271 -306
- package/lib/test/unit/annotation_spec.js +1902 -763
- package/lib/test/unit/annotation_storage_spec.js +83 -0
- package/lib/test/unit/api_spec.js +790 -592
- package/lib/test/unit/bidi_spec.js +7 -7
- package/lib/test/unit/cff_parser_spec.js +73 -72
- package/lib/test/unit/clitests_helper.js +7 -9
- package/lib/test/unit/cmap_spec.js +86 -88
- package/lib/test/unit/colorspace_spec.js +346 -154
- package/lib/test/unit/core_utils_spec.js +125 -105
- package/lib/test/unit/crypto_spec.js +232 -185
- package/lib/test/unit/custom_spec.js +150 -24
- package/lib/test/unit/display_svg_spec.js +34 -39
- package/lib/test/unit/display_utils_spec.js +139 -149
- package/lib/test/unit/document_spec.js +128 -17
- package/lib/test/unit/encodings_spec.js +12 -34
- package/lib/test/unit/evaluator_spec.js +112 -91
- package/lib/test/unit/fetch_stream_spec.js +31 -29
- package/lib/test/unit/function_spec.js +206 -204
- package/lib/test/unit/jasmine-boot.js +48 -32
- package/lib/test/unit/message_handler_spec.js +173 -159
- package/lib/test/unit/metadata_spec.js +71 -71
- package/lib/test/unit/murmurhash3_spec.js +12 -12
- package/lib/test/unit/network_spec.js +13 -11
- package/lib/test/unit/network_utils_spec.js +158 -144
- package/lib/test/unit/node_stream_spec.js +76 -90
- package/lib/test/unit/parser_spec.js +108 -114
- package/lib/test/unit/pdf_find_controller_spec.js +55 -86
- package/lib/test/unit/pdf_find_utils_spec.js +32 -32
- package/lib/test/unit/pdf_history_spec.js +32 -32
- package/lib/test/unit/primitives_spec.js +337 -156
- package/lib/test/unit/stream_spec.js +16 -14
- package/lib/test/unit/test_utils.js +91 -304
- package/lib/test/unit/testreporter.js +33 -22
- package/lib/test/unit/type1_parser_spec.js +42 -42
- package/lib/test/unit/ui_utils_spec.js +299 -461
- package/lib/test/unit/unicode_spec.js +42 -42
- package/lib/test/unit/util_spec.js +129 -149
- package/lib/test/unit/writer_spec.js +84 -0
- package/lib/web/annotation_layer_builder.js +78 -111
- package/lib/web/app.js +1542 -1267
- package/lib/web/app_options.js +76 -91
- package/lib/web/base_tree_viewer.js +100 -0
- package/lib/web/base_viewer.js +869 -834
- package/lib/web/chromecom.js +165 -252
- package/lib/web/debugger.js +149 -205
- package/lib/web/download_manager.js +34 -58
- package/lib/web/firefox_print_service.js +62 -34
- package/lib/web/firefoxcom.js +206 -374
- package/lib/web/genericcom.js +26 -108
- package/lib/web/genericl10n.js +24 -153
- package/lib/web/grab_to_pan.js +30 -30
- package/lib/web/interfaces.js +80 -254
- package/lib/web/overlay_manager.js +70 -246
- package/lib/web/password_prompt.js +38 -64
- package/lib/web/pdf_attachment_viewer.js +150 -126
- package/lib/web/pdf_cursor_tools.js +75 -102
- package/lib/web/pdf_document_properties.js +229 -383
- package/lib/web/pdf_find_bar.js +136 -170
- package/lib/web/pdf_find_controller.js +492 -548
- package/lib/web/pdf_find_utils.js +13 -13
- package/lib/web/pdf_history.js +397 -406
- package/lib/web/pdf_layer_viewer.js +208 -0
- package/lib/web/pdf_link_service.js +304 -348
- package/lib/web/pdf_outline_viewer.js +119 -212
- package/lib/web/pdf_page_view.js +474 -513
- package/lib/web/pdf_presentation_mode.js +308 -357
- package/lib/web/pdf_print_service.js +96 -110
- package/lib/web/pdf_rendering_queue.js +87 -108
- package/lib/web/pdf_sidebar.js +286 -302
- package/lib/web/pdf_sidebar_resizer.js +92 -119
- package/lib/web/pdf_single_page_viewer.js +77 -126
- package/lib/web/pdf_thumbnail_view.js +289 -297
- package/lib/web/pdf_thumbnail_viewer.js +202 -206
- package/lib/web/pdf_viewer.component.js +20 -21
- package/lib/web/pdf_viewer.js +55 -115
- package/lib/web/preferences.js +69 -273
- package/lib/web/secondary_toolbar.js +164 -196
- package/lib/web/text_layer_builder.js +284 -319
- package/lib/web/toolbar.js +217 -210
- package/lib/web/ui_utils.js +274 -421
- package/lib/web/view_history.js +52 -226
- package/lib/web/viewer_compatibility.js +21 -6
- package/package.json +4 -9
- package/types/display/annotation_layer.d.ts +61 -0
- package/types/display/annotation_storage.d.ts +36 -0
- package/types/display/api.d.ts +1107 -0
- package/types/display/api_compatibility.d.ts +1 -0
- package/types/display/canvas.d.ts +4 -0
- package/types/display/content_disposition.d.ts +7 -0
- package/types/display/display_utils.d.ts +243 -0
- package/types/display/fetch_stream.d.ts +67 -0
- package/types/display/font_loader.d.ts +19 -0
- package/types/display/metadata.d.ts +9 -0
- package/types/display/network.d.ts +80 -0
- package/types/display/network_utils.d.ts +14 -0
- package/types/display/node_stream.d.ts +72 -0
- package/types/display/node_utils.d.ts +6 -0
- package/types/display/optional_content_config.d.ts +12 -0
- package/types/display/pattern_helper.d.ts +5 -0
- package/types/display/svg.d.ts +2 -0
- package/types/display/text_layer.d.ts +83 -0
- package/types/display/transport_stream.d.ts +57 -0
- package/types/display/webgl.d.ts +20 -0
- package/types/display/worker_options.d.ts +27 -0
- package/types/display/xml_parser.d.ts +35 -0
- package/types/pdf.d.ts +33 -0
- package/types/shared/compatibility.d.ts +1 -0
- package/types/shared/is_node.d.ts +1 -0
- package/types/shared/message_handler.d.ts +62 -0
- package/types/shared/util.d.ts +421 -0
- package/web/images/shadow.png +0 -0
- package/web/pdf_viewer.css +29 -27
- package/web/pdf_viewer.js +3524 -4746
- package/web/pdf_viewer.js.map +1 -1
- package/webpack.js +6 -5
- package/external/streams/streams-lib.js +0 -3962
- package/external/url/url-lib.js +0 -627
- package/lib/shared/streams_polyfill.js +0 -43
- package/lib/shared/url_polyfill.js +0 -56
- package/web/images/texture.png +0 -0
package/lib/core/colorspace.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* @licstart The following is the entire license notice for the
|
3
3
|
* Javascript code in this page
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2020 Mozilla Foundation
|
6
6
|
*
|
7
7
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
* you may not use this file except in compliance with the License.
|
@@ -26,46 +26,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
26
26
|
});
|
27
27
|
exports.ColorSpace = void 0;
|
28
28
|
|
29
|
-
var _util = require("../shared/util");
|
29
|
+
var _util = require("../shared/util.js");
|
30
30
|
|
31
|
-
var _primitives = require("./primitives");
|
31
|
+
var _primitives = require("./primitives.js");
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
36
|
-
|
37
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
38
|
-
|
39
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
40
|
-
|
41
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
42
|
-
|
43
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
44
|
-
|
45
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
46
|
-
|
47
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
48
|
-
|
49
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
33
|
+
var _core_utils = require("./core_utils.js");
|
50
34
|
|
51
35
|
function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
|
52
|
-
|
36
|
+
const COMPONENTS = 3;
|
53
37
|
alpha01 = alpha01 !== 1 ? 0 : alpha01;
|
54
|
-
|
55
|
-
|
56
|
-
|
38
|
+
const xRatio = w1 / w2;
|
39
|
+
const yRatio = h1 / h2;
|
40
|
+
let newIndex = 0,
|
57
41
|
oldIndex;
|
58
|
-
|
59
|
-
|
42
|
+
const xScaled = new Uint16Array(w2);
|
43
|
+
const w1Scanline = w1 * COMPONENTS;
|
60
44
|
|
61
|
-
for (
|
45
|
+
for (let i = 0; i < w2; i++) {
|
62
46
|
xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
|
63
47
|
}
|
64
48
|
|
65
|
-
for (
|
66
|
-
|
49
|
+
for (let i = 0; i < h2; i++) {
|
50
|
+
const py = Math.floor(i * yRatio) * w1Scanline;
|
67
51
|
|
68
|
-
for (
|
52
|
+
for (let j = 0; j < w2; j++) {
|
69
53
|
oldIndex = py + xScaled[j];
|
70
54
|
dest[newIndex++] = src[oldIndex++];
|
71
55
|
dest[newIndex++] = src[oldIndex++];
|
@@ -75,806 +59,700 @@ function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
|
|
75
59
|
}
|
76
60
|
}
|
77
61
|
|
78
|
-
|
79
|
-
|
80
|
-
function () {
|
81
|
-
function ColorSpace(name, numComps) {
|
82
|
-
_classCallCheck(this, ColorSpace);
|
83
|
-
|
62
|
+
class ColorSpace {
|
63
|
+
constructor(name, numComps) {
|
84
64
|
if (this.constructor === ColorSpace) {
|
85
|
-
(0, _util.unreachable)(
|
65
|
+
(0, _util.unreachable)("Cannot initialize ColorSpace.");
|
86
66
|
}
|
87
67
|
|
88
68
|
this.name = name;
|
89
69
|
this.numComps = numComps;
|
90
70
|
}
|
91
71
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
72
|
+
getRgb(src, srcOffset) {
|
73
|
+
const rgb = new Uint8ClampedArray(3);
|
74
|
+
this.getRgbItem(src, srcOffset, rgb, 0);
|
75
|
+
return rgb;
|
76
|
+
}
|
77
|
+
|
78
|
+
getRgbItem(src, srcOffset, dest, destOffset) {
|
79
|
+
(0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
|
80
|
+
}
|
81
|
+
|
82
|
+
getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
83
|
+
(0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
|
84
|
+
}
|
85
|
+
|
86
|
+
getOutputLength(inputLength, alpha01) {
|
87
|
+
(0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
|
88
|
+
}
|
89
|
+
|
90
|
+
isPassthrough(bits) {
|
91
|
+
return false;
|
92
|
+
}
|
93
|
+
|
94
|
+
isDefaultDecode(decodeMap, bpc) {
|
95
|
+
return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
|
96
|
+
}
|
97
|
+
|
98
|
+
fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
|
99
|
+
const count = originalWidth * originalHeight;
|
100
|
+
let rgbBuf = null;
|
101
|
+
const numComponentColors = 1 << bpc;
|
102
|
+
const needsResizing = originalHeight !== height || originalWidth !== width;
|
103
|
+
|
104
|
+
if (this.isPassthrough(bpc)) {
|
105
|
+
rgbBuf = comps;
|
106
|
+
} else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
|
107
|
+
const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
|
108
|
+
|
109
|
+
for (let i = 0; i < numComponentColors; i++) {
|
110
|
+
allColors[i] = i;
|
111
|
+
}
|
112
|
+
|
113
|
+
const colorMap = new Uint8ClampedArray(numComponentColors * 3);
|
114
|
+
this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
|
115
|
+
|
116
|
+
if (!needsResizing) {
|
117
|
+
let destPos = 0;
|
118
|
+
|
119
|
+
for (let i = 0; i < count; ++i) {
|
120
|
+
const key = comps[i] * 3;
|
121
|
+
dest[destPos++] = colorMap[key];
|
122
|
+
dest[destPos++] = colorMap[key + 1];
|
123
|
+
dest[destPos++] = colorMap[key + 2];
|
124
|
+
destPos += alpha01;
|
125
|
+
}
|
126
|
+
} else {
|
127
|
+
rgbBuf = new Uint8Array(count * 3);
|
128
|
+
let rgbPos = 0;
|
129
|
+
|
130
|
+
for (let i = 0; i < count; ++i) {
|
131
|
+
const key = comps[i] * 3;
|
132
|
+
rgbBuf[rgbPos++] = colorMap[key];
|
133
|
+
rgbBuf[rgbPos++] = colorMap[key + 1];
|
134
|
+
rgbBuf[rgbPos++] = colorMap[key + 2];
|
135
|
+
}
|
136
|
+
}
|
137
|
+
} else {
|
138
|
+
if (!needsResizing) {
|
139
|
+
this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
|
140
|
+
} else {
|
141
|
+
rgbBuf = new Uint8ClampedArray(count * 3);
|
142
|
+
this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
|
143
|
+
}
|
103
144
|
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
145
|
+
|
146
|
+
if (rgbBuf) {
|
147
|
+
if (needsResizing) {
|
148
|
+
resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
|
149
|
+
} else {
|
150
|
+
let destPos = 0,
|
151
|
+
rgbPos = 0;
|
152
|
+
|
153
|
+
for (let i = 0, ii = width * actualHeight; i < ii; i++) {
|
154
|
+
dest[destPos++] = rgbBuf[rgbPos++];
|
155
|
+
dest[destPos++] = rgbBuf[rgbPos++];
|
156
|
+
dest[destPos++] = rgbBuf[rgbPos++];
|
157
|
+
destPos += alpha01;
|
158
|
+
}
|
159
|
+
}
|
108
160
|
}
|
109
|
-
}
|
110
|
-
|
111
|
-
|
112
|
-
|
161
|
+
}
|
162
|
+
|
163
|
+
get usesZeroToOneRange() {
|
164
|
+
return (0, _util.shadow)(this, "usesZeroToOneRange", true);
|
165
|
+
}
|
166
|
+
|
167
|
+
static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
|
168
|
+
if (!localColorSpaceCache) {
|
169
|
+
throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
|
113
170
|
}
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
return false;
|
171
|
+
|
172
|
+
if (!parsedColorSpace) {
|
173
|
+
throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
|
118
174
|
}
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
175
|
+
|
176
|
+
let csName, csRef;
|
177
|
+
|
178
|
+
if (cacheKey instanceof _primitives.Ref) {
|
179
|
+
csRef = cacheKey;
|
180
|
+
cacheKey = xref.fetch(cacheKey);
|
123
181
|
}
|
124
|
-
}, {
|
125
|
-
key: "fillRgb",
|
126
|
-
value: function fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
|
127
|
-
var count = originalWidth * originalHeight;
|
128
|
-
var rgbBuf = null;
|
129
|
-
var numComponentColors = 1 << bpc;
|
130
|
-
var needsResizing = originalHeight !== height || originalWidth !== width;
|
131
|
-
|
132
|
-
if (this.isPassthrough(bpc)) {
|
133
|
-
rgbBuf = comps;
|
134
|
-
} else if (this.numComps === 1 && count > numComponentColors && this.name !== 'DeviceGray' && this.name !== 'DeviceRGB') {
|
135
|
-
var allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
|
136
|
-
|
137
|
-
for (var i = 0; i < numComponentColors; i++) {
|
138
|
-
allColors[i] = i;
|
139
|
-
}
|
140
182
|
|
141
|
-
|
142
|
-
|
183
|
+
if (cacheKey instanceof _primitives.Name) {
|
184
|
+
csName = cacheKey.name;
|
185
|
+
}
|
143
186
|
|
144
|
-
|
145
|
-
|
187
|
+
if (csName || csRef) {
|
188
|
+
localColorSpaceCache.set(csName, csRef, parsedColorSpace);
|
189
|
+
}
|
190
|
+
}
|
146
191
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
dest[destPos++] = colorMap[key + 2];
|
152
|
-
destPos += alpha01;
|
153
|
-
}
|
154
|
-
} else {
|
155
|
-
rgbBuf = new Uint8Array(count * 3);
|
156
|
-
var rgbPos = 0;
|
192
|
+
static getCached(cacheKey, xref, localColorSpaceCache) {
|
193
|
+
if (!localColorSpaceCache) {
|
194
|
+
throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
|
195
|
+
}
|
157
196
|
|
158
|
-
|
159
|
-
|
197
|
+
if (cacheKey instanceof _primitives.Ref) {
|
198
|
+
const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
|
160
199
|
|
161
|
-
|
162
|
-
|
163
|
-
rgbBuf[rgbPos++] = colorMap[_key + 2];
|
164
|
-
}
|
165
|
-
}
|
166
|
-
} else {
|
167
|
-
if (!needsResizing) {
|
168
|
-
this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
|
169
|
-
} else {
|
170
|
-
rgbBuf = new Uint8ClampedArray(count * 3);
|
171
|
-
this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
|
172
|
-
}
|
200
|
+
if (localColorSpace) {
|
201
|
+
return localColorSpace;
|
173
202
|
}
|
174
203
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
_rgbPos = 0;
|
181
|
-
|
182
|
-
for (var _i4 = 0, ii = width * actualHeight; _i4 < ii; _i4++) {
|
183
|
-
dest[_destPos++] = rgbBuf[_rgbPos++];
|
184
|
-
dest[_destPos++] = rgbBuf[_rgbPos++];
|
185
|
-
dest[_destPos++] = rgbBuf[_rgbPos++];
|
186
|
-
_destPos += alpha01;
|
187
|
-
}
|
204
|
+
try {
|
205
|
+
cacheKey = xref.fetch(cacheKey);
|
206
|
+
} catch (ex) {
|
207
|
+
if (ex instanceof _core_utils.MissingDataException) {
|
208
|
+
throw ex;
|
188
209
|
}
|
189
210
|
}
|
190
211
|
}
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
value: function parse(cs, xref, res, pdfFunctionFactory) {
|
199
|
-
var IR = this.parseToIR(cs, xref, res, pdfFunctionFactory);
|
200
|
-
return this.fromIR(IR);
|
212
|
+
|
213
|
+
if (cacheKey instanceof _primitives.Name) {
|
214
|
+
const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
|
215
|
+
|
216
|
+
if (localColorSpace) {
|
217
|
+
return localColorSpace;
|
218
|
+
}
|
201
219
|
}
|
202
|
-
}, {
|
203
|
-
key: "fromIR",
|
204
|
-
value: function fromIR(IR) {
|
205
|
-
var name = Array.isArray(IR) ? IR[0] : IR;
|
206
|
-
var whitePoint, blackPoint, gamma;
|
207
|
-
|
208
|
-
switch (name) {
|
209
|
-
case 'DeviceGrayCS':
|
210
|
-
return this.singletons.gray;
|
211
220
|
|
212
|
-
|
213
|
-
|
221
|
+
return null;
|
222
|
+
}
|
214
223
|
|
215
|
-
|
216
|
-
|
224
|
+
static async parseAsync({
|
225
|
+
cs,
|
226
|
+
xref,
|
227
|
+
resources = null,
|
228
|
+
pdfFunctionFactory,
|
229
|
+
localColorSpaceCache
|
230
|
+
}) {
|
231
|
+
const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
|
217
232
|
|
218
|
-
|
219
|
-
whitePoint = IR[1];
|
220
|
-
blackPoint = IR[2];
|
221
|
-
gamma = IR[3];
|
222
|
-
return new CalGrayCS(whitePoint, blackPoint, gamma);
|
233
|
+
this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
|
223
234
|
|
224
|
-
|
225
|
-
|
226
|
-
blackPoint = IR[2];
|
227
|
-
gamma = IR[3];
|
228
|
-
var matrix = IR[4];
|
229
|
-
return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
|
235
|
+
return parsedColorSpace;
|
236
|
+
}
|
230
237
|
|
231
|
-
|
232
|
-
|
238
|
+
static parse({
|
239
|
+
cs,
|
240
|
+
xref,
|
241
|
+
resources = null,
|
242
|
+
pdfFunctionFactory,
|
243
|
+
localColorSpaceCache
|
244
|
+
}) {
|
245
|
+
const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
|
246
|
+
|
247
|
+
if (cachedColorSpace) {
|
248
|
+
return cachedColorSpace;
|
249
|
+
}
|
233
250
|
|
234
|
-
|
235
|
-
basePatternCS = this.fromIR(basePatternCS);
|
236
|
-
}
|
251
|
+
const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
|
237
252
|
|
238
|
-
|
253
|
+
this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
|
239
254
|
|
240
|
-
|
241
|
-
|
242
|
-
var hiVal = IR[2];
|
243
|
-
var lookup = IR[3];
|
244
|
-
return new IndexedCS(this.fromIR(baseIndexedCS), hiVal, lookup);
|
255
|
+
return parsedColorSpace;
|
256
|
+
}
|
245
257
|
|
246
|
-
|
247
|
-
|
248
|
-
var alt = IR[2];
|
249
|
-
var tintFn = IR[3];
|
250
|
-
return new AlternateCS(numComps, this.fromIR(alt), tintFn);
|
258
|
+
static _parse(cs, xref, resources = null, pdfFunctionFactory) {
|
259
|
+
cs = xref.fetchIfRef(cs);
|
251
260
|
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
return
|
261
|
+
if ((0, _primitives.isName)(cs)) {
|
262
|
+
switch (cs.name) {
|
263
|
+
case "DeviceGray":
|
264
|
+
case "G":
|
265
|
+
return this.singletons.gray;
|
266
|
+
|
267
|
+
case "DeviceRGB":
|
268
|
+
case "RGB":
|
269
|
+
return this.singletons.rgb;
|
270
|
+
|
271
|
+
case "DeviceCMYK":
|
272
|
+
case "CMYK":
|
273
|
+
return this.singletons.cmyk;
|
274
|
+
|
275
|
+
case "Pattern":
|
276
|
+
return new PatternCS(null);
|
257
277
|
|
258
278
|
default:
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
if ((0, _primitives.isName)(cs)) {
|
270
|
-
switch (cs.name) {
|
271
|
-
case 'DeviceGray':
|
272
|
-
case 'G':
|
273
|
-
return 'DeviceGrayCS';
|
274
|
-
|
275
|
-
case 'DeviceRGB':
|
276
|
-
case 'RGB':
|
277
|
-
return 'DeviceRgbCS';
|
278
|
-
|
279
|
-
case 'DeviceCMYK':
|
280
|
-
case 'CMYK':
|
281
|
-
return 'DeviceCmykCS';
|
282
|
-
|
283
|
-
case 'Pattern':
|
284
|
-
return ['PatternCS', null];
|
285
|
-
|
286
|
-
default:
|
287
|
-
if ((0, _primitives.isDict)(res)) {
|
288
|
-
var colorSpaces = res.get('ColorSpace');
|
289
|
-
|
290
|
-
if ((0, _primitives.isDict)(colorSpaces)) {
|
291
|
-
var resCS = colorSpaces.get(cs.name);
|
292
|
-
|
293
|
-
if (resCS) {
|
294
|
-
if ((0, _primitives.isName)(resCS)) {
|
295
|
-
return this.parseToIR(resCS, xref, res, pdfFunctionFactory);
|
296
|
-
}
|
297
|
-
|
298
|
-
cs = resCS;
|
299
|
-
break;
|
279
|
+
if ((0, _primitives.isDict)(resources)) {
|
280
|
+
const colorSpaces = resources.get("ColorSpace");
|
281
|
+
|
282
|
+
if ((0, _primitives.isDict)(colorSpaces)) {
|
283
|
+
const resourcesCS = colorSpaces.get(cs.name);
|
284
|
+
|
285
|
+
if (resourcesCS) {
|
286
|
+
if ((0, _primitives.isName)(resourcesCS)) {
|
287
|
+
return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
|
300
288
|
}
|
289
|
+
|
290
|
+
cs = resourcesCS;
|
291
|
+
break;
|
301
292
|
}
|
302
293
|
}
|
294
|
+
}
|
303
295
|
|
304
|
-
|
305
|
-
}
|
296
|
+
throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
|
306
297
|
}
|
298
|
+
}
|
307
299
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
switch (mode) {
|
313
|
-
case 'DeviceGray':
|
314
|
-
case 'G':
|
315
|
-
return 'DeviceGrayCS';
|
316
|
-
|
317
|
-
case 'DeviceRGB':
|
318
|
-
case 'RGB':
|
319
|
-
return 'DeviceRgbCS';
|
320
|
-
|
321
|
-
case 'DeviceCMYK':
|
322
|
-
case 'CMYK':
|
323
|
-
return 'DeviceCmykCS';
|
324
|
-
|
325
|
-
case 'CalGray':
|
326
|
-
params = xref.fetchIfRef(cs[1]);
|
327
|
-
whitePoint = params.getArray('WhitePoint');
|
328
|
-
blackPoint = params.getArray('BlackPoint');
|
329
|
-
gamma = params.get('Gamma');
|
330
|
-
return ['CalGrayCS', whitePoint, blackPoint, gamma];
|
331
|
-
|
332
|
-
case 'CalRGB':
|
333
|
-
params = xref.fetchIfRef(cs[1]);
|
334
|
-
whitePoint = params.getArray('WhitePoint');
|
335
|
-
blackPoint = params.getArray('BlackPoint');
|
336
|
-
gamma = params.getArray('Gamma');
|
337
|
-
var matrix = params.getArray('Matrix');
|
338
|
-
return ['CalRGBCS', whitePoint, blackPoint, gamma, matrix];
|
339
|
-
|
340
|
-
case 'ICCBased':
|
341
|
-
var stream = xref.fetchIfRef(cs[1]);
|
342
|
-
var dict = stream.dict;
|
343
|
-
numComps = dict.get('N');
|
344
|
-
alt = dict.get('Alternate');
|
345
|
-
|
346
|
-
if (alt) {
|
347
|
-
var altIR = this.parseToIR(alt, xref, res, pdfFunctionFactory);
|
348
|
-
var altCS = this.fromIR(altIR, pdfFunctionFactory);
|
349
|
-
|
350
|
-
if (altCS.numComps === numComps) {
|
351
|
-
return altIR;
|
352
|
-
}
|
300
|
+
if (Array.isArray(cs)) {
|
301
|
+
const mode = xref.fetchIfRef(cs[0]).name;
|
302
|
+
let params, numComps, baseCS, whitePoint, blackPoint, gamma;
|
353
303
|
|
354
|
-
|
355
|
-
|
304
|
+
switch (mode) {
|
305
|
+
case "DeviceGray":
|
306
|
+
case "G":
|
307
|
+
return this.singletons.gray;
|
356
308
|
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
309
|
+
case "DeviceRGB":
|
310
|
+
case "RGB":
|
311
|
+
return this.singletons.rgb;
|
312
|
+
|
313
|
+
case "DeviceCMYK":
|
314
|
+
case "CMYK":
|
315
|
+
return this.singletons.cmyk;
|
364
316
|
|
365
|
-
|
317
|
+
case "CalGray":
|
318
|
+
params = xref.fetchIfRef(cs[1]);
|
319
|
+
whitePoint = params.getArray("WhitePoint");
|
320
|
+
blackPoint = params.getArray("BlackPoint");
|
321
|
+
gamma = params.get("Gamma");
|
322
|
+
return new CalGrayCS(whitePoint, blackPoint, gamma);
|
323
|
+
|
324
|
+
case "CalRGB":
|
325
|
+
params = xref.fetchIfRef(cs[1]);
|
326
|
+
whitePoint = params.getArray("WhitePoint");
|
327
|
+
blackPoint = params.getArray("BlackPoint");
|
328
|
+
gamma = params.getArray("Gamma");
|
329
|
+
const matrix = params.getArray("Matrix");
|
330
|
+
return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
|
331
|
+
|
332
|
+
case "ICCBased":
|
333
|
+
const stream = xref.fetchIfRef(cs[1]);
|
334
|
+
const dict = stream.dict;
|
335
|
+
numComps = dict.get("N");
|
336
|
+
const alt = dict.get("Alternate");
|
366
337
|
|
367
|
-
|
368
|
-
|
338
|
+
if (alt) {
|
339
|
+
const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
|
369
340
|
|
370
|
-
if (
|
371
|
-
|
341
|
+
if (altCS.numComps === numComps) {
|
342
|
+
return altCS;
|
372
343
|
}
|
373
344
|
|
374
|
-
|
345
|
+
(0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
|
346
|
+
}
|
375
347
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
348
|
+
if (numComps === 1) {
|
349
|
+
return this.singletons.gray;
|
350
|
+
} else if (numComps === 3) {
|
351
|
+
return this.singletons.rgb;
|
352
|
+
} else if (numComps === 4) {
|
353
|
+
return this.singletons.cmyk;
|
354
|
+
}
|
381
355
|
|
382
|
-
|
383
|
-
lookup = lookup.getBytes();
|
384
|
-
}
|
356
|
+
break;
|
385
357
|
|
386
|
-
|
387
|
-
|
388
|
-
case 'Separation':
|
389
|
-
case 'DeviceN':
|
390
|
-
var name = xref.fetchIfRef(cs[1]);
|
391
|
-
numComps = Array.isArray(name) ? name.length : 1;
|
392
|
-
alt = this.parseToIR(cs[2], xref, res, pdfFunctionFactory);
|
393
|
-
var tintFn = pdfFunctionFactory.create(xref.fetchIfRef(cs[3]));
|
394
|
-
return ['AlternateCS', numComps, alt, tintFn];
|
395
|
-
|
396
|
-
case 'Lab':
|
397
|
-
params = xref.fetchIfRef(cs[1]);
|
398
|
-
whitePoint = params.getArray('WhitePoint');
|
399
|
-
blackPoint = params.getArray('BlackPoint');
|
400
|
-
var range = params.getArray('Range');
|
401
|
-
return ['LabCS', whitePoint, blackPoint, range];
|
402
|
-
|
403
|
-
default:
|
404
|
-
throw new _util.FormatError("unimplemented color space object \"".concat(mode, "\""));
|
405
|
-
}
|
406
|
-
}
|
358
|
+
case "Pattern":
|
359
|
+
baseCS = cs[1] || null;
|
407
360
|
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
key: "isDefaultDecode",
|
412
|
-
value: function isDefaultDecode(decode, numComps) {
|
413
|
-
if (!Array.isArray(decode)) {
|
414
|
-
return true;
|
415
|
-
}
|
361
|
+
if (baseCS) {
|
362
|
+
baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
|
363
|
+
}
|
416
364
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
365
|
+
return new PatternCS(baseCS);
|
366
|
+
|
367
|
+
case "Indexed":
|
368
|
+
case "I":
|
369
|
+
baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
|
370
|
+
const hiVal = xref.fetchIfRef(cs[2]) + 1;
|
371
|
+
const lookup = xref.fetchIfRef(cs[3]);
|
372
|
+
return new IndexedCS(baseCS, hiVal, lookup);
|
373
|
+
|
374
|
+
case "Separation":
|
375
|
+
case "DeviceN":
|
376
|
+
const name = xref.fetchIfRef(cs[1]);
|
377
|
+
numComps = Array.isArray(name) ? name.length : 1;
|
378
|
+
baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
|
379
|
+
const tintFn = pdfFunctionFactory.create(cs[3]);
|
380
|
+
return new AlternateCS(numComps, baseCS, tintFn);
|
381
|
+
|
382
|
+
case "Lab":
|
383
|
+
params = xref.fetchIfRef(cs[1]);
|
384
|
+
whitePoint = params.getArray("WhitePoint");
|
385
|
+
blackPoint = params.getArray("BlackPoint");
|
386
|
+
const range = params.getArray("Range");
|
387
|
+
return new LabCS(whitePoint, blackPoint, range);
|
421
388
|
|
422
|
-
|
423
|
-
|
424
|
-
return false;
|
425
|
-
}
|
389
|
+
default:
|
390
|
+
throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
|
426
391
|
}
|
392
|
+
}
|
393
|
+
|
394
|
+
throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
|
395
|
+
}
|
427
396
|
|
397
|
+
static isDefaultDecode(decode, numComps) {
|
398
|
+
if (!Array.isArray(decode)) {
|
428
399
|
return true;
|
429
400
|
}
|
430
|
-
}, {
|
431
|
-
key: "singletons",
|
432
|
-
get: function get() {
|
433
|
-
return (0, _util.shadow)(this, 'singletons', {
|
434
|
-
get gray() {
|
435
|
-
return (0, _util.shadow)(this, 'gray', new DeviceGrayCS());
|
436
|
-
},
|
437
|
-
|
438
|
-
get rgb() {
|
439
|
-
return (0, _util.shadow)(this, 'rgb', new DeviceRgbCS());
|
440
|
-
},
|
441
|
-
|
442
|
-
get cmyk() {
|
443
|
-
return (0, _util.shadow)(this, 'cmyk', new DeviceCmykCS());
|
444
|
-
}
|
445
401
|
|
446
|
-
|
402
|
+
if (numComps * 2 !== decode.length) {
|
403
|
+
(0, _util.warn)("The decode map is not the correct length");
|
404
|
+
return true;
|
447
405
|
}
|
448
|
-
}]);
|
449
406
|
|
450
|
-
|
451
|
-
|
407
|
+
for (let i = 0, ii = decode.length; i < ii; i += 2) {
|
408
|
+
if (decode[i] !== 0 || decode[i + 1] !== 1) {
|
409
|
+
return false;
|
410
|
+
}
|
411
|
+
}
|
452
412
|
|
453
|
-
|
413
|
+
return true;
|
414
|
+
}
|
454
415
|
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
416
|
+
static get singletons() {
|
417
|
+
return (0, _util.shadow)(this, "singletons", {
|
418
|
+
get gray() {
|
419
|
+
return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
|
420
|
+
},
|
459
421
|
|
460
|
-
|
461
|
-
|
422
|
+
get rgb() {
|
423
|
+
return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
|
424
|
+
},
|
462
425
|
|
463
|
-
|
426
|
+
get cmyk() {
|
427
|
+
return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
|
428
|
+
}
|
464
429
|
|
465
|
-
|
466
|
-
_this.base = base;
|
467
|
-
_this.tintFn = tintFn;
|
468
|
-
_this.tmpBuf = new Float32Array(base.numComps);
|
469
|
-
return _this;
|
430
|
+
});
|
470
431
|
}
|
471
432
|
|
472
|
-
|
473
|
-
key: "getRgbItem",
|
474
|
-
value: function getRgbItem(src, srcOffset, dest, destOffset) {
|
475
|
-
var tmpBuf = this.tmpBuf;
|
476
|
-
this.tintFn(src, srcOffset, tmpBuf, 0);
|
477
|
-
this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
|
478
|
-
}
|
479
|
-
}, {
|
480
|
-
key: "getRgbBuffer",
|
481
|
-
value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
482
|
-
var tintFn = this.tintFn;
|
483
|
-
var base = this.base;
|
484
|
-
var scale = 1 / ((1 << bits) - 1);
|
485
|
-
var baseNumComps = base.numComps;
|
486
|
-
var usesZeroToOneRange = base.usesZeroToOneRange;
|
487
|
-
var isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
|
488
|
-
var pos = isPassthrough ? destOffset : 0;
|
489
|
-
var baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
|
490
|
-
var numComps = this.numComps;
|
491
|
-
var scaled = new Float32Array(numComps);
|
492
|
-
var tinted = new Float32Array(baseNumComps);
|
493
|
-
var i, j;
|
494
|
-
|
495
|
-
for (i = 0; i < count; i++) {
|
496
|
-
for (j = 0; j < numComps; j++) {
|
497
|
-
scaled[j] = src[srcOffset++] * scale;
|
498
|
-
}
|
499
|
-
|
500
|
-
tintFn(scaled, 0, tinted, 0);
|
433
|
+
}
|
501
434
|
|
502
|
-
|
503
|
-
for (j = 0; j < baseNumComps; j++) {
|
504
|
-
baseBuf[pos++] = tinted[j] * 255;
|
505
|
-
}
|
506
|
-
} else {
|
507
|
-
base.getRgbItem(tinted, 0, baseBuf, pos);
|
508
|
-
pos += baseNumComps;
|
509
|
-
}
|
510
|
-
}
|
435
|
+
exports.ColorSpace = ColorSpace;
|
511
436
|
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
|
520
|
-
}
|
521
|
-
}]);
|
437
|
+
class AlternateCS extends ColorSpace {
|
438
|
+
constructor(numComps, base, tintFn) {
|
439
|
+
super("Alternate", numComps);
|
440
|
+
this.base = base;
|
441
|
+
this.tintFn = tintFn;
|
442
|
+
this.tmpBuf = new Float32Array(base.numComps);
|
443
|
+
}
|
522
444
|
|
523
|
-
|
524
|
-
|
445
|
+
getRgbItem(src, srcOffset, dest, destOffset) {
|
446
|
+
const tmpBuf = this.tmpBuf;
|
447
|
+
this.tintFn(src, srcOffset, tmpBuf, 0);
|
448
|
+
this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
|
449
|
+
}
|
525
450
|
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
451
|
+
getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
452
|
+
const tintFn = this.tintFn;
|
453
|
+
const base = this.base;
|
454
|
+
const scale = 1 / ((1 << bits) - 1);
|
455
|
+
const baseNumComps = base.numComps;
|
456
|
+
const usesZeroToOneRange = base.usesZeroToOneRange;
|
457
|
+
const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
|
458
|
+
let pos = isPassthrough ? destOffset : 0;
|
459
|
+
const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
|
460
|
+
const numComps = this.numComps;
|
461
|
+
const scaled = new Float32Array(numComps);
|
462
|
+
const tinted = new Float32Array(baseNumComps);
|
463
|
+
let i, j;
|
464
|
+
|
465
|
+
for (i = 0; i < count; i++) {
|
466
|
+
for (j = 0; j < numComps; j++) {
|
467
|
+
scaled[j] = src[srcOffset++] * scale;
|
468
|
+
}
|
530
469
|
|
531
|
-
|
532
|
-
var _this2;
|
470
|
+
tintFn(scaled, 0, tinted, 0);
|
533
471
|
|
534
|
-
|
472
|
+
if (usesZeroToOneRange) {
|
473
|
+
for (j = 0; j < baseNumComps; j++) {
|
474
|
+
baseBuf[pos++] = tinted[j] * 255;
|
475
|
+
}
|
476
|
+
} else {
|
477
|
+
base.getRgbItem(tinted, 0, baseBuf, pos);
|
478
|
+
pos += baseNumComps;
|
479
|
+
}
|
480
|
+
}
|
535
481
|
|
536
|
-
|
537
|
-
|
538
|
-
|
482
|
+
if (!isPassthrough) {
|
483
|
+
base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
|
484
|
+
}
|
539
485
|
}
|
540
486
|
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
(0, _util.unreachable)('Should not call PatternCS.isDefaultDecode');
|
545
|
-
}
|
546
|
-
}]);
|
487
|
+
getOutputLength(inputLength, alpha01) {
|
488
|
+
return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
|
489
|
+
}
|
547
490
|
|
548
|
-
|
549
|
-
}(ColorSpace);
|
491
|
+
}
|
550
492
|
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
493
|
+
class PatternCS extends ColorSpace {
|
494
|
+
constructor(baseCS) {
|
495
|
+
super("Pattern", null);
|
496
|
+
this.base = baseCS;
|
497
|
+
}
|
555
498
|
|
556
|
-
|
557
|
-
|
499
|
+
isDefaultDecode(decodeMap, bpc) {
|
500
|
+
(0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
|
501
|
+
}
|
558
502
|
|
559
|
-
|
503
|
+
}
|
560
504
|
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
505
|
+
class IndexedCS extends ColorSpace {
|
506
|
+
constructor(base, highVal, lookup) {
|
507
|
+
super("Indexed", 1);
|
508
|
+
this.base = base;
|
509
|
+
this.highVal = highVal;
|
510
|
+
const length = base.numComps * highVal;
|
511
|
+
this.lookup = new Uint8Array(length);
|
566
512
|
|
567
513
|
if ((0, _primitives.isStream)(lookup)) {
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
_this3.lookup = new Uint8Array(length);
|
574
|
-
|
575
|
-
for (var i = 0; i < length; ++i) {
|
576
|
-
_this3.lookup[i] = lookup.charCodeAt(i);
|
514
|
+
const bytes = lookup.getBytes(length);
|
515
|
+
this.lookup.set(bytes);
|
516
|
+
} else if (typeof lookup === "string") {
|
517
|
+
for (let i = 0; i < length; ++i) {
|
518
|
+
this.lookup[i] = lookup.charCodeAt(i) & 0xff;
|
577
519
|
}
|
578
|
-
} else if (lookup instanceof Uint8Array) {
|
579
|
-
_this3.lookup = lookup;
|
580
520
|
} else {
|
581
|
-
throw new _util.FormatError(
|
521
|
+
throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
|
582
522
|
}
|
523
|
+
}
|
583
524
|
|
584
|
-
|
525
|
+
getRgbItem(src, srcOffset, dest, destOffset) {
|
526
|
+
const numComps = this.base.numComps;
|
527
|
+
const start = src[srcOffset] * numComps;
|
528
|
+
this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
|
585
529
|
}
|
586
530
|
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
var base = this.base;
|
598
|
-
var numComps = base.numComps;
|
599
|
-
var outputDelta = base.getOutputLength(numComps, alpha01);
|
600
|
-
var lookup = this.lookup;
|
601
|
-
|
602
|
-
for (var i = 0; i < count; ++i) {
|
603
|
-
var lookupPos = src[srcOffset++] * numComps;
|
604
|
-
base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
|
605
|
-
destOffset += outputDelta;
|
606
|
-
}
|
607
|
-
}
|
608
|
-
}, {
|
609
|
-
key: "getOutputLength",
|
610
|
-
value: function getOutputLength(inputLength, alpha01) {
|
611
|
-
return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
|
531
|
+
getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
532
|
+
const base = this.base;
|
533
|
+
const numComps = base.numComps;
|
534
|
+
const outputDelta = base.getOutputLength(numComps, alpha01);
|
535
|
+
const lookup = this.lookup;
|
536
|
+
|
537
|
+
for (let i = 0; i < count; ++i) {
|
538
|
+
const lookupPos = src[srcOffset++] * numComps;
|
539
|
+
base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
|
540
|
+
destOffset += outputDelta;
|
612
541
|
}
|
613
|
-
}
|
614
|
-
key: "isDefaultDecode",
|
615
|
-
value: function isDefaultDecode(decodeMap, bpc) {
|
616
|
-
if (!Array.isArray(decodeMap)) {
|
617
|
-
return true;
|
618
|
-
}
|
542
|
+
}
|
619
543
|
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
}
|
544
|
+
getOutputLength(inputLength, alpha01) {
|
545
|
+
return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
|
546
|
+
}
|
624
547
|
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
548
|
+
isDefaultDecode(decodeMap, bpc) {
|
549
|
+
if (!Array.isArray(decodeMap)) {
|
550
|
+
return true;
|
551
|
+
}
|
629
552
|
|
630
|
-
|
553
|
+
if (decodeMap.length !== 2) {
|
554
|
+
(0, _util.warn)("Decode map length is not correct");
|
555
|
+
return true;
|
556
|
+
}
|
557
|
+
|
558
|
+
if (!Number.isInteger(bpc) || bpc < 1) {
|
559
|
+
(0, _util.warn)("Bits per component is not correct");
|
560
|
+
return true;
|
631
561
|
}
|
632
|
-
}]);
|
633
562
|
|
634
|
-
|
635
|
-
}
|
563
|
+
return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
|
564
|
+
}
|
636
565
|
|
637
|
-
|
638
|
-
/*#__PURE__*/
|
639
|
-
function (_ColorSpace4) {
|
640
|
-
_inherits(DeviceGrayCS, _ColorSpace4);
|
566
|
+
}
|
641
567
|
|
642
|
-
|
643
|
-
|
568
|
+
class DeviceGrayCS extends ColorSpace {
|
569
|
+
constructor() {
|
570
|
+
super("DeviceGray", 1);
|
571
|
+
}
|
644
572
|
|
645
|
-
|
573
|
+
getRgbItem(src, srcOffset, dest, destOffset) {
|
574
|
+
const c = src[srcOffset] * 255;
|
575
|
+
dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
|
646
576
|
}
|
647
577
|
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
q = destOffset;
|
660
|
-
|
661
|
-
for (var i = 0; i < count; ++i) {
|
662
|
-
var c = scale * src[j++];
|
663
|
-
dest[q++] = c;
|
664
|
-
dest[q++] = c;
|
665
|
-
dest[q++] = c;
|
666
|
-
q += alpha01;
|
667
|
-
}
|
668
|
-
}
|
669
|
-
}, {
|
670
|
-
key: "getOutputLength",
|
671
|
-
value: function getOutputLength(inputLength, alpha01) {
|
672
|
-
return inputLength * (3 + alpha01);
|
578
|
+
getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
579
|
+
const scale = 255 / ((1 << bits) - 1);
|
580
|
+
let j = srcOffset,
|
581
|
+
q = destOffset;
|
582
|
+
|
583
|
+
for (let i = 0; i < count; ++i) {
|
584
|
+
const c = scale * src[j++];
|
585
|
+
dest[q++] = c;
|
586
|
+
dest[q++] = c;
|
587
|
+
dest[q++] = c;
|
588
|
+
q += alpha01;
|
673
589
|
}
|
674
|
-
}
|
590
|
+
}
|
675
591
|
|
676
|
-
|
677
|
-
|
592
|
+
getOutputLength(inputLength, alpha01) {
|
593
|
+
return inputLength * (3 + alpha01);
|
594
|
+
}
|
678
595
|
|
679
|
-
|
680
|
-
/*#__PURE__*/
|
681
|
-
function (_ColorSpace5) {
|
682
|
-
_inherits(DeviceRgbCS, _ColorSpace5);
|
596
|
+
}
|
683
597
|
|
684
|
-
|
685
|
-
|
598
|
+
class DeviceRgbCS extends ColorSpace {
|
599
|
+
constructor() {
|
600
|
+
super("DeviceRGB", 3);
|
601
|
+
}
|
686
602
|
|
687
|
-
|
603
|
+
getRgbItem(src, srcOffset, dest, destOffset) {
|
604
|
+
dest[destOffset] = src[srcOffset] * 255;
|
605
|
+
dest[destOffset + 1] = src[srcOffset + 1] * 255;
|
606
|
+
dest[destOffset + 2] = src[srcOffset + 2] * 255;
|
688
607
|
}
|
689
608
|
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
dest[destOffset + 1] = src[srcOffset + 1] * 255;
|
695
|
-
dest[destOffset + 2] = src[srcOffset + 2] * 255;
|
609
|
+
getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
610
|
+
if (bits === 8 && alpha01 === 0) {
|
611
|
+
dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
|
612
|
+
return;
|
696
613
|
}
|
697
|
-
}, {
|
698
|
-
key: "getRgbBuffer",
|
699
|
-
value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
700
|
-
if (bits === 8 && alpha01 === 0) {
|
701
|
-
dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
|
702
|
-
return;
|
703
|
-
}
|
704
614
|
|
705
|
-
|
706
|
-
|
707
|
-
|
615
|
+
const scale = 255 / ((1 << bits) - 1);
|
616
|
+
let j = srcOffset,
|
617
|
+
q = destOffset;
|
708
618
|
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
}
|
715
|
-
}
|
716
|
-
}, {
|
717
|
-
key: "getOutputLength",
|
718
|
-
value: function getOutputLength(inputLength, alpha01) {
|
719
|
-
return inputLength * (3 + alpha01) / 3 | 0;
|
619
|
+
for (let i = 0; i < count; ++i) {
|
620
|
+
dest[q++] = scale * src[j++];
|
621
|
+
dest[q++] = scale * src[j++];
|
622
|
+
dest[q++] = scale * src[j++];
|
623
|
+
q += alpha01;
|
720
624
|
}
|
721
|
-
}
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
}]);
|
625
|
+
}
|
626
|
+
|
627
|
+
getOutputLength(inputLength, alpha01) {
|
628
|
+
return inputLength * (3 + alpha01) / 3 | 0;
|
629
|
+
}
|
727
630
|
|
728
|
-
|
729
|
-
|
631
|
+
isPassthrough(bits) {
|
632
|
+
return bits === 8;
|
633
|
+
}
|
634
|
+
|
635
|
+
}
|
730
636
|
|
731
|
-
|
637
|
+
const DeviceCmykCS = function DeviceCmykCSClosure() {
|
732
638
|
function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
639
|
+
const c = src[srcOffset] * srcScale;
|
640
|
+
const m = src[srcOffset + 1] * srcScale;
|
641
|
+
const y = src[srcOffset + 2] * srcScale;
|
642
|
+
const k = src[srcOffset + 3] * srcScale;
|
737
643
|
dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
|
738
644
|
dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
|
739
645
|
dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
|
740
646
|
}
|
741
647
|
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
function DeviceCmykCS() {
|
748
|
-
_classCallCheck(this, DeviceCmykCS);
|
648
|
+
class DeviceCmykCS extends ColorSpace {
|
649
|
+
constructor() {
|
650
|
+
super("DeviceCMYK", 4);
|
651
|
+
}
|
749
652
|
|
750
|
-
|
653
|
+
getRgbItem(src, srcOffset, dest, destOffset) {
|
654
|
+
convertToRgb(src, srcOffset, 1, dest, destOffset);
|
751
655
|
}
|
752
656
|
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
761
|
-
var scale = 1 / ((1 << bits) - 1);
|
762
|
-
|
763
|
-
for (var i = 0; i < count; i++) {
|
764
|
-
convertToRgb(src, srcOffset, scale, dest, destOffset);
|
765
|
-
srcOffset += 4;
|
766
|
-
destOffset += 3 + alpha01;
|
767
|
-
}
|
768
|
-
}
|
769
|
-
}, {
|
770
|
-
key: "getOutputLength",
|
771
|
-
value: function getOutputLength(inputLength, alpha01) {
|
772
|
-
return inputLength / 4 * (3 + alpha01) | 0;
|
657
|
+
getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
658
|
+
const scale = 1 / ((1 << bits) - 1);
|
659
|
+
|
660
|
+
for (let i = 0; i < count; i++) {
|
661
|
+
convertToRgb(src, srcOffset, scale, dest, destOffset);
|
662
|
+
srcOffset += 4;
|
663
|
+
destOffset += 3 + alpha01;
|
773
664
|
}
|
774
|
-
}
|
665
|
+
}
|
666
|
+
|
667
|
+
getOutputLength(inputLength, alpha01) {
|
668
|
+
return inputLength / 4 * (3 + alpha01) | 0;
|
669
|
+
}
|
775
670
|
|
776
|
-
|
777
|
-
}(ColorSpace);
|
671
|
+
}
|
778
672
|
|
779
673
|
return DeviceCmykCS;
|
780
674
|
}();
|
781
675
|
|
782
|
-
|
676
|
+
const CalGrayCS = function CalGrayCSClosure() {
|
783
677
|
function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
678
|
+
const A = src[srcOffset] * scale;
|
679
|
+
const AG = A ** cs.G;
|
680
|
+
const L = cs.YW * AG;
|
681
|
+
const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
|
788
682
|
dest[destOffset] = val;
|
789
683
|
dest[destOffset + 1] = val;
|
790
684
|
dest[destOffset + 2] = val;
|
791
685
|
}
|
792
686
|
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
_inherits(CalGrayCS, _ColorSpace7);
|
797
|
-
|
798
|
-
function CalGrayCS(whitePoint, blackPoint, gamma) {
|
799
|
-
var _this4;
|
800
|
-
|
801
|
-
_classCallCheck(this, CalGrayCS);
|
802
|
-
|
803
|
-
_this4 = _possibleConstructorReturn(this, _getPrototypeOf(CalGrayCS).call(this, 'CalGray', 1));
|
687
|
+
class CalGrayCS extends ColorSpace {
|
688
|
+
constructor(whitePoint, blackPoint, gamma) {
|
689
|
+
super("CalGray", 1);
|
804
690
|
|
805
691
|
if (!whitePoint) {
|
806
|
-
throw new _util.FormatError(
|
692
|
+
throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
|
807
693
|
}
|
808
694
|
|
809
695
|
blackPoint = blackPoint || [0, 0, 0];
|
810
696
|
gamma = gamma || 1;
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
if (
|
820
|
-
throw new _util.FormatError(
|
697
|
+
this.XW = whitePoint[0];
|
698
|
+
this.YW = whitePoint[1];
|
699
|
+
this.ZW = whitePoint[2];
|
700
|
+
this.XB = blackPoint[0];
|
701
|
+
this.YB = blackPoint[1];
|
702
|
+
this.ZB = blackPoint[2];
|
703
|
+
this.G = gamma;
|
704
|
+
|
705
|
+
if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
|
706
|
+
throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
|
821
707
|
}
|
822
708
|
|
823
|
-
if (
|
824
|
-
(0, _util.info)(
|
825
|
-
|
709
|
+
if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
|
710
|
+
(0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
|
711
|
+
this.XB = this.YB = this.ZB = 0;
|
826
712
|
}
|
827
713
|
|
828
|
-
if (
|
829
|
-
(0, _util.warn)(
|
714
|
+
if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
|
715
|
+
(0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
|
830
716
|
}
|
831
717
|
|
832
|
-
if (
|
833
|
-
(0, _util.info)(
|
834
|
-
|
718
|
+
if (this.G < 1) {
|
719
|
+
(0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
|
720
|
+
this.G = 1;
|
835
721
|
}
|
722
|
+
}
|
836
723
|
|
837
|
-
|
724
|
+
getRgbItem(src, srcOffset, dest, destOffset) {
|
725
|
+
convertToRgb(this, src, srcOffset, dest, destOffset, 1);
|
838
726
|
}
|
839
727
|
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
848
|
-
var scale = 1 / ((1 << bits) - 1);
|
849
|
-
|
850
|
-
for (var i = 0; i < count; ++i) {
|
851
|
-
convertToRgb(this, src, srcOffset, dest, destOffset, scale);
|
852
|
-
srcOffset += 1;
|
853
|
-
destOffset += 3 + alpha01;
|
854
|
-
}
|
855
|
-
}
|
856
|
-
}, {
|
857
|
-
key: "getOutputLength",
|
858
|
-
value: function getOutputLength(inputLength, alpha01) {
|
859
|
-
return inputLength * (3 + alpha01);
|
728
|
+
getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
729
|
+
const scale = 1 / ((1 << bits) - 1);
|
730
|
+
|
731
|
+
for (let i = 0; i < count; ++i) {
|
732
|
+
convertToRgb(this, src, srcOffset, dest, destOffset, scale);
|
733
|
+
srcOffset += 1;
|
734
|
+
destOffset += 3 + alpha01;
|
860
735
|
}
|
861
|
-
}
|
736
|
+
}
|
737
|
+
|
738
|
+
getOutputLength(inputLength, alpha01) {
|
739
|
+
return inputLength * (3 + alpha01);
|
740
|
+
}
|
862
741
|
|
863
|
-
|
864
|
-
}(ColorSpace);
|
742
|
+
}
|
865
743
|
|
866
744
|
return CalGrayCS;
|
867
745
|
}();
|
868
746
|
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
747
|
+
const CalRGBCS = function CalRGBCSClosure() {
|
748
|
+
const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
|
749
|
+
const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
|
750
|
+
const SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
|
751
|
+
const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
|
752
|
+
const tempNormalizeMatrix = new Float32Array(3);
|
753
|
+
const tempConvertMatrix1 = new Float32Array(3);
|
754
|
+
const tempConvertMatrix2 = new Float32Array(3);
|
755
|
+
const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
|
878
756
|
|
879
757
|
function matrixProduct(a, b, result) {
|
880
758
|
result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
@@ -889,9 +767,9 @@ var CalRGBCS = function CalRGBCSClosure() {
|
|
889
767
|
}
|
890
768
|
|
891
769
|
function convertToD65(sourceWhitePoint, LMS, result) {
|
892
|
-
|
893
|
-
|
894
|
-
|
770
|
+
const D65X = 0.95047;
|
771
|
+
const D65Y = 1;
|
772
|
+
const D65Z = 1.08883;
|
895
773
|
result[0] = LMS[0] * D65X / sourceWhitePoint[0];
|
896
774
|
result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
|
897
775
|
result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
|
@@ -902,7 +780,11 @@ var CalRGBCS = function CalRGBCSClosure() {
|
|
902
780
|
return adjustToRange(0, 1, 12.92 * color);
|
903
781
|
}
|
904
782
|
|
905
|
-
|
783
|
+
if (color >= 0.99554525) {
|
784
|
+
return 1;
|
785
|
+
}
|
786
|
+
|
787
|
+
return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
|
906
788
|
}
|
907
789
|
|
908
790
|
function adjustToRange(min, max, value) {
|
@@ -915,7 +797,7 @@ var CalRGBCS = function CalRGBCSClosure() {
|
|
915
797
|
}
|
916
798
|
|
917
799
|
if (L > 8.0) {
|
918
|
-
return
|
800
|
+
return ((L + 16) / 116) ** 3;
|
919
801
|
}
|
920
802
|
|
921
803
|
return L * DECODE_L_CONSTANT;
|
@@ -929,19 +811,19 @@ var CalRGBCS = function CalRGBCSClosure() {
|
|
929
811
|
return;
|
930
812
|
}
|
931
813
|
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
814
|
+
const zeroDecodeL = decodeL(0);
|
815
|
+
const X_DST = zeroDecodeL;
|
816
|
+
const X_SRC = decodeL(sourceBlackPoint[0]);
|
817
|
+
const Y_DST = zeroDecodeL;
|
818
|
+
const Y_SRC = decodeL(sourceBlackPoint[1]);
|
819
|
+
const Z_DST = zeroDecodeL;
|
820
|
+
const Z_SRC = decodeL(sourceBlackPoint[2]);
|
821
|
+
const X_Scale = (1 - X_DST) / (1 - X_SRC);
|
822
|
+
const X_Offset = 1 - X_Scale;
|
823
|
+
const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
|
824
|
+
const Y_Offset = 1 - Y_Scale;
|
825
|
+
const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
|
826
|
+
const Z_Offset = 1 - Z_Scale;
|
945
827
|
result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
|
946
828
|
result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
|
947
829
|
result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
|
@@ -955,137 +837,121 @@ var CalRGBCS = function CalRGBCSClosure() {
|
|
955
837
|
return;
|
956
838
|
}
|
957
839
|
|
958
|
-
|
840
|
+
const LMS = result;
|
959
841
|
matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
|
960
|
-
|
842
|
+
const LMS_Flat = tempNormalizeMatrix;
|
961
843
|
convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
|
962
844
|
matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
|
963
845
|
}
|
964
846
|
|
965
847
|
function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
|
966
|
-
|
848
|
+
const LMS = result;
|
967
849
|
matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
|
968
|
-
|
850
|
+
const LMS_D65 = tempNormalizeMatrix;
|
969
851
|
convertToD65(sourceWhitePoint, LMS, LMS_D65);
|
970
852
|
matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
|
971
853
|
}
|
972
854
|
|
973
855
|
function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
856
|
+
const A = adjustToRange(0, 1, src[srcOffset] * scale);
|
857
|
+
const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
|
858
|
+
const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
|
859
|
+
const AGR = A === 1 ? 1 : A ** cs.GR;
|
860
|
+
const BGG = B === 1 ? 1 : B ** cs.GG;
|
861
|
+
const CGB = C === 1 ? 1 : C ** cs.GB;
|
862
|
+
const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
|
863
|
+
const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
|
864
|
+
const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
|
865
|
+
const XYZ = tempConvertMatrix1;
|
984
866
|
XYZ[0] = X;
|
985
867
|
XYZ[1] = Y;
|
986
868
|
XYZ[2] = Z;
|
987
|
-
|
869
|
+
const XYZ_Flat = tempConvertMatrix2;
|
988
870
|
normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
|
989
|
-
|
871
|
+
const XYZ_Black = tempConvertMatrix1;
|
990
872
|
compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
|
991
|
-
|
873
|
+
const XYZ_D65 = tempConvertMatrix2;
|
992
874
|
normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
|
993
|
-
|
875
|
+
const SRGB = tempConvertMatrix1;
|
994
876
|
matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
|
995
877
|
dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
|
996
878
|
dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
|
997
879
|
dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
|
998
880
|
}
|
999
881
|
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
_inherits(CalRGBCS, _ColorSpace8);
|
1004
|
-
|
1005
|
-
function CalRGBCS(whitePoint, blackPoint, gamma, matrix) {
|
1006
|
-
var _this5;
|
1007
|
-
|
1008
|
-
_classCallCheck(this, CalRGBCS);
|
1009
|
-
|
1010
|
-
_this5 = _possibleConstructorReturn(this, _getPrototypeOf(CalRGBCS).call(this, 'CalRGB', 3));
|
882
|
+
class CalRGBCS extends ColorSpace {
|
883
|
+
constructor(whitePoint, blackPoint, gamma, matrix) {
|
884
|
+
super("CalRGB", 3);
|
1011
885
|
|
1012
886
|
if (!whitePoint) {
|
1013
|
-
throw new _util.FormatError(
|
887
|
+
throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
|
1014
888
|
}
|
1015
889
|
|
1016
890
|
blackPoint = blackPoint || new Float32Array(3);
|
1017
891
|
gamma = gamma || new Float32Array([1, 1, 1]);
|
1018
892
|
matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
893
|
+
const XW = whitePoint[0];
|
894
|
+
const YW = whitePoint[1];
|
895
|
+
const ZW = whitePoint[2];
|
896
|
+
this.whitePoint = whitePoint;
|
897
|
+
const XB = blackPoint[0];
|
898
|
+
const YB = blackPoint[1];
|
899
|
+
const ZB = blackPoint[2];
|
900
|
+
this.blackPoint = blackPoint;
|
901
|
+
this.GR = gamma[0];
|
902
|
+
this.GG = gamma[1];
|
903
|
+
this.GB = gamma[2];
|
904
|
+
this.MXA = matrix[0];
|
905
|
+
this.MYA = matrix[1];
|
906
|
+
this.MZA = matrix[2];
|
907
|
+
this.MXB = matrix[3];
|
908
|
+
this.MYB = matrix[4];
|
909
|
+
this.MZB = matrix[5];
|
910
|
+
this.MXC = matrix[6];
|
911
|
+
this.MYC = matrix[7];
|
912
|
+
this.MZC = matrix[8];
|
1039
913
|
|
1040
914
|
if (XW < 0 || ZW < 0 || YW !== 1) {
|
1041
|
-
throw new _util.FormatError(
|
915
|
+
throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
|
1042
916
|
}
|
1043
917
|
|
1044
918
|
if (XB < 0 || YB < 0 || ZB < 0) {
|
1045
|
-
(0, _util.info)(
|
1046
|
-
|
919
|
+
(0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
|
920
|
+
this.blackPoint = new Float32Array(3);
|
1047
921
|
}
|
1048
922
|
|
1049
|
-
if (
|
1050
|
-
(0, _util.info)(
|
1051
|
-
|
923
|
+
if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
|
924
|
+
(0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
|
925
|
+
this.GR = this.GG = this.GB = 1;
|
1052
926
|
}
|
927
|
+
}
|
1053
928
|
|
1054
|
-
|
929
|
+
getRgbItem(src, srcOffset, dest, destOffset) {
|
930
|
+
convertToRgb(this, src, srcOffset, dest, destOffset, 1);
|
1055
931
|
}
|
1056
932
|
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
1065
|
-
var scale = 1 / ((1 << bits) - 1);
|
1066
|
-
|
1067
|
-
for (var i = 0; i < count; ++i) {
|
1068
|
-
convertToRgb(this, src, srcOffset, dest, destOffset, scale);
|
1069
|
-
srcOffset += 3;
|
1070
|
-
destOffset += 3 + alpha01;
|
1071
|
-
}
|
1072
|
-
}
|
1073
|
-
}, {
|
1074
|
-
key: "getOutputLength",
|
1075
|
-
value: function getOutputLength(inputLength, alpha01) {
|
1076
|
-
return inputLength * (3 + alpha01) / 3 | 0;
|
933
|
+
getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
934
|
+
const scale = 1 / ((1 << bits) - 1);
|
935
|
+
|
936
|
+
for (let i = 0; i < count; ++i) {
|
937
|
+
convertToRgb(this, src, srcOffset, dest, destOffset, scale);
|
938
|
+
srcOffset += 3;
|
939
|
+
destOffset += 3 + alpha01;
|
1077
940
|
}
|
1078
|
-
}
|
941
|
+
}
|
942
|
+
|
943
|
+
getOutputLength(inputLength, alpha01) {
|
944
|
+
return inputLength * (3 + alpha01) / 3 | 0;
|
945
|
+
}
|
1079
946
|
|
1080
|
-
|
1081
|
-
}(ColorSpace);
|
947
|
+
}
|
1082
948
|
|
1083
949
|
return CalRGBCS;
|
1084
950
|
}();
|
1085
951
|
|
1086
|
-
|
952
|
+
const LabCS = function LabCSClosure() {
|
1087
953
|
function fn_g(x) {
|
1088
|
-
|
954
|
+
let result;
|
1089
955
|
|
1090
956
|
if (x >= 6 / 29) {
|
1091
957
|
result = x * x * x;
|
@@ -1101,9 +967,9 @@ var LabCS = function LabCSClosure() {
|
|
1101
967
|
}
|
1102
968
|
|
1103
969
|
function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
970
|
+
let Ls = src[srcOffset];
|
971
|
+
let as = src[srcOffset + 1];
|
972
|
+
let bs = src[srcOffset + 2];
|
1107
973
|
|
1108
974
|
if (maxVal !== false) {
|
1109
975
|
Ls = decode(Ls, maxVal, 0, 100);
|
@@ -1111,24 +977,34 @@ var LabCS = function LabCSClosure() {
|
|
1111
977
|
bs = decode(bs, maxVal, cs.bmin, cs.bmax);
|
1112
978
|
}
|
1113
979
|
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
980
|
+
if (as > cs.amax) {
|
981
|
+
as = cs.amax;
|
982
|
+
} else if (as < cs.amin) {
|
983
|
+
as = cs.amin;
|
984
|
+
}
|
985
|
+
|
986
|
+
if (bs > cs.bmax) {
|
987
|
+
bs = cs.bmax;
|
988
|
+
} else if (bs < cs.bmin) {
|
989
|
+
bs = cs.bmin;
|
990
|
+
}
|
991
|
+
|
992
|
+
const M = (Ls + 16) / 116;
|
993
|
+
const L = M + as / 500;
|
994
|
+
const N = M - bs / 200;
|
995
|
+
const X = cs.XW * fn_g(L);
|
996
|
+
const Y = cs.YW * fn_g(M);
|
997
|
+
const Z = cs.ZW * fn_g(N);
|
998
|
+
let r, g, b;
|
1123
999
|
|
1124
1000
|
if (cs.ZW < 1) {
|
1125
|
-
r = X * 3.1339 + Y * -1.
|
1126
|
-
g = X * -0.9785 + Y * 1.
|
1127
|
-
b = X * 0.
|
1001
|
+
r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
|
1002
|
+
g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
|
1003
|
+
b = X * 0.072 + Y * -0.229 + Z * 1.4057;
|
1128
1004
|
} else {
|
1129
1005
|
r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
|
1130
1006
|
g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
|
1131
|
-
b = X * 0.0557 + Y * -0.
|
1007
|
+
b = X * 0.0557 + Y * -0.204 + Z * 1.057;
|
1132
1008
|
}
|
1133
1009
|
|
1134
1010
|
dest[destOffset] = Math.sqrt(r) * 255;
|
@@ -1136,90 +1012,72 @@ var LabCS = function LabCSClosure() {
|
|
1136
1012
|
dest[destOffset + 2] = Math.sqrt(b) * 255;
|
1137
1013
|
}
|
1138
1014
|
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
_inherits(LabCS, _ColorSpace9);
|
1143
|
-
|
1144
|
-
function LabCS(whitePoint, blackPoint, range) {
|
1145
|
-
var _this6;
|
1146
|
-
|
1147
|
-
_classCallCheck(this, LabCS);
|
1148
|
-
|
1149
|
-
_this6 = _possibleConstructorReturn(this, _getPrototypeOf(LabCS).call(this, 'Lab', 3));
|
1015
|
+
class LabCS extends ColorSpace {
|
1016
|
+
constructor(whitePoint, blackPoint, range) {
|
1017
|
+
super("Lab", 3);
|
1150
1018
|
|
1151
1019
|
if (!whitePoint) {
|
1152
|
-
throw new _util.FormatError(
|
1020
|
+
throw new _util.FormatError("WhitePoint missing - required for color space Lab");
|
1153
1021
|
}
|
1154
1022
|
|
1155
1023
|
blackPoint = blackPoint || [0, 0, 0];
|
1156
1024
|
range = range || [-100, 100, -100, 100];
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
if (
|
1169
|
-
throw new _util.FormatError(
|
1025
|
+
this.XW = whitePoint[0];
|
1026
|
+
this.YW = whitePoint[1];
|
1027
|
+
this.ZW = whitePoint[2];
|
1028
|
+
this.amin = range[0];
|
1029
|
+
this.amax = range[1];
|
1030
|
+
this.bmin = range[2];
|
1031
|
+
this.bmax = range[3];
|
1032
|
+
this.XB = blackPoint[0];
|
1033
|
+
this.YB = blackPoint[1];
|
1034
|
+
this.ZB = blackPoint[2];
|
1035
|
+
|
1036
|
+
if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
|
1037
|
+
throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
|
1170
1038
|
}
|
1171
1039
|
|
1172
|
-
if (
|
1173
|
-
(0, _util.info)(
|
1174
|
-
|
1040
|
+
if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
|
1041
|
+
(0, _util.info)("Invalid BlackPoint, falling back to default");
|
1042
|
+
this.XB = this.YB = this.ZB = 0;
|
1175
1043
|
}
|
1176
1044
|
|
1177
|
-
if (
|
1178
|
-
(0, _util.info)(
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1045
|
+
if (this.amin > this.amax || this.bmin > this.bmax) {
|
1046
|
+
(0, _util.info)("Invalid Range, falling back to defaults");
|
1047
|
+
this.amin = -100;
|
1048
|
+
this.amax = 100;
|
1049
|
+
this.bmin = -100;
|
1050
|
+
this.bmax = 100;
|
1183
1051
|
}
|
1052
|
+
}
|
1184
1053
|
|
1185
|
-
|
1054
|
+
getRgbItem(src, srcOffset, dest, destOffset) {
|
1055
|
+
convertToRgb(this, src, srcOffset, false, dest, destOffset);
|
1186
1056
|
}
|
1187
1057
|
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
value: function getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
1196
|
-
var maxVal = (1 << bits) - 1;
|
1197
|
-
|
1198
|
-
for (var i = 0; i < count; i++) {
|
1199
|
-
convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
|
1200
|
-
srcOffset += 3;
|
1201
|
-
destOffset += 3 + alpha01;
|
1202
|
-
}
|
1203
|
-
}
|
1204
|
-
}, {
|
1205
|
-
key: "getOutputLength",
|
1206
|
-
value: function getOutputLength(inputLength, alpha01) {
|
1207
|
-
return inputLength * (3 + alpha01) / 3 | 0;
|
1208
|
-
}
|
1209
|
-
}, {
|
1210
|
-
key: "isDefaultDecode",
|
1211
|
-
value: function isDefaultDecode(decodeMap, bpc) {
|
1212
|
-
return true;
|
1213
|
-
}
|
1214
|
-
}, {
|
1215
|
-
key: "usesZeroToOneRange",
|
1216
|
-
get: function get() {
|
1217
|
-
return (0, _util.shadow)(this, 'usesZeroToOneRange', false);
|
1058
|
+
getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
|
1059
|
+
const maxVal = (1 << bits) - 1;
|
1060
|
+
|
1061
|
+
for (let i = 0; i < count; i++) {
|
1062
|
+
convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
|
1063
|
+
srcOffset += 3;
|
1064
|
+
destOffset += 3 + alpha01;
|
1218
1065
|
}
|
1219
|
-
}
|
1066
|
+
}
|
1220
1067
|
|
1221
|
-
|
1222
|
-
|
1068
|
+
getOutputLength(inputLength, alpha01) {
|
1069
|
+
return inputLength * (3 + alpha01) / 3 | 0;
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
isDefaultDecode(decodeMap, bpc) {
|
1073
|
+
return true;
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
get usesZeroToOneRange() {
|
1077
|
+
return (0, _util.shadow)(this, "usesZeroToOneRange", false);
|
1078
|
+
}
|
1079
|
+
|
1080
|
+
}
|
1223
1081
|
|
1224
1082
|
return LabCS;
|
1225
1083
|
}();
|