rxing-wasm 0.3.0 → 0.3.2

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/rxing_wasm_bg.js CHANGED
@@ -4,24 +4,31 @@ export function __wbg_set_wasm(val) {
4
4
  }
5
5
 
6
6
 
7
- const heap = new Array(128).fill(undefined);
7
+ let cachedUint8ArrayMemory0 = null;
8
8
 
9
- heap.push(undefined, null, true, false);
10
-
11
- function getObject(idx) { return heap[idx]; }
9
+ function getUint8ArrayMemory0() {
10
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
11
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8ArrayMemory0;
14
+ }
12
15
 
13
- let heap_next = heap.length;
16
+ let WASM_VECTOR_LEN = 0;
14
17
 
15
- function dropObject(idx) {
16
- if (idx < 132) return;
17
- heap[idx] = heap_next;
18
- heap_next = idx;
18
+ function passArray8ToWasm0(arg, malloc) {
19
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
20
+ getUint8ArrayMemory0().set(arg, ptr / 1);
21
+ WASM_VECTOR_LEN = arg.length;
22
+ return ptr;
19
23
  }
20
24
 
21
- function takeObject(idx) {
22
- const ret = getObject(idx);
23
- dropObject(idx);
24
- return ret;
25
+ let cachedDataViewMemory0 = null;
26
+
27
+ function getDataViewMemory0() {
28
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
29
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
30
+ }
31
+ return cachedDataViewMemory0;
25
32
  }
26
33
 
27
34
  const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
@@ -30,39 +37,48 @@ let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true
30
37
 
31
38
  cachedTextDecoder.decode();
32
39
 
33
- let cachedUint8Memory0 = null;
34
-
35
- function getUint8Memory0() {
36
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
37
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
38
- }
39
- return cachedUint8Memory0;
40
- }
41
-
42
40
  function getStringFromWasm0(ptr, len) {
43
41
  ptr = ptr >>> 0;
44
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
42
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
45
43
  }
46
44
 
