rxing-wasm 0.2.1 → 0.2.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/README.md +13 -1
- package/package.json +1 -1
- package/rxing_wasm.d.ts +206 -0
- package/rxing_wasm_bg.js +290 -23
- package/rxing_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -102,5 +102,17 @@ pub fn decode_multi(
|
|
|
102
102
|
) -> Result<MultiDecodeResult, String>;
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
```rust
|
|
106
|
+
pub fn encode_barcode_with_hints(
|
|
107
|
+
data: &str,
|
|
108
|
+
width: u32,
|
|
109
|
+
height: u32,
|
|
110
|
+
bc_type: BarcodeFormat,
|
|
111
|
+
hints: &mut EncodeHintDictionary,
|
|
112
|
+
) -> Result<String, String>;
|
|
113
|
+
```
|
|
114
|
+
|
|
105
115
|
## Beta Features
|
|
106
|
-
`decode_multi` is currently in beta. The output may be unexpected, or undefined. Please use with caution. The interface may be unstable, and change.
|
|
116
|
+
`decode_multi` is currently in beta. The output may be unexpected, or undefined. Please use with caution. The interface may be unstable, and change.
|
|
117
|
+
|
|
118
|
+
`encode_barcode_with_hints` is currently in alpha. The output and behaviour is unexpected and poorly documented. Use at your own risk, feature may change, unstable interface.
|
package/package.json
CHANGED
package/rxing_wasm.d.ts
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export function encode_barcode(data: string, width: number, height: number, bc_type: number): string;
|
|
12
12
|
/**
|
|
13
|
+
* Encode a barcode with the given data, dimensions, and type, use the given encoding hints
|
|
14
|
+
* @param {string} data
|
|
15
|
+
* @param {number} width
|
|
16
|
+
* @param {number} height
|
|
17
|
+
* @param {number} bc_type
|
|
18
|
+
* @param {EncodeHintDictionary} hints
|
|
19
|
+
* @returns {string}
|
|
20
|
+
*/
|
|
21
|
+
export function encode_barcode_with_hints(data: string, width: number, height: number, bc_type: number, hints: EncodeHintDictionary): string;
|
|
22
|
+
/**
|
|
13
23
|
* Decode a barcode from an array of 8bit luma data
|
|
14
24
|
* @param {Uint8Array} data
|
|
15
25
|
* @param {number} width
|
|
@@ -57,6 +67,178 @@ export function decode_barcode_with_hints(data: Uint8Array, width: number, heigh
|
|
|
57
67
|
*/
|
|
58
68
|
export function decode_multi(data: Uint8Array, width: number, height: number, hints: DecodeHintDictionary): MultiDecodeResult;
|
|
59
69
|
/**
|
|
70
|
+
*/
|
|
71
|
+
export enum EncodeHintTypes {
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
* * Specifies what degree of error correction to use, for example in QR Codes.
|
|
75
|
+
* * Type depends on the encoder. For example for QR codes it's type
|
|
76
|
+
* * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
|
|
77
|
+
* * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
|
|
78
|
+
* * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
|
|
79
|
+
* * In all cases, it can also be a {@link String} representation of the desired value as well.
|
|
80
|
+
* * Note: an Aztec symbol should have a minimum of 25% EC words.
|
|
81
|
+
*
|
|
82
|
+
*/
|
|
83
|
+
ErrorCorrection = 0,
|
|
84
|
+
/**
|
|
85
|
+
*
|
|
86
|
+
* * Specifies what character encoding to use where applicable (type {@link String})
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
CharacterSet = 1,
|
|
90
|
+
/**
|
|
91
|
+
*
|
|
92
|
+
* * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
DataMatrixShape = 2,
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* * Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
|
|
99
|
+
* * {@link String } value).
|
|
100
|
+
* * The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
|
|
101
|
+
* * character set via ECIs.
|
|
102
|
+
* * Please note that in that case, the most compact character encoding is chosen for characters in
|
|
103
|
+
* * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
|
|
104
|
+
* * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
|
|
105
|
+
* * means of the {@link #CHARACTER_SET} encoding hint.
|
|
106
|
+
* * Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
|
|
107
|
+
* * group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
|
|
108
|
+
* * for the purpose of delimiting AIs.
|
|
109
|
+
* * This option and {@link #FORCE_C40} are mutually exclusive.
|
|
110
|
+
*
|
|
111
|
+
*/
|
|
112
|
+
DataMatrixCompact = 3,
|
|
113
|
+
/**
|
|
114
|
+
*
|
|
115
|
+
* * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
|
|
116
|
+
* *
|
|
117
|
+
* * @deprecated use width/height params in
|
|
118
|
+
* * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
|
|
119
|
+
*
|
|
120
|
+
*/
|
|
121
|
+
MinSize = 4,
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
|
|
125
|
+
* *
|
|
126
|
+
* * @deprecated without replacement
|
|
127
|
+
*
|
|
128
|
+
*/
|
|
129
|
+
MaxSize = 5,
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
* * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
|
|
133
|
+
* * by format; for example it controls margin before and after the barcode horizontally for
|
|
134
|
+
* * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
|
|
135
|
+
*
|
|
136
|
+
*/
|
|
137
|
+
MARGIN = 6,
|
|
138
|
+
/**
|
|
139
|
+
*
|
|
140
|
+
* * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
|
|
141
|
+
* * {@link String} value).
|
|
142
|
+
*
|
|
143
|
+
*/
|
|
144
|
+
Pdf417Compact = 7,
|
|
145
|
+
/**
|
|
146
|
+
*
|
|
147
|
+
* * Specifies what compaction mode to use for PDF417 (type
|
|
148
|
+
* * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
|
|
149
|
+
* * enum values).
|
|
150
|
+
*
|
|
151
|
+
*/
|
|
152
|
+
Pdf417Compaction = 8,
|
|
153
|
+
/**
|
|
154
|
+
*
|
|
155
|
+
* * Specifies the minimum and maximum number of rows and columns for PDF417 (type
|
|
156
|
+
* * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
|
|
157
|
+
*
|
|
158
|
+
*/
|
|
159
|
+
Pdf417Dimensions = 9,
|
|
160
|
+
/**
|
|
161
|
+
*
|
|
162
|
+
* * Specifies whether to automatically insert ECIs when encoding PDF417 (type {@link Boolean}, or "true" or "false"
|
|
163
|
+
* * {@link String} value).
|
|
164
|
+
* * Please note that in that case, the most compact character encoding is chosen for characters in
|
|
165
|
+
* * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
|
|
166
|
+
* * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
|
|
167
|
+
* * means of the {@link #CHARACTER_SET} encoding hint.
|
|
168
|
+
*
|
|
169
|
+
*/
|
|
170
|
+
Pdf417AutoEci = 10,
|
|
171
|
+
/**
|
|
172
|
+
*
|
|
173
|
+
* * Specifies the required number of layers for an Aztec code.
|
|
174
|
+
* * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
|
|
175
|
+
* * 0 indicates to use the minimum number of layers (the default).
|
|
176
|
+
* * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
|
|
177
|
+
* * (Type {@link Integer}, or {@link String} representation of the integer value).
|
|
178
|
+
*
|
|
179
|
+
*/
|
|
180
|
+
AztecLayers = 11,
|
|
181
|
+
/**
|
|
182
|
+
*
|
|
183
|
+
* * Specifies the exact version of QR code to be encoded.
|
|
184
|
+
* * (Type {@link Integer}, or {@link String} representation of the integer value).
|
|
185
|
+
*
|
|
186
|
+
*/
|
|
187
|
+
QrVersion = 12,
|
|
188
|
+
/**
|
|
189
|
+
*
|
|
190
|
+
* * Specifies the QR code mask pattern to be used. Allowed values are
|
|
191
|
+
* * 0..QRCode.NUM_MASK_PATTERNS-1. By default the code will automatically select
|
|
192
|
+
* * the optimal mask pattern.
|
|
193
|
+
* * * (Type {@link Integer}, or {@link String} representation of the integer value).
|
|
194
|
+
*
|
|
195
|
+
*/
|
|
196
|
+
QrMaskPattern = 13,
|
|
197
|
+
/**
|
|
198
|
+
*
|
|
199
|
+
* * Specifies whether to use compact mode for QR code (type {@link Boolean}, or "true" or "false"
|
|
200
|
+
* * {@link String } value).
|
|
201
|
+
* * Please note that when compaction is performed, the most compact character encoding is chosen
|
|
202
|
+
* * for characters in the input that are not in the ISO-8859-1 character set. Based on experience,
|
|
203
|
+
* * some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can
|
|
204
|
+
* * be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint.
|
|
205
|
+
*
|
|
206
|
+
*/
|
|
207
|
+
QrCompact = 14,
|
|
208
|
+
/**
|
|
209
|
+
*
|
|
210
|
+
* * Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
|
|
211
|
+
* * {@link String } value).
|
|
212
|
+
*
|
|
213
|
+
*/
|
|
214
|
+
Gs1Format = 15,
|
|
215
|
+
/**
|
|
216
|
+
*
|
|
217
|
+
* * Forces which encoding will be used. Currently only used for Code-128 code sets (Type {@link String}).
|
|
218
|
+
* * Valid values are "A", "B", "C".
|
|
219
|
+
* * This option and {@link #CODE128_COMPACT} are mutually exclusive.
|
|
220
|
+
*
|
|
221
|
+
*/
|
|
222
|
+
ForceCodeSet = 16,
|
|
223
|
+
/**
|
|
224
|
+
*
|
|
225
|
+
* * Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
|
|
226
|
+
* * option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
|
|
227
|
+
*
|
|
228
|
+
*/
|
|
229
|
+
ForceC40 = 17,
|
|
230
|
+
/**
|
|
231
|
+
*
|
|
232
|
+
* * Specifies whether to use compact mode for Code-128 code (type {@link Boolean}, or "true" or "false"
|
|
233
|
+
* * {@link String } value).
|
|
234
|
+
* * This can yield slightly smaller bar codes. This option and {@link #FORCE_CODE_SET} are mutually
|
|
235
|
+
* * exclusive.
|
|
236
|
+
*
|
|
237
|
+
*/
|
|
238
|
+
Code128Compact = 18,
|
|
239
|
+
TelepenAsNumeric = 19,
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
60
242
|
* Available barcode types
|
|
61
243
|
*/
|
|
62
244
|
export enum BarcodeFormat {
|
|
@@ -288,6 +470,30 @@ export class DecodeHintDictionary {
|
|
|
288
470
|
}
|
|
289
471
|
/**
|
|
290
472
|
*/
|
|
473
|
+
export class EncodeHintDictionary {
|
|
474
|
+
free(): void;
|
|
475
|
+
/**
|
|
476
|
+
*/
|
|
477
|
+
constructor();
|
|
478
|
+
/**
|
|
479
|
+
* @param {number} hint
|
|
480
|
+
* @returns {string}
|
|
481
|
+
*/
|
|
482
|
+
get_hint(hint: number): string;
|
|
483
|
+
/**
|
|
484
|
+
* @param {number} hint
|
|
485
|
+
* @param {string} value
|
|
486
|
+
* @returns {boolean}
|
|
487
|
+
*/
|
|
488
|
+
set_hint(hint: number, value: string): boolean;
|
|
489
|
+
/**
|
|
490
|
+
* @param {number} hint
|
|
491
|
+
* @returns {boolean}
|
|
492
|
+
*/
|
|
493
|
+
remove_hint(hint: number): boolean;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
*/
|
|
291
497
|
export class MultiDecodeResult {
|
|
292
498
|
free(): void;
|
|
293
499
|
/**
|
package/rxing_wasm_bg.js
CHANGED
|
@@ -61,23 +61,6 @@ function getInt32Memory0() {
|
|
|
61
61
|
return cachedInt32Memory0;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
let cachedFloat32Memory0 = null;
|
|
65
|
-
|
|
66
|
-
function getFloat32Memory0() {
|
|
67
|
-
if (cachedFloat32Memory0 === null || cachedFloat32Memory0.byteLength === 0) {
|
|
68
|
-
cachedFloat32Memory0 = new Float32Array(wasm.memory.buffer);
|
|
69
|
-
}
|
|
70
|
-
return cachedFloat32Memory0;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function getArrayF32FromWasm0(ptr, len) {
|
|
74
|
-
return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
78
|
-
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
64
|
let WASM_VECTOR_LEN = 0;
|
|
82
65
|
|
|
83
66
|
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
|
@@ -134,6 +117,23 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
134
117
|
WASM_VECTOR_LEN = offset;
|
|
135
118
|
return ptr;
|
|
136
119
|
}
|
|
120
|
+
|
|
121
|
+
let cachedFloat32Memory0 = null;
|
|
122
|
+
|
|
123
|
+
function getFloat32Memory0() {
|
|
124
|
+
if (cachedFloat32Memory0 === null || cachedFloat32Memory0.byteLength === 0) {
|
|
125
|
+
cachedFloat32Memory0 = new Float32Array(wasm.memory.buffer);
|
|
126
|
+
}
|
|
127
|
+
return cachedFloat32Memory0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function getArrayF32FromWasm0(ptr, len) {
|
|
131
|
+
return getFloat32Memory0().subarray(ptr / 4, ptr / 4 + len);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
135
|
+
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
|
|
136
|
+
}
|
|
137
137
|
/**
|
|
138
138
|
* Encode a barcode with the given data, dimensions, and type
|
|
139
139
|
* @param {string} data
|
|
@@ -165,6 +165,45 @@ export function encode_barcode(data, width, height, bc_type) {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
function _assertClass(instance, klass) {
|
|
169
|
+
if (!(instance instanceof klass)) {
|
|
170
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
171
|
+
}
|
|
172
|
+
return instance.ptr;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Encode a barcode with the given data, dimensions, and type, use the given encoding hints
|
|
176
|
+
* @param {string} data
|
|
177
|
+
* @param {number} width
|
|
178
|
+
* @param {number} height
|
|
179
|
+
* @param {number} bc_type
|
|
180
|
+
* @param {EncodeHintDictionary} hints
|
|
181
|
+
* @returns {string}
|
|
182
|
+
*/
|
|
183
|
+
export function encode_barcode_with_hints(data, width, height, bc_type, hints) {
|
|
184
|
+
try {
|
|
185
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
186
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
187
|
+
const len0 = WASM_VECTOR_LEN;
|
|
188
|
+
_assertClass(hints, EncodeHintDictionary);
|
|
189
|
+
wasm.encode_barcode_with_hints(retptr, ptr0, len0, width, height, bc_type, hints.ptr);
|
|
190
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
191
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
192
|
+
var r2 = getInt32Memory0()[retptr / 4 + 2];
|
|
193
|
+
var r3 = getInt32Memory0()[retptr / 4 + 3];
|
|
194
|
+
var ptr1 = r0;
|
|
195
|
+
var len1 = r1;
|
|
196
|
+
if (r3) {
|
|
197
|
+
ptr1 = 0; len1 = 0;
|
|
198
|
+
throw takeObject(r2);
|
|
199
|
+
}
|
|
200
|
+
return getStringFromWasm0(ptr1, len1);
|
|
201
|
+
} finally {
|
|
202
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
203
|
+
wasm.__wbindgen_free(ptr1, len1);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
168
207
|
function passArray8ToWasm0(arg, malloc) {
|
|
169
208
|
const ptr = malloc(arg.length * 1);
|
|
170
209
|
getUint8Memory0().set(arg, ptr / 1);
|
|
@@ -270,12 +309,6 @@ export function decode_barcode_rgb(data, width, height, try_harder) {
|
|
|
270
309
|
}
|
|
271
310
|
}
|
|
272
311
|
|
|
273
|
-
function _assertClass(instance, klass) {
|
|
274
|
-
if (!(instance instanceof klass)) {
|
|
275
|
-
throw new Error(`expected instance of ${klass.name}`);
|
|
276
|
-
}
|
|
277
|
-
return instance.ptr;
|
|
278
|
-
}
|
|
279
312
|
/**
|
|
280
313
|
* @param {Uint8Array} data
|
|
281
314
|
* @param {number} width
|
|
@@ -328,6 +361,176 @@ export function decode_multi(data, width, height, hints) {
|
|
|
328
361
|
}
|
|
329
362
|
}
|
|
330
363
|
|
|
364
|
+
/**
|
|
365
|
+
*/
|
|
366
|
+
export const EncodeHintTypes = Object.freeze({
|
|
367
|
+
/**
|
|
368
|
+
*
|
|
369
|
+
* * Specifies what degree of error correction to use, for example in QR Codes.
|
|
370
|
+
* * Type depends on the encoder. For example for QR codes it's type
|
|
371
|
+
* * {@link com.google.zxing.qrcode.decoder.ErrorCorrectionLevel ErrorCorrectionLevel}.
|
|
372
|
+
* * For Aztec it is of type {@link Integer}, representing the minimal percentage of error correction words.
|
|
373
|
+
* * For PDF417 it is of type {@link Integer}, valid values being 0 to 8.
|
|
374
|
+
* * In all cases, it can also be a {@link String} representation of the desired value as well.
|
|
375
|
+
* * Note: an Aztec symbol should have a minimum of 25% EC words.
|
|
376
|
+
*
|
|
377
|
+
*/
|
|
378
|
+
ErrorCorrection:0,"0":"ErrorCorrection",
|
|
379
|
+
/**
|
|
380
|
+
*
|
|
381
|
+
* * Specifies what character encoding to use where applicable (type {@link String})
|
|
382
|
+
*
|
|
383
|
+
*/
|
|
384
|
+
CharacterSet:1,"1":"CharacterSet",
|
|
385
|
+
/**
|
|
386
|
+
*
|
|
387
|
+
* * Specifies the matrix shape for Data Matrix (type {@link com.google.zxing.datamatrix.encoder.SymbolShapeHint})
|
|
388
|
+
*
|
|
389
|
+
*/
|
|
390
|
+
DataMatrixShape:2,"2":"DataMatrixShape",
|
|
391
|
+
/**
|
|
392
|
+
*
|
|
393
|
+
* * Specifies whether to use compact mode for Data Matrix (type {@link Boolean}, or "true" or "false"
|
|
394
|
+
* * {@link String } value).
|
|
395
|
+
* * The compact encoding mode also supports the encoding of characters that are not in the ISO-8859-1
|
|
396
|
+
* * character set via ECIs.
|
|
397
|
+
* * Please note that in that case, the most compact character encoding is chosen for characters in
|
|
398
|
+
* * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
|
|
399
|
+
* * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
|
|
400
|
+
* * means of the {@link #CHARACTER_SET} encoding hint.
|
|
401
|
+
* * Compact encoding also provides GS1-FNC1 support when {@link #GS1_FORMAT} is selected. In this case
|
|
402
|
+
* * group-separator character (ASCII 29 decimal) can be used to encode the positions of FNC1 codewords
|
|
403
|
+
* * for the purpose of delimiting AIs.
|
|
404
|
+
* * This option and {@link #FORCE_C40} are mutually exclusive.
|
|
405
|
+
*
|
|
406
|
+
*/
|
|
407
|
+
DataMatrixCompact:3,"3":"DataMatrixCompact",
|
|
408
|
+
/**
|
|
409
|
+
*
|
|
410
|
+
* * Specifies a minimum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
|
|
411
|
+
* *
|
|
412
|
+
* * @deprecated use width/height params in
|
|
413
|
+
* * {@link com.google.zxing.datamatrix.DataMatrixWriter#encode(String, BarcodeFormat, int, int)}
|
|
414
|
+
*
|
|
415
|
+
*/
|
|
416
|
+
MinSize:4,"4":"MinSize",
|
|
417
|
+
/**
|
|
418
|
+
*
|
|
419
|
+
* * Specifies a maximum barcode size (type {@link Dimension}). Only applicable to Data Matrix now.
|
|
420
|
+
* *
|
|
421
|
+
* * @deprecated without replacement
|
|
422
|
+
*
|
|
423
|
+
*/
|
|
424
|
+
MaxSize:5,"5":"MaxSize",
|
|
425
|
+
/**
|
|
426
|
+
*
|
|
427
|
+
* * Specifies margin, in pixels, to use when generating the barcode. The meaning can vary
|
|
428
|
+
* * by format; for example it controls margin before and after the barcode horizontally for
|
|
429
|
+
* * most 1D formats. (Type {@link Integer}, or {@link String} representation of the integer value).
|
|
430
|
+
*
|
|
431
|
+
*/
|
|
432
|
+
MARGIN:6,"6":"MARGIN",
|
|
433
|
+
/**
|
|
434
|
+
*
|
|
435
|
+
* * Specifies whether to use compact mode for PDF417 (type {@link Boolean}, or "true" or "false"
|
|
436
|
+
* * {@link String} value).
|
|
437
|
+
*
|
|
438
|
+
*/
|
|
439
|
+
Pdf417Compact:7,"7":"Pdf417Compact",
|
|
440
|
+
/**
|
|
441
|
+
*
|
|
442
|
+
* * Specifies what compaction mode to use for PDF417 (type
|
|
443
|
+
* * {@link com.google.zxing.pdf417.encoder.Compaction Compaction} or {@link String} value of one of its
|
|
444
|
+
* * enum values).
|
|
445
|
+
*
|
|
446
|
+
*/
|
|
447
|
+
Pdf417Compaction:8,"8":"Pdf417Compaction",
|
|
448
|
+
/**
|
|
449
|
+
*
|
|
450
|
+
* * Specifies the minimum and maximum number of rows and columns for PDF417 (type
|
|
451
|
+
* * {@link com.google.zxing.pdf417.encoder.Dimensions Dimensions}).
|
|
452
|
+
*
|
|
453
|
+
*/
|
|
454
|
+
Pdf417Dimensions:9,"9":"Pdf417Dimensions",
|
|
455
|
+
/**
|
|
456
|
+
*
|
|
457
|
+
* * Specifies whether to automatically insert ECIs when encoding PDF417 (type {@link Boolean}, or "true" or "false"
|
|
458
|
+
* * {@link String} value).
|
|
459
|
+
* * Please note that in that case, the most compact character encoding is chosen for characters in
|
|
460
|
+
* * the input that are not in the ISO-8859-1 character set. Based on experience, some scanners do not
|
|
461
|
+
* * support encodings like cp-1256 (Arabic). In such cases the encoding can be forced to UTF-8 by
|
|
462
|
+
* * means of the {@link #CHARACTER_SET} encoding hint.
|
|
463
|
+
*
|
|
464
|
+
*/
|
|
465
|
+
Pdf417AutoEci:10,"10":"Pdf417AutoEci",
|
|
466
|
+
/**
|
|
467
|
+
*
|
|
468
|
+
* * Specifies the required number of layers for an Aztec code.
|
|
469
|
+
* * A negative number (-1, -2, -3, -4) specifies a compact Aztec code.
|
|
470
|
+
* * 0 indicates to use the minimum number of layers (the default).
|
|
471
|
+
* * A positive number (1, 2, .. 32) specifies a normal (non-compact) Aztec code.
|
|
472
|
+
* * (Type {@link Integer}, or {@link String} representation of the integer value).
|
|
473
|
+
*
|
|
474
|
+
*/
|
|
475
|
+
AztecLayers:11,"11":"AztecLayers",
|
|
476
|
+
/**
|
|
477
|
+
*
|
|
478
|
+
* * Specifies the exact version of QR code to be encoded.
|
|
479
|
+
* * (Type {@link Integer}, or {@link String} representation of the integer value).
|
|
480
|
+
*
|
|
481
|
+
*/
|
|
482
|
+
QrVersion:12,"12":"QrVersion",
|
|
483
|
+
/**
|
|
484
|
+
*
|
|
485
|
+
* * Specifies the QR code mask pattern to be used. Allowed values are
|
|
486
|
+
* * 0..QRCode.NUM_MASK_PATTERNS-1. By default the code will automatically select
|
|
487
|
+
* * the optimal mask pattern.
|
|
488
|
+
* * * (Type {@link Integer}, or {@link String} representation of the integer value).
|
|
489
|
+
*
|
|
490
|
+
*/
|
|
491
|
+
QrMaskPattern:13,"13":"QrMaskPattern",
|
|
492
|
+
/**
|
|
493
|
+
*
|
|
494
|
+
* * Specifies whether to use compact mode for QR code (type {@link Boolean}, or "true" or "false"
|
|
495
|
+
* * {@link String } value).
|
|
496
|
+
* * Please note that when compaction is performed, the most compact character encoding is chosen
|
|
497
|
+
* * for characters in the input that are not in the ISO-8859-1 character set. Based on experience,
|
|
498
|
+
* * some scanners do not support encodings like cp-1256 (Arabic). In such cases the encoding can
|
|
499
|
+
* * be forced to UTF-8 by means of the {@link #CHARACTER_SET} encoding hint.
|
|
500
|
+
*
|
|
501
|
+
*/
|
|
502
|
+
QrCompact:14,"14":"QrCompact",
|
|
503
|
+
/**
|
|
504
|
+
*
|
|
505
|
+
* * Specifies whether the data should be encoded to the GS1 standard (type {@link Boolean}, or "true" or "false"
|
|
506
|
+
* * {@link String } value).
|
|
507
|
+
*
|
|
508
|
+
*/
|
|
509
|
+
Gs1Format:15,"15":"Gs1Format",
|
|
510
|
+
/**
|
|
511
|
+
*
|
|
512
|
+
* * Forces which encoding will be used. Currently only used for Code-128 code sets (Type {@link String}).
|
|
513
|
+
* * Valid values are "A", "B", "C".
|
|
514
|
+
* * This option and {@link #CODE128_COMPACT} are mutually exclusive.
|
|
515
|
+
*
|
|
516
|
+
*/
|
|
517
|
+
ForceCodeSet:16,"16":"ForceCodeSet",
|
|
518
|
+
/**
|
|
519
|
+
*
|
|
520
|
+
* * Forces C40 encoding for data-matrix (type {@link Boolean}, or "true" or "false") {@link String } value). This
|
|
521
|
+
* * option and {@link #DATA_MATRIX_COMPACT} are mutually exclusive.
|
|
522
|
+
*
|
|
523
|
+
*/
|
|
524
|
+
ForceC40:17,"17":"ForceC40",
|
|
525
|
+
/**
|
|
526
|
+
*
|
|
527
|
+
* * Specifies whether to use compact mode for Code-128 code (type {@link Boolean}, or "true" or "false"
|
|
528
|
+
* * {@link String } value).
|
|
529
|
+
* * This can yield slightly smaller bar codes. This option and {@link #FORCE_CODE_SET} are mutually
|
|
530
|
+
* * exclusive.
|
|
531
|
+
*
|
|
532
|
+
*/
|
|
533
|
+
Code128Compact:18,"18":"Code128Compact",TelepenAsNumeric:19,"19":"TelepenAsNumeric", });
|
|
331
534
|
/**
|
|
332
535
|
* Available barcode types
|
|
333
536
|
*/
|
|
@@ -660,6 +863,70 @@ export class DecodeHintDictionary {
|
|
|
660
863
|
}
|
|
661
864
|
/**
|
|
662
865
|
*/
|
|
866
|
+
export class EncodeHintDictionary {
|
|
867
|
+
|
|
868
|
+
static __wrap(ptr) {
|
|
869
|
+
const obj = Object.create(EncodeHintDictionary.prototype);
|
|
870
|
+
obj.ptr = ptr;
|
|
871
|
+
|
|
872
|
+
return obj;
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
__destroy_into_raw() {
|
|
876
|
+
const ptr = this.ptr;
|
|
877
|
+
this.ptr = 0;
|
|
878
|
+
|
|
879
|
+
return ptr;
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
free() {
|
|
883
|
+
const ptr = this.__destroy_into_raw();
|
|
884
|
+
wasm.__wbg_encodehintdictionary_free(ptr);
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
*/
|
|
888
|
+
constructor() {
|
|
889
|
+
const ret = wasm.encodehintdictionary_new();
|
|
890
|
+
return EncodeHintDictionary.__wrap(ret);
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* @param {number} hint
|
|
894
|
+
* @returns {string}
|
|
895
|
+
*/
|
|
896
|
+
get_hint(hint) {
|
|
897
|
+
try {
|
|
898
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
899
|
+
wasm.encodehintdictionary_get_hint(retptr, this.ptr, hint);
|
|
900
|
+
var r0 = getInt32Memory0()[retptr / 4 + 0];
|
|
901
|
+
var r1 = getInt32Memory0()[retptr / 4 + 1];
|
|
902
|
+
return getStringFromWasm0(r0, r1);
|
|
903
|
+
} finally {
|
|
904
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
905
|
+
wasm.__wbindgen_free(r0, r1);
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* @param {number} hint
|
|
910
|
+
* @param {string} value
|
|
911
|
+
* @returns {boolean}
|
|
912
|
+
*/
|
|
913
|
+
set_hint(hint, value) {
|
|
914
|
+
const ptr0 = passStringToWasm0(value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
915
|
+
const len0 = WASM_VECTOR_LEN;
|
|
916
|
+
const ret = wasm.encodehintdictionary_set_hint(this.ptr, hint, ptr0, len0);
|
|
917
|
+
return ret !== 0;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* @param {number} hint
|
|
921
|
+
* @returns {boolean}
|
|
922
|
+
*/
|
|
923
|
+
remove_hint(hint) {
|
|
924
|
+
const ret = wasm.encodehintdictionary_remove_hint(this.ptr, hint);
|
|
925
|
+
return ret !== 0;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
*/
|
|
663
930
|
export class MultiDecodeResult {
|
|
664
931
|
|
|
665
932
|
static __wrap(ptr) {
|
package/rxing_wasm_bg.wasm
CHANGED
|
Binary file
|