Barcode Detection API - Parte 2
Usando a câmera para detectar código
barcode.d.ts
interface BarcodeDetector {
new (barcodeDetectorOptions?: BarcodeDetectorOptions): BarcodeDetector;
static getSupportedFormats(): Promise<BarcodeFormat[]>;
detect(image: ImageBitmapSource): Promise<DetectedBarcode[]>;
}
declare var BarcodeDetector: {
prototype: BarcodeDetector;
new (barcodeDetectorOptions?: BarcodeDetectorOptions): BarcodeDetector;
};
interface BarcodeDetectorOptions {
formats: BarcodeFormat;
}
interface Point2D {
x: number
y: number
}
interface DetectedBarcode {
boundingBox: DOMRectReadOnly;
rawValue: string;
format: BarcodeFormat;
cornerPoints: Point2D[];
}
type BarcodeFormat =
| "aztec"
| "code_128"
| "code_39"
| "code_93"
| "codabar"
| "data_matrix"
| "ean_13"
| "ean_8"
| "itf"
| "pdf417"
| "qr_code"
| "unknown"
| "upc_a"
| "upc_e";
main.ts
draw.ts
Last updated