@gueshbzh-perso/scanner 0.8.0 → 0.10.0
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 +15 -2
- package/dist/core.d.ts +12 -4
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +24 -11
- package/dist/core.js.map +1 -1
- package/dist/engine.d.ts +13 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +24 -4
- package/dist/engine.js.map +1 -1
- package/dist/native.d.ts +43 -0
- package/dist/native.d.ts.map +1 -0
- package/dist/native.js +107 -0
- package/dist/native.js.map +1 -0
- package/dist/overlay.js +2 -1
- package/dist/overlay.js.map +1 -1
- package/dist/reader.d.ts +40 -1
- package/dist/reader.d.ts.map +1 -1
- package/dist/reader.js +186 -30
- package/dist/reader.js.map +1 -1
- package/dist/types.d.ts +19 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/wasm/scanner_wasm.d.ts +20 -0
- package/dist/wasm/scanner_wasm.js +53 -0
- package/dist/wasm/scanner_wasm_bg.wasm +0 -0
- package/dist/wasm/scanner_wasm_bg.wasm.d.ts +2 -0
- package/package.json +1 -1
- package/src/core.ts +24 -11
- package/src/engine.ts +43 -5
- package/src/native.ts +140 -0
- package/src/overlay.ts +2 -1
- package/src/reader.ts +205 -34
- package/src/types.ts +19 -2
package/src/types.ts
CHANGED
|
@@ -23,8 +23,10 @@ export interface Detection {
|
|
|
23
23
|
/** Symbology, e.g. `"qr_code"`, `"ean_13"`. */
|
|
24
24
|
format: BarcodeFormat;
|
|
25
25
|
/**
|
|
26
|
-
* Location of the code
|
|
27
|
-
*
|
|
26
|
+
* Location of the code: corners of the symbol (2D codes: their finder
|
|
27
|
+
* points; 1D codes: start-top, end-top, end-bottom, start-bottom). For
|
|
28
|
+
* camera scans: video pixels (`video.videoWidth` space). For `scanImage`:
|
|
29
|
+
* pixels of the source image.
|
|
28
30
|
*/
|
|
29
31
|
points: Point[];
|
|
30
32
|
/** Raw payload bytes when the symbology provides them (binary QR codes…). */
|
|
@@ -116,6 +118,17 @@ export interface ProcessingOptions {
|
|
|
116
118
|
maxDimension?: number;
|
|
117
119
|
/** Frame pipeline. `'auto'` uses WebGL2 and falls back to Canvas 2D. Default: `'auto'`. */
|
|
118
120
|
backend?: 'auto' | 'webgl' | 'canvas';
|
|
121
|
+
/**
|
|
122
|
+
* Use the browser's native `BarcodeDetector` (Chrome on Android, macOS and
|
|
123
|
+
* ChromeOS) as the fast pass, when it supports every requested format
|
|
124
|
+
* (`micro_qr` excepted). The engine's fallback strategies keep running on
|
|
125
|
+
* the frames it finds nothing in: hard codes (laser engraving, shadows…)
|
|
126
|
+
* are still read. Codes get the same confirmation and de-duplication.
|
|
127
|
+
* It reads codes whatever their orientation. Elsewhere (Safari, Firefox,
|
|
128
|
+
* Chrome on Windows / Linux), or if it fails, the engine does everything.
|
|
129
|
+
* `'off'`: always the engine alone. Default: `'auto'`.
|
|
130
|
+
*/
|
|
131
|
+
nativeDetector?: 'auto' | 'off';
|
|
119
132
|
}
|
|
120
133
|
|
|
121
134
|
export interface ReaderOptions extends EngineOptions, AssetOptions {
|
|
@@ -150,6 +163,10 @@ export interface ReaderStats {
|
|
|
150
163
|
worker: boolean;
|
|
151
164
|
/** Frames decoded in parallel (number of workers, `1` on the main thread). */
|
|
152
165
|
workers: number;
|
|
166
|
+
/** `true` when the native `BarcodeDetector` does the fast pass (see `processing.nativeDetector`). */
|
|
167
|
+
native: boolean;
|
|
168
|
+
/** Average native detection time, in ms (`0` when not used). */
|
|
169
|
+
nativeMs: number;
|
|
153
170
|
}
|
|
154
171
|
|
|
155
172
|
export interface ReaderEvents {
|