@pixelverse/strichjs-sdk 1.7.5 → 1.8.1
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/CHANGELOG.md +23 -3
- package/README.md +1 -2
- package/dist/strich-noesm.js +18 -18
- package/dist/strich.d.ts +69 -0
- package/dist/strich.js +14 -14
- package/package.json +2 -1
package/dist/strich.d.ts
CHANGED
|
@@ -334,6 +334,71 @@ export declare interface FrameSourceConfiguration {
|
|
|
334
334
|
constraints?: MediaStreamConstraints;
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
+
/**
|
|
338
|
+
* Configuration object for {@link ImageScanner}.
|
|
339
|
+
*
|
|
340
|
+
* Specify which kind of 1D/2D barcodes should be detected using the
|
|
341
|
+
* {@link EngineConfiguration.symbologies} field.
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* To read a QR Code from an image, use this configuration:
|
|
345
|
+
*
|
|
346
|
+
* ```javascript
|
|
347
|
+
* const cfg = {
|
|
348
|
+
* engine: { symbologies: ['qr'] }
|
|
349
|
+
* }
|
|
350
|
+
* ```
|
|
351
|
+
*/
|
|
352
|
+
export declare interface ImageConfiguration {
|
|
353
|
+
/**
|
|
354
|
+
* Engine configuration
|
|
355
|
+
*/
|
|
356
|
+
engine?: EngineConfiguration;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Scanner for static images, typically provided via an HTML input element.
|
|
361
|
+
*
|
|
362
|
+
* @remarks
|
|
363
|
+
* Make sure that the input image is sharp, and that the code to be scanned is in focus. Some images might not scan
|
|
364
|
+
* using ImageScanner, but can be scanned using camera-based scanning (BarcodeReader, PopupScanner). This is due to
|
|
365
|
+
* more frames being available for decoding, increasing the chances of getting a good quality sample.
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* HTML:
|
|
369
|
+
* ```html
|
|
370
|
+
* <input id="image-input" type="file" accept="image/*" />
|
|
371
|
+
* ```
|
|
372
|
+
*
|
|
373
|
+
* JavaScript:
|
|
374
|
+
* ```javascript
|
|
375
|
+
* const imageInput = document.getElementById('image-input');
|
|
376
|
+
* imageInput.onchange = async () => {
|
|
377
|
+
* const detections = await ImageScanner.scan(image.files[0], {
|
|
378
|
+
* engine: { symbologies: ['qr'] }
|
|
379
|
+
* });
|
|
380
|
+
* }
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
export declare class ImageScanner {
|
|
384
|
+
/**
|
|
385
|
+
* Decode a barcode in a static image.
|
|
386
|
+
*
|
|
387
|
+
* @remarks
|
|
388
|
+
* By default, a single barcode is detected. In a future release, an option to detect multiple barcodes
|
|
389
|
+
* will be added.
|
|
390
|
+
*
|
|
391
|
+
* @param image - The image source, can be a HTMLImageElement, ImageData, ImageBitmap, File, Blob or a data URL.
|
|
392
|
+
* @param cfg - The engine configuration to use for barcode detection.
|
|
393
|
+
*/
|
|
394
|
+
static scan(image: ImageSource, cfg: ImageConfiguration): Promise<CodeDetection[]>;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* The types of image input {@link ImageScanner.scan} can process.
|
|
399
|
+
*/
|
|
400
|
+
export declare type ImageSource = HTMLImageElement | ImageData | ImageBitmap | File | Blob | string;
|
|
401
|
+
|
|
337
402
|
/**
|
|
338
403
|
* Locator configuration
|
|
339
404
|
*/
|
|
@@ -713,6 +778,10 @@ export declare class SdkError extends Error {
|
|
|
713
778
|
*/
|
|
714
779
|
detailMessage?: string;
|
|
715
780
|
constructor(keyOrMessage: string, cause?: Error);
|
|
781
|
+
/**
|
|
782
|
+
* Create an SDK error with 'invalid input' semantics.
|
|
783
|
+
*/
|
|
784
|
+
static invalidInputError(cause?: Error): SdkError;
|
|
716
785
|
}
|
|
717
786
|
|
|
718
787
|
/**
|