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