format-png 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +114 -0
- package/README.md +123 -26
- package/dist/async.d.ts +28 -0
- package/dist/async.js +48 -0
- package/dist/core.d.ts +393 -0
- package/dist/core.js +405 -0
- package/dist/index.d.ts +5 -376
- package/dist/index.js +3 -367
- package/dist/pool.d.ts +82 -0
- package/dist/pool.js +407 -0
- package/dist/port-node.d.ts +3 -0
- package/dist/port-node.js +9 -0
- package/dist/port-web.d.ts +3 -0
- package/dist/port-web.js +7 -0
- package/dist/protocol.d.ts +40 -0
- package/dist/protocol.js +36 -0
- package/dist/spawn-node.d.ts +3 -0
- package/dist/spawn-node.js +9 -0
- package/dist/spawn-web.d.ts +2 -0
- package/dist/spawn-web.js +9 -0
- package/dist/wasm/format_png_wasm.d.ts +127 -68
- package/dist/wasm/format_png_wasm.js +948 -370
- package/dist/wasm/format_png_wasm_bg.wasm.base64.d.ts +3 -0
- package/dist/wasm/format_png_wasm_bg.wasm.base64.js +3 -0
- package/dist/worker.d.ts +1 -0
- package/dist/worker.js +137 -0
- package/package.json +25 -6
- package/dist/wasm/format_png_wasm_bg.wasm +0 -0
- package/dist/wasm/format_png_wasm_bg.wasm.d.ts +0 -93
|
@@ -29,12 +29,16 @@ export class Chunk {
|
|
|
29
29
|
let deferred1_0;
|
|
30
30
|
let deferred1_1;
|
|
31
31
|
try {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
33
|
+
wasm.chunk_chunkType(retptr, this.__wbg_ptr);
|
|
34
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
35
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
36
|
+
deferred1_0 = r0;
|
|
37
|
+
deferred1_1 = r1;
|
|
38
|
+
return getStringFromWasm0(r0, r1);
|
|
36
39
|
} finally {
|
|
37
|
-
wasm.
|
|
40
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
41
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
@@ -42,11 +46,18 @@ export class Chunk {
|
|
|
42
46
|
* @returns {Uint8Array}
|
|
43
47
|
*/
|
|
44
48
|
intoData() {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
try {
|
|
50
|
+
const ptr = this.__destroy_into_raw();
|
|
51
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
52
|
+
wasm.chunk_intoData(retptr, ptr);
|
|
53
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
54
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
55
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
56
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
57
|
+
return v1;
|
|
58
|
+
} finally {
|
|
59
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
60
|
+
}
|
|
50
61
|
}
|
|
51
62
|
/**
|
|
52
63
|
* "before-palette", "before-image-data" or "after-image-data".
|
|
@@ -56,12 +67,16 @@ export class Chunk {
|
|
|
56
67
|
let deferred1_0;
|
|
57
68
|
let deferred1_1;
|
|
58
69
|
try {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
70
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
71
|
+
wasm.chunk_position(retptr, this.__wbg_ptr);
|
|
72
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
73
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
74
|
+
deferred1_0 = r0;
|
|
75
|
+
deferred1_1 = r1;
|
|
76
|
+
return getStringFromWasm0(r0, r1);
|
|
63
77
|
} finally {
|
|
64
|
-
wasm.
|
|
78
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
79
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
65
80
|
}
|
|
66
81
|
}
|
|
67
82
|
}
|
|
@@ -93,10 +108,17 @@ export class ChunkList {
|
|
|
93
108
|
* @returns {Uint32Array}
|
|
94
109
|
*/
|
|
95
110
|
get crcs() {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
111
|
+
try {
|
|
112
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
113
|
+
wasm.chunklist_crcs(retptr, this.__wbg_ptr);
|
|
114
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
115
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
116
|
+
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
117
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
118
|
+
return v1;
|
|
119
|
+
} finally {
|
|
120
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
121
|
+
}
|
|
100
122
|
}
|
|
101
123
|
/**
|
|
102
124
|
* @returns {Header}
|
|
@@ -110,20 +132,34 @@ export class ChunkList {
|
|
|
110
132
|
* @returns {Uint8Array}
|
|
111
133
|
*/
|
|
112
134
|
get known() {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
135
|
+
try {
|
|
136
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
137
|
+
wasm.chunklist_known(retptr, this.__wbg_ptr);
|
|
138
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
139
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
140
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
141
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
142
|
+
return v1;
|
|
143
|
+
} finally {
|
|
144
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
145
|
+
}
|
|
117
146
|
}
|
|
118
147
|
/**
|
|
119
148
|
* The length of each chunk's data.
|
|
120
149
|
* @returns {Uint32Array}
|
|
121
150
|
*/
|
|
122
151
|
get lengths() {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
152
|
+
try {
|
|
153
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
154
|
+
wasm.chunklist_lengths(retptr, this.__wbg_ptr);
|
|
155
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
156
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
157
|
+
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
158
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
159
|
+
return v1;
|
|
160
|
+
} finally {
|
|
161
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
162
|
+
}
|
|
127
163
|
}
|
|
128
164
|
/**
|
|
129
165
|
* @returns {Metadata}
|
|
@@ -137,36 +173,57 @@ export class ChunkList {
|
|
|
137
173
|
* @returns {Uint32Array}
|
|
138
174
|
*/
|
|
139
175
|
get offsets() {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
176
|
+
try {
|
|
177
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
178
|
+
wasm.chunklist_offsets(retptr, this.__wbg_ptr);
|
|
179
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
180
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
181
|
+
var v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
182
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
183
|
+
return v1;
|
|
184
|
+
} finally {
|
|
185
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
186
|
+
}
|
|
144
187
|
}
|
|
145
188
|
/**
|
|
146
189
|
* `PLTE`: red, green and blue for each entry, in index order.
|
|
147
190
|
* @returns {Uint8Array | undefined}
|
|
148
191
|
*/
|
|
149
192
|
get palette() {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
193
|
+
try {
|
|
194
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
195
|
+
wasm.chunklist_palette(retptr, this.__wbg_ptr);
|
|
196
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
197
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
198
|
+
let v1;
|
|
199
|
+
if (r0 !== 0) {
|
|
200
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
201
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
202
|
+
}
|
|
203
|
+
return v1;
|
|
204
|
+
} finally {
|
|
205
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
155
206
|
}
|
|
156
|
-
return v1;
|
|
157
207
|
}
|
|
158
208
|
/**
|
|
159
209
|
* `tRNS`: "gray", "rgb" or "palette".
|
|
160
210
|
* @returns {string | undefined}
|
|
161
211
|
*/
|
|
162
212
|
get transparencyKind() {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
213
|
+
try {
|
|
214
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
215
|
+
wasm.chunklist_transparencyKind(retptr, this.__wbg_ptr);
|
|
216
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
217
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
218
|
+
let v1;
|
|
219
|
+
if (r0 !== 0) {
|
|
220
|
+
v1 = getStringFromWasm0(r0, r1);
|
|
221
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
222
|
+
}
|
|
223
|
+
return v1;
|
|
224
|
+
} finally {
|
|
225
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
168
226
|
}
|
|
169
|
-
return v1;
|
|
170
227
|
}
|
|
171
228
|
/**
|
|
172
229
|
* `tRNS`: the transparent gray value, the transparent red, green and blue,
|
|
@@ -174,13 +231,20 @@ export class ChunkList {
|
|
|
174
231
|
* @returns {Uint16Array | undefined}
|
|
175
232
|
*/
|
|
176
233
|
get transparencyValues() {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
234
|
+
try {
|
|
235
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
236
|
+
wasm.chunklist_transparencyValues(retptr, this.__wbg_ptr);
|
|
237
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
238
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
239
|
+
let v1;
|
|
240
|
+
if (r0 !== 0) {
|
|
241
|
+
v1 = getArrayU16FromWasm0(r0, r1).slice();
|
|
242
|
+
wasm.__wbindgen_export(r0, r1 * 2, 2);
|
|
243
|
+
}
|
|
244
|
+
return v1;
|
|
245
|
+
} finally {
|
|
246
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
182
247
|
}
|
|
183
|
-
return v1;
|
|
184
248
|
}
|
|
185
249
|
/**
|
|
186
250
|
* The four-letter types of every chunk, joined.
|
|
@@ -190,12 +254,16 @@ export class ChunkList {
|
|
|
190
254
|
let deferred1_0;
|
|
191
255
|
let deferred1_1;
|
|
192
256
|
try {
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
257
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
258
|
+
wasm.chunklist_types(retptr, this.__wbg_ptr);
|
|
259
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
260
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
261
|
+
deferred1_0 = r0;
|
|
262
|
+
deferred1_1 = r1;
|
|
263
|
+
return getStringFromWasm0(r0, r1);
|
|
197
264
|
} finally {
|
|
198
|
-
wasm.
|
|
265
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
266
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
199
267
|
}
|
|
200
268
|
}
|
|
201
269
|
}
|
|
@@ -228,11 +296,18 @@ export class DecodedImage {
|
|
|
228
296
|
* @returns {Uint8Array}
|
|
229
297
|
*/
|
|
230
298
|
intoPixels() {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
299
|
+
try {
|
|
300
|
+
const ptr = this.__destroy_into_raw();
|
|
301
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
302
|
+
wasm.decodedimage_intoPixels(retptr, ptr);
|
|
303
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
304
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
305
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
306
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
307
|
+
return v1;
|
|
308
|
+
} finally {
|
|
309
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
310
|
+
}
|
|
236
311
|
}
|
|
237
312
|
/**
|
|
238
313
|
* The parsed ancillary chunks; empty unless `preserveMetadata` was set.
|
|
@@ -248,10 +323,17 @@ export class DecodedImage {
|
|
|
248
323
|
* @returns {Chunk[]}
|
|
249
324
|
*/
|
|
250
325
|
takeChunks() {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
326
|
+
try {
|
|
327
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
328
|
+
wasm.decodedimage_takeChunks(retptr, this.__wbg_ptr);
|
|
329
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
330
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
331
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1);
|
|
332
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
333
|
+
return v1;
|
|
334
|
+
} finally {
|
|
335
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
336
|
+
}
|
|
255
337
|
}
|
|
256
338
|
/**
|
|
257
339
|
* @returns {number}
|
|
@@ -289,26 +371,42 @@ export class Decoder {
|
|
|
289
371
|
* @returns {DecodedImage}
|
|
290
372
|
*/
|
|
291
373
|
decodeRgba8(bytes) {
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
374
|
+
try {
|
|
375
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
376
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
|
|
377
|
+
const len0 = WASM_VECTOR_LEN;
|
|
378
|
+
wasm.decoder_decodeRgba8(retptr, this.__wbg_ptr, ptr0, len0);
|
|
379
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
380
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
381
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
382
|
+
if (r2) {
|
|
383
|
+
throw takeObject(r1);
|
|
384
|
+
}
|
|
385
|
+
return DecodedImage.__wrap(r0);
|
|
386
|
+
} finally {
|
|
387
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
297
388
|
}
|
|
298
|
-
return DecodedImage.__wrap(ret[0]);
|
|
299
389
|
}
|
|
300
390
|
/**
|
|
301
391
|
* @param {Uint8Array} bytes
|
|
302
392
|
* @returns {RawImage}
|
|
303
393
|
*/
|
|
304
394
|
decode(bytes) {
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
395
|
+
try {
|
|
396
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
397
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
|
|
398
|
+
const len0 = WASM_VECTOR_LEN;
|
|
399
|
+
wasm.decoder_decode(retptr, this.__wbg_ptr, ptr0, len0);
|
|
400
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
401
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
402
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
403
|
+
if (r2) {
|
|
404
|
+
throw takeObject(r1);
|
|
405
|
+
}
|
|
406
|
+
return RawImage.__wrap(r0);
|
|
407
|
+
} finally {
|
|
408
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
310
409
|
}
|
|
311
|
-
return RawImage.__wrap(ret[0]);
|
|
312
410
|
}
|
|
313
411
|
/**
|
|
314
412
|
* @param {boolean} validate_crc
|
|
@@ -327,13 +425,21 @@ export class Decoder {
|
|
|
327
425
|
* @returns {ChunkList}
|
|
328
426
|
*/
|
|
329
427
|
readChunks(bytes) {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
428
|
+
try {
|
|
429
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
430
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
|
|
431
|
+
const len0 = WASM_VECTOR_LEN;
|
|
432
|
+
wasm.decoder_readChunks(retptr, this.__wbg_ptr, ptr0, len0);
|
|
433
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
434
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
435
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
436
|
+
if (r2) {
|
|
437
|
+
throw takeObject(r1);
|
|
438
|
+
}
|
|
439
|
+
return ChunkList.__wrap(r0);
|
|
440
|
+
} finally {
|
|
441
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
335
442
|
}
|
|
336
|
-
return ChunkList.__wrap(ret[0]);
|
|
337
443
|
}
|
|
338
444
|
}
|
|
339
445
|
if (Symbol.dispose) Decoder.prototype[Symbol.dispose] = Decoder.prototype.free;
|
|
@@ -362,15 +468,22 @@ export class EncodeImage {
|
|
|
362
468
|
* @param {string} position
|
|
363
469
|
*/
|
|
364
470
|
addChunk(chunk_type, data, position) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
471
|
+
try {
|
|
472
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
473
|
+
const ptr0 = passStringToWasm0(chunk_type, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
474
|
+
const len0 = WASM_VECTOR_LEN;
|
|
475
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export2);
|
|
476
|
+
const len1 = WASM_VECTOR_LEN;
|
|
477
|
+
const ptr2 = passStringToWasm0(position, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
478
|
+
const len2 = WASM_VECTOR_LEN;
|
|
479
|
+
wasm.encodeimage_addChunk(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
480
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
481
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
482
|
+
if (r1) {
|
|
483
|
+
throw takeObject(r0);
|
|
484
|
+
}
|
|
485
|
+
} finally {
|
|
486
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
374
487
|
}
|
|
375
488
|
}
|
|
376
489
|
/**
|
|
@@ -385,19 +498,26 @@ export class EncodeImage {
|
|
|
385
498
|
* @param {boolean} compressed
|
|
386
499
|
*/
|
|
387
500
|
addText(chunk_type, keyword, text, language_tag, translated_keyword, compressed) {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
501
|
+
try {
|
|
502
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
503
|
+
const ptr0 = passStringToWasm0(chunk_type, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
504
|
+
const len0 = WASM_VECTOR_LEN;
|
|
505
|
+
const ptr1 = passStringToWasm0(keyword, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
506
|
+
const len1 = WASM_VECTOR_LEN;
|
|
507
|
+
const ptr2 = passStringToWasm0(text, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
508
|
+
const len2 = WASM_VECTOR_LEN;
|
|
509
|
+
const ptr3 = passStringToWasm0(language_tag, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
510
|
+
const len3 = WASM_VECTOR_LEN;
|
|
511
|
+
const ptr4 = passStringToWasm0(translated_keyword, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
512
|
+
const len4 = WASM_VECTOR_LEN;
|
|
513
|
+
wasm.encodeimage_addText(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, compressed);
|
|
514
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
515
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
516
|
+
if (r1) {
|
|
517
|
+
throw takeObject(r0);
|
|
518
|
+
}
|
|
519
|
+
} finally {
|
|
520
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
401
521
|
}
|
|
402
522
|
}
|
|
403
523
|
/**
|
|
@@ -411,28 +531,43 @@ export class EncodeImage {
|
|
|
411
531
|
* @param {Uint8Array} data
|
|
412
532
|
*/
|
|
413
533
|
constructor(width, height, bit_depth, color_type, interlaced, data) {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
534
|
+
try {
|
|
535
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
536
|
+
const ptr0 = passStringToWasm0(color_type, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
537
|
+
const len0 = WASM_VECTOR_LEN;
|
|
538
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export2);
|
|
539
|
+
const len1 = WASM_VECTOR_LEN;
|
|
540
|
+
wasm.encodeimage_new(retptr, width, height, bit_depth, ptr0, len0, interlaced, ptr1, len1);
|
|
541
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
542
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
543
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
544
|
+
if (r2) {
|
|
545
|
+
throw takeObject(r1);
|
|
546
|
+
}
|
|
547
|
+
this.__wbg_ptr = r0;
|
|
548
|
+
EncodeImageFinalization.register(this, this.__wbg_ptr, this);
|
|
549
|
+
return this;
|
|
550
|
+
} finally {
|
|
551
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
421
552
|
}
|
|
422
|
-
this.__wbg_ptr = ret[0];
|
|
423
|
-
EncodeImageFinalization.register(this, this.__wbg_ptr, this);
|
|
424
|
-
return this;
|
|
425
553
|
}
|
|
426
554
|
/**
|
|
427
555
|
* `cHRM`: white, red, green and blue x and y, in that order, as fractions.
|
|
428
556
|
* @param {Float64Array} values
|
|
429
557
|
*/
|
|
430
558
|
setChromaticities(values) {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
559
|
+
try {
|
|
560
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
561
|
+
const ptr0 = passArrayF64ToWasm0(values, wasm.__wbindgen_export2);
|
|
562
|
+
const len0 = WASM_VECTOR_LEN;
|
|
563
|
+
wasm.encodeimage_setChromaticities(retptr, this.__wbg_ptr, ptr0, len0);
|
|
564
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
565
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
566
|
+
if (r1) {
|
|
567
|
+
throw takeObject(r0);
|
|
568
|
+
}
|
|
569
|
+
} finally {
|
|
570
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
436
571
|
}
|
|
437
572
|
}
|
|
438
573
|
/**
|
|
@@ -451,11 +586,18 @@ export class EncodeImage {
|
|
|
451
586
|
* @param {Uint8Array} data
|
|
452
587
|
*/
|
|
453
588
|
setExif(data) {
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
589
|
+
try {
|
|
590
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
591
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_export2);
|
|
592
|
+
const len0 = WASM_VECTOR_LEN;
|
|
593
|
+
wasm.encodeimage_setExif(retptr, this.__wbg_ptr, ptr0, len0);
|
|
594
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
595
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
596
|
+
if (r1) {
|
|
597
|
+
throw takeObject(r0);
|
|
598
|
+
}
|
|
599
|
+
} finally {
|
|
600
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
459
601
|
}
|
|
460
602
|
}
|
|
461
603
|
/**
|
|
@@ -463,9 +605,16 @@ export class EncodeImage {
|
|
|
463
605
|
* @param {number} gamma
|
|
464
606
|
*/
|
|
465
607
|
setGamma(gamma) {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
608
|
+
try {
|
|
609
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
610
|
+
wasm.encodeimage_setGamma(retptr, this.__wbg_ptr, gamma);
|
|
611
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
612
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
613
|
+
if (r1) {
|
|
614
|
+
throw takeObject(r0);
|
|
615
|
+
}
|
|
616
|
+
} finally {
|
|
617
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
469
618
|
}
|
|
470
619
|
}
|
|
471
620
|
/**
|
|
@@ -475,9 +624,9 @@ export class EncodeImage {
|
|
|
475
624
|
* @param {Uint8Array} profile
|
|
476
625
|
*/
|
|
477
626
|
setIccProfile(name, profile) {
|
|
478
|
-
const ptr0 = passStringToWasm0(name, wasm.
|
|
627
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
479
628
|
const len0 = WASM_VECTOR_LEN;
|
|
480
|
-
const ptr1 = passArray8ToWasm0(profile, wasm.
|
|
629
|
+
const ptr1 = passArray8ToWasm0(profile, wasm.__wbindgen_export2);
|
|
481
630
|
const len1 = WASM_VECTOR_LEN;
|
|
482
631
|
wasm.encodeimage_setIccProfile(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
483
632
|
}
|
|
@@ -486,11 +635,18 @@ export class EncodeImage {
|
|
|
486
635
|
* @param {Uint8Array} colors
|
|
487
636
|
*/
|
|
488
637
|
setPalette(colors) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
638
|
+
try {
|
|
639
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
640
|
+
const ptr0 = passArray8ToWasm0(colors, wasm.__wbindgen_export2);
|
|
641
|
+
const len0 = WASM_VECTOR_LEN;
|
|
642
|
+
wasm.encodeimage_setPalette(retptr, this.__wbg_ptr, ptr0, len0);
|
|
643
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
644
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
645
|
+
if (r1) {
|
|
646
|
+
throw takeObject(r0);
|
|
647
|
+
}
|
|
648
|
+
} finally {
|
|
649
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
494
650
|
}
|
|
495
651
|
}
|
|
496
652
|
/**
|
|
@@ -500,11 +656,18 @@ export class EncodeImage {
|
|
|
500
656
|
* @param {string} unit
|
|
501
657
|
*/
|
|
502
658
|
setPhysicalDimensions(x, y, unit) {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
659
|
+
try {
|
|
660
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
661
|
+
const ptr0 = passStringToWasm0(unit, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
662
|
+
const len0 = WASM_VECTOR_LEN;
|
|
663
|
+
wasm.encodeimage_setPhysicalDimensions(retptr, this.__wbg_ptr, x, y, ptr0, len0);
|
|
664
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
665
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
666
|
+
if (r1) {
|
|
667
|
+
throw takeObject(r0);
|
|
668
|
+
}
|
|
669
|
+
} finally {
|
|
670
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
508
671
|
}
|
|
509
672
|
}
|
|
510
673
|
/**
|
|
@@ -512,11 +675,18 @@ export class EncodeImage {
|
|
|
512
675
|
* @param {string} intent
|
|
513
676
|
*/
|
|
514
677
|
setSrgb(intent) {
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
678
|
+
try {
|
|
679
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
680
|
+
const ptr0 = passStringToWasm0(intent, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
681
|
+
const len0 = WASM_VECTOR_LEN;
|
|
682
|
+
wasm.encodeimage_setSrgb(retptr, this.__wbg_ptr, ptr0, len0);
|
|
683
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
684
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
685
|
+
if (r1) {
|
|
686
|
+
throw takeObject(r0);
|
|
687
|
+
}
|
|
688
|
+
} finally {
|
|
689
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
520
690
|
}
|
|
521
691
|
}
|
|
522
692
|
/**
|
|
@@ -539,13 +709,20 @@ export class EncodeImage {
|
|
|
539
709
|
* @param {Uint16Array} values
|
|
540
710
|
*/
|
|
541
711
|
setTransparency(kind, values) {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
712
|
+
try {
|
|
713
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
714
|
+
const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
715
|
+
const len0 = WASM_VECTOR_LEN;
|
|
716
|
+
const ptr1 = passArray16ToWasm0(values, wasm.__wbindgen_export2);
|
|
717
|
+
const len1 = WASM_VECTOR_LEN;
|
|
718
|
+
wasm.encodeimage_setTransparency(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
719
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
720
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
721
|
+
if (r1) {
|
|
722
|
+
throw takeObject(r0);
|
|
723
|
+
}
|
|
724
|
+
} finally {
|
|
725
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
549
726
|
}
|
|
550
727
|
}
|
|
551
728
|
}
|
|
@@ -570,42 +747,88 @@ export class Encoder {
|
|
|
570
747
|
* @returns {Uint8Array}
|
|
571
748
|
*/
|
|
572
749
|
encode(image) {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
750
|
+
try {
|
|
751
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
752
|
+
_assertClass(image, EncodeImage);
|
|
753
|
+
wasm.encoder_encode(retptr, this.__wbg_ptr, image.__wbg_ptr);
|
|
754
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
755
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
756
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
757
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
758
|
+
if (r3) {
|
|
759
|
+
throw takeObject(r2);
|
|
760
|
+
}
|
|
761
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
762
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
763
|
+
return v1;
|
|
764
|
+
} finally {
|
|
765
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
577
766
|
}
|
|
578
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
579
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
580
|
-
return v1;
|
|
581
767
|
}
|
|
582
768
|
/**
|
|
583
769
|
* `compression` is 0 to 9. `compressionStrategy` is "dynamic", "fixed" or
|
|
584
770
|
* "stored"; `filter` is "adaptive", "none", "sub", "up", "average" or
|
|
585
|
-
* "paeth"; `palette` is "keep" or "auto"; `strip` is "keep", "safe" or
|
|
771
|
+
* "paeth"; `palette` is "keep" or "auto"; `strip` is "keep", "safe" or
|
|
772
|
+
* "all"; `threads` is "single" or "auto". WebAssembly has no threads, so
|
|
773
|
+
* "auto" compresses the image data in segments on this thread: the same
|
|
774
|
+
* file as `format_png::Threads::Auto` writes natively.
|
|
586
775
|
* @param {number} compression
|
|
587
776
|
* @param {string} compression_strategy
|
|
588
777
|
* @param {string} filter
|
|
589
778
|
* @param {boolean} keep_unsafe_chunks
|
|
590
779
|
* @param {string} palette
|
|
591
780
|
* @param {string} strip
|
|
781
|
+
* @param {string} threads
|
|
592
782
|
*/
|
|
593
|
-
constructor(compression, compression_strategy, filter, keep_unsafe_chunks, palette, strip) {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
783
|
+
constructor(compression, compression_strategy, filter, keep_unsafe_chunks, palette, strip, threads) {
|
|
784
|
+
try {
|
|
785
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
786
|
+
const ptr0 = passStringToWasm0(compression_strategy, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
787
|
+
const len0 = WASM_VECTOR_LEN;
|
|
788
|
+
const ptr1 = passStringToWasm0(filter, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
789
|
+
const len1 = WASM_VECTOR_LEN;
|
|
790
|
+
const ptr2 = passStringToWasm0(palette, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
791
|
+
const len2 = WASM_VECTOR_LEN;
|
|
792
|
+
const ptr3 = passStringToWasm0(strip, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
793
|
+
const len3 = WASM_VECTOR_LEN;
|
|
794
|
+
const ptr4 = passStringToWasm0(threads, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
795
|
+
const len4 = WASM_VECTOR_LEN;
|
|
796
|
+
wasm.encoder_new(retptr, compression, ptr0, len0, ptr1, len1, keep_unsafe_chunks, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
797
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
798
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
799
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
800
|
+
if (r2) {
|
|
801
|
+
throw takeObject(r1);
|
|
802
|
+
}
|
|
803
|
+
this.__wbg_ptr = r0;
|
|
804
|
+
EncoderFinalization.register(this, this.__wbg_ptr, this);
|
|
805
|
+
return this;
|
|
806
|
+
} finally {
|
|
807
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Everything `encode` does except compressing the image data, which is
|
|
812
|
+
* left in segments to compress anywhere, such as in other Web Workers.
|
|
813
|
+
* Always in segments, whatever `threads` says.
|
|
814
|
+
* @param {EncodeImage} image
|
|
815
|
+
* @returns {Prepared}
|
|
816
|
+
*/
|
|
817
|
+
prepare(image) {
|
|
818
|
+
try {
|
|
819
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
820
|
+
_assertClass(image, EncodeImage);
|
|
821
|
+
wasm.encoder_prepare(retptr, this.__wbg_ptr, image.__wbg_ptr);
|
|
822
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
823
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
824
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
825
|
+
if (r2) {
|
|
826
|
+
throw takeObject(r1);
|
|
827
|
+
}
|
|
828
|
+
return Prepared.__wrap(r0);
|
|
829
|
+
} finally {
|
|
830
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
605
831
|
}
|
|
606
|
-
this.__wbg_ptr = ret[0];
|
|
607
|
-
EncoderFinalization.register(this, this.__wbg_ptr, this);
|
|
608
|
-
return this;
|
|
609
832
|
}
|
|
610
833
|
}
|
|
611
834
|
if (Symbol.dispose) Encoder.prototype[Symbol.dispose] = Encoder.prototype.free;
|
|
@@ -666,12 +889,16 @@ export class Header {
|
|
|
666
889
|
let deferred1_0;
|
|
667
890
|
let deferred1_1;
|
|
668
891
|
try {
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
892
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
893
|
+
wasm.header_colorType(retptr, this.__wbg_ptr);
|
|
894
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
895
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
896
|
+
deferred1_0 = r0;
|
|
897
|
+
deferred1_1 = r1;
|
|
898
|
+
return getStringFromWasm0(r0, r1);
|
|
673
899
|
} finally {
|
|
674
|
-
wasm.
|
|
900
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
901
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
675
902
|
}
|
|
676
903
|
}
|
|
677
904
|
}
|
|
@@ -702,13 +929,20 @@ export class Metadata {
|
|
|
702
929
|
* @returns {Float64Array | undefined}
|
|
703
930
|
*/
|
|
704
931
|
get chromaticities() {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
932
|
+
try {
|
|
933
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
934
|
+
wasm.metadata_chromaticities(retptr, this.__wbg_ptr);
|
|
935
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
936
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
937
|
+
let v1;
|
|
938
|
+
if (r0 !== 0) {
|
|
939
|
+
v1 = getArrayF64FromWasm0(r0, r1).slice();
|
|
940
|
+
wasm.__wbindgen_export(r0, r1 * 8, 8);
|
|
941
|
+
}
|
|
942
|
+
return v1;
|
|
943
|
+
} finally {
|
|
944
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
710
945
|
}
|
|
711
|
-
return v1;
|
|
712
946
|
}
|
|
713
947
|
/**
|
|
714
948
|
* `cICP`: color primaries, transfer function, matrix coefficients and the
|
|
@@ -716,139 +950,334 @@ export class Metadata {
|
|
|
716
950
|
* @returns {Uint8Array | undefined}
|
|
717
951
|
*/
|
|
718
952
|
get cicp() {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
953
|
+
try {
|
|
954
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
955
|
+
wasm.metadata_cicp(retptr, this.__wbg_ptr);
|
|
956
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
957
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
958
|
+
let v1;
|
|
959
|
+
if (r0 !== 0) {
|
|
960
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
961
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
962
|
+
}
|
|
963
|
+
return v1;
|
|
964
|
+
} finally {
|
|
965
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
724
966
|
}
|
|
725
|
-
return v1;
|
|
726
967
|
}
|
|
727
968
|
/**
|
|
728
969
|
* `eXIf`: "big-endian" or "little-endian".
|
|
729
970
|
* @returns {string | undefined}
|
|
730
971
|
*/
|
|
731
972
|
get exifByteOrder() {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
973
|
+
try {
|
|
974
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
975
|
+
wasm.metadata_exifByteOrder(retptr, this.__wbg_ptr);
|
|
976
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
977
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
978
|
+
let v1;
|
|
979
|
+
if (r0 !== 0) {
|
|
980
|
+
v1 = getStringFromWasm0(r0, r1);
|
|
981
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
982
|
+
}
|
|
983
|
+
return v1;
|
|
984
|
+
} finally {
|
|
985
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
737
986
|
}
|
|
738
|
-
return v1;
|
|
739
987
|
}
|
|
740
988
|
/**
|
|
741
989
|
* `eXIf`: the Exif data, raw, starting with its TIFF header.
|
|
742
990
|
* @returns {Uint8Array | undefined}
|
|
743
991
|
*/
|
|
744
992
|
get exif() {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
993
|
+
try {
|
|
994
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
995
|
+
wasm.metadata_exif(retptr, this.__wbg_ptr);
|
|
996
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
997
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
998
|
+
let v1;
|
|
999
|
+
if (r0 !== 0) {
|
|
1000
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1001
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1002
|
+
}
|
|
1003
|
+
return v1;
|
|
1004
|
+
} finally {
|
|
1005
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
750
1006
|
}
|
|
751
|
-
return v1;
|
|
752
1007
|
}
|
|
753
1008
|
/**
|
|
754
1009
|
* `gAMA`, for example 0.45455.
|
|
755
1010
|
* @returns {number | undefined}
|
|
756
1011
|
*/
|
|
757
1012
|
get gamma() {
|
|
758
|
-
|
|
759
|
-
|
|
1013
|
+
try {
|
|
1014
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1015
|
+
wasm.metadata_gamma(retptr, this.__wbg_ptr);
|
|
1016
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1017
|
+
var r2 = getDataViewMemory0().getFloat64(retptr + 8 * 1, true);
|
|
1018
|
+
return r0 === 0 ? undefined : r2;
|
|
1019
|
+
} finally {
|
|
1020
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1021
|
+
}
|
|
760
1022
|
}
|
|
761
1023
|
/**
|
|
762
1024
|
* `iCCP`: the profile's name.
|
|
763
1025
|
* @returns {string | undefined}
|
|
764
1026
|
*/
|
|
765
1027
|
get iccProfileName() {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
1028
|
+
try {
|
|
1029
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1030
|
+
wasm.metadata_iccProfileName(retptr, this.__wbg_ptr);
|
|
1031
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1032
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1033
|
+
let v1;
|
|
1034
|
+
if (r0 !== 0) {
|
|
1035
|
+
v1 = getStringFromWasm0(r0, r1);
|
|
1036
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1037
|
+
}
|
|
1038
|
+
return v1;
|
|
1039
|
+
} finally {
|
|
1040
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
771
1041
|
}
|
|
772
|
-
return v1;
|
|
773
1042
|
}
|
|
774
1043
|
/**
|
|
775
1044
|
* `iCCP`: the ICC profile, decompressed.
|
|
776
1045
|
* @returns {Uint8Array | undefined}
|
|
777
1046
|
*/
|
|
778
1047
|
get iccProfile() {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
1048
|
+
try {
|
|
1049
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1050
|
+
wasm.metadata_iccProfile(retptr, this.__wbg_ptr);
|
|
1051
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1052
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1053
|
+
let v1;
|
|
1054
|
+
if (r0 !== 0) {
|
|
1055
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1056
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1057
|
+
}
|
|
1058
|
+
return v1;
|
|
1059
|
+
} finally {
|
|
1060
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
784
1061
|
}
|
|
785
|
-
return v1;
|
|
786
1062
|
}
|
|
787
1063
|
/**
|
|
788
1064
|
* `pHYs`: pixels per unit, x then y.
|
|
789
1065
|
* @returns {Uint32Array | undefined}
|
|
790
1066
|
*/
|
|
791
1067
|
get physicalPixelsPerUnit() {
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
1068
|
+
try {
|
|
1069
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1070
|
+
wasm.metadata_physicalPixelsPerUnit(retptr, this.__wbg_ptr);
|
|
1071
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1072
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1073
|
+
let v1;
|
|
1074
|
+
if (r0 !== 0) {
|
|
1075
|
+
v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
1076
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
1077
|
+
}
|
|
1078
|
+
return v1;
|
|
1079
|
+
} finally {
|
|
1080
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
797
1081
|
}
|
|
798
|
-
return v1;
|
|
799
1082
|
}
|
|
800
1083
|
/**
|
|
801
1084
|
* `pHYs` unit: "meter" or "unknown" (the values are only an aspect ratio).
|
|
802
1085
|
* @returns {string | undefined}
|
|
803
1086
|
*/
|
|
804
1087
|
get physicalUnit() {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
1088
|
+
try {
|
|
1089
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1090
|
+
wasm.metadata_physicalUnit(retptr, this.__wbg_ptr);
|
|
1091
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1092
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1093
|
+
let v1;
|
|
1094
|
+
if (r0 !== 0) {
|
|
1095
|
+
v1 = getStringFromWasm0(r0, r1);
|
|
1096
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1097
|
+
}
|
|
1098
|
+
return v1;
|
|
1099
|
+
} finally {
|
|
1100
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
810
1101
|
}
|
|
811
|
-
return v1;
|
|
812
1102
|
}
|
|
813
1103
|
/**
|
|
814
1104
|
* `sRGB`: "perceptual", "relative-colorimetric", "saturation" or "absolute-colorimetric".
|
|
815
1105
|
* @returns {string | undefined}
|
|
816
1106
|
*/
|
|
817
1107
|
get srgb() {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
1108
|
+
try {
|
|
1109
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1110
|
+
wasm.metadata_srgb(retptr, this.__wbg_ptr);
|
|
1111
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1112
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1113
|
+
let v1;
|
|
1114
|
+
if (r0 !== 0) {
|
|
1115
|
+
v1 = getStringFromWasm0(r0, r1);
|
|
1116
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1117
|
+
}
|
|
1118
|
+
return v1;
|
|
1119
|
+
} finally {
|
|
1120
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
823
1121
|
}
|
|
824
|
-
return v1;
|
|
825
1122
|
}
|
|
826
1123
|
/**
|
|
827
1124
|
* `tEXt`, `zTXt` and `iTXt`, in file order.
|
|
828
1125
|
* @returns {Text[]}
|
|
829
1126
|
*/
|
|
830
1127
|
text() {
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
1128
|
+
try {
|
|
1129
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1130
|
+
wasm.metadata_text(retptr, this.__wbg_ptr);
|
|
1131
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1132
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1133
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1);
|
|
1134
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
1135
|
+
return v1;
|
|
1136
|
+
} finally {
|
|
1137
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1138
|
+
}
|
|
835
1139
|
}
|
|
836
1140
|
/**
|
|
837
1141
|
* `tIME`: year, month, day, hour, minute and second, in UTC.
|
|
838
1142
|
* @returns {Uint16Array | undefined}
|
|
839
1143
|
*/
|
|
840
1144
|
get time() {
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1145
|
+
try {
|
|
1146
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1147
|
+
wasm.metadata_time(retptr, this.__wbg_ptr);
|
|
1148
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1149
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1150
|
+
let v1;
|
|
1151
|
+
if (r0 !== 0) {
|
|
1152
|
+
v1 = getArrayU16FromWasm0(r0, r1).slice();
|
|
1153
|
+
wasm.__wbindgen_export(r0, r1 * 2, 2);
|
|
1154
|
+
}
|
|
1155
|
+
return v1;
|
|
1156
|
+
} finally {
|
|
1157
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
846
1158
|
}
|
|
847
|
-
return v1;
|
|
848
1159
|
}
|
|
849
1160
|
}
|
|
850
1161
|
if (Symbol.dispose) Metadata.prototype[Symbol.dispose] = Metadata.prototype.free;
|
|
851
1162
|
|
|
1163
|
+
/**
|
|
1164
|
+
* An image from `Encoder.prepare`, waiting for its segments to be compressed.
|
|
1165
|
+
* Copy each `segment(i)` out, compress it with `compressSegment`, pass the
|
|
1166
|
+
* results to `pushCompressed` in segment order, then call `finish()`. Call
|
|
1167
|
+
* `free()` when done with it, finished or not.
|
|
1168
|
+
*/
|
|
1169
|
+
export class Prepared {
|
|
1170
|
+
static __wrap(ptr) {
|
|
1171
|
+
const obj = Object.create(Prepared.prototype);
|
|
1172
|
+
obj.__wbg_ptr = ptr;
|
|
1173
|
+
PreparedFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1174
|
+
return obj;
|
|
1175
|
+
}
|
|
1176
|
+
__destroy_into_raw() {
|
|
1177
|
+
const ptr = this.__wbg_ptr;
|
|
1178
|
+
this.__wbg_ptr = 0;
|
|
1179
|
+
PreparedFinalization.unregister(this);
|
|
1180
|
+
return ptr;
|
|
1181
|
+
}
|
|
1182
|
+
free() {
|
|
1183
|
+
const ptr = this.__destroy_into_raw();
|
|
1184
|
+
wasm.__wbg_prepared_free(ptr, 0);
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* The level to pass to `compressSegment`.
|
|
1188
|
+
* @returns {number}
|
|
1189
|
+
*/
|
|
1190
|
+
get compressionLevel() {
|
|
1191
|
+
const ret = wasm.prepared_compressionLevel(this.__wbg_ptr);
|
|
1192
|
+
return ret;
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* The strategy to pass to `compressSegment`: "dynamic", "fixed" or "stored".
|
|
1196
|
+
* @returns {string}
|
|
1197
|
+
*/
|
|
1198
|
+
get compressionStrategy() {
|
|
1199
|
+
let deferred1_0;
|
|
1200
|
+
let deferred1_1;
|
|
1201
|
+
try {
|
|
1202
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1203
|
+
wasm.prepared_compressionStrategy(retptr, this.__wbg_ptr);
|
|
1204
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1205
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1206
|
+
deferred1_0 = r0;
|
|
1207
|
+
deferred1_1 = r1;
|
|
1208
|
+
return getStringFromWasm0(r0, r1);
|
|
1209
|
+
} finally {
|
|
1210
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1211
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* Joins the compressed segments into the PNG. Only once: afterwards the
|
|
1216
|
+
* other methods throw.
|
|
1217
|
+
* @returns {Uint8Array}
|
|
1218
|
+
*/
|
|
1219
|
+
finish() {
|
|
1220
|
+
try {
|
|
1221
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1222
|
+
wasm.prepared_finish(retptr, this.__wbg_ptr);
|
|
1223
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1224
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1225
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1226
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1227
|
+
if (r3) {
|
|
1228
|
+
throw takeObject(r2);
|
|
1229
|
+
}
|
|
1230
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1231
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1232
|
+
return v1;
|
|
1233
|
+
} finally {
|
|
1234
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Adds the next compressed segment, in segment order.
|
|
1239
|
+
* @param {Uint8Array} segment
|
|
1240
|
+
*/
|
|
1241
|
+
pushCompressed(segment) {
|
|
1242
|
+
const ptr0 = passArray8ToWasm0(segment, wasm.__wbindgen_export2);
|
|
1243
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1244
|
+
wasm.prepared_pushCompressed(this.__wbg_ptr, ptr0, len0);
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* 0 for images with 1 MiB of filtered data or less, which are already
|
|
1248
|
+
* encoded: call `finish()` for the PNG.
|
|
1249
|
+
* @returns {number}
|
|
1250
|
+
*/
|
|
1251
|
+
get segmentCount() {
|
|
1252
|
+
const ret = wasm.prepared_segmentCount(this.__wbg_ptr);
|
|
1253
|
+
return ret >>> 0;
|
|
1254
|
+
}
|
|
1255
|
+
/**
|
|
1256
|
+
* Segment `index`, copied out of WebAssembly memory.
|
|
1257
|
+
* @param {number} index
|
|
1258
|
+
* @returns {Uint8Array}
|
|
1259
|
+
*/
|
|
1260
|
+
segment(index) {
|
|
1261
|
+
try {
|
|
1262
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1263
|
+
wasm.prepared_segment(retptr, this.__wbg_ptr, index);
|
|
1264
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1265
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1266
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1267
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1268
|
+
if (r3) {
|
|
1269
|
+
throw takeObject(r2);
|
|
1270
|
+
}
|
|
1271
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1272
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1273
|
+
return v1;
|
|
1274
|
+
} finally {
|
|
1275
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
if (Symbol.dispose) Prepared.prototype[Symbol.dispose] = Prepared.prototype.free;
|
|
1280
|
+
|
|
852
1281
|
/**
|
|
853
1282
|
* A decoded image in the file's own format, from `decode`. JavaScript reads
|
|
854
1283
|
* the header, palette, transparency, `metadata()` and `takeChunks()`, then
|
|
@@ -885,11 +1314,18 @@ export class RawImage {
|
|
|
885
1314
|
* @returns {Uint8Array}
|
|
886
1315
|
*/
|
|
887
1316
|
intoData() {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
1317
|
+
try {
|
|
1318
|
+
const ptr = this.__destroy_into_raw();
|
|
1319
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1320
|
+
wasm.rawimage_intoData(retptr, ptr);
|
|
1321
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1322
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1323
|
+
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1324
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1325
|
+
return v1;
|
|
1326
|
+
} finally {
|
|
1327
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1328
|
+
}
|
|
893
1329
|
}
|
|
894
1330
|
/**
|
|
895
1331
|
* The parsed ancillary chunks; empty unless `preserveMetadata` was set.
|
|
@@ -904,49 +1340,77 @@ export class RawImage {
|
|
|
904
1340
|
* @returns {Uint8Array | undefined}
|
|
905
1341
|
*/
|
|
906
1342
|
get palette() {
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1343
|
+
try {
|
|
1344
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1345
|
+
wasm.rawimage_palette(retptr, this.__wbg_ptr);
|
|
1346
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1347
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1348
|
+
let v1;
|
|
1349
|
+
if (r0 !== 0) {
|
|
1350
|
+
v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1351
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1352
|
+
}
|
|
1353
|
+
return v1;
|
|
1354
|
+
} finally {
|
|
1355
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
912
1356
|
}
|
|
913
|
-
return v1;
|
|
914
1357
|
}
|
|
915
1358
|
/**
|
|
916
1359
|
* The raw ancillary chunks; empty unless `preserveChunks` was set.
|
|
917
1360
|
* @returns {Chunk[]}
|
|
918
1361
|
*/
|
|
919
1362
|
takeChunks() {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1363
|
+
try {
|
|
1364
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1365
|
+
wasm.rawimage_takeChunks(retptr, this.__wbg_ptr);
|
|
1366
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1367
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1368
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1);
|
|
1369
|
+
wasm.__wbindgen_export(r0, r1 * 4, 4);
|
|
1370
|
+
return v1;
|
|
1371
|
+
} finally {
|
|
1372
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1373
|
+
}
|
|
924
1374
|
}
|
|
925
1375
|
/**
|
|
926
1376
|
* `tRNS`: "gray", "rgb" or "palette".
|
|
927
1377
|
* @returns {string | undefined}
|
|
928
1378
|
*/
|
|
929
1379
|
get transparencyKind() {
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
1380
|
+
try {
|
|
1381
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1382
|
+
wasm.rawimage_transparencyKind(retptr, this.__wbg_ptr);
|
|
1383
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1384
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1385
|
+
let v1;
|
|
1386
|
+
if (r0 !== 0) {
|
|
1387
|
+
v1 = getStringFromWasm0(r0, r1);
|
|
1388
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1389
|
+
}
|
|
1390
|
+
return v1;
|
|
1391
|
+
} finally {
|
|
1392
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
935
1393
|
}
|
|
936
|
-
return v1;
|
|
937
1394
|
}
|
|
938
1395
|
/**
|
|
939
1396
|
* `tRNS`, as `ChunkList.transparencyValues`.
|
|
940
1397
|
* @returns {Uint16Array | undefined}
|
|
941
1398
|
*/
|
|
942
1399
|
get transparencyValues() {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1400
|
+
try {
|
|
1401
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1402
|
+
wasm.rawimage_transparencyValues(retptr, this.__wbg_ptr);
|
|
1403
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1404
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1405
|
+
let v1;
|
|
1406
|
+
if (r0 !== 0) {
|
|
1407
|
+
v1 = getArrayU16FromWasm0(r0, r1).slice();
|
|
1408
|
+
wasm.__wbindgen_export(r0, r1 * 2, 2);
|
|
1409
|
+
}
|
|
1410
|
+
return v1;
|
|
1411
|
+
} finally {
|
|
1412
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
948
1413
|
}
|
|
949
|
-
return v1;
|
|
950
1414
|
}
|
|
951
1415
|
}
|
|
952
1416
|
if (Symbol.dispose) RawImage.prototype[Symbol.dispose] = RawImage.prototype.free;
|
|
@@ -980,12 +1444,16 @@ export class Text {
|
|
|
980
1444
|
let deferred1_0;
|
|
981
1445
|
let deferred1_1;
|
|
982
1446
|
try {
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
1447
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1448
|
+
wasm.text_chunkType(retptr, this.__wbg_ptr);
|
|
1449
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1450
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1451
|
+
deferred1_0 = r0;
|
|
1452
|
+
deferred1_1 = r1;
|
|
1453
|
+
return getStringFromWasm0(r0, r1);
|
|
987
1454
|
} finally {
|
|
988
|
-
wasm.
|
|
1455
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1456
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
989
1457
|
}
|
|
990
1458
|
}
|
|
991
1459
|
/**
|
|
@@ -1003,12 +1471,16 @@ export class Text {
|
|
|
1003
1471
|
let deferred1_0;
|
|
1004
1472
|
let deferred1_1;
|
|
1005
1473
|
try {
|
|
1006
|
-
const
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1474
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1475
|
+
wasm.text_keyword(retptr, this.__wbg_ptr);
|
|
1476
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1477
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1478
|
+
deferred1_0 = r0;
|
|
1479
|
+
deferred1_1 = r1;
|
|
1480
|
+
return getStringFromWasm0(r0, r1);
|
|
1010
1481
|
} finally {
|
|
1011
|
-
wasm.
|
|
1482
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1483
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
1012
1484
|
}
|
|
1013
1485
|
}
|
|
1014
1486
|
/**
|
|
@@ -1018,12 +1490,16 @@ export class Text {
|
|
|
1018
1490
|
let deferred1_0;
|
|
1019
1491
|
let deferred1_1;
|
|
1020
1492
|
try {
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1493
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1494
|
+
wasm.text_languageTag(retptr, this.__wbg_ptr);
|
|
1495
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1496
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1497
|
+
deferred1_0 = r0;
|
|
1498
|
+
deferred1_1 = r1;
|
|
1499
|
+
return getStringFromWasm0(r0, r1);
|
|
1025
1500
|
} finally {
|
|
1026
|
-
wasm.
|
|
1501
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1502
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
1027
1503
|
}
|
|
1028
1504
|
}
|
|
1029
1505
|
/**
|
|
@@ -1033,12 +1509,16 @@ export class Text {
|
|
|
1033
1509
|
let deferred1_0;
|
|
1034
1510
|
let deferred1_1;
|
|
1035
1511
|
try {
|
|
1036
|
-
const
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1512
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1513
|
+
wasm.text_text(retptr, this.__wbg_ptr);
|
|
1514
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1515
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1516
|
+
deferred1_0 = r0;
|
|
1517
|
+
deferred1_1 = r1;
|
|
1518
|
+
return getStringFromWasm0(r0, r1);
|
|
1040
1519
|
} finally {
|
|
1041
|
-
wasm.
|
|
1520
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1521
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
1042
1522
|
}
|
|
1043
1523
|
}
|
|
1044
1524
|
/**
|
|
@@ -1048,17 +1528,52 @@ export class Text {
|
|
|
1048
1528
|
let deferred1_0;
|
|
1049
1529
|
let deferred1_1;
|
|
1050
1530
|
try {
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1531
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1532
|
+
wasm.text_translatedKeyword(retptr, this.__wbg_ptr);
|
|
1533
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1534
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1535
|
+
deferred1_0 = r0;
|
|
1536
|
+
deferred1_1 = r1;
|
|
1537
|
+
return getStringFromWasm0(r0, r1);
|
|
1055
1538
|
} finally {
|
|
1056
|
-
wasm.
|
|
1539
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1540
|
+
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
1057
1541
|
}
|
|
1058
1542
|
}
|
|
1059
1543
|
}
|
|
1060
1544
|
if (Symbol.dispose) Text.prototype[Symbol.dispose] = Text.prototype.free;
|
|
1061
1545
|
|
|
1546
|
+
/**
|
|
1547
|
+
* Compresses one segment of a `Prepared`, with its `compressionLevel` and
|
|
1548
|
+
* `compressionStrategy`. The same result in any WebAssembly instance.
|
|
1549
|
+
* @param {Uint8Array} segment
|
|
1550
|
+
* @param {number} level
|
|
1551
|
+
* @param {string} strategy
|
|
1552
|
+
* @returns {Uint8Array}
|
|
1553
|
+
*/
|
|
1554
|
+
export function compressSegment(segment, level, strategy) {
|
|
1555
|
+
try {
|
|
1556
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1557
|
+
const ptr0 = passArray8ToWasm0(segment, wasm.__wbindgen_export2);
|
|
1558
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1559
|
+
const ptr1 = passStringToWasm0(strategy, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1560
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1561
|
+
wasm.compressSegment(retptr, ptr0, len0, level, ptr1, len1);
|
|
1562
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1563
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1564
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1565
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1566
|
+
if (r3) {
|
|
1567
|
+
throw takeObject(r2);
|
|
1568
|
+
}
|
|
1569
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1570
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1571
|
+
return v3;
|
|
1572
|
+
} finally {
|
|
1573
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1062
1577
|
/**
|
|
1063
1578
|
* Decodes a PNG in its own format with a one-off decoder.
|
|
1064
1579
|
* @param {Uint8Array} bytes
|
|
@@ -1069,13 +1584,21 @@ if (Symbol.dispose) Text.prototype[Symbol.dispose] = Text.prototype.free;
|
|
|
1069
1584
|
* @returns {RawImage}
|
|
1070
1585
|
*/
|
|
1071
1586
|
export function decode(bytes, validate_crc, preserve_metadata, preserve_chunks, strict_ancillary) {
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1587
|
+
try {
|
|
1588
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1589
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
|
|
1590
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1591
|
+
wasm.decode(retptr, ptr0, len0, validate_crc, preserve_metadata, preserve_chunks, strict_ancillary);
|
|
1592
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1593
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1594
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1595
|
+
if (r2) {
|
|
1596
|
+
throw takeObject(r1);
|
|
1597
|
+
}
|
|
1598
|
+
return RawImage.__wrap(r0);
|
|
1599
|
+
} finally {
|
|
1600
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1077
1601
|
}
|
|
1078
|
-
return RawImage.__wrap(ret[0]);
|
|
1079
1602
|
}
|
|
1080
1603
|
|
|
1081
1604
|
/**
|
|
@@ -1088,17 +1611,25 @@ export function decode(bytes, validate_crc, preserve_metadata, preserve_chunks,
|
|
|
1088
1611
|
* @returns {DecodedImage}
|
|
1089
1612
|
*/
|
|
1090
1613
|
export function decodeRgba8(bytes, validate_crc, preserve_metadata, preserve_chunks, strict_ancillary) {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1614
|
+
try {
|
|
1615
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1616
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
|
|
1617
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1618
|
+
wasm.decodeRgba8(retptr, ptr0, len0, validate_crc, preserve_metadata, preserve_chunks, strict_ancillary);
|
|
1619
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1620
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1621
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1622
|
+
if (r2) {
|
|
1623
|
+
throw takeObject(r1);
|
|
1624
|
+
}
|
|
1625
|
+
return DecodedImage.__wrap(r0);
|
|
1626
|
+
} finally {
|
|
1627
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1096
1628
|
}
|
|
1097
|
-
return DecodedImage.__wrap(ret[0]);
|
|
1098
1629
|
}
|
|
1099
1630
|
|
|
1100
1631
|
/**
|
|
1101
|
-
* Encodes an image with a one-off encoder.
|
|
1632
|
+
* Encodes an image with a one-off encoder: the image, then `Encoder`'s options.
|
|
1102
1633
|
* @param {EncodeImage} image
|
|
1103
1634
|
* @param {number} compression
|
|
1104
1635
|
* @param {string} compression_strategy
|
|
@@ -1106,25 +1637,37 @@ export function decodeRgba8(bytes, validate_crc, preserve_metadata, preserve_chu
|
|
|
1106
1637
|
* @param {boolean} keep_unsafe_chunks
|
|
1107
1638
|
* @param {string} palette
|
|
1108
1639
|
* @param {string} strip
|
|
1640
|
+
* @param {string} threads
|
|
1109
1641
|
* @returns {Uint8Array}
|
|
1110
1642
|
*/
|
|
1111
|
-
export function encode(image, compression, compression_strategy, filter, keep_unsafe_chunks, palette, strip) {
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1643
|
+
export function encode(image, compression, compression_strategy, filter, keep_unsafe_chunks, palette, strip, threads) {
|
|
1644
|
+
try {
|
|
1645
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1646
|
+
_assertClass(image, EncodeImage);
|
|
1647
|
+
const ptr0 = passStringToWasm0(compression_strategy, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1648
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1649
|
+
const ptr1 = passStringToWasm0(filter, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1650
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1651
|
+
const ptr2 = passStringToWasm0(palette, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1652
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1653
|
+
const ptr3 = passStringToWasm0(strip, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1654
|
+
const len3 = WASM_VECTOR_LEN;
|
|
1655
|
+
const ptr4 = passStringToWasm0(threads, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1656
|
+
const len4 = WASM_VECTOR_LEN;
|
|
1657
|
+
wasm.encode(retptr, image.__wbg_ptr, compression, ptr0, len0, ptr1, len1, keep_unsafe_chunks, ptr2, len2, ptr3, len3, ptr4, len4);
|
|
1658
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1659
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1660
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1661
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1662
|
+
if (r3) {
|
|
1663
|
+
throw takeObject(r2);
|
|
1664
|
+
}
|
|
1665
|
+
var v6 = getArrayU8FromWasm0(r0, r1).slice();
|
|
1666
|
+
wasm.__wbindgen_export(r0, r1 * 1, 1);
|
|
1667
|
+
return v6;
|
|
1668
|
+
} finally {
|
|
1669
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1670
|
+
}
|
|
1128
1671
|
}
|
|
1129
1672
|
|
|
1130
1673
|
/**
|
|
@@ -1134,15 +1677,23 @@ export function encode(image, compression, compression_strategy, filter, keep_un
|
|
|
1134
1677
|
* @returns {Text}
|
|
1135
1678
|
*/
|
|
1136
1679
|
export function parseText(chunk_type, data) {
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1680
|
+
try {
|
|
1681
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1682
|
+
const ptr0 = passStringToWasm0(chunk_type, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
|
|
1683
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1684
|
+
const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export2);
|
|
1685
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1686
|
+
wasm.parseText(retptr, ptr0, len0, ptr1, len1);
|
|
1687
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1688
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1689
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1690
|
+
if (r2) {
|
|
1691
|
+
throw takeObject(r1);
|
|
1692
|
+
}
|
|
1693
|
+
return Text.__wrap(r0);
|
|
1694
|
+
} finally {
|
|
1695
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1696
|
+
}
|
|
1146
1697
|
}
|
|
1147
1698
|
|
|
1148
1699
|
/**
|
|
@@ -1153,13 +1704,21 @@ export function parseText(chunk_type, data) {
|
|
|
1153
1704
|
* @returns {ChunkList}
|
|
1154
1705
|
*/
|
|
1155
1706
|
export function readChunks(bytes, validate_crc, strict_ancillary) {
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1707
|
+
try {
|
|
1708
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1709
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
|
|
1710
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1711
|
+
wasm.readChunks(retptr, ptr0, len0, validate_crc, strict_ancillary);
|
|
1712
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1713
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1714
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1715
|
+
if (r2) {
|
|
1716
|
+
throw takeObject(r1);
|
|
1717
|
+
}
|
|
1718
|
+
return ChunkList.__wrap(r0);
|
|
1719
|
+
} finally {
|
|
1720
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1161
1721
|
}
|
|
1162
|
-
return ChunkList.__wrap(ret[0]);
|
|
1163
1722
|
}
|
|
1164
1723
|
|
|
1165
1724
|
/**
|
|
@@ -1168,40 +1727,39 @@ export function readChunks(bytes, validate_crc, strict_ancillary) {
|
|
|
1168
1727
|
* @returns {Header}
|
|
1169
1728
|
*/
|
|
1170
1729
|
export function readHeader(bytes) {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1730
|
+
try {
|
|
1731
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1732
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export2);
|
|
1733
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1734
|
+
wasm.readHeader(retptr, ptr0, len0);
|
|
1735
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1736
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1737
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1738
|
+
if (r2) {
|
|
1739
|
+
throw takeObject(r1);
|
|
1740
|
+
}
|
|
1741
|
+
return Header.__wrap(r0);
|
|
1742
|
+
} finally {
|
|
1743
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1176
1744
|
}
|
|
1177
|
-
return Header.__wrap(ret[0]);
|
|
1178
1745
|
}
|
|
1179
1746
|
function __wbg_get_imports() {
|
|
1180
1747
|
const import0 = {
|
|
1181
1748
|
__proto__: null,
|
|
1182
1749
|
__wbg_Error_67e7344beaa85059: function(arg0, arg1) {
|
|
1183
1750
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1184
|
-
return ret;
|
|
1751
|
+
return addHeapObject(ret);
|
|
1185
1752
|
},
|
|
1186
1753
|
__wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
|
|
1187
1754
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1188
1755
|
},
|
|
1189
1756
|
__wbg_chunk_new: function(arg0) {
|
|
1190
1757
|
const ret = Chunk.__wrap(arg0);
|
|
1191
|
-
return ret;
|
|
1758
|
+
return addHeapObject(ret);
|
|
1192
1759
|
},
|
|
1193
1760
|
__wbg_text_new: function(arg0) {
|
|
1194
1761
|
const ret = Text.__wrap(arg0);
|
|
1195
|
-
return ret;
|
|
1196
|
-
},
|
|
1197
|
-
__wbindgen_init_externref_table: function() {
|
|
1198
|
-
const table = wasm.__wbindgen_externrefs;
|
|
1199
|
-
const offset = table.grow(4);
|
|
1200
|
-
table.set(0, undefined);
|
|
1201
|
-
table.set(offset + 0, undefined);
|
|
1202
|
-
table.set(offset + 1, null);
|
|
1203
|
-
table.set(offset + 2, true);
|
|
1204
|
-
table.set(offset + 3, false);
|
|
1762
|
+
return addHeapObject(ret);
|
|
1205
1763
|
},
|
|
1206
1764
|
};
|
|
1207
1765
|
return {
|
|
@@ -1234,6 +1792,9 @@ const HeaderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1234
1792
|
const MetadataFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1235
1793
|
? { register: () => {}, unregister: () => {} }
|
|
1236
1794
|
: new FinalizationRegistry(ptr => wasm.__wbg_metadata_free(ptr, 1));
|
|
1795
|
+
const PreparedFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1796
|
+
? { register: () => {}, unregister: () => {} }
|
|
1797
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_prepared_free(ptr, 1));
|
|
1237
1798
|
const RawImageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1238
1799
|
? { register: () => {}, unregister: () => {} }
|
|
1239
1800
|
: new FinalizationRegistry(ptr => wasm.__wbg_rawimage_free(ptr, 1));
|
|
@@ -1241,12 +1802,27 @@ const TextFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
1241
1802
|
? { register: () => {}, unregister: () => {} }
|
|
1242
1803
|
: new FinalizationRegistry(ptr => wasm.__wbg_text_free(ptr, 1));
|
|
1243
1804
|
|
|
1805
|
+
function addHeapObject(obj) {
|
|
1806
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
1807
|
+
const idx = heap_next;
|
|
1808
|
+
heap_next = heap[idx];
|
|
1809
|
+
|
|
1810
|
+
heap[idx] = obj;
|
|
1811
|
+
return idx;
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1244
1814
|
function _assertClass(instance, klass) {
|
|
1245
1815
|
if (!(instance instanceof klass)) {
|
|
1246
1816
|
throw new Error(`expected instance of ${klass.name}`);
|
|
1247
1817
|
}
|
|
1248
1818
|
}
|
|
1249
1819
|
|
|
1820
|
+
function dropObject(idx) {
|
|
1821
|
+
if (idx < 1028) return;
|
|
1822
|
+
heap[idx] = heap_next;
|
|
1823
|
+
heap_next = idx;
|
|
1824
|
+
}
|
|
1825
|
+
|
|
1250
1826
|
function getArrayF64FromWasm0(ptr, len) {
|
|
1251
1827
|
ptr = ptr >>> 0;
|
|
1252
1828
|
return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
|
|
@@ -1257,9 +1833,8 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
1257
1833
|
const mem = getDataViewMemory0();
|
|
1258
1834
|
const result = [];
|
|
1259
1835
|
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
1260
|
-
result.push(
|
|
1836
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
1261
1837
|
}
|
|
1262
|
-
wasm.__externref_drop_slice(ptr, len);
|
|
1263
1838
|
return result;
|
|
1264
1839
|
}
|
|
1265
1840
|
|
|
@@ -1322,6 +1897,13 @@ function getUint8ArrayMemory0() {
|
|
|
1322
1897
|
return cachedUint8ArrayMemory0;
|
|
1323
1898
|
}
|
|
1324
1899
|
|
|
1900
|
+
function getObject(idx) { return heap[idx]; }
|
|
1901
|
+
|
|
1902
|
+
let heap = new Array(1024).fill(undefined);
|
|
1903
|
+
heap.push(undefined, null, true, false);
|
|
1904
|
+
|
|
1905
|
+
let heap_next = heap.length;
|
|
1906
|
+
|
|
1325
1907
|
function passArray16ToWasm0(arg, malloc) {
|
|
1326
1908
|
const ptr = malloc(arg.length * 2, 2) >>> 0;
|
|
1327
1909
|
getUint16ArrayMemory0().set(arg, ptr / 2);
|
|
@@ -1380,10 +1962,10 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
1380
1962
|
return ptr;
|
|
1381
1963
|
}
|
|
1382
1964
|
|
|
1383
|
-
function
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1386
|
-
return
|
|
1965
|
+
function takeObject(idx) {
|
|
1966
|
+
const ret = getObject(idx);
|
|
1967
|
+
dropObject(idx);
|
|
1968
|
+
return ret;
|
|
1387
1969
|
}
|
|
1388
1970
|
|
|
1389
1971
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
@@ -1425,7 +2007,6 @@ function __wbg_finalize_init(instance, module) {
|
|
|
1425
2007
|
cachedUint16ArrayMemory0 = null;
|
|
1426
2008
|
cachedUint32ArrayMemory0 = null;
|
|
1427
2009
|
cachedUint8ArrayMemory0 = null;
|
|
1428
|
-
wasm.__wbindgen_start();
|
|
1429
2010
|
return wasm;
|
|
1430
2011
|
}
|
|
1431
2012
|
|
|
@@ -1501,13 +2082,10 @@ async function __wbg_init(module_or_path) {
|
|
|
1501
2082
|
}
|
|
1502
2083
|
|
|
1503
2084
|
if (module_or_path === undefined) {
|
|
1504
|
-
|
|
2085
|
+
throw new Error("format-png: no WebAssembly module given");
|
|
1505
2086
|
}
|
|
1506
2087
|
const imports = __wbg_get_imports();
|
|
1507
2088
|
|
|
1508
|
-
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1509
|
-
module_or_path = fetch(module_or_path);
|
|
1510
|
-
}
|
|
1511
2089
|
|
|
1512
2090
|
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1513
2091
|
|