rxing-wasm 0.3.1 → 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/package.json +1 -1
- package/rxing_wasm.d.ts +338 -444
- package/rxing_wasm.js +2 -1
- package/rxing_wasm_bg.js +643 -748
- package/rxing_wasm_bg.wasm +0 -0
package/rxing_wasm_bg.js
CHANGED
|
@@ -4,24 +4,31 @@ export function __wbg_set_wasm(val) {
|
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
let cachedUint8ArrayMemory0 = null;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
16
|
+
let WASM_VECTOR_LEN = 0;
|
|
14
17
|
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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(
|
|
42
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
45
43
|
}
|
|
46
44
|
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
heap_next = heap[idx];
|
|
45
|
+
function isLikeNone(x) {
|
|
46
|
+
return x === undefined || x === null;
|
|
47
|
+
}
|
|
51
48
|
|
|
52
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
57
63
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
let cachedFloat32ArrayMemory0 = null;
|
|
65
|
+
|
|
66
|
+
function getFloat32ArrayMemory0() {
|
|
67
|
+
if (cachedFloat32ArrayMemory0 === null || cachedFloat32ArrayMemory0.byteLength === 0) {
|
|
68
|
+
cachedFloat32ArrayMemory0 = new Float32Array(wasm.memory.buffer);
|
|
61
69
|
}
|
|
62
|
-
return
|
|
70
|
+
return cachedFloat32ArrayMemory0;
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
|
|
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
|
-
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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(
|
|
157
|
-
var
|
|
158
|
-
var
|
|
159
|
-
|
|
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
|
|
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,618 +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(
|
|
200
|
-
var
|
|
201
|
-
var
|
|
202
|
-
|
|
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
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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);
|
|
279
|
-
}
|
|
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;
|
|
280
245
|
}
|
|
281
246
|
|
|
282
|
-
let stack_pointer = 128;
|
|
283
|
-
|
|
284
|
-
function addBorrowedObject(obj) {
|
|
285
|
-
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
286
|
-
heap[--stack_pointer] = obj;
|
|
287
|
-
return stack_pointer;
|
|
288
|
-
}
|
|
289
247
|
/**
|
|
290
|
-
* @param {HTMLCanvasElement} canvas
|
|
291
|
-
* @returns {Uint8Array}
|
|
292
|
-
*/
|
|
248
|
+
* @param {HTMLCanvasElement} canvas
|
|
249
|
+
* @returns {Uint8Array}
|
|
250
|
+
*/
|
|
293
251
|
export function convert_canvas_to_luma(canvas) {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
298
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
299
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
300
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
301
|
-
if (r3) {
|
|
302
|
-
throw takeObject(r2);
|
|
303
|
-
}
|
|
304
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
305
|
-
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
306
|
-
return v1;
|
|
307
|
-
} finally {
|
|
308
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
309
|
-
heap[stack_pointer++] = undefined;
|
|
252
|
+
const ret = wasm.convert_canvas_to_luma(canvas);
|
|
253
|
+
if (ret[3]) {
|
|
254
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
310
255
|
}
|
|
256
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
257
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
258
|
+
return v1;
|
|
311
259
|
}
|
|
312
260
|
|
|
313
261
|
/**
|
|
314
|
-
* @param {ImageData} image_data
|
|
315
|
-
* @returns {Uint8Array}
|
|
316
|
-
*/
|
|
262
|
+
* @param {ImageData} image_data
|
|
263
|
+
* @returns {Uint8Array}
|
|
264
|
+
*/
|
|
317
265
|
export function convert_imagedata_to_luma(image_data) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
323
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
324
|
-
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
325
|
-
return v1;
|
|
326
|
-
} finally {
|
|
327
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
328
|
-
heap[stack_pointer++] = undefined;
|
|
329
|
-
}
|
|
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;
|
|
330
270
|
}
|
|
331
271
|
|
|
332
|
-
let
|
|
272
|
+
let cachedUint32ArrayMemory0 = null;
|
|
333
273
|
|
|
334
|
-
function
|
|
335
|
-
if (
|
|
336
|
-
|
|
274
|
+
function getUint32ArrayMemory0() {
|
|
275
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
276
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
337
277
|
}
|
|
338
|
-
return
|
|
278
|
+
return cachedUint32ArrayMemory0;
|
|
339
279
|
}
|
|
340
280
|
|
|
341
281
|
function passArray32ToWasm0(arg, malloc) {
|
|
342
282
|
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
343
|
-
|
|
283
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
344
284
|
WASM_VECTOR_LEN = arg.length;
|
|
345
285
|
return ptr;
|
|
346
286
|
}
|
|
347
287
|
/**
|
|
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
|
-
*/
|
|
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
|
+
*/
|
|
357
297
|
export function decode_barcode_rgb(data, width, height, try_harder) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
364
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
365
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
366
|
-
if (r2) {
|
|
367
|
-
throw takeObject(r1);
|
|
368
|
-
}
|
|
369
|
-
return BarcodeResult.__wrap(r0);
|
|
370
|
-
} finally {
|
|
371
|
-
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]);
|
|
372
303
|
}
|
|
304
|
+
return BarcodeResult.__wrap(ret[0]);
|
|
373
305
|
}
|
|
374
306
|
|
|
375
307
|
/**
|
|
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
|
-
*/
|
|
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
|
+
*/
|
|
383
315
|
export function decode_barcode_with_hints(data, width, height, hints, filter_image) {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
391
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
392
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
393
|
-
if (r2) {
|
|
394
|
-
throw takeObject(r1);
|
|
395
|
-
}
|
|
396
|
-
return BarcodeResult.__wrap(r0);
|
|
397
|
-
} finally {
|
|
398
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
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]);
|
|
399
322
|
}
|
|
323
|
+
return BarcodeResult.__wrap(ret[0]);
|
|
400
324
|
}
|
|
401
325
|
|
|
402
326
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
403
327
|
ptr = ptr >>> 0;
|
|
404
|
-
const mem =
|
|
405
|
-
const slice = mem.subarray(ptr / 4, ptr / 4 + len);
|
|
328
|
+
const mem = getDataViewMemory0();
|
|
406
329
|
const result = [];
|
|
407
|
-
for (let i =
|
|
408
|
-
result.push(
|
|
330
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
331
|
+
result.push(wasm.__wbindgen_export_2.get(mem.getUint32(i, true)));
|
|
409
332
|
}
|
|
333
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
410
334
|
return result;
|
|
411
335
|
}
|
|
412
336
|
/**
|
|
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
|
-
*/
|
|
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
|
+
*/
|
|
420
344
|
export function decode_multi(data, width, height, hints, filter_image) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
428
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
429
|
-
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
430
|
-
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
431
|
-
if (r3) {
|
|
432
|
-
throw takeObject(r2);
|
|
433
|
-
}
|
|
434
|
-
var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
435
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
436
|
-
return v2;
|
|
437
|
-
} finally {
|
|
438
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
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]);
|
|
439
351
|
}
|
|
352
|
+
var v2 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
353
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
354
|
+
return v2;
|
|
440
355
|
}
|
|
441
356
|
|
|
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
357
|
/**
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
|
|
705
|
-
*
|
|
706
|
-
*/
|
|
707
|
-
AlsoInverted:11,"11":"AlsoInverted",
|
|
708
|
-
/**
|
|
709
|
-
*
|
|
710
|
-
* * Translate the ASCII values parsed by the Telepen reader into the Telepen Numeric form; use {@link Boolean#TRUE}.
|
|
711
|
-
*
|
|
712
|
-
*/
|
|
713
|
-
TelepenAsNumeric:12,"12":"TelepenAsNumeric", });
|
|
714
|
-
/**
|
|
715
|
-
* Available barcode types
|
|
716
|
-
*/
|
|
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
|
+
*/
|
|
717
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
|
+
});
|
|
718
435
|
/**
|
|
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
|
-
|
|
436
|
+
* @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12}
|
|
437
|
+
*/
|
|
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
|
+
});
|
|
782
532
|
/**
|
|
783
|
-
*
|
|
784
|
-
*/
|
|
785
|
-
|
|
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
|
+
});
|
|
786
705
|
|
|
787
706
|
const BarcodeResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
788
707
|
? { register: () => {}, unregister: () => {} }
|
|
789
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_barcoderesult_free(ptr >>> 0));
|
|
790
|
-
|
|
791
|
-
*/
|
|
708
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_barcoderesult_free(ptr >>> 0, 1));
|
|
709
|
+
|
|
792
710
|
export class BarcodeResult {
|
|
793
711
|
|
|
794
712
|
static __wrap(ptr) {
|
|
@@ -808,95 +726,76 @@ export class BarcodeResult {
|
|
|
808
726
|
|
|
809
727
|
free() {
|
|
810
728
|
const ptr = this.__destroy_into_raw();
|
|
811
|
-
wasm.__wbg_barcoderesult_free(ptr);
|
|
729
|
+
wasm.__wbg_barcoderesult_free(ptr, 0);
|
|
812
730
|
}
|
|
813
731
|
/**
|
|
814
|
-
|
|
815
|
-
|
|
732
|
+
* @returns {number}
|
|
733
|
+
*/
|
|
816
734
|
timestamp() {
|
|
817
735
|
const ret = wasm.barcoderesult_timestamp(this.__wbg_ptr);
|
|
818
736
|
return ret;
|
|
819
737
|
}
|
|
820
738
|
/**
|
|
821
|
-
|
|
822
|
-
|
|
739
|
+
* @returns {BarcodeFormat}
|
|
740
|
+
*/
|
|
823
741
|
format() {
|
|
824
742
|
const ret = wasm.barcoderesult_format(this.__wbg_ptr);
|
|
825
743
|
return ret;
|
|
826
744
|
}
|
|
827
745
|
/**
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
746
|
+
* Each pair of f32 values is an (x,y) point
|
|
747
|
+
* @returns {Float32Array}
|
|
748
|
+
*/
|
|
831
749
|
result_points() {
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
837
|
-
var v1 = getArrayF32FromWasm0(r0, r1).slice();
|
|
838
|
-
wasm.__wbindgen_free(r0, r1 * 4, 4);
|
|
839
|
-
return v1;
|
|
840
|
-
} finally {
|
|
841
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
842
|
-
}
|
|
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;
|
|
843
754
|
}
|
|
844
755
|
/**
|
|
845
|
-
|
|
846
|
-
|
|
756
|
+
* @returns {number}
|
|
757
|
+
*/
|
|
847
758
|
num_bits() {
|
|
848
759
|
const ret = wasm.barcoderesult_num_bits(this.__wbg_ptr);
|
|
849
760
|
return ret >>> 0;
|
|
850
761
|
}
|
|
851
762
|
/**
|
|
852
|
-
|
|
853
|
-
|
|
763
|
+
* @returns {Uint8Array}
|
|
764
|
+
*/
|
|
854
765
|
raw_bytes() {
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
860
|
-
var v1 = getArrayU8FromWasm0(r0, r1).slice();
|
|
861
|
-
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
862
|
-
return v1;
|
|
863
|
-
} finally {
|
|
864
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
865
|
-
}
|
|
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;
|
|
866
770
|
}
|
|
867
771
|
/**
|
|
868
|
-
|
|
869
|
-
|
|
772
|
+
* @returns {string}
|
|
773
|
+
*/
|
|
870
774
|
text() {
|
|
871
775
|
let deferred1_0;
|
|
872
776
|
let deferred1_1;
|
|
873
777
|
try {
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
deferred1_0 = r0;
|
|
879
|
-
deferred1_1 = r1;
|
|
880
|
-
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]);
|
|
881
782
|
} finally {
|
|
882
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
883
783
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
884
784
|
}
|
|
885
785
|
}
|
|
886
786
|
/**
|
|
887
|
-
|
|
888
|
-
|
|
787
|
+
* @returns {Map<any, any>}
|
|
788
|
+
*/
|
|
889
789
|
get_meta_data() {
|
|
890
790
|
const ret = wasm.barcoderesult_get_meta_data(this.__wbg_ptr);
|
|
891
|
-
return
|
|
791
|
+
return ret;
|
|
892
792
|
}
|
|
893
793
|
}
|
|
894
794
|
|
|
895
795
|
const DecodeHintDictionaryFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
896
796
|
? { register: () => {}, unregister: () => {} }
|
|
897
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_decodehintdictionary_free(ptr >>> 0));
|
|
898
|
-
|
|
899
|
-
*/
|
|
797
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_decodehintdictionary_free(ptr >>> 0, 1));
|
|
798
|
+
|
|
900
799
|
export class DecodeHintDictionary {
|
|
901
800
|
|
|
902
801
|
__destroy_into_raw() {
|
|
@@ -908,40 +807,35 @@ export class DecodeHintDictionary {
|
|
|
908
807
|
|
|
909
808
|
free() {
|
|
910
809
|
const ptr = this.__destroy_into_raw();
|
|
911
|
-
wasm.__wbg_decodehintdictionary_free(ptr);
|
|
810
|
+
wasm.__wbg_decodehintdictionary_free(ptr, 0);
|
|
912
811
|
}
|
|
913
|
-
/**
|
|
914
|
-
*/
|
|
915
812
|
constructor() {
|
|
916
813
|
const ret = wasm.decodehintdictionary_new();
|
|
917
814
|
this.__wbg_ptr = ret >>> 0;
|
|
815
|
+
DecodeHintDictionaryFinalization.register(this, this.__wbg_ptr, this);
|
|
918
816
|
return this;
|
|
919
817
|
}
|
|
920
818
|
/**
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
819
|
+
* @param {DecodeHintTypes} hint
|
|
820
|
+
* @returns {string}
|
|
821
|
+
*/
|
|
924
822
|
get_hint(hint) {
|
|
925
823
|
let deferred1_0;
|
|
926
824
|
let deferred1_1;
|
|
927
825
|
try {
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
deferred1_0 = r0;
|
|
933
|
-
deferred1_1 = r1;
|
|
934
|
-
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]);
|
|
935
830
|
} finally {
|
|
936
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
937
831
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
938
832
|
}
|
|
939
833
|
}
|
|
940
834
|
/**
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
835
|
+
* @param {DecodeHintTypes} hint
|
|
836
|
+
* @param {string} value
|
|
837
|
+
* @returns {boolean}
|
|
838
|
+
*/
|
|
945
839
|
set_hint(hint, value) {
|
|
946
840
|
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
947
841
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -949,9 +843,9 @@ export class DecodeHintDictionary {
|
|
|
949
843
|
return ret !== 0;
|
|
950
844
|
}
|
|
951
845
|
/**
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
846
|
+
* @param {DecodeHintTypes} hint
|
|
847
|
+
* @returns {boolean}
|
|
848
|
+
*/
|
|
955
849
|
remove_hint(hint) {
|
|
956
850
|
const ret = wasm.decodehintdictionary_remove_hint(this.__wbg_ptr, hint);
|
|
957
851
|
return ret !== 0;
|
|
@@ -960,9 +854,8 @@ export class DecodeHintDictionary {
|
|
|
960
854
|
|
|
961
855
|
const EncodeHintDictionaryFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
962
856
|
? { register: () => {}, unregister: () => {} }
|
|
963
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_encodehintdictionary_free(ptr >>> 0));
|
|
964
|
-
|
|
965
|
-
*/
|
|
857
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_encodehintdictionary_free(ptr >>> 0, 1));
|
|
858
|
+
|
|
966
859
|
export class EncodeHintDictionary {
|
|
967
860
|
|
|
968
861
|
__destroy_into_raw() {
|
|
@@ -974,40 +867,35 @@ export class EncodeHintDictionary {
|
|
|
974
867
|
|
|
975
868
|
free() {
|
|
976
869
|
const ptr = this.__destroy_into_raw();
|
|
977
|
-
wasm.__wbg_encodehintdictionary_free(ptr);
|
|
870
|
+
wasm.__wbg_encodehintdictionary_free(ptr, 0);
|
|
978
871
|
}
|
|
979
|
-
/**
|
|
980
|
-
*/
|
|
981
872
|
constructor() {
|
|
982
873
|
const ret = wasm.encodehintdictionary_new();
|
|
983
874
|
this.__wbg_ptr = ret >>> 0;
|
|
875
|
+
EncodeHintDictionaryFinalization.register(this, this.__wbg_ptr, this);
|
|
984
876
|
return this;
|
|
985
877
|
}
|
|
986
878
|
/**
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
879
|
+
* @param {EncodeHintTypes} hint
|
|
880
|
+
* @returns {string}
|
|
881
|
+
*/
|
|
990
882
|
get_hint(hint) {
|
|
991
883
|
let deferred1_0;
|
|
992
884
|
let deferred1_1;
|
|
993
885
|
try {
|
|
994
|
-
const
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
deferred1_0 = r0;
|
|
999
|
-
deferred1_1 = r1;
|
|
1000
|
-
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]);
|
|
1001
890
|
} finally {
|
|
1002
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1003
891
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1004
892
|
}
|
|
1005
893
|
}
|
|
1006
894
|
/**
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
895
|
+
* @param {EncodeHintTypes} hint
|
|
896
|
+
* @param {string} value
|
|
897
|
+
* @returns {boolean}
|
|
898
|
+
*/
|
|
1011
899
|
set_hint(hint, value) {
|
|
1012
900
|
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1013
901
|
const len0 = WASM_VECTOR_LEN;
|
|
@@ -1015,33 +903,52 @@ export class EncodeHintDictionary {
|
|
|
1015
903
|
return ret !== 0;
|
|
1016
904
|
}
|
|
1017
905
|
/**
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
906
|
+
* @param {EncodeHintTypes} hint
|
|
907
|
+
* @returns {boolean}
|
|
908
|
+
*/
|
|
1021
909
|
remove_hint(hint) {
|
|
1022
910
|
const ret = wasm.encodehintdictionary_remove_hint(this.__wbg_ptr, hint);
|
|
1023
911
|
return ret !== 0;
|
|
1024
912
|
}
|
|
1025
913
|
}
|
|
1026
914
|
|
|
1027
|
-
export function
|
|
1028
|
-
|
|
915
|
+
export function __wbg_barcoderesult_new(arg0) {
|
|
916
|
+
const ret = BarcodeResult.__wrap(arg0);
|
|
917
|
+
return ret;
|
|
1029
918
|
};
|
|
1030
919
|
|
|
1031
|
-
export function
|
|
1032
|
-
const ret =
|
|
1033
|
-
|
|
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);
|
|
1034
926
|
};
|
|
1035
927
|
|
|
1036
|
-
export function
|
|
1037
|
-
const ret =
|
|
1038
|
-
return
|
|
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;
|
|
1039
941
|
};
|
|
1040
942
|
|
|
1041
|
-
export function
|
|
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) {
|
|
1042
949
|
let result;
|
|
1043
950
|
try {
|
|
1044
|
-
result =
|
|
951
|
+
result = arg0 instanceof CanvasRenderingContext2D;
|
|
1045
952
|
} catch (_) {
|
|
1046
953
|
result = false;
|
|
1047
954
|
}
|
|
@@ -1049,54 +956,42 @@ export function __wbg_instanceof_CanvasRenderingContext2d_20bf99ccc051643b(arg0)
|
|
|
1049
956
|
return ret;
|
|
1050
957
|
};
|
|
1051
958
|
|
|
1052
|
-
export function
|
|
1053
|
-
const ret =
|
|
1054
|
-
return addHeapObject(ret);
|
|
1055
|
-
}, arguments) };
|
|
1056
|
-
|
|
1057
|
-
export function __wbg_width_aee8b8809b033b05(arg0) {
|
|
1058
|
-
const ret = getObject(arg0).width;
|
|
959
|
+
export function __wbg_new0_55477545727914d9() {
|
|
960
|
+
const ret = new Date();
|
|
1059
961
|
return ret;
|
|
1060
962
|
};
|
|
1061
963
|
|
|
1062
|
-
export function
|
|
1063
|
-
const ret =
|
|
964
|
+
export function __wbg_new_bc96c6a1c0786643() {
|
|
965
|
+
const ret = new Map();
|
|
1064
966
|
return ret;
|
|
1065
967
|
};
|
|
1066
968
|
|
|
1067
|
-
export function
|
|
1068
|
-
const ret =
|
|
1069
|
-
return
|
|
1070
|
-
}, arguments) };
|
|
1071
|
-
|
|
1072
|
-
export function __wbg_data_c02d3aac6da15e9f(arg0, arg1) {
|
|
1073
|
-
const ret = getObject(arg1).data;
|
|
1074
|
-
const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc);
|
|
1075
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1076
|
-
getInt32Memory0()[arg0 / 4 + 1] = len1;
|
|
1077
|
-
getInt32Memory0()[arg0 / 4 + 0] = ptr1;
|
|
969
|
+
export function __wbg_set_76818dc3c59a63d5(arg0, arg1, arg2) {
|
|
970
|
+
const ret = arg0.set(arg1, arg2);
|
|
971
|
+
return ret;
|
|
1078
972
|
};
|
|
1079
973
|
|
|
1080
|
-
export function
|
|
1081
|
-
const ret =
|
|
1082
|
-
return
|
|
974
|
+
export function __wbg_width_9927e6a7adb23d6d(arg0) {
|
|
975
|
+
const ret = arg0.width;
|
|
976
|
+
return ret;
|
|
1083
977
|
};
|
|
1084
978
|
|
|
1085
|
-
export function
|
|
1086
|
-
const
|
|
1087
|
-
|
|
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
|
+
;
|
|
1088
988
|
};
|
|
1089
989
|
|
|
1090
|
-
export function
|
|
1091
|
-
const ret =
|
|
990
|
+
export function __wbindgen_string_new(arg0, arg1) {
|
|
991
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1092
992
|
return ret;
|
|
1093
993
|
};
|
|
1094
994
|
|
|
1095
|
-
export function __wbg_new0_7d84e5b2cd9fdc73() {
|
|
1096
|
-
const ret = new Date();
|
|
1097
|
-
return addHeapObject(ret);
|
|
1098
|
-
};
|
|
1099
|
-
|
|
1100
995
|
export function __wbindgen_throw(arg0, arg1) {
|
|
1101
996
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1102
997
|
};
|