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