zedbar 0.2.2 → 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/package.json +1 -1
- package/zedbar.d.ts +17 -10
- package/zedbar.js +27 -20
- package/zedbar_bg.wasm +0 -0
package/package.json
CHANGED
package/zedbar.d.ts
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Scan grayscale image data for barcodes and QR codes.
|
|
5
|
-
*
|
|
6
|
-
* `data` must be an array of 8-bit grayscale pixel values,
|
|
7
|
-
* row-major, with dimensions `width` x `height`.
|
|
8
|
-
*
|
|
9
|
-
* Returns an array of `DecodeResult` objects.
|
|
10
|
-
*/
|
|
11
|
-
export function scanGrayscale(data: Uint8Array, width: number, height: number, options?: ScanOptions | null): DecodeResult[];
|
|
12
3
|
/**
|
|
13
4
|
* Scan an encoded image (PNG, JPEG, BMP, WebP) for barcodes and QR codes.
|
|
14
5
|
*
|
|
@@ -21,6 +12,15 @@ export function scanGrayscale(data: Uint8Array, width: number, height: number, o
|
|
|
21
12
|
* Returns an array of `DecodeResult` objects.
|
|
22
13
|
*/
|
|
23
14
|
export function scanImageBytes(bytes: Uint8Array, options?: ScanOptions | null): DecodeResult[];
|
|
15
|
+
/**
|
|
16
|
+
* Scan grayscale image data for barcodes and QR codes.
|
|
17
|
+
*
|
|
18
|
+
* `data` must be an array of 8-bit grayscale pixel values,
|
|
19
|
+
* row-major, with dimensions `width` x `height`.
|
|
20
|
+
*
|
|
21
|
+
* Returns an array of `DecodeResult` objects.
|
|
22
|
+
*/
|
|
23
|
+
export function scanGrayscale(data: Uint8Array, width: number, height: number, options?: ScanOptions | null): DecodeResult[];
|
|
24
24
|
/**
|
|
25
25
|
* A decoded barcode/QR code result.
|
|
26
26
|
*/
|
|
@@ -34,10 +34,17 @@ export class DecodeResult {
|
|
|
34
34
|
readonly symbolType: string;
|
|
35
35
|
/**
|
|
36
36
|
* Raw decoded bytes.
|
|
37
|
+
*
|
|
38
|
+
* For 2D codes (QR, SQ), these are the original bytes as encoded
|
|
39
|
+
* in the barcode, before any text encoding or base64 conversion.
|
|
37
40
|
*/
|
|
38
41
|
readonly data: Uint8Array;
|
|
39
42
|
/**
|
|
40
|
-
* Decoded data as
|
|
43
|
+
* Decoded data as text, or null if not decodable as text.
|
|
44
|
+
*
|
|
45
|
+
* For 2D codes, the text is produced by detecting the encoding (UTF-8,
|
|
46
|
+
* Shift-JIS, Windows-1252, etc.) and converting to a UTF-8 string.
|
|
47
|
+
* For linear barcodes, the data is always ASCII text.
|
|
41
48
|
*/
|
|
42
49
|
readonly text: string | undefined;
|
|
43
50
|
}
|
package/zedbar.js
CHANGED
|
@@ -74,27 +74,28 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
74
74
|
return result;
|
|
75
75
|
}
|
|
76
76
|
/**
|
|
77
|
-
* Scan
|
|
77
|
+
* Scan an encoded image (PNG, JPEG, BMP, WebP) for barcodes and QR codes.
|
|
78
78
|
*
|
|
79
|
-
* `
|
|
80
|
-
*
|
|
79
|
+
* `bytes` should contain the raw bytes of an image file in one of the
|
|
80
|
+
* supported formats: PNG, JPEG, BMP, or WebP.
|
|
81
|
+
*
|
|
82
|
+
* The image will be automatically decoded and converted to grayscale
|
|
83
|
+
* before scanning.
|
|
81
84
|
*
|
|
82
85
|
* Returns an array of `DecodeResult` objects.
|
|
83
|
-
* @param {Uint8Array}
|
|
84
|
-
* @param {number} width
|
|
85
|
-
* @param {number} height
|
|
86
|
+
* @param {Uint8Array} bytes
|
|
86
87
|
* @param {ScanOptions | null} [options]
|
|
87
88
|
* @returns {DecodeResult[]}
|
|
88
89
|
*/
|
|
89
|
-
exports.
|
|
90
|
-
const ptr0 = passArray8ToWasm0(
|
|
90
|
+
exports.scanImageBytes = function(bytes, options) {
|
|
91
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
91
92
|
const len0 = WASM_VECTOR_LEN;
|
|
92
93
|
let ptr1 = 0;
|
|
93
94
|
if (!isLikeNone(options)) {
|
|
94
95
|
_assertClass(options, ScanOptions);
|
|
95
96
|
ptr1 = options.__destroy_into_raw();
|
|
96
97
|
}
|
|
97
|
-
const ret = wasm.
|
|
98
|
+
const ret = wasm.scanImageBytes(ptr0, len0, ptr1);
|
|
98
99
|
if (ret[3]) {
|
|
99
100
|
throw takeFromExternrefTable0(ret[2]);
|
|
100
101
|
}
|
|
@@ -104,28 +105,27 @@ exports.scanGrayscale = function(data, width, height, options) {
|
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
/**
|
|
107
|
-
* Scan
|
|
108
|
-
*
|
|
109
|
-
* `bytes` should contain the raw bytes of an image file in one of the
|
|
110
|
-
* supported formats: PNG, JPEG, BMP, or WebP.
|
|
108
|
+
* Scan grayscale image data for barcodes and QR codes.
|
|
111
109
|
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
110
|
+
* `data` must be an array of 8-bit grayscale pixel values,
|
|
111
|
+
* row-major, with dimensions `width` x `height`.
|
|
114
112
|
*
|
|
115
113
|
* Returns an array of `DecodeResult` objects.
|
|
116
|
-
* @param {Uint8Array}
|
|
114
|
+
* @param {Uint8Array} data
|
|
115
|
+
* @param {number} width
|
|
116
|
+
* @param {number} height
|
|
117
117
|
* @param {ScanOptions | null} [options]
|
|
118
118
|
* @returns {DecodeResult[]}
|
|
119
119
|
*/
|
|
120
|
-
exports.
|
|
121
|
-
const ptr0 = passArray8ToWasm0(
|
|
120
|
+
exports.scanGrayscale = function(data, width, height, options) {
|
|
121
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
122
122
|
const len0 = WASM_VECTOR_LEN;
|
|
123
123
|
let ptr1 = 0;
|
|
124
124
|
if (!isLikeNone(options)) {
|
|
125
125
|
_assertClass(options, ScanOptions);
|
|
126
126
|
ptr1 = options.__destroy_into_raw();
|
|
127
127
|
}
|
|
128
|
-
const ret = wasm.
|
|
128
|
+
const ret = wasm.scanGrayscale(ptr0, len0, width, height, ptr1);
|
|
129
129
|
if (ret[3]) {
|
|
130
130
|
throw takeFromExternrefTable0(ret[2]);
|
|
131
131
|
}
|
|
@@ -179,6 +179,9 @@ class DecodeResult {
|
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Raw decoded bytes.
|
|
182
|
+
*
|
|
183
|
+
* For 2D codes (QR, SQ), these are the original bytes as encoded
|
|
184
|
+
* in the barcode, before any text encoding or base64 conversion.
|
|
182
185
|
* @returns {Uint8Array}
|
|
183
186
|
*/
|
|
184
187
|
get data() {
|
|
@@ -188,7 +191,11 @@ class DecodeResult {
|
|
|
188
191
|
return v1;
|
|
189
192
|
}
|
|
190
193
|
/**
|
|
191
|
-
* Decoded data as
|
|
194
|
+
* Decoded data as text, or null if not decodable as text.
|
|
195
|
+
*
|
|
196
|
+
* For 2D codes, the text is produced by detecting the encoding (UTF-8,
|
|
197
|
+
* Shift-JIS, Windows-1252, etc.) and converting to a UTF-8 string.
|
|
198
|
+
* For linear barcodes, the data is always ASCII text.
|
|
192
199
|
* @returns {string | undefined}
|
|
193
200
|
*/
|
|
194
201
|
get text() {
|
package/zedbar_bg.wasm
CHANGED
|
Binary file
|