47
- function addHeapObject(obj) {
48
- if (heap_next === heap.length) heap.push(heap.length + 1);
49
- const idx = heap_next;
50
- heap_next = heap[idx];
45
+ function isLikeNone(x) {
46
+ return x === undefined || x === null;
47
+ }
51
48
 
52
- heap[idx] = obj;
49
+ function addToExternrefTable0(obj) {
50
+ const idx = wasm.__externref_table_alloc();
51
+ wasm.__wbindgen_export_2.set(idx, obj);
53
52
  return idx;
54
53
  }
55
54
 
56
- let cachedInt32Memory0 = null;
55
+ function handleError(f, args) {
56
+ try {
57
+ return f.apply(this, args);
58
+ } catch (e) {
59
+ const idx = addToExternrefTable0(e);
60
+ wasm.__wbindgen_exn_store(idx);
61
+ }
62
+ }
63
+
64
+ let cachedFloat32ArrayMemory0 = null;
57
65
 
58
- function getInt32Memory0() {
59
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
60
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
66
+ function getFloat32ArrayMemory0() {
67
+ if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
68
+ cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
61
69
  }
62
- return cachedInt32Memory0;
70
+ return cachedFloat32ArrayMemory0;
63
71
  }
64
72
 
65
- let WASM_VECTOR_LEN = 0;
73
+ function getArrayF32FromWasm0(ptr, len) {
74
+ ptr = ptr >>> 0;
75
+ return getFloat32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
76
+ }
77
+
78
+ function getArrayU8FromWasm0(ptr, len) {
79
+ ptr = ptr >>> 0;
80
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
81
+ }
66
82
 
67
83
  const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
68
84
 
@@ -86,7 +102,7 @@ function passStringToWasm0(arg, malloc, realloc) {
86
102
  if (realloc === undefined) {
87
103
  const buf = cachedTextEncoder.encode(arg);
88
104
  const ptr = malloc(buf.length, 1) >>> 0;
89
- getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
105
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
90
106
  WASM_VECTOR_LEN = buf.length;
91
107
  return ptr;
92
108
  }
@@ -94,7 +110,7 @@ function passStringToWasm0(arg, malloc, realloc) {
94
110
  let len = arg.length;
95
111
  let ptr = malloc(len, 1) >>> 0;
96
112
 
97
- const mem = getUint8Memory0();
113
+ const mem = getUint8ArrayMemory0();
98
114
 
99
115
  let offset = 0;
100
116
 
@@ -109,7 +125,7 @@ function passStringToWasm0(arg, malloc, realloc) {
109
125
  arg = arg.slice(offset);
110
126
  }
111
127
  ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
112
- const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
128
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
113
129
  const ret = encodeString(arg, view);
114
130
 
115
131
  offset += ret.written;
@@ -120,55 +136,36 @@ function passStringToWasm0(arg, malloc, realloc) {
120
136
  return ptr;
121
137
  }
122
138
 
123
- let cachedFloat32Memory0 = null;
124
-
125
- function getFloat32Memory0() {
126
- if (cachedFloat32Memory0 === null || cachedFloat32Memory0.byteLength === 0) {
127
- cachedFloat32Memory0 = new Float32Array(wasm.memory.buffer);
128
- }
129
- return cachedFloat32Memory0;
130
- }
131
-
132
- function getArrayF32FromWasm0(ptr, len) {
133
- ptr = ptr >>> 0;
134
- return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
135
- }
136
-
137
- function getArrayU8FromWasm0(ptr, len) {
138
- ptr = ptr >>> 0;
139
- return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
139
+ function takeFromExternrefTable0(idx) {
140
+ const value = wasm.__wbindgen_export_2.get(idx);
141
+ wasm.__externref_table_dealloc(idx);
142
+ return value;
140
143
  }
141
144
  /**
142
- * Encode a barcode with the given data, dimensions, and type
143
- * @param {string} data
144
- * @param {number} width
145
- * @param {number} height
146
- * @param {BarcodeFormat} bc_type
147
- * @returns {string}
148
- */
145
+ * Encode a barcode with the given data, dimensions, and type
146
+ * @param {string} data
147
+ * @param {number} width
148
+ * @param {number} height
149
+ * @param {BarcodeFormat} bc_type
150
+ * @returns {string}
151
+ */
149
152
  export function encode_barcode(data, width, height, bc_type) {
150
153
  let deferred3_0;
151
154
  let deferred3_1;
152
155
  try {
153
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
154
156
  const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
155
157
  const len0 = WASM_VECTOR_LEN;
156
- wasm.encode_barcode(retptr, ptr0, len0, width, height, bc_type);
157
- var r0 = getInt32Memory0()[retptr / 4 + 0];
158
- var r1 = getInt32Memory0()[retptr / 4 + 1];
159
- var r2 = getInt32Memory0()[retptr / 4 + 2];
160
- var r3 = getInt32Memory0()[retptr / 4 + 3];
161
- var ptr2 = r0;
162
- var len2 = r1;
163
- if (r3) {
158
+ const ret = wasm.encode_barcode(ptr0, len0, width, height, bc_type);
159
+ var ptr2 = ret[0];
160
+ var len2 = ret[1];
161
+ if (ret[3]) {
164
162
  ptr2 = 0; len2 = 0;
165
- throw takeObject(r2);
163
+ throw takeFromExternrefTable0(ret[2]);
166
164
  }
167
165
  deferred3_0 = ptr2;
168
166
  deferred3_1 = len2;
169
167
  return getStringFromWasm0(ptr2, len2);
170
168
  } finally {
171
- wasm.__wbindgen_add_to_stack_pointer(16);
172
169
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
173
170
  }
174
171
  }
@@ -177,561 +174,539 @@ function _assertClass(instance, klass) {
177
174
  if (!(instance instanceof klass)) {
178
175
  throw new Error(`expected instance of ${klass.name}`);
179
176
  }
180
- return instance.ptr;
181
177
  }
182
178
  /**
183
- * Encode a barcode with the given data, dimensions, and type, use the given encoding hints
184
- * @param {string} data
185
- * @param {number} width
186
- * @param {number} height
187
- * @param {BarcodeFormat} bc_type
188
- * @param {EncodeHintDictionary} hints
189
- * @returns {string}
190
- */
179
+ * Encode a barcode with the given data, dimensions, and type, use the given encoding hints
180
+ * @param {string} data
181
+ * @param {number} width
182
+ * @param {number} height
183
+ * @param {BarcodeFormat} bc_type
184
+ * @param {EncodeHintDictionary} hints
185
+ * @returns {string}
186
+ */
191
187
  export function encode_barcode_with_hints(data, width, height, bc_type, hints) {
192
188
  let deferred3_0;
193
189
  let deferred3_1;
194
190
  try {
195
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
196
191
  const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
197
192
  const len0 = WASM_VECTOR_LEN;
198
193
  _assertClass(hints, EncodeHintDictionary);
199
- wasm.encode_barcode_with_hints(retptr, ptr0, len0, width, height, bc_type, hints.__wbg_ptr);
200
- var r0 = getInt32Memory0()[retptr / 4 + 0];
201
- var r1 = getInt32Memory0()[retptr / 4 + 1];
202
- var r2 = getInt32Memory0()[retptr / 4 + 2];
203
- var r3 = getInt32Memory0()[retptr / 4 + 3];
204
- var ptr2 = r0;
205
- var len2 = r1;
206
- if (r3) {
194
+ const ret = wasm.encode_barcode_with_hints(ptr0, len0, width, height, bc_type, hints.__wbg_ptr);
195
+ var ptr2 = ret[0];
196
+ var len2 = ret[1];
197
+ if (ret[3]) {
207
198
  ptr2 = 0; len2 = 0;
208
- throw takeObject(r2);
199
+ throw takeFromExternrefTable0(ret[2]);
209
200
  }
210
201
  deferred3_0 = ptr2;
211
202
  deferred3_1 = len2;
212
203
  return getStringFromWasm0(ptr2, len2);
213
204
  } finally {
214
- wasm.__wbindgen_add_to_stack_pointer(16);
215
205
  wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
216
206
  }
217
207
  }
218
208
 
219
- function passArray8ToWasm0(arg, malloc) {
220
- const ptr = malloc(arg.length * 1, 1) >>> 0;
221
- getUint8Memory0().set(arg, ptr / 1);
222
- WASM_VECTOR_LEN = arg.length;
223
- return ptr;
224
- }
225
-
226
- function isLikeNone(x) {
227
- return x === undefined || x === null;
228
- }
229
209
  /**
230
- * Decode a barcode from an array of 8bit luma data
231
- * @param {Uint8Array} data
232
- * @param {number} width
233
- * @param {number} height
234
- * @param {boolean | undefined} [try_harder]
235
- * @param {boolean | undefined} [filter_image]
236
- * @returns {BarcodeResult}
237
- */
210
+ * Decode a barcode from an array of 8bit luma data
211
+ * @param {Uint8Array} data
212
+ * @param {number} width
213
+ * @param {number} height
214
+ * @param {boolean | undefined} [try_harder]
215
+ * @param {boolean | undefined} [filter_image]
216
+ * @returns {BarcodeResult}
217
+ */
238
218
  export function decode_barcode(data, width, height, try_harder, filter_image) {
239
- try {
240
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
241
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
242
- const len0 = WASM_VECTOR_LEN;
243
- wasm.decode_barcode(retptr, ptr0, len0, width, height, isLikeNone(try_harder) ? 0xFFFFFF : try_harder ? 1 : 0, isLikeNone(filter_image) ? 0xFFFFFF : filter_image ? 1 : 0);
244
- var r0 = getInt32Memory0()[retptr / 4 + 0];
245
- var r1 = getInt32Memory0()[retptr / 4 + 1];
246
- var r2 = getInt32Memory0()[retptr / 4 + 2];
247
- if (r2) {
248
- throw takeObject(r1);
249
- }
250
- return BarcodeResult.__wrap(r0);
251
- } finally {
252
- wasm.__wbindgen_add_to_stack_pointer(16);
219
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
220
+ const len0 = WASM_VECTOR_LEN;
221
+ const ret = wasm.decode_barcode(ptr0, len0, width, height, isLikeNone(try_harder) ? 0xFFFFFF : try_harder ? 1 : 0, isLikeNone(filter_image) ? 0xFFFFFF : filter_image ? 1 : 0);
222
+ if (ret[2]) {
223
+ throw takeFromExternrefTable0(ret[1]);
253
224
  }
225
+ return BarcodeResult.__wrap(ret[0]);
254
226
  }
255
227
 
256
228
  /**
257
- * Convert a javascript image context's data into luma 8.
258
- *
259
- * Data for this function can be found from any canvas object
260
- * using the `data` property of an `ImageData` object.
261
- * Such an object could be obtained using the `getImageData`
262
- * method of a `CanvasRenderingContext2D` object.
263
- * @param {Uint8Array} data
264
- * @returns {Uint8Array}
265
- */
229
+ * Convert a javascript image context's data into luma 8.
230
+ *
231
+ * Data for this function can be found from any canvas object
232
+ * using the `data` property of an `ImageData` object.
233
+ * Such an object could be obtained using the `getImageData`
234
+ * method of a `CanvasRenderingContext2D` object.
235
+ * @param {Uint8Array} data
236
+ * @returns {Uint8Array}
237
+ */
266
238
  export function convert_js_image_to_luma(data) {
267
- try {
268
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
269
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
270
- const len0 = WASM_VECTOR_LEN;
271
- wasm.convert_js_image_to_luma(retptr, ptr0, len0);
272
- var r0 = getInt32Memory0()[retptr / 4 + 0];
273
- var r1 = getInt32Memory0()[retptr / 4 + 1];
274
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
275
- wasm.__wbindgen_free(r0, r1 * 1, 1);
276
- return v2;
277
- } finally {
278
- wasm.__wbindgen_add_to_stack_pointer(16);
239
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
240
+ const len0 = WASM_VECTOR_LEN;
241
+ const ret = wasm.convert_js_image_to_luma(ptr0, len0);
242
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
243
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
244
+ return v2;
245
+ }
246
+
247
+ /**
248
+ * @param {HTMLCanvasElement} canvas
249
+ * @returns {Uint8Array}
250
+ */
251
+ export function convert_canvas_to_luma(canvas) {
252
+ const ret = wasm.convert_canvas_to_luma(canvas);
253
+ if (ret[3]) {
254
+ throw takeFromExternrefTable0(ret[2]);
279
255
  }
256
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
257
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
258
+ return v1;
280
259
  }
281
260
 
282
- let cachedUint32Memory0 = null;
261
+ /**
262
+ * @param {ImageData} image_data
263
+ * @returns {Uint8Array}
264
+ */
265
+ export function convert_imagedata_to_luma(image_data) {
266
+ const ret = wasm.convert_imagedata_to_luma(image_data);
267
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
268
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
269
+ return v1;
270
+ }
283
271
 
284
- function getUint32Memory0() {
285
- if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
286
- cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
272
+ let cachedUint32ArrayMemory0 = null;
273
+
274
+ function getUint32ArrayMemory0() {
275
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
276
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
287
277
  }
288
- return cachedUint32Memory0;
278
+ return cachedUint32ArrayMemory0;
289
279
  }
290
280
 
291
281
  function passArray32ToWasm0(arg, malloc) {
292
282
  const ptr = malloc(arg.length * 4, 4) >>> 0;
293
- getUint32Memory0().set(arg, ptr / 4);
283
+ getUint32ArrayMemory0().set(arg, ptr / 4);
294
284
  WASM_VECTOR_LEN = arg.length;
295
285
  return ptr;
296
286
  }
297
287
  /**
298
- * Decode a barcode from an array of rgba data.
299
- * Pixel data is in the form of:
300
- * Each pixel is one u32, [r,g,b].
301
- * @param {Uint32Array} data
302
- * @param {number} width
303
- * @param {number} height
304
- * @param {boolean | undefined} [try_harder]
305
- * @returns {BarcodeResult}
306
- */
288
+ * Decode a barcode from an array of rgba data.
289
+ * Pixel data is in the form of:
290
+ * Each pixel is one u32, [r,g,b].
291
+ * @param {Uint32Array} data
292
+ * @param {number} width
293
+ * @param {number} height
294
+ * @param {boolean | undefined} [try_harder]
295
+ * @returns {BarcodeResult}
296
+ */
307
297
  export function decode_barcode_rgb(data, width, height, try_harder) {
308
- try {
309
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
310
- const ptr0 = passArray32ToWasm0(data, wasm.__wbindgen_malloc);
311
- const len0 = WASM_VECTOR_LEN;
312
- wasm.decode_barcode_rgb(retptr, ptr0, len0, width, height, isLikeNone(try_harder) ? 0xFFFFFF : try_harder ? 1 : 0);
313
- var r0 = getInt32Memory0()[retptr / 4 + 0];
314
- var r1 = getInt32Memory0()[retptr / 4 + 1];
315
- var r2 = getInt32Memory0()[retptr / 4 + 2];
316
- if (r2) {
317
- throw takeObject(r1);
318
- }
319
- return BarcodeResult.__wrap(r0);
320
- } finally {
321
- wasm.__wbindgen_add_to_stack_pointer(16);
298
+ const ptr0 = passArray32ToWasm0(data, wasm.__wbindgen_malloc);
299
+ const len0 = WASM_VECTOR_LEN;
300
+ const ret = wasm.decode_barcode_rgb(ptr0, len0, width, height, isLikeNone(try_harder) ? 0xFFFFFF : try_harder ? 1 : 0);
301
+ if (ret[2]) {
302
+ throw takeFromExternrefTable0(ret[1]);
322
303
  }
304
+ return BarcodeResult.__wrap(ret[0]);
323
305
  }
324
306
 
325
307
  /**
326
- * @param {Uint8Array} data
327
- * @param {number} width
328
- * @param {number} height
329
- * @param {DecodeHintDictionary} hints
330
- * @param {boolean | undefined} [filter_image]
331
- * @returns {BarcodeResult}
332
- */
308
+ * @param {Uint8Array} data
309
+ * @param {number} width
310
+ * @param {number} height
311
+ * @param {DecodeHintDictionary} hints
312
+ * @param {boolean | undefined} [filter_image]
313
+ * @returns {BarcodeResult}
314
+ */
333
315
  export function decode_barcode_with_hints(data, width, height, hints, filter_image) {
334
- try {
335
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
336
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
337
- const len0 = WASM_VECTOR_LEN;
338
- _assertClass(hints, DecodeHintDictionary);
339
- wasm.decode_barcode_with_hints(retptr, ptr0, len0, width, height, hints.__wbg_ptr, isLikeNone(filter_image) ? 0xFFFFFF : filter_image ? 1 : 0);
340
- var r0 = getInt32Memory0()[retptr / 4 + 0];
341
- var r1 = getInt32Memory0()[retptr / 4 + 1];
342
- var r2 = getInt32Memory0()[retptr / 4 + 2];
343
- if (r2) {
344
- throw takeObject(r1);
345
- }
346
- return BarcodeResult.__wrap(r0);
347
- } finally {
348
- wasm.__wbindgen_add_to_stack_pointer(16);
349
- }
316
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
317
+ const len0 = WASM_VECTOR_LEN;
318
+ _assertClass(hints, DecodeHintDictionary);
319
+ const ret = wasm.decode_barcode_with_hints(ptr0, len0, width, height, hints.__wbg_ptr, isLikeNone(filter_image) ? 0xFFFFFF : filter_image ? 1 : 0);
320
+ if (ret[2]) {
321
+ throw takeFromExternrefTable0(ret[1]);
322
+ }
323
+ return BarcodeResult.__wrap(ret[0]);
350
324
  }
351
325
 
352
326
  function getArrayJsValueFromWasm0(ptr, len) {
353
327
  ptr = ptr >>> 0;
354
- const mem = getUint32Memory0();
355
- const slice = mem.subarray(ptr / 4, ptr / 4 + len);
328
+ const mem = getDataViewMemory0();
356
329
  const result = [];
357
- for (let i = 0; i < slice.length; i++) {
358
- result.push(takeObject(slice[i]));
330
+ for (let i = ptr; i < ptr + 4 * len; i += 4) {
331
+ result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
359
332
  }
333
+ wasm.__externref_drop_slice(ptr, len);
360
334
  return result;
361
335
  }
362
336
  /**
363
- * @param {Uint8Array} data
364
- * @param {number} width
365
- * @param {number} height
366
- * @param {DecodeHintDictionary} hints
367
- * @param {boolean | undefined} [filter_image]
368
- * @returns {(BarcodeResult)[]}
369
- */
337
+ * @param {Uint8Array} data
338
+ * @param {number} width
339
+ * @param {number} height
340
+ * @param {DecodeHintDictionary} hints
341
+ * @param {boolean | undefined} [filter_image]
342
+ * @returns {(BarcodeResult)[]}
343
+ */
370
344
  export function decode_multi(data, width, height, hints, filter_image) {
371
- try {
372
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
373
- const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
374
- const len0 = WASM_VECTOR_LEN;
375
- _assertClass(hints, DecodeHintDictionary);
376
- wasm.decode_multi(retptr, ptr0, len0, width, height, hints.__wbg_ptr, isLikeNone(filter_image) ? 0xFFFFFF : filter_image ? 1 : 0);
377
- var r0 = getInt32Memory0()[retptr / 4 + 0];
378
- var r1 = getInt32Memory0()[retptr / 4 + 1];
379
- var r2 = getInt32Memory0()[retptr / 4 + 2];
380
- var r3 = getInt32Memory0()[retptr / 4 + 3];
381
- if (r3) {
382
- throw takeObject(r2);
383
- }
384
- var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
385
- wasm.__wbindgen_free(r0, r1 * 4, 4);
386
- return v2;
387
- } finally {
388
- wasm.__wbindgen_add_to_stack_pointer(16);
389
- }
345
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
346
+ const len0 = WASM_VECTOR_LEN;
347
+ _assertClass(hints, DecodeHintDictionary);
348
+ const ret = wasm.decode_multi(ptr0, len0, width, height, hints.__wbg_ptr, isLikeNone(filter_image) ? 0xFFFFFF : filter_image ? 1 : 0);
349
+ if (ret[3]) {
350
+ throw takeFromExternrefTable0(ret[2]);
351
+ }
352
+ var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
353
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
354
+ return v2;
390
355
  }
391
356
 
392
357
  /**
393
- */
394
- export const EncodeHintTypes = Object.freeze({
395
- /**
396
- *
397
- * * Specifies what degree of error correction to use, for example in QR Codes.
398
- * * Type depends on the encoder. For example for QR codes it's type
399
- * * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
400
- * * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
401
- * * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
402
- * * In all cases, it can also be a {@link String} representation of the desired value as well.
403
- * * Note: an Aztec symbol should have a minimum of 25% EC words.
404
- *
405
- */
406
- ErrorCorrection:0,"0":"ErrorCorrection",
407
- /**
408
- *
409
- * * Specifies what character encoding to use where applicable (type {@link String})
410
- *
411
- */
412
- CharacterSet:1,"1":"CharacterSet",
413
- /**
414
- *
415
- * * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
416
- *
417
- */
418
- DataMatrixShape:2,"2":"DataMatrixShape",
419
- /**
420
- *
421
- * * Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
422
- * * {@link String } value).
423
- * * The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
424
- * * character set via ECIs.
425
- * * Please note that in that case, the most compact character encoding is chosen for characters in
426
- * * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
427
- * * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
428
- * * means of the {@link #CHARACTER_SET} encoding hint.
429
- * * Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
430
- * * group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
431
- * * for the purpose of delimiting AIs.
432
- * * This option and {@link #FORCE_C40} are mutually exclusive.
433
- *
434
- */
435
- DataMatrixCompact:3,"3":"DataMatrixCompact",
436
- /**
437
- *
438
- * * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
439
- * *
440
- * * @deprecated use width/height params in
441
- * * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
442
- *
443
- */
444
- MinSize:4,"4":"MinSize",
445
- /**
446
- *
447
- * * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
448
- * *
449
- * * @deprecated without replacement
450
- *
451
- */
452
- MaxSize:5,"5":"MaxSize",
453
- /**
454
- *
455
- * * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
456
- * * by format; for example it controls margin before and after the barcode horizontally for
457
- * * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
458
- *
459
- */
460
- MARGIN:6,"6":"MARGIN",
461
- /**
462
- *
463
- * * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
464
- * * {@link String} value).
465
- *
466
- */
467
- Pdf417Compact:7,"7":"Pdf417Compact",
468
- /**
469
- *
470
- * * Specifies what compaction mode to use for PDF417 (type
471
- * * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
472
- * * enum values).
473
- *
474
- */
475
- Pdf417Compaction:8,"8":"Pdf417Compaction",
476
- /**
477
- *
478
- * * Specifies the minimum and maximum number of rows and columns for PDF417 (type
479
- * * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
480
- *
481
- */
482
- Pdf417Dimensions:9,"9":"Pdf417Dimensions",
483
- /**
484
- *
485
- * * Specifies whether to automatically insert ECIs when encoding PDF417 (type {@link Boolean}, or "true" or "false"
486
- * * {@link String} value).
487
- * * Please note that in that case, the most compact character encoding is chosen for characters in
488
- * * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
489
- * * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
490
- * * means of the {@link #CHARACTER_SET} encoding hint.
491
- *
492
- */
493
- Pdf417AutoEci:10,"10":"Pdf417AutoEci",
494
- /**
495
- *
496
- * * Specifies the required number of layers for an Aztec code.
497
- * * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
498
- * * 0 indicates to use the minimum number of layers (the default).
499
- * * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
500
- * * (Type {@link Integer}, or {@link String} representation of the integer value).
501
- *
502
- */
503
- AztecLayers:11,"11":"AztecLayers",
504
- /**
505
- *
506
- * * Specifies the exact version of QR code to be encoded.
507
- * * (Type {@link Integer}, or {@link String} representation of the integer value).
508
- *
509
- */
510
- QrVersion:12,"12":"QrVersion",
511
- /**
512
- *
513
- * * Specifies the QR code mask pattern to be used. Allowed values are
514
- * * 0..QRCode.NUM_MASK_PATTERNS-1. By default the code will automatically select
515
- * * the optimal mask pattern.
516
- * * * (Type {@link Integer}, or {@link String} representation of the integer value).
517
- *
518
- */
519
- QrMaskPattern:13,"13":"QrMaskPattern",
520
- /**
521
- *
522
- * * Specifies whether to use compact mode for QR code (type {@link Boolean}, or "true" or "false"
523
- * * {@link String } value).
524
- * * Please note that when compaction is performed, the most compact character encoding is chosen
525
- * * for characters in the input that are not in the ISO-8859-1 character set. Based on experience,
526
- * * some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can
527
- * * be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint.
528
- *
529
- */
530
- QrCompact:14,"14":"QrCompact",
531
- /**
532
- *
533
- * * Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
534
- * * {@link String } value).
535
- *
536
- */
537
- Gs1Format:15,"15":"Gs1Format",
538
- /**
539
- *
540
- * * Forces which encoding will be used. Currently only used for Code-128 code sets (Type {@link String}).
541
- * * Valid values are "A", "B", "C".
542
- * * This option and {@link #CODE128_COMPACT} are mutually exclusive.
543
- *
544
- */
545
- ForceCodeSet:16,"16":"ForceCodeSet",
546
- /**
547
- *
548
- * * Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
549
- * * option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
550
- *
551
- */
552
- ForceC40:17,"17":"ForceC40",
553
- /**
554
- *
555
- * * Specifies whether to use compact mode for Code-128 code (type {@link Boolean}, or "true" or "false"
556
- * * {@link String } value).
557
- * * This can yield slightly smaller bar codes. This option and {@link #FORCE_CODE_SET} are mutually
558
- * * exclusive.
559
- *
560
- */
561
- Code128Compact:18,"18":"Code128Compact",TelepenAsNumeric:19,"19":"TelepenAsNumeric", });
562
- /**
563
- * Available barcode types
564
- */
358
+ * Available barcode types
359
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20}
360
+ */
565
361
  export const BarcodeFormat = Object.freeze({
362
+ /**
363
+ * Aztec 2D barcode format.
364
+ */
365
+ AZTEC: 0, "0": "AZTEC",
366
+ /**
367
+ * CODABAR 1D format.
368
+ */
369
+ CODABAR: 1, "1": "CODABAR",
370
+ /**
371
+ * Code 39 1D format.
372
+ */
373
+ Code39: 2, "2": "Code39",
374
+ /**
375
+ * Code 93 1D format.
376
+ */
377
+ Code93: 3, "3": "Code93",
378
+ /**
379
+ * Code 128 1D format.
380
+ */
381
+ Code128: 4, "4": "Code128",
382
+ /**
383
+ * Data Matrix 2D barcode format.
384
+ */
385
+ DataMatrix: 5, "5": "DataMatrix",
386
+ /**
387
+ * EAN-8 1D format.
388
+ */
389
+ Ean8: 6, "6": "Ean8",
390
+ /**
391
+ * EAN-13 1D format.
392
+ */
393
+ Ean13: 7, "7": "Ean13",
394
+ /**
395
+ * ITF (Interleaved Two of Five) 1D format.
396
+ */
397
+ ITF: 8, "8": "ITF",
398
+ /**
399
+ * MaxiCode 2D barcode format.
400
+ */
401
+ MAXICODE: 9, "9": "MAXICODE",
402
+ /**
403
+ * PDF417 format.
404
+ */
405
+ Pdf417: 10, "10": "Pdf417",
406
+ /**
407
+ * QR Code 2D barcode format.
408
+ */
409
+ QrCode: 11, "11": "QrCode",
410
+ /**
411
+ * RSS 14
412
+ */
413
+ Rss14: 12, "12": "Rss14",
414
+ /**
415
+ * RSS EXPANDED
416
+ */
417
+ RssExpanded: 13, "13": "RssExpanded",
418
+ /**
419
+ * UPC-A 1D format.
420
+ */
421
+ UpcA: 14, "14": "UpcA",
422
+ /**
423
+ * UPC-E 1D format.
424
+ */
425
+ UpcE: 15, "15": "UpcE",
426
+ /**
427
+ * UPC/EAN extension format. Not a stand-alone format.
428
+ */
429
+ UpcEanExtension: 16, "16": "UpcEanExtension",
430
+ MicroQR: 17, "17": "MicroQR",
431
+ Telepen: 18, "18": "Telepen",
432
+ RectangularMicroQR: 19, "19": "RectangularMicroQR",
433
+ UnsuportedFormat: 20, "20": "UnsuportedFormat",
434
+ });
566
435
  /**
567
- * Aztec 2D barcode format.
568
- */
569
- AZTEC:0,"0":"AZTEC",
570
- /**
571
- * CODABAR 1D format.
572
- */
573
- CODABAR:1,"1":"CODABAR",
574
- /**
575
- * Code 39 1D format.
576
- */
577
- Code39:2,"2":"Code39",
578
- /**
579
- * Code 93 1D format.
580
- */
581
- Code93:3,"3":"Code93",
582
- /**
583
- * Code 128 1D format.
584
- */
585
- Code128:4,"4":"Code128",
586
- /**
587
- * Data Matrix 2D barcode format.
588
- */
589
- DataMatrix:5,"5":"DataMatrix",
590
- /**
591
- * EAN-8 1D format.
592
- */
593
- Ean8:6,"6":"Ean8",
594
- /**
595
- * EAN-13 1D format.
596
- */
597
- Ean13:7,"7":"Ean13",
598
- /**
599
- * ITF (Interleaved Two of Five) 1D format.
600
- */
601
- ITF:8,"8":"ITF",
602
- /**
603
- * MaxiCode 2D barcode format.
604
- */
605
- MAXICODE:9,"9":"MAXICODE",
606
- /**
607
- * PDF417 format.
608
- */
609
- Pdf417:10,"10":"Pdf417",
610
- /**
611
- * QR Code 2D barcode format.
612
- */
613
- QrCode:11,"11":"QrCode",
614
- /**
615
- * RSS 14
616
- */
617
- Rss14:12,"12":"Rss14",
618
- /**
619
- * RSS EXPANDED
620
- */
621
- RssExpanded:13,"13":"RssExpanded",
622
- /**
623
- * UPC-A 1D format.
624
- */
625
- UpcA:14,"14":"UpcA",
626
- /**
627
- * UPC-E 1D format.
628
- */
629
- UpcE:15,"15":"UpcE",
630
- /**
631
- * UPC/EAN extension format. Not a stand-alone format.
632
- */
633
- UpcEanExtension:16,"16":"UpcEanExtension",MicroQR:17,"17":"MicroQR",Telepen:18,"18":"Telepen",RectangularMicroQR:19,"19":"RectangularMicroQR",UnsuportedFormat:20,"20":"UnsuportedFormat", });
634
- /**
635
- */
436
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}
437
+ */
636
438
  export const DecodeHintTypes = Object.freeze({
439
+ /**
440
+ *
441
+ * * Unspecified, application-specific hint. Maps to an unspecified {@link Object}.
442
+ *
443
+ */
444
+ Other: 0, "0": "Other",
445
+ /**
446
+ *
447
+ * * Image is a pure monochrome image of a barcode. Doesn't matter what it maps to;
448
+ * * use {@link Boolean#TRUE}.
449
+ *
450
+ */
451
+ PureBarcode: 1, "1": "PureBarcode",
452
+ /**
453
+ *
454
+ * * Image is known to be of one of a few possible formats.
455
+ * * Maps to a {@link List} of {@link BarcodeFormat}s.
456
+ *
457
+ */
458
+ PossibleFormats: 2, "2": "PossibleFormats",
459
+ /**
460
+ *
461
+ * * Spend more time to try to find a barcode; optimize for accuracy, not speed.
462
+ * * Doesn't matter what it maps to; use {@link Boolean#TRUE}.
463
+ *
464
+ */
465
+ TryHarder: 3, "3": "TryHarder",
466
+ /**
467
+ *
468
+ * * Specifies what character encoding to use when decoding, where applicable (type String)
469
+ *
470
+ */
471
+ CharacterSet: 4, "4": "CharacterSet",
472
+ /**
473
+ *
474
+ * * Allowed lengths of encoded data -- reject anything else. Maps to an {@code int[]}.
475
+ *
476
+ */
477
+ AllowedLengths: 5, "5": "AllowedLengths",
478
+ /**
479
+ *
480
+ * * Assume Code 39 codes employ a check digit. Doesn't matter what it maps to;
481
+ * * use {@link Boolean#TRUE}.
482
+ *
483
+ */
484
+ AssumeCode39CheckDigit: 6, "6": "AssumeCode39CheckDigit",
485
+ /**
486
+ *
487
+ * * Assume the barcode is being processed as a GS1 barcode, and modify behavior as needed.
488
+ * * For example this affects FNC1 handling for Code 128 (aka GS1-128). Doesn't matter what it maps to;
489
+ * * use {@link Boolean#TRUE}.
490
+ *
491
+ */
492
+ AssumeGs1: 7, "7": "AssumeGs1",
493
+ /**
494
+ *
495
+ * * If true, return the start and end digits in a Codabar barcode instead of stripping them. They
496
+ * * are alpha, whereas the rest are numeric. By default, they are stripped, but this causes them
497
+ * * to not be. Doesn't matter what it maps to; use {@link Boolean#TRUE}.
498
+ *
499
+ */
500
+ ReturnCodabarStartEnd: 8, "8": "ReturnCodabarStartEnd",
501
+ /**
502
+ *
503
+ * * The caller needs to be notified via callback when a possible {@link RXingResultPoint}
504
+ * * is found. Maps to a {@link RXingResultPointCallback}.
505
+ *
506
+ */
507
+ NeedResultPointCallback: 9, "9": "NeedResultPointCallback",
508
+ /**
509
+ *
510
+ * * Allowed extension lengths for EAN or UPC barcodes. Other formats will ignore this.
511
+ * * Maps to an {@code int[]} of the allowed extension lengths, for example [2], [5], or [2, 5].
512
+ * * If it is optional to have an extension, do not set this hint. If this is set,
513
+ * * and a UPC or EAN barcode is found but an extension is not, then no result will be returned
514
+ * * at all.
515
+ *
516
+ */
517
+ AllowedEanExtensions: 10, "10": "AllowedEanExtensions",
518
+ /**
519
+ *
520
+ * * If true, also tries to decode as inverted image. All configured decoders are simply called a
521
+ * * second time with an inverted image. Doesn't matter what it maps to; use {@link Boolean#TRUE}.
522
+ *
523
+ */
524
+ AlsoInverted: 11, "11": "AlsoInverted",
525
+ /**
526
+ *
527
+ * * Translate the ASCII values parsed by the Telepen reader into the Telepen Numeric form; use {@link Boolean#TRUE}.
528
+ *
529
+ */
530
+ TelepenAsNumeric: 12, "12": "TelepenAsNumeric",
531
+ });
637
532
  /**
638
- *
639
- * * Unspecified, application-specific hint. Maps to an unspecified {@link Object}.
640
- *
641
- */
642
- Other:0,"0":"Other",
643
- /**
644
- *
645
- * * Image is a pure monochrome image of a barcode. Doesn't matter what it maps to;
646
- * * use {@link Boolean#TRUE}.
647
- *
648
- */
649
- PureBarcode:1,"1":"PureBarcode",
650
- /**
651
- *
652
- * * Image is known to be of one of a few possible formats.
653
- * * Maps to a {@link List} of {@link BarcodeFormat}s.
654
- *
655
- */
656
- PossibleFormats:2,"2":"PossibleFormats",
657
- /**
658
- *
659
- * * Spend more time to try to find a barcode; optimize for accuracy, not speed.
660
- * * Doesn't matter what it maps to; use {@link Boolean#TRUE}.
661
- *
662
- */
663
- TryHarder:3,"3":"TryHarder",
664
- /**
665
- *
666
- * * Specifies what character encoding to use when decoding, where applicable (type String)
667
- *
668
- */
669
- CharacterSet:4,"4":"CharacterSet",
670
- /**
671
- *
672
- * * Allowed lengths of encoded data -- reject anything else. Maps to an {@code int[]}.
673
- *
674
- */
675
- AllowedLengths:5,"5":"AllowedLengths",
676
- /**
677
- *
678
- * * Assume Code 39 codes employ a check digit. Doesn't matter what it maps to;
679
- * * use {@link Boolean#TRUE}.
680
- *
681
- */
682
- AssumeCode39CheckDigit:6,"6":"AssumeCode39CheckDigit",
683
- /**
684
- *
685
- * * Assume the barcode is being processed as a GS1 barcode, and modify behavior as needed.
686
- * * For example this affects FNC1 handling for Code 128 (aka GS1-128). Doesn't matter what it maps to;
687
- * * use {@link Boolean#TRUE}.
688
- *
689
- */
690
- AssumeGs1:7,"7":"AssumeGs1",
691
- /**
692
- *
693
- * * If true, return the start and end digits in a Codabar barcode instead of stripping them. They
694
- * * are alpha, whereas the rest are numeric. By default, they are stripped, but this causes them
695
- * * to not be. Doesn't matter what it maps to; use {@link Boolean#TRUE}.
696
- *
697
- */
698
- ReturnCodabarStartEnd:8,"8":"ReturnCodabarStartEnd",
699
- /**
700
- *
701
- * * The caller needs to be notified via callback when a possible {@link RXingResultPoint}
702
- * * is found. Maps to a {@link RXingResultPointCallback}.
703
- *
704
- */
705
- NeedResultPointCallback:9,"9":"NeedResultPointCallback",
706
- /**
707
- *
708
- * * Allowed extension lengths for EAN or UPC barcodes. Other formats will ignore this.
709
- * * Maps to an {@code int[]} of the allowed extension lengths, for example [2], [5], or [2, 5].
710
- * * If it is optional to have an extension, do not set this hint. If this is set,
711
- * * and a UPC or EAN barcode is found but an extension is not, then no result will be returned
712
- * * at all.
713
- *
714
- */
715
- AllowedEanExtensions:10,"10":"AllowedEanExtensions",
716
- /**
717
- *
718
- * * If true, also tries to decode as inverted image. All configured decoders are simply called a
719
- * * second time with an inverted image. Doesn't matter what it maps to; use {@link Boolean#TRUE}.
720
- *
721
- */
722
- AlsoInverted:11,"11":"AlsoInverted",
723
- /**
724
- *
725
- * * Translate the ASCII values parsed by the Telepen reader into the Telepen Numeric form; use {@link Boolean#TRUE}.
726
- *
727
- */
728
- TelepenAsNumeric:12,"12":"TelepenAsNumeric", });
533
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19}
534
+ */
535
+ export const EncodeHintTypes = Object.freeze({
536
+ /**
537
+ *
538
+ * * Specifies what degree of error correction to use, for example in QR Codes.
539
+ * * Type depends on the encoder. For example for QR codes it's type
540
+ * * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
541
+ * * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
542
+ * * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
543
+ * * In all cases, it can also be a {@link String} representation of the desired value as well.
544
+ * * Note: an Aztec symbol should have a minimum of 25% EC words.
545
+ *
546
+ */
547
+ ErrorCorrection: 0, "0": "ErrorCorrection",
548
+ /**
549
+ *
550
+ * * Specifies what character encoding to use where applicable (type {@link String})
551
+ *
552
+ */
553
+ CharacterSet: 1, "1": "CharacterSet",
554
+ /**
555
+ *
556
+ * * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
557
+ *
558
+ */
559
+ DataMatrixShape: 2, "2": "DataMatrixShape",
560
+ /**
561
+ *
562
+ * * Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
563
+ * * {@link String } value).
564
+ * * The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
565
+ * * character set via ECIs.
566
+ * * Please note that in that case, the most compact character encoding is chosen for characters in
567
+ * * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
568
+ * * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
569
+ * * means of the {@link #CHARACTER_SET} encoding hint.
570
+ * * Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
571
+ * * group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
572
+ * * for the purpose of delimiting AIs.
573
+ * * This option and {@link #FORCE_C40} are mutually exclusive.
574
+ *
575
+ */
576
+ DataMatrixCompact: 3, "3": "DataMatrixCompact",
577
+ /**
578
+ *
579
+ * * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
580
+ * *
581
+ * * @deprecated use width/height params in
582
+ * * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
583
+ *
584
+ */
585
+ MinSize: 4, "4": "MinSize",
586
+ /**
587
+ *
588
+ * * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
589
+ * *
590
+ * * @deprecated without replacement
591
+ *
592
+ */
593
+ MaxSize: 5, "5": "MaxSize",
594
+ /**
595
+ *
596
+ * * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
597
+ * * by format; for example it controls margin before and after the barcode horizontally for
598
+ * * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
599
+ *
600
+ */
601
+ MARGIN: 6, "6": "MARGIN",
602
+ /**
603
+ *
604
+ * * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
605
+ * * {@link String} value).
606
+ *
607
+ */
608
+ Pdf417Compact: 7, "7": "Pdf417Compact",
609
+ /**
610
+ *
611
+ * * Specifies what compaction mode to use for PDF417 (type
612
+ * * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
613
+ * * enum values).
614
+ *
615
+ */
616
+ Pdf417Compaction: 8, "8": "Pdf417Compaction",
617
+ /**
618
+ *
619
+ * * Specifies the minimum and maximum number of rows and columns for PDF417 (type
620
+ * * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
621
+ *
622
+ */
623
+ Pdf417Dimensions: 9, "9": "Pdf417Dimensions",
624
+ /**
625
+ *
626
+ * * Specifies whether to automatically insert ECIs when encoding PDF417 (type {@link Boolean}, or "true" or "false"
627
+ * * {@link String} value).
628
+ * * Please note that in that case, the most compact character encoding is chosen for characters in
629
+ * * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
630
+ * * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
631
+ * * means of the {@link #CHARACTER_SET} encoding hint.
632
+ *
633
+ */
634
+ Pdf417AutoEci: 10, "10": "Pdf417AutoEci",
635
+ /**
636
+ *
637
+ * * Specifies the required number of layers for an Aztec code.
638
+ * * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
639
+ * * 0 indicates to use the minimum number of layers (the default).
640
+ * * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
641
+ * * (Type {@link Integer}, or {@link String} representation of the integer value).
642
+ *
643
+ */
644
+ AztecLayers: 11, "11": "AztecLayers",
645
+ /**
646
+ *
647
+ * * Specifies the exact version of QR code to be encoded.
648
+ * * (Type {@link Integer}, or {@link String} representation of the integer value).
649
+ *
650
+ */
651
+ QrVersion: 12, "12": "QrVersion",
652
+ /**
653
+ *
654
+ * * Specifies the QR code mask pattern to be used. Allowed values are
655
+ * * 0..QRCode.NUM_MASK_PATTERNS-1. By default the code will automatically select
656
+ * * the optimal mask pattern.
657
+ * * * (Type {@link Integer}, or {@link String} representation of the integer value).
658
+ *
659
+ */
660
+ QrMaskPattern: 13, "13": "QrMaskPattern",
661
+ /**
662
+ *
663
+ * * Specifies whether to use compact mode for QR code (type {@link Boolean}, or "true" or "false"
664
+ * * {@link String } value).
665
+ * * Please note that when compaction is performed, the most compact character encoding is chosen
666
+ * * for characters in the input that are not in the ISO-8859-1 character set. Based on experience,
667
+ * * some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can
668
+ * * be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint.
669
+ *
670
+ */
671
+ QrCompact: 14, "14": "QrCompact",
672
+ /**
673
+ *
674
+ * * Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
675
+ * * {@link String } value).
676
+ *
677
+ */
678
+ Gs1Format: 15, "15": "Gs1Format",
679
+ /**
680
+ *
681
+ * * Forces which encoding will be used. Currently only used for Code-128 code sets (Type {@link String}).
682
+ * * Valid values are "A", "B", "C".
683
+ * * This option and {@link #CODE128_COMPACT} are mutually exclusive.
684
+ *
685
+ */
686
+ ForceCodeSet: 16, "16": "ForceCodeSet",
687
+ /**
688
+ *
689
+ * * Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
690
+ * * option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
691
+ *
692
+ */
693
+ ForceC40: 17, "17": "ForceC40",
694
+ /**
695
+ *
696
+ * * Specifies whether to use compact mode for Code-128 code (type {@link Boolean}, or "true" or "false"
697
+ * * {@link String } value).
698
+ * * This can yield slightly smaller bar codes. This option and {@link #FORCE_CODE_SET} are mutually
699
+ * * exclusive.
700
+ *
701
+ */
702
+ Code128Compact: 18, "18": "Code128Compact",
703
+ TelepenAsNumeric: 19, "19": "TelepenAsNumeric",
704
+ });
729
705
 
730
706
  const BarcodeResultFinalization = (typeof FinalizationRegistry === 'undefined')
731
707
  ? { register: () => {}, unregister: () => {} }
732
- : new FinalizationRegistry(ptr => wasm.__wbg_barcoderesult_free(ptr >>> 0));
733
- /**
734
- */
708
+ : new FinalizationRegistry(ptr => wasm.__wbg_barcoderesult_free(ptr >>> 0, 1));
709
+
735
710
  export class BarcodeResult {
736
711
 
737
712
  static __wrap(ptr) {
@@ -751,95 +726,76 @@ export class BarcodeResult {
751
726
 
752
727
  free() {
753
728
  const ptr = this.__destroy_into_raw();
754
- wasm.__wbg_barcoderesult_free(ptr);
729
+ wasm.__wbg_barcoderesult_free(ptr, 0);
755
730
  }
756
731
  /**
757
- * @returns {number}
758
- */
732
+ * @returns {number}
733
+ */
759
734
  timestamp() {
760
735
  const ret = wasm.barcoderesult_timestamp(this.__wbg_ptr);
761
736
  return ret;
762
737
  }
763
738
  /**
764
- * @returns {BarcodeFormat}
765
- */
739
+ * @returns {BarcodeFormat}
740
+ */
766
741
  format() {
767
742
  const ret = wasm.barcoderesult_format(this.__wbg_ptr);
768
743
  return ret;
769
744
  }
770
745
  /**
771
- * Each pair of f32 values is an (x,y) point
772
- * @returns {Float32Array}
773
- */
746
+ * Each pair of f32 values is an (x,y) point
747
+ * @returns {Float32Array}
748
+ */
774
749
  result_points() {
775
- try {
776
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
777
- wasm.barcoderesult_result_points(retptr, this.__wbg_ptr);
778
- var r0 = getInt32Memory0()[retptr / 4 + 0];
779
- var r1 = getInt32Memory0()[retptr / 4 + 1];
780
- var v1 = getArrayF32FromWasm0(r0, r1).slice();
781
- wasm.__wbindgen_free(r0, r1 * 4, 4);
782
- return v1;
783
- } finally {
784
- wasm.__wbindgen_add_to_stack_pointer(16);
785
- }
750
+ const ret = wasm.barcoderesult_result_points(this.__wbg_ptr);
751
+ var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
752
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
753
+ return v1;
786
754
  }
787
755
  /**
788
- * @returns {number}
789
- */
756
+ * @returns {number}
757
+ */
790
758
  num_bits() {
791
759
  const ret = wasm.barcoderesult_num_bits(this.__wbg_ptr);
792
760
  return ret >>> 0;
793
761
  }
794
762
  /**
795
- * @returns {Uint8Array}
796
- */
763
+ * @returns {Uint8Array}
764
+ */
797
765
  raw_bytes() {
798
- try {
799
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
800
- wasm.barcoderesult_raw_bytes(retptr, this.__wbg_ptr);
801
- var r0 = getInt32Memory0()[retptr / 4 + 0];
802
- var r1 = getInt32Memory0()[retptr / 4 + 1];
803
- var v1 = getArrayU8FromWasm0(r0, r1).slice();
804
- wasm.__wbindgen_free(r0, r1 * 1, 1);
805
- return v1;
806
- } finally {
807
- wasm.__wbindgen_add_to_stack_pointer(16);
808
- }
766
+ const ret = wasm.barcoderesult_raw_bytes(this.__wbg_ptr);
767
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
768
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
769
+ return v1;
809
770
  }
810
771
  /**
811
- * @returns {string}
812
- */
772
+ * @returns {string}
773
+ */
813
774
  text() {
814
775
  let deferred1_0;
815
776
  let deferred1_1;
816
777
  try {
817
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
818
- wasm.barcoderesult_text(retptr, this.__wbg_ptr);
819
- var r0 = getInt32Memory0()[retptr / 4 + 0];
820
- var r1 = getInt32Memory0()[retptr / 4 + 1];
821
- deferred1_0 = r0;
822
- deferred1_1 = r1;
823
- return getStringFromWasm0(r0, r1);
778
+ const ret = wasm.barcoderesult_text(this.__wbg_ptr);
779
+ deferred1_0 = ret[0];
780
+ deferred1_1 = ret[1];
781
+ return getStringFromWasm0(ret[0], ret[1]);
824
782
  } finally {
825
- wasm.__wbindgen_add_to_stack_pointer(16);
826
783
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
827
784
  }
828
785
  }
829
786
  /**
830
- * @returns {Map<any, any>}
831
- */
787
+ * @returns {Map<any, any>}
788
+ */
832
789
  get_meta_data() {
833
790
  const ret = wasm.barcoderesult_get_meta_data(this.__wbg_ptr);
834
- return takeObject(ret);
791
+ return ret;
835
792
  }
836
793
  }
837
794
 
838
795
  const DecodeHintDictionaryFinalization = (typeof FinalizationRegistry === 'undefined')
839
796
  ? { register: () => {}, unregister: () => {} }
840
- : new FinalizationRegistry(ptr => wasm.__wbg_decodehintdictionary_free(ptr >>> 0));
841
- /**
842
- */
797
+ : new FinalizationRegistry(ptr => wasm.__wbg_decodehintdictionary_free(ptr >>> 0, 1));
798
+
843
799
  export class DecodeHintDictionary {
844
800
 
845
801
  __destroy_into_raw() {
@@ -851,40 +807,35 @@ export class DecodeHintDictionary {
851
807
 
852
808
  free() {
853
809
  const ptr = this.__destroy_into_raw();
854
- wasm.__wbg_decodehintdictionary_free(ptr);
810
+ wasm.__wbg_decodehintdictionary_free(ptr, 0);
855
811
  }
856
- /**
857
- */
858
812
  constructor() {
859
813
  const ret = wasm.decodehintdictionary_new();
860
814
  this.__wbg_ptr = ret >>> 0;
815
+ DecodeHintDictionaryFinalization.register(this, this.__wbg_ptr, this);
861
816
  return this;
862
817
  }
863
818
  /**
864
- * @param {DecodeHintTypes} hint
865
- * @returns {string}
866
- */
819
+ * @param {DecodeHintTypes} hint
820
+ * @returns {string}
821
+ */
867
822
  get_hint(hint) {
868
823
  let deferred1_0;
869
824
  let deferred1_1;
870
825
  try {
871
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
872
- wasm.decodehintdictionary_get_hint(retptr, this.__wbg_ptr, hint);
873
- var r0 = getInt32Memory0()[retptr / 4 + 0];
874
- var r1 = getInt32Memory0()[retptr / 4 + 1];
875
- deferred1_0 = r0;
876
- deferred1_1 = r1;
877
- return getStringFromWasm0(r0, r1);
826
+ const ret = wasm.decodehintdictionary_get_hint(this.__wbg_ptr, hint);
827
+ deferred1_0 = ret[0];
828
+ deferred1_1 = ret[1];
829
+ return getStringFromWasm0(ret[0], ret[1]);
878
830
  } finally {
879
- wasm.__wbindgen_add_to_stack_pointer(16);
880
831
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
881
832
  }
882
833
  }
883
834
  /**
884
- * @param {DecodeHintTypes} hint
885
- * @param {string} value
886
- * @returns {boolean}
887
- */
835
+ * @param {DecodeHintTypes} hint
836
+ * @param {string} value
837
+ * @returns {boolean}
838
+ */
888
839
  set_hint(hint, value) {
889
840
  const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
890
841
  const len0 = WASM_VECTOR_LEN;
@@ -892,9 +843,9 @@ export class DecodeHintDictionary {
892
843
  return ret !== 0;
893
844
  }
894
845
  /**
895
- * @param {DecodeHintTypes} hint
896
- * @returns {boolean}
897
- */
846
+ * @param {DecodeHintTypes} hint
847
+ * @returns {boolean}
848
+ */
898
849
  remove_hint(hint) {
899
850
  const ret = wasm.decodehintdictionary_remove_hint(this.__wbg_ptr, hint);
900
851
  return ret !== 0;
@@ -903,9 +854,8 @@ export class DecodeHintDictionary {
903
854
 
904
855
  const EncodeHintDictionaryFinalization = (typeof FinalizationRegistry === 'undefined')
905
856
  ? { register: () => {}, unregister: () => {} }
906
- : new FinalizationRegistry(ptr => wasm.__wbg_encodehintdictionary_free(ptr >>> 0));
907
- /**
908
- */
857
+ : new FinalizationRegistry(ptr => wasm.__wbg_encodehintdictionary_free(ptr >>> 0, 1));
858
+
909
859
  export class EncodeHintDictionary {
910
860
 
911
861
  __destroy_into_raw() {
@@ -917,40 +867,35 @@ export class EncodeHintDictionary {
917
867
 
918
868
  free() {
919
869
  const ptr = this.__destroy_into_raw();
920
- wasm.__wbg_encodehintdictionary_free(ptr);
870
+ wasm.__wbg_encodehintdictionary_free(ptr, 0);
921
871
  }
922
- /**
923
- */
924
872
  constructor() {
925
873
  const ret = wasm.encodehintdictionary_new();
926
874
  this.__wbg_ptr = ret >>> 0;
875
+ EncodeHintDictionaryFinalization.register(this, this.__wbg_ptr, this);
927
876
  return this;
928
877
  }
929
878
  /**
930
- * @param {EncodeHintTypes} hint
931
- * @returns {string}
932
- */
879
+ * @param {EncodeHintTypes} hint
880
+ * @returns {string}
881
+ */
933
882
  get_hint(hint) {
934
883
  let deferred1_0;
935
884
  let deferred1_1;
936
885
  try {
937
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
938
- wasm.encodehintdictionary_get_hint(retptr, this.__wbg_ptr, hint);
939
- var r0 = getInt32Memory0()[retptr / 4 + 0];
940
- var r1 = getInt32Memory0()[retptr / 4 + 1];
941
- deferred1_0 = r0;
942
- deferred1_1 = r1;
943
- return getStringFromWasm0(r0, r1);
886
+ const ret = wasm.encodehintdictionary_get_hint(this.__wbg_ptr, hint);
887
+ deferred1_0 = ret[0];
888
+ deferred1_1 = ret[1];
889
+ return getStringFromWasm0(ret[0], ret[1]);
944
890
  } finally {
945
- wasm.__wbindgen_add_to_stack_pointer(16);
946
891
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
947
892
  }
948
893
  }
949
894
  /**
950
- * @param {EncodeHintTypes} hint
951
- * @param {string} value
952
- * @returns {boolean}
953
- */
895
+ * @param {EncodeHintTypes} hint
896
+ * @param {string} value
897
+ * @returns {boolean}
898
+ */
954
899
  set_hint(hint, value) {
955
900
  const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
956
901
  const len0 = WASM_VECTOR_LEN;
@@ -958,47 +903,93 @@ export class EncodeHintDictionary {
958
903
  return ret !== 0;
959
904
  }
960
905
  /**
961
- * @param {EncodeHintTypes} hint
962
- * @returns {boolean}
963
- */
906
+ * @param {EncodeHintTypes} hint
907
+ * @returns {boolean}
908
+ */
964
909
  remove_hint(hint) {
965
910
  const ret = wasm.encodehintdictionary_remove_hint(this.__wbg_ptr, hint);
966
911
  return ret !== 0;
967
912
  }
968
913
  }
969
914
 
970
- export function __wbindgen_object_drop_ref(arg0) {
971
- takeObject(arg0);
915
+ export function __wbg_barcoderesult_new(arg0) {
916
+ const ret = BarcodeResult.__wrap(arg0);
917
+ return ret;
918
+ };
919
+
920
+ export function __wbg_data_3ba00521691343fc(arg0, arg1) {
921
+ const ret = arg1.data;
922
+ const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
923
+ const len1 = WASM_VECTOR_LEN;
924
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
925
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
972
926
  };
973
927
 
974
- export function __wbindgen_string_new(arg0, arg1) {
975
- const ret = getStringFromWasm0(arg0, arg1);
976
- return addHeapObject(ret);
928
+ export function __wbg_getContext_5eaf5645cd6acb46() { return handleError(function (arg0, arg1, arg2) {
929
+ const ret = arg0.getContext(getStringFromWasm0(arg1, arg2));
930
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
931
+ }, arguments) };
932
+
933
+ export function __wbg_getImageData_eb8a47512c21d5f8() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
934
+ const ret = arg0.getImageData(arg1, arg2, arg3, arg4);
935
+ return ret;
936
+ }, arguments) };
937
+
938
+ export function __wbg_getTime_ab8b72009983c537(arg0) {
939
+ const ret = arg0.getTime();
940
+ return ret;
977
941
  };
978
942
 
979
- export function __wbg_barcoderesult_new(arg0) {
980
- const ret = BarcodeResult.__wrap(arg0);
981
- return addHeapObject(ret);
943
+ export function __wbg_height_f36c36e27347cf38(arg0) {
944
+ const ret = arg0.height;
945
+ return ret;
946
+ };
947
+
948
+ export function __wbg_instanceof_CanvasRenderingContext2d_23b21317d73228be(arg0) {
949
+ let result;
950
+ try {
951
+ result = arg0 instanceof CanvasRenderingContext2D;
952
+ } catch (_) {
953
+ result = false;
954
+ }
955
+ const ret = result;
956
+ return ret;
982
957
  };
983
958
 
984
- export function __wbg_new_d9bc3a0147634640() {
959
+ export function __wbg_new0_55477545727914d9() {
960
+ const ret = new Date();
961
+ return ret;
962
+ };
963
+
964
+ export function __wbg_new_bc96c6a1c0786643() {
985
965
  const ret = new Map();
986
- return addHeapObject(ret);
966
+ return ret;
987
967
  };
988
968
 
989
- export function __wbg_set_8417257aaedc936b(arg0, arg1, arg2) {
990
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
991
- return addHeapObject(ret);
969
+ export function __wbg_set_76818dc3c59a63d5(arg0, arg1, arg2) {
970
+ const ret = arg0.set(arg1, arg2);
971
+ return ret;
992
972
  };
993
973
 
994
- export function __wbg_getTime_2bc4375165f02d15(arg0) {
995
- const ret = getObject(arg0).getTime();
974
+ export function __wbg_width_9927e6a7adb23d6d(arg0) {
975
+ const ret = arg0.width;
996
976
  return ret;
997
977
  };
998
978
 
999
- export function __wbg_new0_7d84e5b2cd9fdc73() {
1000
- const ret = new Date();
1001
- return addHeapObject(ret);
979
+ export function __wbindgen_init_externref_table() {
980
+ const table = wasm.__wbindgen_export_2;
981
+ const offset = table.grow(4);
982
+ table.set(0, undefined);
983
+ table.set(offset + 0, undefined);
984
+ table.set(offset + 1, null);
985
+ table.set(offset + 2, true);
986
+ table.set(offset + 3, false);
987
+ ;
988
+ };
989
+
990
+ export function __wbindgen_string_new(arg0, arg1) {
991
+ const ret = getStringFromWasm0(arg0, arg1);
992
+ return ret;
1002
993
  };
1003
994
 
1004
995
  export function __wbindgen_throw(arg0, arg1) {