dynamsoft-barcode-reader-bundle 11.2.4000 → 11.4.2000-beta-202604162228

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.
Files changed (58) hide show
  1. package/LEGAL.txt +8 -1
  2. package/LICENSE +1 -1
  3. package/README.html +541 -115
  4. package/README.md +628 -125
  5. package/dist/dbr.bundle.d.ts +1577 -2689
  6. package/dist/dbr.bundle.esm.js +3 -3
  7. package/dist/dbr.bundle.js +3 -3
  8. package/dist/dbr.bundle.mjs +3 -3
  9. package/dist/dbr.bundle.worker.js +3 -3
  10. package/dist/dynamsoft-barcode-reader-bundle-ml-simd-pthread.js +1 -1
  11. package/dist/dynamsoft-barcode-reader-bundle-ml-simd-pthread.wasm +0 -0
  12. package/dist/dynamsoft-barcode-reader-bundle-ml-simd.js +1 -1
  13. package/dist/dynamsoft-barcode-reader-bundle-ml-simd.wasm +0 -0
  14. package/dist/dynamsoft-barcode-reader-bundle.js +1 -1
  15. package/dist/dynamsoft-barcode-reader-bundle.wasm +0 -0
  16. package/dist/models/Code128Decoder.data +0 -0
  17. package/dist/models/Code39ITFDecoder.data +0 -0
  18. package/dist/models/DataMatrixQRCodeDeblur.data +0 -0
  19. package/dist/models/DataMatrixQRCodeLocalization.data +0 -0
  20. package/dist/models/EAN13Decoder.data +0 -0
  21. package/dist/models/OneDDeblur.data +0 -0
  22. package/dist/models/OneDLocalization.data +0 -0
  23. package/dist/models/PDF417Deblur.data +0 -0
  24. package/dist/models/PDF417Localization.data +0 -0
  25. package/dist/parser-resources/AADHAAR.data +0 -0
  26. package/dist/parser-resources/AAMVA_DL_ID.data +1 -0
  27. package/dist/parser-resources/GS1_AI.data +66 -0
  28. package/dist/parser-resources/MRTD.data +1 -0
  29. package/dist/parser-resources/SOUTH_AFRICA_DL.data +1 -0
  30. package/dist/parser-resources/VIN.data +0 -0
  31. package/dist/templates/DBR-PresetTemplates.json +9 -22
  32. package/dist/ui/barcode-scanner.ui.xml +271 -108
  33. package/dist/ui/dce.rtu.ui.xml +431 -0
  34. package/dist/ui/dce.ui.v5.xml +470 -0
  35. package/dist/ui/dce.ui.xml +138 -114
  36. package/dist/ui/dls.license.dialog.html +1 -1
  37. package/package.json +16 -15
  38. package/samples.url +1 -1
  39. package/API_Reference_BarcodeScanner.url +0 -2
  40. package/API_Reference_Foundational.url +0 -2
  41. package/dist/parser-resources/AADHAAR.dcpres +0 -1
  42. package/dist/parser-resources/AADHAAR_Map.txt +0 -3
  43. package/dist/parser-resources/AAMVA_DL_ID.dcpres +0 -1
  44. package/dist/parser-resources/AAMVA_DL_ID_WITH_MAG_STRIPE.dcpres +0 -1
  45. package/dist/parser-resources/AAMVA_Map.txt +0 -70
  46. package/dist/parser-resources/GS1_AI.dcpres +0 -1
  47. package/dist/parser-resources/GS1_AI_Map.txt +0 -643
  48. package/dist/parser-resources/MRTD_Map.txt +0 -255
  49. package/dist/parser-resources/MRTD_TD1_ID.dcpres +0 -1
  50. package/dist/parser-resources/MRTD_TD2_FRENCH_ID.dcpres +0 -1
  51. package/dist/parser-resources/MRTD_TD2_ID.dcpres +0 -1
  52. package/dist/parser-resources/MRTD_TD2_VISA.dcpres +0 -1
  53. package/dist/parser-resources/MRTD_TD3_PASSPORT.dcpres +0 -1
  54. package/dist/parser-resources/MRTD_TD3_VISA.dcpres +0 -1
  55. package/dist/parser-resources/SOUTH_AFRICA_DL.dcpres +0 -1
  56. package/dist/parser-resources/SOUTH_AFRICA_DL_Map.txt +0 -3
  57. package/dist/parser-resources/VIN.dcpres +0 -1
  58. package/dist/parser-resources/VIN_Map.txt +0 -150
@@ -114,7 +114,7 @@ declare enum EnumErrorCode {
114
114
  /** The specified file path does not exist and could not be created. This error could be due to insufficient permissions, a read-only filesystem, or other environmental constraints preventing file creation. */
115
115
  EC_CREATE_FILE_FAILED = -10068,
116
116
  /** The input ImageData object contains invalid parameters. This could be due to incorrect data types, out-of-range values, or improperly formatted data being passed to a function expecting ImageData. */
117
- EC_IMGAE_DATA_INVALID = -10069,
117
+ EC_IMAGE_DATA_INVALID = -10069,
118
118
  /** The size of the input image does not meet the requirements. */
119
119
  EC_IMAGE_SIZE_NOT_MATCH = -10070,
120
120
  /** The pixel format of the input image does not meet the requirements. */
@@ -135,6 +135,8 @@ declare enum EnumErrorCode {
135
135
  /**The rectangle is invalid.*/
136
136
  EC_RECT_INVALID = -10080,
137
137
  EC_TEMPLATE_VERSION_INCOMPATIBLE = -10081,
138
+ /** The portrait zone could not be located on the identity document.*/
139
+ EC_PORTRAIT_ZONE_NOT_FOUND = -10082,
138
140
  /** Indicates no license is available or the license is not set. */
139
141
  EC_NO_LICENSE = -20000,
140
142
  /** Encountered failures while attempting to read or write to the license buffer. */
@@ -448,7 +450,9 @@ declare enum EnumRegionObjectElementType {
448
450
  /** Corresponds to the `TargetROIElement` subclass. */
449
451
  ROET_TARGET_ROI = 8,
450
452
  /** Corresponds to the `EnhancedImageElement` subclass, indicating images that have undergone enhancement for better clarity or detail, specifically in the context of enhanced image processing. */
451
- ROET_ENHANCED_IMAGE = 9
453
+ ROET_ENHANCED_IMAGE = 9,
454
+ /** Corresponds to the `AuxiliaryRegionElement` subclass, representing auxiliary regions detected within the image. */
455
+ ROET_AUXILIARY_REGION = 10
452
456
  }
453
457
 
454
458
  declare enum EnumSectionType {
@@ -504,17 +508,6 @@ declare enum EnumModuleName {
504
508
  MN_DYNAMSOFT_CAPTURE_VISION_STD = "std"
505
509
  }
506
510
 
507
- declare enum EnumTransformMatrixType {
508
- /**Represents a transformation matrix that converts coordinates from the local image to the original image.*/
509
- TMT_LOCAL_TO_ORIGINAL_IMAGE = 0,
510
- /**Represents a transformation matrix that converts coordinates from the original image to the local image.*/
511
- TMT_ORIGINAL_TO_LOCAL_IMAGE = 1,
512
- /**Represents a transformation matrix that converts coordinates from the local image to the section image.*/
513
- TMT_LOCAL_TO_SECTION_IMAGE = 2,
514
- /**Represents a transformation matrix that converts coordinates from the section image to the local image.*/
515
- TMT_SECTION_TO_LOCAL_IMAGE = 3
516
- }
517
-
518
511
  type WorkerAutoResources = {
519
512
  [key in EnumModuleName]?: {
520
513
  js?: boolean;
@@ -559,6 +552,7 @@ interface EngineResourcePaths {
559
552
  "dcp"?: string | PathInfo;
560
553
  "dce"?: string | PathInfo;
561
554
  "dcvData"?: string | PathInfo;
555
+ "identityutility"?: string | PathInfo;
562
556
  "ddv"?: string | PathInfo;
563
557
  "dwt"?: string | DwtInfo;
564
558
  "dbrBundle"?: string | PathInfo;
@@ -590,79 +584,17 @@ interface WasmLoadOptions {
590
584
  wasmType?: WasmType;
591
585
  pthreadPoolSize?: number;
592
586
  }
593
- type MimeType = "image/png" | "image/jpeg";
587
+ type MimeType = "image/png" | "image/jpeg" | "image/bmp";
594
588
 
595
- declare const mapAsyncDependency: {
596
- [key: string]: any;
597
- };
598
- declare const waitAsyncDependency: (depName: string | string[]) => Promise<void>;
599
- declare const doOrWaitAsyncDependency: (depName: string | string[], asyncFunc: () => Promise<void>) => Promise<void>;
600
- declare let worker: Worker;
601
- declare const getNextTaskID: () => number;
602
- declare const mapTaskCallBack: {
603
- [key: string]: Function;
604
- };
605
- declare let onLog: (message: string) => void | undefined;
606
- declare const setOnLog: (value: typeof onLog) => void;
607
- declare let bDebug: boolean;
608
- declare const setBDebug: (value: boolean) => void;
609
- declare const innerVersions: InnerVersions;
610
- declare const mapPackageRegister: {
611
- [key: string]: any;
612
- };
613
- declare const workerAutoResources: WorkerAutoResources;
614
- declare class CoreModule {
615
- static get engineResourcePaths(): EngineResourcePaths;
616
- static set engineResourcePaths(value: EngineResourcePaths);
617
- private static _bSupportDce4Module;
618
- static get bSupportDce4Module(): number;
619
- private static _bSupportIRTModule;
620
- static get bSupportIRTModule(): number;
621
- private static _versions;
622
- static get versions(): any;
623
- static get _onLog(): (message: string) => void;
624
- static set _onLog(value: (message: string) => void);
625
- static get _bDebug(): boolean;
626
- static set _bDebug(value: boolean);
627
- static _bundleEnv: "DCV" | "DBR";
628
- static get _workerName(): string;
629
- private static _wasmLoadOptions;
630
- static get wasmLoadOptions(): WasmLoadOptions;
631
- static set wasmLoadOptions(options: WasmLoadOptions);
632
- static loadedWasmType: Exclude<WasmType, "auto">;
633
- /**
634
- * Initiates the loading process for the .wasm file(s) corresponding to the specified module(s).
635
- * If a module relies on other modules, the other modules will be loaded as well.
636
- *
637
- * @returns A promise that resolves when the resources have been successfully released. It does not provide any value upon resolution.
638
- */
639
- static isModuleLoaded(name?: string): boolean;
640
- static loadWasm(): Promise<void>;
641
- /**
642
- * An event that fires during the loading of a WebAssembly module (.wasm).
643
- *
644
- * @param filePath The path of the wasm file.
645
- * @param tag Indicates the ongoing status of the file download ("starting", "in progress", "completed").
646
- * @param progress An object indicating the progress of the download, with `loaded` and `total` bytes.
647
- */
648
- static onWasmLoadProgressChanged: (filePath: string, tag: "starting" | "in progress" | "completed", progress: {
649
- loaded: number;
650
- total: number;
651
- }) => void;
652
- /**
653
- * Detect environment and get a report.
654
- */
655
- static detectEnvironment(): Promise<any>;
656
- /**
657
- * modify from https://gist.github.com/2107/5529665
658
- * @ignore
659
- */
660
- static browserInfo: any;
661
- static getModuleVersion(): Promise<WasmVersions>;
662
- static getVersion(): string;
663
- static enableLogging(): void;
664
- static disableLogging(): void;
665
- static cfd(count: number): Promise<void>;
589
+ interface CapturedResultItem {
590
+ /** The type of the captured result item, indicating what kind of data it represents. */
591
+ readonly type: EnumCapturedResultItemType;
592
+ /** A property of type `CapturedResultItem` that represents a reference to another captured result item. */
593
+ readonly referenceItem: CapturedResultItem | null;
594
+ /** The name of the target ROI definition which includes a task that generated the result. */
595
+ readonly targetROIDefName: string;
596
+ /** The name of the task that generated the result. */
597
+ readonly taskName: string;
666
598
  }
667
599
 
668
600
  interface ImageTag {
@@ -684,18 +616,7 @@ interface DSImageData {
684
616
  /** The pixel format of the image. */
685
617
  format: EnumImagePixelFormat;
686
618
  /** An optional tag associated with the image data. */
687
- tag?: ImageTag;
688
- }
689
-
690
- interface CapturedResultItem {
691
- /** The type of the captured result item, indicating what kind of data it represents. */
692
- readonly type: EnumCapturedResultItemType;
693
- /** A property of type `CapturedResultItem` that represents a reference to another captured result item. */
694
- readonly referenceItem: CapturedResultItem | null;
695
- /** The name of the target ROI definition which includes a task that generated the result. */
696
- readonly targetROIDefName: string;
697
- /** The name of the task that generated the result. */
698
- readonly taskName: string;
619
+ imageTag?: ImageTag;
699
620
  }
700
621
 
701
622
  interface OriginalImageResultItem extends CapturedResultItem {
@@ -898,8 +819,6 @@ interface RegionObjectElement {
898
819
  referencedElement: RegionObjectElement;
899
820
  /** The type of the region object element, defined by the enumeration EnumRegionObjectElementType. */
900
821
  elementType: EnumRegionObjectElementType;
901
- /**The image data for the `RegionObjectElement`. */
902
- imageData: DSImageData;
903
822
  }
904
823
 
905
824
  interface PredetectedRegionElement extends RegionObjectElement {
@@ -1023,6 +942,91 @@ interface ErrorInfo {
1023
942
  errorString: string;
1024
943
  }
1025
944
 
945
+ interface AuxiliaryRegionElement extends RegionObjectElement {
946
+ /** The name of this auxiliary region(e.g., "PortraitZone", "SignatureArea"). */
947
+ name: string;
948
+ /** The confidence level of this auxiliary region detection, typically in the range [0, 100] */
949
+ confidence: number;
950
+ }
951
+
952
+ declare const mapAsyncDependency: {
953
+ [key: string]: any;
954
+ };
955
+ declare const waitAsyncDependency: (depName: string | string[]) => Promise<void>;
956
+ declare const doOrWaitAsyncDependency: (depName: string | string[], asyncFunc: () => Promise<void>) => Promise<void>;
957
+ declare const imagePtrToUint8Array: (data: {
958
+ ptr: number;
959
+ length: number;
960
+ }) => Promise<Uint8Array>;
961
+ declare const resolveDsImageData: (point: number) => Promise<DSImageData>;
962
+ declare let worker: Worker;
963
+ declare const getNextTaskID: () => number;
964
+ declare const mapTaskCallBack: {
965
+ [key: string]: (body: any) => void;
966
+ };
967
+ declare let onLog: (message: string) => void | undefined;
968
+ declare const setOnLog: (value: typeof onLog) => void;
969
+ declare let bDebug: boolean;
970
+ declare const setBDebug: (value: boolean) => void;
971
+ declare const innerVersions: InnerVersions;
972
+ declare const mapPackageRegister: {
973
+ [key: string]: any;
974
+ };
975
+ declare const workerAutoResources: WorkerAutoResources;
976
+ declare class CoreModule {
977
+ static get engineResourcePaths(): EngineResourcePaths;
978
+ static set engineResourcePaths(value: EngineResourcePaths);
979
+ private static _bSupportDce4Module;
980
+ static get bSupportDce4Module(): number;
981
+ private static _bSupportIRTModule;
982
+ static get bSupportIRTModule(): number;
983
+ private static _versions;
984
+ static get versions(): any;
985
+ static get _onLog(): (message: string) => void;
986
+ static set _onLog(value: (message: string) => void);
987
+ static get _bDebug(): boolean;
988
+ static set _bDebug(value: boolean);
989
+ static _bundleEnv: "DCV" | "DBR";
990
+ static get _workerName(): string;
991
+ private static _wasmLoadOptions;
992
+ static get wasmLoadOptions(): WasmLoadOptions;
993
+ static set wasmLoadOptions(options: WasmLoadOptions);
994
+ static loadedWasmType: Exclude<WasmType, "auto">;
995
+ /**
996
+ * Initiates the loading process for the .wasm file(s) corresponding to the specified module(s).
997
+ * If a module relies on other modules, the other modules will be loaded as well.
998
+ *
999
+ * @returns A promise that resolves when the resources have been successfully released. It does not provide any value upon resolution.
1000
+ */
1001
+ static isModuleLoaded(name?: string): boolean;
1002
+ static loadWasm(): Promise<void>;
1003
+ /**
1004
+ * An event that fires during the loading of a WebAssembly module (.wasm).
1005
+ *
1006
+ * @param filePath The path of the wasm file.
1007
+ * @param tag Indicates the ongoing status of the file download ("starting", "in progress", "completed").
1008
+ * @param progress An object indicating the progress of the download, with `loaded` and `total` bytes.
1009
+ */
1010
+ static onWasmLoadProgressChanged: (filePath: string, tag: "starting" | "in progress" | "completed", progress: {
1011
+ loaded: number;
1012
+ total: number;
1013
+ }) => void;
1014
+ /**
1015
+ * Detect environment and get a report.
1016
+ */
1017
+ static detectEnvironment(): Promise<any>;
1018
+ /**
1019
+ * modify from https://gist.github.com/2107/5529665
1020
+ * @ignore
1021
+ */
1022
+ static browserInfo: any;
1023
+ static getModuleVersion(): Promise<WasmVersions>;
1024
+ static getVersion(): string;
1025
+ static enableLogging(): void;
1026
+ static disableLogging(): void;
1027
+ static cfd(count: number): Promise<void>;
1028
+ }
1029
+
1026
1030
  declare abstract class ImageSourceAdapter {
1027
1031
  #private;
1028
1032
  /**
@@ -1163,6 +1167,7 @@ declare const isArc: (value: any) => value is Arc;
1163
1167
  * @ignore
1164
1168
  */
1165
1169
  declare const isContour: (value: any) => value is Contour;
1170
+ declare const isDsImageKeyValue: (k: any, v: any) => boolean;
1166
1171
  declare const isOriginalDsImageData: (value: any) => boolean;
1167
1172
  /**
1168
1173
  * Judge is the input is a {@link DSImageData} object.
@@ -1233,8 +1238,12 @@ declare const _saveToFile: (imageData: ImageData, name: string, download?: boole
1233
1238
  declare const _toCanvas: (imageData: ImageData | DSImageData) => HTMLCanvasElement;
1234
1239
  declare const _toImage: (MIMEType: MimeType, imageData: ImageData | DSImageData) => HTMLImageElement;
1235
1240
  declare const _toBlob: (MIMEType: MimeType, imageData: ImageData | DSImageData) => Promise<Blob>;
1236
- declare const _getNorImageData: (dsImageData: DSImageData) => ImageData;
1237
- declare const isSimdSupported: () => Promise<boolean>;
1241
+ declare const encodeBMP: (imageData: ImageData) => ArrayBuffer;
1242
+ declare const createImageData: (dsImageData: DSImageData) => ImageData;
1243
+ declare const isSimdSupported: () => boolean;
1244
+ declare const blobToDsImage: (blob: Blob) => Promise<DSImageData>;
1245
+ declare const e: (d: any, s: any) => Promise<string>;
1246
+ declare const d: (d: any, s: any) => Promise<string>;
1238
1247
  declare const productNameMap: {
1239
1248
  readonly std: "dynamsoft-capture-vision-std";
1240
1249
  readonly dip: "dynamsoft-image-processing";
@@ -1249,13 +1258,14 @@ declare const productNameMap: {
1249
1258
  readonly dcp: "dynamsoft-code-parser";
1250
1259
  readonly dcvData: "dynamsoft-capture-vision-data";
1251
1260
  readonly dce: "dynamsoft-camera-enhancer";
1261
+ readonly identityutility: "dynamsoft-identity-utility";
1252
1262
  readonly ddv: "dynamsoft-document-viewer";
1253
1263
  readonly dwt: "dwt";
1254
1264
  readonly dbrBundle: "dynamsoft-barcode-reader-bundle";
1255
1265
  readonly dcvBundle: "dynamsoft-capture-vision-bundle";
1256
1266
  };
1257
1267
 
1258
- export { Arc, BinaryImageUnit, CapturedResultBase, CapturedResultItem, ColourImageUnit, Contour, ContoursUnit, CoreModule, Corner, DSFile, DSImageData, DSRect, DwtInfo, Edge, EngineResourcePaths, EnhancedGrayscaleImageUnit, EnumBufferOverflowProtectionMode, EnumCapturedResultItemType, EnumColourChannelUsageType, EnumCornerType, EnumCrossVerificationStatus, EnumErrorCode, EnumGrayscaleEnhancementMode, EnumGrayscaleTransformationMode, EnumImageCaptureDistanceMode, EnumImageFileFormat, EnumImagePixelFormat, EnumImageTagType, EnumIntermediateResultUnitType, EnumModuleName, EnumPDFReadingMode, EnumRasterDataSource, EnumRegionObjectElementType, EnumSectionType, EnumTransformMatrixType, ErrorInfo, FileImageTag, GrayscaleImageUnit, ImageSourceAdapter, ImageSourceErrorListener, ImageTag, InnerVersions, IntermediateResult, IntermediateResultExtraInfo, IntermediateResultUnit, LineSegment, LineSegmentsUnit, MapController, MimeType, ObservationParameters, OriginalImageResultItem, PDFReadingParameter, PathInfo, Point, Polygon, PostMessageBody, PredetectedRegionElement, PredetectedRegionsUnit, Quadrilateral, Rect, RegionObjectElement, ScaledColourImageUnit, ShortLinesUnit, TextRemovedBinaryImageUnit, TextZone, TextZonesUnit, TextureDetectionResultUnit, TextureRemovedBinaryImageUnit, TextureRemovedGrayscaleImageUnit, TransformedGrayscaleImageUnit, Warning, WasmLoadOptions, WasmType, WasmVersions, WorkerAutoResources, _getNorImageData, _saveToFile, _toBlob, _toCanvas, _toImage, bDebug, checkIsLink, compareVersion, doOrWaitAsyncDependency, getNextTaskID, handleEngineResourcePaths, innerVersions, isArc, isContour, isDSImageData, isDSRect, isImageTag, isLineSegment, isObject, isOriginalDsImageData, isPoint, isPolygon, isQuad, isRect, isSimdSupported, mapAsyncDependency, mapPackageRegister, mapTaskCallBack, onLog, productNameMap, requestResource, setBDebug, setOnLog, waitAsyncDependency, worker, workerAutoResources };
1268
+ export { Arc, AuxiliaryRegionElement, BinaryImageUnit, CapturedResultBase, CapturedResultItem, ColourImageUnit, Contour, ContoursUnit, CoreModule, Corner, DSFile, DSImageData, DSRect, DwtInfo, Edge, EngineResourcePaths, EnhancedGrayscaleImageUnit, EnumBufferOverflowProtectionMode, EnumCapturedResultItemType, EnumColourChannelUsageType, EnumCornerType, EnumCrossVerificationStatus, EnumErrorCode, EnumGrayscaleEnhancementMode, EnumGrayscaleTransformationMode, EnumImageCaptureDistanceMode, EnumImageFileFormat, EnumImagePixelFormat, EnumImageTagType, EnumIntermediateResultUnitType, EnumModuleName, EnumPDFReadingMode, EnumRasterDataSource, EnumRegionObjectElementType, EnumSectionType, ErrorInfo, FileImageTag, GrayscaleImageUnit, ImageSourceAdapter, ImageSourceErrorListener, ImageTag, InnerVersions, IntermediateResult, IntermediateResultExtraInfo, IntermediateResultUnit, LineSegment, LineSegmentsUnit, MapController, MimeType, ObservationParameters, OriginalImageResultItem, PDFReadingParameter, PathInfo, Point, Polygon, PostMessageBody, PredetectedRegionElement, PredetectedRegionsUnit, Quadrilateral, Rect, RegionObjectElement, ScaledColourImageUnit, ShortLinesUnit, TextRemovedBinaryImageUnit, TextZone, TextZonesUnit, TextureDetectionResultUnit, TextureRemovedBinaryImageUnit, TextureRemovedGrayscaleImageUnit, TransformedGrayscaleImageUnit, Warning, WasmLoadOptions, WasmType, WasmVersions, WorkerAutoResources, _saveToFile, _toBlob, _toCanvas, _toImage, bDebug, blobToDsImage, checkIsLink, compareVersion, createImageData, d, doOrWaitAsyncDependency, e, encodeBMP, getNextTaskID, handleEngineResourcePaths, imagePtrToUint8Array, innerVersions, isArc, isContour, isDSImageData, isDSRect, isDsImageKeyValue, isImageTag, isLineSegment, isObject, isOriginalDsImageData, isPoint, isPolygon, isQuad, isRect, isSimdSupported, mapAsyncDependency, mapPackageRegister, mapTaskCallBack, onLog, productNameMap, requestResource, resolveDsImageData, setBDebug, setOnLog, waitAsyncDependency, worker, workerAutoResources };
1259
1269
 
1260
1270
 
1261
1271
 
@@ -1311,7 +1321,7 @@ declare class BufferedItemsManager {
1311
1321
  * Gets the buffered character items.
1312
1322
  * @return the buffered character items
1313
1323
  */
1314
- getBufferedCharacterItemSet(): Promise<Array<BufferedCharacterItemSet>>;
1324
+ getBufferedCharacterItemSet(): Promise<BufferedCharacterItemSet>;
1315
1325
  }
1316
1326
 
1317
1327
  declare class IntermediateResultReceiver {
@@ -1373,6 +1383,7 @@ declare class IntermediateResultManager {
1373
1383
  * @param receiver The receiver object, of type `IntermediateResultReceiver`.
1374
1384
  */
1375
1385
  removeResultReceiver(receiver: IntermediateResultReceiver): Promise<void>;
1386
+ removeAllResultReceivers(): Promise<void>;
1376
1387
  /**
1377
1388
  * Retrieves the original image data.
1378
1389
  *
@@ -1421,8 +1432,7 @@ interface SimplifiedCaptureVisionSettings {
1421
1432
  /**
1422
1433
  * Specifies the shortest time span, in milliseconds, that must elapse between two successive image captures. Opting for a higher interval decreases capture frequency, which can lower the system's processing load and conserve energy. On the other hand, a smaller interval value increases the frequency of image captures, enhancing the system's responsiveness.
1423
1434
  * @remarks Handling of Special Values:
1424
- * -1: This value ensures the image source waits until processing of the current image is complete before starting to acquire the next one. This approach ensures there is a deliberate pause between processing consecutive images.
1425
- * 0 (The default setting): Adopting this value means the image source queues up the next image for immediate availability once processing of the current image is finished, facilitating continuous, uninterrupted image processing.
1435
+ * 0 (The default setting): Adopting this value means the image source queues up the next image for immediate availability once processing of the current image is finished, facilitating continuous, uninterrupted image processing.
1426
1436
  */
1427
1437
  minImageCaptureInterval: number;
1428
1438
  /**
@@ -1472,12 +1482,10 @@ declare class CaptureVisionRouter {
1472
1482
  * @param error The error object that contains the error code and error string.
1473
1483
  */
1474
1484
  onCaptureError: (error: Error) => void;
1485
+ provideDsImage: DSImageData;
1475
1486
  _instanceID: number;
1476
- private _dsImage;
1477
1487
  private _loopReadVideoTimeoutId;
1478
- private _isPauseScan;
1479
1488
  private _isOutputOriginalImage;
1480
- private _templateName;
1481
1489
  private _isOpenDetectVerify;
1482
1490
  private _isOpenNormalizeVerify;
1483
1491
  private _isOpenBarcodeVerify;
@@ -1488,12 +1496,17 @@ declare class CaptureVisionRouter {
1488
1496
  private _currentSettings;
1489
1497
  private _averageTime;
1490
1498
  private _dynamsoft;
1499
+ private _enhancedFeaturesIrr;
1500
+ private _templateName;
1501
+ private _isCapturing;
1502
+ private _s;
1491
1503
  /**
1492
1504
  * Returns whether the `CaptureVisionRouter` instance has been disposed of.
1493
1505
  *
1494
1506
  * @returns Boolean indicating whether the `CaptureVisionRouter` instance has been disposed of.
1495
1507
  */
1496
1508
  get disposed(): boolean;
1509
+ get isCapturing(): boolean;
1497
1510
  /**
1498
1511
  * Initializes a new instance of the `CaptureVisionRouter` class.
1499
1512
  *
@@ -1507,7 +1520,7 @@ declare class CaptureVisionRouter {
1507
1520
  *
1508
1521
  * @returns A promise that resolves once the model file is successfully loaded. It does not provide any value upon resolution.
1509
1522
  */
1510
- static appendDLModelBuffer(modelName: string, dataPath?: string): Promise<ErrorInfo>;
1523
+ static appendDLModelBuffer(modelName: string | Array<string>, dataPath?: string): Promise<ErrorInfo>;
1511
1524
  /**
1512
1525
  * Clears all deep learning models from buffer to free up memory
1513
1526
  */
@@ -1518,7 +1531,7 @@ declare class CaptureVisionRouter {
1518
1531
  * Sets up an image source to provide images for continuous processing.
1519
1532
  * @param imageSource The image source which is compliant with the `ImageSourceAdapter` interface.
1520
1533
  */
1521
- setInput(imageSource: ImageSourceAdapter): void;
1534
+ setInput(imageSource: ImageSourceAdapter | any): void;
1522
1535
  /**
1523
1536
  * Returns the image source object.
1524
1537
  */
@@ -1535,12 +1548,13 @@ declare class CaptureVisionRouter {
1535
1548
  * Adds a `CapturedResultReceiver` object as the receiver of captured results.
1536
1549
  * @param receiver The receiver object, of type `CapturedResultReceiver`.
1537
1550
  */
1538
- addResultReceiver(receiver: CapturedResultReceiver): void;
1551
+ addResultReceiver(receiver: CapturedResultReceiver): Promise<void>;
1539
1552
  /**
1540
1553
  * Removes the specified `CapturedResultReceiver` object.
1541
1554
  * @param receiver The receiver object, of type `CapturedResultReceiver`.
1542
1555
  */
1543
- removeResultReceiver(receiver: CapturedResultReceiver): void;
1556
+ removeResultReceiver(receiver: CapturedResultReceiver): Promise<void>;
1557
+ removeAllResultReceivers(): Promise<void>;
1544
1558
  private _setCrrRegistry;
1545
1559
  /**
1546
1560
  * Adds a `MultiFrameResultCrossFilter` object to filter non-essential results.
@@ -1556,6 +1570,7 @@ declare class CaptureVisionRouter {
1556
1570
  * @returns A promise that resolves when the operation has successfully completed. It does not provide any value upon resolution.
1557
1571
  */
1558
1572
  removeResultFilter(filter: CapturedResultFilter): Promise<void>;
1573
+ removeAllResultFilters(): Promise<void>;
1559
1574
  private _handleFilterUpdate;
1560
1575
  /**
1561
1576
  * Initiates a capturing process based on a specified template. This process is repeated for each image fetched from the source.
@@ -1581,8 +1596,8 @@ declare class CaptureVisionRouter {
1581
1596
  /**
1582
1597
  * Video stream capture, recursive call, loop frame capture
1583
1598
  */
1584
- private _loopReadVideo;
1585
- private _reRunCurrnetFunc;
1599
+ private barcodeScanLoop;
1600
+ private continueLoop;
1586
1601
  getClarity(dsimage: DSImageData, bitcount: number, wr: number, hr: number, grayThreshold: number): Promise<number>;
1587
1602
  /**
1588
1603
  * Processes a single image or a file containing a single image to derive important information.
@@ -1613,7 +1628,7 @@ declare class CaptureVisionRouter {
1613
1628
  *
1614
1629
  * @returns A promise that resolves with the object that contains settings for the specified template or all templates.
1615
1630
  */
1616
- outputSettings(templateName?: string, includeDefaultValues?: boolean): Promise<any>;
1631
+ outputSettings(templateName: string, includeDefaultValues?: boolean): Promise<any>;
1617
1632
  /**
1618
1633
  * Generates a Blob object or initiates a JSON file download containing the settings for the specified `CaptureVisionTemplate`.
1619
1634
  * @param templateName Specifies a `CaptureVisionTemplate` by its name. If passed "*", the returned object will contain all templates.
@@ -1666,6 +1681,7 @@ declare class CaptureVisionRouter {
1666
1681
  * @param intraOpNumThreads Number of threads used internally for model execution.
1667
1682
  */
1668
1683
  static setGlobalIntraOpNumThreads(intraOpNumThreads?: number): Promise<void>;
1684
+ checkTemplateNameValidity(templateName: string): Promise<boolean>;
1669
1685
  parseRequiredResources(templateName: string): Promise<{
1670
1686
  models: string[];
1671
1687
  specss: string[];
@@ -1675,7 +1691,7 @@ declare class CaptureVisionRouter {
1675
1691
  *
1676
1692
  * @returns A promise that resolves when the resources have been successfully released. It does not provide any value upon resolution.
1677
1693
  */
1678
- dispose(): Promise<void>;
1694
+ dispose(): void;
1679
1695
  /**
1680
1696
  * For Debug
1681
1697
  */
@@ -1692,7 +1708,7 @@ declare class CaptureVisionRouterModule {
1692
1708
  }
1693
1709
 
1694
1710
  interface RawImageResultItem extends CapturedResultItem {
1695
- readonly imageData: DSImageData;
1711
+ imageData: DSImageData;
1696
1712
  }
1697
1713
 
1698
1714
  declare enum EnumPresetTemplate {
@@ -1997,6 +2013,23 @@ interface AztecDetails extends BarcodeDetails {
1997
2013
  layerNumber: number;
1998
2014
  }
1999
2015
 
2016
+ /**
2017
+ * Represents the Extended Channel Interpretation (ECI) information within a barcode.
2018
+ *
2019
+ * Each ECI segment specifies the character encoding used for a portion of the decoded bytes.
2020
+ * The charset names follow the IANA character set registry (e.g. "UTF-8", "ISO-8859-1").
2021
+ */
2022
+ interface ECISegment {
2023
+ /** The ECI assignment number as defined by ISO/IEC 15424. */
2024
+ eciValue: number;
2025
+ /** The charset encoding name defined by IANA (e.g. "UTF-8", "ISO-8859-1"). */
2026
+ charsetEncoding: string;
2027
+ /** The start index of this ECI segment in the decoded barcode bytes. */
2028
+ startIndex: number;
2029
+ /** The length (in bytes) of this segment within the decoded barcode bytes. */
2030
+ length: number;
2031
+ }
2032
+
2000
2033
  interface BarcodeResultItem extends CapturedResultItem {
2001
2034
  /** The format of the decoded barcode, as defined by `EnumBarcodeFormat`. */
2002
2035
  format: EnumBarcodeFormat;
@@ -2020,6 +2053,8 @@ interface BarcodeResultItem extends CapturedResultItem {
2020
2053
  isMirrored: boolean;
2021
2054
  /** Indicates if the barcode is detected using Direct Part Marking (DPM) method. */
2022
2055
  isDPM: boolean;
2056
+ /** An array of ECI segments present in the barcode, if any. Each segment is represented by a `ECISegment` object. */
2057
+ eciSegments: Array<ECISegment>;
2023
2058
  }
2024
2059
 
2025
2060
  interface DataMatrixDetails extends BarcodeDetails {
@@ -2065,6 +2100,8 @@ interface DecodedBarcodeElement extends RegionObjectElement {
2065
2100
  confidence: number;
2066
2101
  /** Array of extended barcode results if available. */
2067
2102
  extendedBarcodeResults: Array<ExtendedBarcodeResult>;
2103
+ /** An array of ECI segments present in the barcode, if any. Each segment is represented by a `ECISegment` object. */
2104
+ eciSegments: Array<ECISegment>;
2068
2105
  }
2069
2106
 
2070
2107
  interface ExtendedBarcodeResult extends DecodedBarcodeElement {
@@ -2187,10 +2224,10 @@ interface DecodedBarcodesUnit extends IntermediateResultUnit {
2187
2224
  * The `DeformationResistedBarcode` interface represents a deformation-resisted barcode image.
2188
2225
  */
2189
2226
  interface DeformationResistedBarcode {
2190
- /** Format of the barcode, as defined by `EnumBarcodeFormat`. */
2191
- format: EnumBarcodeFormat;
2192
2227
  /** Image data of the deformation-resisted barcode image. */
2193
2228
  imageData: DSImageData;
2229
+ /** Format of the barcode, as defined by `EnumBarcodeFormat`. */
2230
+ format: EnumBarcodeFormat;
2194
2231
  /** Location of the deformation-resisted barcode within the image. */
2195
2232
  location: Quadrilateral;
2196
2233
  }
@@ -2230,2518 +2267,80 @@ export { BarcodeReaderModule, EnumBarcodeFormat, EnumDeblurMode, EnumExtendedBar
2230
2267
  export type { AztecDetails, BarcodeDetails, BarcodeResultItem, CandidateBarcodeZone, CandidateBarcodeZonesUnit, ComplementedBarcodeImageUnit, DataMatrixDetails, DecodedBarcodeElement, DecodedBarcodesResult, DecodedBarcodesUnit, DeformationResistedBarcode, DeformationResistedBarcodeImageUnit, ExtendedBarcodeResult, LocalizedBarcodeElement, LocalizedBarcodesUnit, OneDCodeDetails, PDF417Details, QRCodeDetails, ScaledBarcodeImageUnit, SimplifiedBarcodeReaderSettings };
2231
2268
 
2232
2269
 
2233
- declare class CameraEnhancerModule {
2234
- /**
2235
- * Returns the version of the CameraEnhancer module.
2236
- */
2237
- static getVersion(): string;
2238
- }
2239
-
2240
- interface VideoFrameTag extends ImageTag {
2241
- /** Indicates whether the video frame is cropped. */
2242
- isCropped: boolean;
2243
- /** The region based on which the original frame was cropped. If `isCropped` is false, the region covers the entire original image. */
2244
- cropRegion: DSRect;
2245
- /** The original width of the video frame before any cropping. */
2246
- originalWidth: number;
2247
- /** The original height of the video frame before any cropping. */
2248
- originalHeight: number;
2249
- /** The current width of the video frame after cropping. */
2250
- currentWidth: number;
2251
- /** The current height of the video frame after cropping. */
2252
- currentHeight: number;
2253
- /** The time spent acquiring the frame, in milliseconds. */
2254
- timeSpent: number;
2255
- /** The timestamp marking the completion of the frame acquisition. */
2256
- timeStamp: number;
2257
- }
2258
-
2259
- interface DCEFrame extends DSImageData {
2260
- /** Converts the image data into an HTMLCanvasElement for display or further manipulation in web applications. */
2261
- toCanvas: () => HTMLCanvasElement;
2262
- /** Flag indicating whether the frame is a `DCEFrame`. */
2263
- isDCEFrame: boolean;
2264
- /** Holds extra information about the image data which is extracted from video streams. */
2265
- tag?: VideoFrameTag;
2266
- }
2267
-
2268
- interface DrawingItemEvent extends Event {
2269
- /** The drawing item that is the target of the event. */
2270
- targetItem: DrawingItem;
2271
- /** The X coordinate of the item relative to the viewpoint of the browser window. */
2272
- itemClientX: number;
2273
- /** The Y coordinate of the item relative to the viewpoint of the browser window. */
2274
- itemClientY: number;
2275
- /** The X coordinate of the item relative to the entire document (the webpage content). */
2276
- itemPageX: number;
2277
- /** The Y coordinate of the item relative to the entire document (the webpage content). */
2278
- itemPageY: number;
2279
- }
2280
-
2281
- interface DrawingStyle {
2270
+ interface ParsedResultItem extends CapturedResultItem {
2282
2271
  /**
2283
- * ID for the drawing style.
2284
- * The `id` property is immutable and is exclusively assigned at the creation of a new drawing style.
2272
+ * The code type of the parsed result.
2285
2273
  */
2286
- id?: number;
2274
+ codeType: string;
2287
2275
  /**
2288
- * The width of lines.
2289
- * If not specified, the default is 2.
2276
+ * The parsed result represented as a JSON-formatted string.
2290
2277
  */
2291
- lineWidth?: number;
2278
+ jsonString: string;
2292
2279
  /**
2293
- * The fill color and opacity in rgba format.
2294
- * If not specified, the default is "rgba(245, 236, 73, 0.5)".
2280
+ * Retrieves a list of all field names present in the parsed result.
2281
+ * @returns An array of strings, where each string is a field name from the parsed result.
2282
+ * This method allows for dynamic access to the fields in the parsed result, enabling users to iterate through all available fields without needing to know their names in advance.
2283
+ * [NOTE]: If the field is nested, the name includes all parent fields, separated by a dot (.). The format follows this pattern: [.[....]].
2295
2284
  */
2296
- fillStyle?: string;
2285
+ getAllFieldNames(): Array<string>;
2297
2286
  /**
2298
- * The stroke color and opacity in rgba format.
2299
- * If not specified, the default is "rgba(245, 236, 73, 1)".
2287
+ * Retrieves the value of a specified field.
2288
+ * @param fieldName The name of the field whose value is being requested.
2289
+ *
2290
+ * @returns The value of the field.
2300
2291
  */
2301
- strokeStyle?: string;
2292
+ getFieldValue(fieldName: string): string;
2302
2293
  /**
2303
- * The mode of painting.
2304
- * If not specified, the default is "stroke".
2294
+ * Retrieves the value of a specified field from the parsed result, without mapping process.
2295
+ * @param fieldName The name of the field whose raw value is being requested.
2296
+ *
2297
+ * @returns The raw value of the field.
2305
2298
  */
2306
- paintMode?: "fill" | "stroke" | "strokeAndFill";
2299
+ getFieldRawValue(fieldName: string): string;
2307
2300
  /**
2308
- * The font family for text elements.
2309
- * If not specified, the default is "consolas".
2301
+ * Retrieves the mapping status for a specified field name.
2302
+ * @param fieldName The name of the field whose mapping status is being queried.
2303
+ *
2304
+ * @returns The mapping status of the specified field as an EnumMappingStatus value.
2310
2305
  */
2311
- fontFamily?: string;
2306
+ getFieldMappingStatus: (fieldName: string) => EnumMappingStatus;
2312
2307
  /**
2313
- * The font size for text elements.
2314
- * If not specified, the default is 40.
2308
+ * Retrieves the validation status for a specified field name.
2309
+ * @param fieldName The name of the field whose validation status is being queried.
2310
+ *
2311
+ * @returns The validation status of the specified field as an EnumValidationStatus value.
2315
2312
  */
2316
- fontSize?: number;
2317
- }
2318
-
2319
- interface Note {
2320
- /** The name of the note. */
2321
- name: string;
2322
- /** The content of the note, can be of any type. */
2323
- content: any;
2324
- }
2325
-
2326
- interface PlayCallbackInfo {
2327
- /** The height of the video frame. */
2328
- height: number;
2329
- /** The width of the video frame. */
2330
- width: number;
2331
- /** The unique identifier of the camera. */
2332
- deviceId: string;
2333
- }
2334
-
2335
- interface Resolution {
2336
- /** The width of the video frame. */
2337
- width: number;
2338
- /** The height of the video frame. */
2339
- height: number;
2340
- }
2341
-
2342
- interface TipConfig {
2343
- /** The top left point of the tip message box. */
2344
- topLeftPoint: Point;
2345
- /** The width of the tip message box. */
2346
- width: number;
2347
- /** The display duration of the tip in milliseconds. */
2348
- duration: number;
2349
- /** The base coordinate system used (e.g., "view" or "image"). */
2350
- coordinateBase?: "view" | "image";
2351
- }
2352
-
2353
- interface VideoDeviceInfo {
2354
- /** The unique identifier for the camera. */
2355
- deviceId: string;
2356
- /** The label or name of the camera. */
2357
- label: string;
2358
- /** @ignore */
2359
- _checked: boolean;
2313
+ getFieldValidationStatus: (fieldName: string) => EnumValidationStatus;
2360
2314
  }
2361
2315
 
2362
- declare enum EnumDrawingItemMediaType {
2363
- /**
2364
- * Represents a rectangle, a basic geometric shape with four sides where opposite sides are equal in length and it has four right angles.
2365
- */
2366
- DIMT_RECTANGLE = 1,
2316
+ declare class CodeParser {
2317
+ private _instanceID;
2367
2318
  /**
2368
- * Represents any four-sided figure. This includes squares, rectangles, rhombuses, and more general forms that do not necessarily have right angles or equal sides.
2319
+ * Initializes a new instance of the `CodeParser` class.
2320
+ *
2321
+ * @returns A promise that resolves with the initialized `CodeParser` instance.
2369
2322
  */
2370
- DIMT_QUADRILATERAL = 2,
2323
+ static createInstance(): Promise<CodeParser>;
2371
2324
  /**
2372
- * Represents a text element. This allows for the inclusion of textual content as a distinct drawing item within the graphic representation.
2325
+ * Releases all resources used by the `CodeParser` instance.
2326
+ *
2327
+ * @returns A promise that resolves when the resources have been successfully released. It does not provide any value upon resolution.
2373
2328
  */
2374
- DIMT_TEXT = 4,
2329
+ dispose(): Promise<void>;
2375
2330
  /**
2376
- * Represents an arc, which is a portion of the circumference of a circle or an ellipse. Arcs are used to create curved shapes and segments.
2331
+ * Returns whether the `CodeParser` instance has been disposed of.
2332
+ *
2333
+ * @returns Boolean indicating whether the `CodeParser` instance has been disposed of.
2377
2334
  */
2378
- DIMT_ARC = 8,
2335
+ protected bDestroyed: boolean;
2336
+ get disposed(): boolean;
2379
2337
  /**
2380
- * Represents an image. This enables embedding bitmap images within the drawing context.
2338
+ * Configures runtime settings using a provided JSON string.
2339
+ * @param settings A JSON string that represents the content of the settings which contain at least one `CodeParserTaskSetting` object.
2340
+ *
2341
+ * @returns A promise that resolves when the operation has completed. It does not provide any value upon resolution.
2381
2342
  */
2382
- DIMT_IMAGE = 16,
2383
- /**
2384
- * Represents a polygon, which is a plane figure that is described by a finite number of straight line segments connected to form a closed polygonal chain or circuit.
2385
- */
2386
- DIMT_POLYGON = 32,
2387
- /**
2388
- * Represents a line segment. This is the simplest form of a drawing item, defined by two endpoints and the straight path connecting them.
2389
- */
2390
- DIMT_LINE = 64,
2391
- /**
2392
- * Represents a group of drawing items. This allows for the logical grouping of multiple items, treating them as a single entity for manipulation or transformation purposes.
2393
- */
2394
- DIMT_GROUP = 128
2395
- }
2396
-
2397
- declare enum EnumDrawingItemState {
2398
- /**
2399
- * DIS_DEFAULT: The default state of a drawing item. This state indicates that the drawing item is in its normal, unselected state.
2400
- */
2401
- DIS_DEFAULT = 1,
2402
- /**
2403
- * DIS_SELECTED: Indicates that the drawing item is currently selected. This state can trigger different behaviors or visual styles, such as highlighting the item to show it is active or the focus of user interaction.
2404
- */
2405
- DIS_SELECTED = 2
2406
- }
2407
-
2408
- declare enum EnumEnhancedFeatures {
2409
- /**
2410
- * Enables auto-focus on areas likely to contain barcodes, assisting in their identification and interpretation.
2411
- */
2412
- EF_ENHANCED_FOCUS = 4,
2413
- /**
2414
- * Facilitates automatic zooming in on areas likely to contain barcodes, aiding in their detection and decoding.
2415
- */
2416
- EF_AUTO_ZOOM = 16,
2417
- /**
2418
- * Allows users to tap on a specific item or area in the video feed to focus on, simplifying the interaction for selecting or highlighting important elements.
2419
- */
2420
- EF_TAP_TO_FOCUS = 64
2421
- }
2422
-
2423
- declare enum EnumPixelFormat {
2424
- GREY = "grey",
2425
- GREY32 = "grey32",
2426
- RGBA = "rgba",
2427
- RBGA = "rbga",
2428
- GRBA = "grba",
2429
- GBRA = "gbra",
2430
- BRGA = "brga",
2431
- BGRA = "bgra"
2432
- }
2433
-
2434
- declare enum EnumItemType {
2435
- ARC = 0,
2436
- IMAGE = 1,
2437
- LINE = 2,
2438
- POLYGON = 3,
2439
- QUAD = 4,
2440
- RECT = 5,
2441
- TEXT = 6,
2442
- GROUP = 7
2443
- }
2444
- declare enum EnumItemState {
2445
- DEFAULT = 0,
2446
- SELECTED = 1
2447
- }
2448
- declare abstract class DrawingItem {
2449
- #private;
2450
- /**
2451
- * TODO: replace with enum
2452
- * @ignore
2453
- */
2454
- static arrMediaTypes: string[];
2455
- /**
2456
- * @ignore
2457
- */
2458
- static mapItemType: Map<EnumItemType, string>;
2459
- /**
2460
- * TOOD: replace with enum
2461
- * @ignore
2462
- */
2463
- static arrStyleSelectors: string[];
2464
- /**
2465
- * @ignore
2466
- */
2467
- static mapItemState: Map<EnumItemState, string>;
2468
- protected _fabricObject: any;
2469
- /**
2470
- * TODO: make it private and replace it with 'mediaType'
2471
- * @ignore
2472
- */
2473
- _mediaType: string;
2474
- /**
2475
- * @ignore
2476
- */
2477
- get mediaType(): EnumDrawingItemMediaType;
2478
- /**
2479
- * TODO: rename it to 'state' and return enum
2480
- */
2481
- get styleSelector(): string;
2482
- /**
2483
- * @ignore
2484
- */
2485
- styleId?: number;
2486
- /**
2487
- * Returns or sets the numeric ID for the `DrawingStyle` that applies to this `DrawingItem`.
2488
- * Invoke `renderAll()` for the new `DrawingStyle` to take effect.
2489
- */
2490
- set drawingStyleId(id: number);
2491
- get drawingStyleId(): number;
2492
- /**
2493
- * Returns or sets the coordinate system base with a string:
2494
- * - "view" for viewport-based coordinates or
2495
- * - "image" for image-based coordinates.
2496
- */
2497
- set coordinateBase(base: "view" | "image");
2498
- get coordinateBase(): "view" | "image";
2499
- /**
2500
- * @ignore
2501
- */
2502
- _zIndex?: number;
2503
- /**
2504
- * @ignore
2505
- */
2506
- _drawingLayer: any;
2507
- /**
2508
- * @ignore
2509
- */
2510
- _drawingLayerId: number;
2511
- /**
2512
- * Returns the numeric ID for the `DrawingLayer` this `DrawingItem` belongs to.
2513
- */
2514
- get drawingLayerId(): number;
2515
- /**
2516
- * record the item's styles
2517
- * TODO: use enum
2518
- * @ignore
2519
- */
2520
- _mapState_StyleId: Map<string, number>;
2521
- protected mapEvent_Callbacks: Map<string, Map<Function, Function>>;
2522
- protected mapNoteName_Content: Map<string, Array<any>>;
2523
- /**
2524
- * @ignore
2525
- */
2526
- readonly isDrawingItem: boolean;
2527
- /**
2528
- *
2529
- * @param fabricObject
2530
- * @param drawingStyleId
2531
- * @ignore
2532
- */
2533
- constructor(fabricObject?: any, drawingStyleId?: number);
2534
- protected _setFabricObject(fabricObject: any): void;
2535
- /**
2536
- *
2537
- * @returns
2538
- * @ignore
2539
- */
2540
- _getFabricObject(): any;
2541
- /**
2542
- *
2543
- * @param state Specifies the state of the `DrawingItem` as a string.
2544
- * @ignore
2545
- */
2546
- setState(state: EnumDrawingItemState): void;
2547
- /**
2548
- * Returns the current state of the `DrawingItem`.
2549
- *
2550
- * @returns The current state of the `DrawingItem`, of type `EnumDrawingItemState`.
2551
- */
2552
- getState(): EnumDrawingItemState;
2553
- /**
2554
- * @ignore
2555
- */
2556
- _on(eventName: string, listener: (event: DrawingItemEvent) => void): void;
2557
- /**
2558
- * Binds a listener for a specific event.
2559
- * The event name is limited to "mousedown" | "mouseup" | "dblclick" | "mouseover" | "mouseout".
2560
- * @param eventName Specifies the event by its name.
2561
- * @param listener The event listener.
2562
- */
2563
- on(eventName: "mousedown" | "mouseup" | "dblclick" | "mouseover" | "mouseout", listener: (event: DrawingItemEvent) => void): void;
2564
- /**
2565
- * @ignore
2566
- */
2567
- _off(eventName: string, listener: (event: DrawingItemEvent) => void): void;
2568
- /**
2569
- * Unbinds a listener for a specific event.
2570
- * The event name is limited to "mousedown" | "mouseup" | "dblclick" | "mouseover" | "mouseout".
2571
- * @param eventName Specifies the event by its name.
2572
- * @param listener The event listener.
2573
- */
2574
- off(eventName: "mousedown" | "mouseup" | "dblclick" | "mouseover" | "mouseout", listener: (event: DrawingItemEvent) => void): void;
2575
- /**
2576
- * Set if this item can be edited.
2577
- * @param editable
2578
- * @ignore
2579
- */
2580
- _setEditable(editable: boolean): void;
2581
- /**
2582
- * Checks if a `Note` object with the specified name exists.
2583
- * @param name Specifies the name of the `Note` object.
2584
- *
2585
- * @returns Boolean indicating whether the `Note` object exists.
2586
- */
2587
- hasNote(name: string): boolean;
2588
- /**
2589
- * Adds a `Note` object to this `DrawingItem`.
2590
- * @param note Specifies the `Note` object.
2591
- * @param replace [Optional] Whether to replace an existing note if the notes share the same name.
2592
- */
2593
- addNote(note: Note, replace?: boolean): void;
2594
- /**
2595
- * Returns a `Note` object specified by its name, if it exists.
2596
- * @param name Specifies the name of the `Note` object.
2597
- *
2598
- * @returns The corresponding `Note` object specified by its name, if it exists.
2599
- */
2600
- getNote(name: string): Note;
2601
- /**
2602
- * Returns a collection of all existing `Note` objects on this `DrawingItem`.
2603
- *
2604
- * @returns All existing `Note` objects on this `DrawingItem`.
2605
- */
2606
- getNotes(): Array<Note>;
2607
- /**
2608
- * Updates the content of a specified `Note` object.
2609
- * @param name Specifies the name of the `Note` object.
2610
- * @param content Specifies the new content, can be of any type.
2611
- * @param mergeContent [Optional] Whether to merge the new content with the existing one.
2612
- */
2613
- updateNote(name: string, content: any, mergeContent?: boolean): void;
2614
- /**
2615
- * Deletes a `Note` object specified by its name.
2616
- * @param name Specifies the name of the `Note` object.
2617
- */
2618
- deleteNote(name: string): void;
2619
- /**
2620
- * Deletes all `Note` objects on this `DrawingItem`.
2621
- */
2622
- clearNotes(): void;
2623
- protected abstract extendSet(property: string, value: any): boolean;
2624
- protected abstract extendGet(property: string): any;
2625
- /**
2626
- *
2627
- * @param property
2628
- * @returns
2629
- * @ignore
2630
- */
2631
- set(property: string, value: any): void;
2632
- /**
2633
- *
2634
- * @param property
2635
- * @returns
2636
- * @ignore
2637
- */
2638
- get(property: string): any;
2639
- /**
2640
- * Remove this item from drawing layer.
2641
- * @ignore
2642
- */
2643
- remove(): void;
2644
- /**
2645
- * Convert item's property(width, height, x, y, etc.) from related to image/video to related to view/page.
2646
- * @param value
2647
- * @returns
2648
- */
2649
- protected convertPropFromImageToView(value: number): number;
2650
- /**
2651
- * Convert item's property(width, height, x, y, etc.) from related to view/page to related to image/video.
2652
- * @param value
2653
- * @returns
2654
- */
2655
- protected convertPropFromViewToImage(value: number): number;
2656
- protected abstract updateCoordinateBaseFromImageToView(): void;
2657
- protected abstract updateCoordinateBaseFromViewToImage(): void;
2658
- /**
2659
- * @ignore
2660
- */
2661
- _setLineWidth(value: number): void;
2662
- /**
2663
- * @ignore
2664
- */
2665
- _getLineWidth(): number;
2666
- /**
2667
- * @ignore
2668
- */
2669
- _setFontSize(value: number): void;
2670
- /**
2671
- * @ignore
2672
- */
2673
- _getFontSize(): number;
2674
- /**
2675
- * @ignore
2676
- */
2677
- abstract setPosition(position: any): void;
2678
- /**
2679
- * @ignore
2680
- */
2681
- abstract getPosition(): any;
2682
- /**
2683
- * Update item's propertys(width, height, x, y, etc.).
2684
- * It is called when item is added to layer.
2685
- * @ignore
2686
- */
2687
- abstract updatePosition(): void;
2688
- }
2689
-
2690
- declare class DT_Rect extends DrawingItem {
2691
- #private;
2692
- constructor(rect: Rect, drawingStyleId?: number);
2693
- protected extendSet(property: string, value: any): boolean;
2694
- protected extendGet(property: string): void;
2695
- protected updateCoordinateBaseFromImageToView(): void;
2696
- protected updateCoordinateBaseFromViewToImage(): void;
2697
- setPosition(position: any): void;
2698
- getPosition(): any;
2699
- updatePosition(): void;
2700
- setRect(rect: Rect): void;
2701
- getRect(): Rect;
2702
- }
2703
-
2704
- declare class DT_Polygon extends DrawingItem {
2705
- #private;
2706
- constructor(polygon: Polygon, drawingStyleId?: number);
2707
- protected extendSet(property: string, value: any): boolean;
2708
- protected extendGet(property: string): any;
2709
- protected updateCoordinateBaseFromImageToView(): void;
2710
- protected updateCoordinateBaseFromViewToImage(): void;
2711
- setPosition(position: any): void;
2712
- getPosition(): any;
2713
- updatePosition(): void;
2714
- setPolygon(polygon: Polygon): void;
2715
- getPolygon(): Polygon;
2716
- }
2717
-
2718
- declare class DT_Image extends DrawingItem {
2719
- #private;
2720
- private image;
2721
- set maintainAspectRatio(value: boolean);
2722
- get maintainAspectRatio(): boolean;
2723
- constructor(image: DSImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, rect: Rect, maintainAspectRatio: boolean, drawingStyleId?: number);
2724
- protected extendSet(property: string, value: any): boolean;
2725
- protected extendGet(property: string): any;
2726
- protected updateCoordinateBaseFromImageToView(): void;
2727
- protected updateCoordinateBaseFromViewToImage(): void;
2728
- setPosition(position: any): void;
2729
- getPosition(): any;
2730
- updatePosition(): void;
2731
- setImage(image: DSImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
2732
- getImage(): DSImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
2733
- setImageRect(rect: Rect): void;
2734
- getImageRect(): Rect;
2735
- }
2736
-
2737
- declare class DT_Text extends DrawingItem {
2738
- #private;
2739
- private _text;
2740
- constructor(text: string, rect: Rect, drawingStyleId?: number);
2741
- protected extendSet(property: string, value: any): boolean;
2742
- protected extendGet(property: string): any;
2743
- protected updateCoordinateBaseFromImageToView(): void;
2744
- protected updateCoordinateBaseFromViewToImage(): void;
2745
- setPosition(position: any): void;
2746
- getPosition(): any;
2747
- updatePosition(): void;
2748
- setText(text: string): void;
2749
- getText(): string;
2750
- setTextRect(rect: Rect): void;
2751
- getTextRect(): Rect;
2752
- }
2753
-
2754
- declare class DT_Line extends DT_Polygon {
2755
- #private;
2756
- constructor(line: LineSegment, drawingStyleId?: number);
2757
- protected extendSet(property: string, value: any): boolean;
2758
- protected extendGet(property: string): any;
2759
- protected updateCoordinateBaseFromImageToView(): void;
2760
- protected updateCoordinateBaseFromViewToImage(): void;
2761
- setPosition(position: any): void;
2762
- getPosition(): any;
2763
- updatePosition(): void;
2764
- /**
2765
- * @ignore
2766
- */
2767
- setPolygon(): void;
2768
- /**
2769
- * @ignore
2770
- */
2771
- getPolygon(): Polygon;
2772
- setLine(line: LineSegment): void;
2773
- getLine(): LineSegment;
2774
- }
2775
-
2776
- declare class DT_Quad extends DT_Polygon {
2777
- #private;
2778
- constructor(quad: Quadrilateral, drawingStyleId?: number);
2779
- setPosition(position: any): void;
2780
- getPosition(): any;
2781
- updatePosition(): void;
2782
- /**
2783
- * @ignore
2784
- */
2785
- setPolygon(): void;
2786
- /**
2787
- * @ignore
2788
- */
2789
- getPolygon(): Polygon;
2790
- setQuad(quad: Quadrilateral): void;
2791
- getQuad(): Quadrilateral;
2792
- }
2793
-
2794
- declare class DT_Group extends DrawingItem {
2795
- constructor(childItems: Array<DrawingItem>);
2796
- protected extendSet(property: string, value: any): boolean;
2797
- protected extendGet(property: string): void;
2798
- protected updateCoordinateBaseFromImageToView(): void;
2799
- protected updateCoordinateBaseFromViewToImage(): void;
2800
- setPosition(): void;
2801
- getPosition(): any;
2802
- updatePosition(): void;
2803
- getChildDrawingItems(): Array<DrawingItem>;
2804
- setChildDrawingItems(item: DrawingItem): void;
2805
- removeChildItem(item: DrawingItem): void;
2806
- }
2807
-
2808
- declare class DrawingLayer {
2809
- /**
2810
- * Predefined ID for the default layer meant to be used by Dynamsoft Document Normalizer.
2811
- */
2812
- static DDN_LAYER_ID: number;
2813
- /**
2814
- * Predefined ID for the default layer meant to be used by Dynamsoft Barcode Reader.
2815
- */
2816
- static DBR_LAYER_ID: number;
2817
- /**
2818
- * Predefined ID for the default layer meant to be used by Dynamsoft Label Recognizer.
2819
- */
2820
- static DLR_LAYER_ID: number;
2821
- /**
2822
- * The starting ID for user-defined layers, distinguishing them from default system layers.
2823
- */
2824
- static USER_DEFINED_LAYER_BASE_ID: number;
2825
- /**
2826
- * @ignore
2827
- */
2828
- static TIP_LAYER_ID: number;
2829
- /**
2830
- * returns the 'fabric.Canvas' object
2831
- * @ignore
2832
- */
2833
- fabricCanvas: any;
2834
- private id;
2835
- /**
2836
- * @ignore
2837
- */
2838
- get width(): number;
2839
- /**
2840
- * @ignore
2841
- */
2842
- get height(): number;
2843
- private mapType_StateAndStyleId;
2844
- private mode;
2845
- /**
2846
- * Event triggered whenever there is a change in which `DrawingItem` objects are selected or deselected.
2847
- * @param selectedDrawingItems An array of `DrawingItem` objects that have been selected as a result of the latest selection change.
2848
- * @param deselectedDrawingItems An array of `DrawingItem` objects that have been deselected as a result of the latest selection change.
2849
- * [NOTE]: This event is only functional when the `DrawingLayer` in which it is defined belongs to an `ImageEditorView` instance.
2850
- */
2851
- onSelectionChanged: (selectedDrawingItems: Array<DrawingItem>, deselectedDrawingItems: Array<DrawingItem>) => void;
2852
- private _arrDrwaingItem;
2853
- private _arrFabricObject;
2854
- private _visible;
2855
- /**
2856
- * @ignore
2857
- */
2858
- _manager: any;
2859
- /**
2860
- * @ignore
2861
- */
2862
- set _allowMultiSelect(value: boolean);
2863
- get _allowMultiSelect(): boolean;
2864
- /**
2865
- * @ignore
2866
- */
2867
- constructor(canvas: HTMLCanvasElement, id: number, options?: Object);
2868
- /**
2869
- * Retrieves the unique identifier of the layer.
2870
- */
2871
- getId(): number;
2872
- /**
2873
- * Sets the visibility of the layer.
2874
- * @param visible Whether to show or hide the layer.
2875
- */
2876
- setVisible(visible: boolean): void;
2877
- /**
2878
- * Retrieves the visibility status of the layer.
2879
- *
2880
- * @returns Boolean indicating whether the layer is visible.
2881
- */
2882
- isVisible(): boolean;
2883
- private _getItemCurrentStyle;
2884
- /**
2885
- * Change style of drawingItems of specific media type in specific style selector.
2886
- * DrawingItems that have 'styleId' won't be changed.
2887
- * @param mediaType the mediaType of drawingItems that attend to change
2888
- * @param styleSelector
2889
- * @param drawingStyle
2890
- * @private
2891
- */
2892
- private _changeMediaTypeCurStyleInStyleSelector;
2893
- /**
2894
- * Change the style of specific drawingItem.
2895
- * DrawingItem that has 'styleId' won't be changed.
2896
- * @param drawingItem
2897
- * @param drawingStyle
2898
- * @private
2899
- */
2900
- private _changeItemStyle;
2901
- /**
2902
- *
2903
- * @param targetGroup
2904
- * @param item
2905
- * @param addOrRemove
2906
- * @returns
2907
- * @ignore
2908
- */
2909
- _updateGroupItem(targetGroup: DrawingItem, item: DrawingItem, addOrRemove: string): void;
2910
- private _addDrawingItem;
2911
- /**
2912
- * Add a drawing item to the drawing layer.
2913
- * Drawing items in drawing layer with higher id are always above those in drawing layer with lower id.
2914
- * In a same drawing layer, the later added is above the previous added.
2915
- * @param drawingItem
2916
- * @ignore
2917
- */
2918
- private addDrawingItem;
2919
- /**
2920
- * Adds an array of `DrawingItem` objects to the layer.
2921
- * @param drawingItems An array of `DrawingItem` objects.
2922
- */
2923
- addDrawingItems(drawingItems: Array<DrawingItem>): void;
2924
- /**
2925
- *
2926
- * @param drawingItem
2927
- * @returns
2928
- * @ignore
2929
- */
2930
- private removeDrawingItem;
2931
- /**
2932
- * Removes specified `DrawingItem` objects from the layer.
2933
- * @param drawingItems An array of `DrawingItem` objects.
2934
- */
2935
- removeDrawingItems(drawingItems: Array<DrawingItem>): void;
2936
- /**
2937
- * Sets the layer's `DrawingItem` objects, replacing any existing items.
2938
- * @param drawingItems An array of `DrawingItem` objects.
2939
- */
2940
- setDrawingItems(drawingItems: Array<DrawingItem>): void;
2941
- /**
2942
- * Retrieves `DrawingItem` objects from the layer, optionally filtered by a custom function.
2943
- * @param filter [Optional] A predicate function used to select a subset of `DrawingItem` objects based on specific criteria. Only items for which this function returns `true` are included in the result.
2944
- *
2945
- */
2946
- getDrawingItems(filter?: (item: DrawingItem) => boolean): Array<DrawingItem>;
2947
- /**
2948
- * Returns an array of all selected DrawingItem instances.
2949
- *
2950
- * @returns An array of `DrawingItem` objects.
2951
- */
2952
- getSelectedDrawingItems(): Array<DrawingItem>;
2953
- /**
2954
- * Checks if a specific `DrawingItem` exists within the layer.
2955
- * @param drawingItem Specifies the `DrawingItem`.
2956
- *
2957
- * @returns Boolean indicating whether the specific `DrawingItem` exists.
2958
- */
2959
- hasDrawingItem(drawingItem: DrawingItem): boolean;
2960
- /**
2961
- * Clears all `DrawingItem` objects from the layer.
2962
- */
2963
- clearDrawingItems(): void;
2964
- private _setDefaultStyle;
2965
- /**
2966
- * Establishes the baseline styling preferences for `DrawingItem` objects on the layer.
2967
- * This method offers flexible styling options tailored to the diverse requirements of `DrawingItem` objects based on their state and type:
2968
- * - Universal Application: By default, without specifying `state` or `mediaType`, the designated style is universally applied to all `DrawingItem` objects on the layer, ensuring a cohesive look and feel.
2969
- * - State-Specific Styling: Specifying only the state parameter allows the method to target `DrawingItem` objects matching that particular state, enabling differentiated styling that reflects their current status or condition.
2970
- * - Refined Targeting with State and MediaType: Providing both `state` and `mediaType` parameters focuses the style application even further, affecting only those `DrawingItem` objects that align with the specified type while in the given state.
2971
- *
2972
- * This precision is particularly useful for creating visually distinct interactions or highlighting specific elements based on their content and interaction state.
2973
- * @param drawingStyleId The unique ID of the `DrawingStyle` to be applied.
2974
- * @param state [Optional] Allows the styling to be conditional based on the `DrawingItem`'s current state.
2975
- * @param mediaType [Optional] Further refines the application of the style based on the the `DrawingItem`'s type.
2976
- */
2977
- setDefaultStyle(drawingStyleId: number, state?: EnumDrawingItemState, mediaType?: EnumDrawingItemMediaType): void;
2978
- /**
2979
- * Change drawing layer mode, "viewer" or "editor".
2980
- * @param newMode
2981
- * @ignore
2982
- */
2983
- setMode(newMode: string): void;
2984
- /**
2985
- *
2986
- * @returns
2987
- * @ignore
2988
- */
2989
- getMode(): string;
2990
- /**
2991
- * Update the dimensions of drawing layer.
2992
- * @param dimensions
2993
- * @param options
2994
- * @ignore
2995
- */
2996
- _setDimensions(dimensions: {
2997
- width: number | string;
2998
- height: number | string;
2999
- }, options?: {
3000
- backstoreOnly?: boolean;
3001
- cssOnly?: boolean;
3002
- }): void;
3003
- /**
3004
- * Update the object-fit of drawing layer.
3005
- * @param value
3006
- * @ignore
3007
- */
3008
- _setObjectFit(value: string): void;
3009
- /**
3010
- *
3011
- * @returns
3012
- * @ignore
3013
- */
3014
- _getObjectFit(): string;
3015
- /**
3016
- * Forces a re-render of all `DrawingItem` objects on the layer.
3017
- * Invoke this method to ensure any modifications made to existing `DrawingItem` objects are visually reflected on the layer.
3018
- */
3019
- renderAll(): void;
3020
- /**
3021
- * @ignore
3022
- */
3023
- dispose(): void;
3024
- }
3025
-
3026
- declare class DrawingLayerManager {
3027
- _arrDrawingLayer: DrawingLayer[];
3028
- /**
3029
- * Creates a new `DrawingLayer` object and returns it.
3030
- * @param baseCvs An `HTMLCanvasElement` used as the base for creating the `DrawingLayer` object.
3031
- * @param drawingLayerId Assign a unique number as an identifier for the `DrawingLayer` object.
3032
- *
3033
- * @returns The created `DrawingLayer` object.
3034
- */
3035
- createDrawingLayer(baseCvs: HTMLCanvasElement, drawingLayerId: number): DrawingLayer;
3036
- /**
3037
- * Deletes a user-defined `DrawingLayer` object specified by its unique identifier (ID).
3038
- * [NOTE] The name for the same method on `CameraView` or `ImageEditorView` is deleteUserDefinedDrawingLayer().
3039
- * @param drawingLayerId The unique identifier (ID) of the `DrawingLayer` object.
3040
- */
3041
- deleteDrawingLayer(drawingLayerId: number): void;
3042
- /**
3043
- * Clears all user-defined `DrawingLayer` objects, resetting the drawing space without affecting default built-in `DrawingLayer` objects.
3044
- * [NOTE] The name for the same method on `CameraView` or `ImageEditorView` is clearUserDefinedDrawingLayers().
3045
- */
3046
- clearDrawingLayers(): void;
3047
- /**
3048
- * Retrieves a `DrawingLayer` object by its unique identifier (ID).
3049
- * @param id The unique identifier (ID) of the `DrawingLayer` object.
3050
- *
3051
- * @returns The `DrawingLayer` object specified by its unique identifier (ID) or `null`.
3052
- */
3053
- getDrawingLayer(drawingLayerId: number): DrawingLayer;
3054
- /**
3055
- * Returns an array of all `DrawingLayer` objects managed by this `DrawingLayerManager`.
3056
- *
3057
- * @returns An array of all `DrawingLayer` objects.
3058
- */
3059
- getAllDrawingLayers(): Array<DrawingLayer>;
3060
- /**
3061
- * Returns an array of all selected DrawingItem instances across different layers, supporting complex selection scenarios.
3062
- *
3063
- * @returns An array of `DrawingItem` objects.
3064
- */
3065
- getSelectedDrawingItems(): Array<DrawingItem>;
3066
- setDimensions(dimensions: {
3067
- width: number | string;
3068
- height: number | string;
3069
- }, options?: {
3070
- backstoreOnly?: boolean;
3071
- cssOnly?: boolean;
3072
- }): void;
3073
- setObjectFit(value: string): void;
3074
- getObjectFit(): string;
3075
- setVisible(visible: boolean): void;
3076
- _getFabricCanvas(): any;
3077
- _switchPointerEvent(): void;
3078
- }
3079
-
3080
- declare class InnerComponent extends HTMLElement {
3081
- #private;
3082
- constructor();
3083
- getWrapper(): HTMLDivElement;
3084
- setElement(slot: "content" | "single-frame-input-container" | "drawing-layer", el: HTMLElement): void;
3085
- getElement(slot: "content" | "single-frame-input-container" | "drawing-layer"): HTMLElement;
3086
- removeElement(slot: "content" | "single-frame-input-container" | "drawing-layer"): void;
3087
- }
3088
-
3089
- declare class DT_Tip extends DT_Text {
3090
- #private;
3091
- constructor(text: string, x: number, y: number, width: number, styleId?: number);
3092
- /**
3093
- * Make the tip hidden after a period of time.
3094
- * @param duration if less then 0, it clears the timer.
3095
- */
3096
- setDuration(duration: number): void;
3097
- getDuration(): number;
3098
- }
3099
- declare abstract class View {
3100
- #private;
3101
- /**
3102
- * @ignore
3103
- */
3104
- _innerComponent: InnerComponent;
3105
- /** @ignore */
3106
- _drawingLayerManager: DrawingLayerManager;
3107
- /** @ignore */
3108
- _layerBaseCvs: HTMLCanvasElement;
3109
- /** @ignore */
3110
- _drawingLayerOfTip: DrawingLayer;
3111
- private _tipStyleId;
3112
- /** @ignore */
3113
- _tip: DT_Tip;
3114
- constructor();
3115
- /**
3116
- * get the dimensions of content which the view shows. In 'CameraView', the 'content' usually means the video; in 'ImageEditorView', the 'content' usually means the image.
3117
- */
3118
- protected abstract getContentDimensions(): {
3119
- width: number;
3120
- height: number;
3121
- objectFit: string;
3122
- };
3123
- /**
3124
- * Create a native 'canvas' element, which will be passed to 'fabric' to create a 'fabric.Canvas'.
3125
- * In fact, all drawing layers are in one canvas.
3126
- * @ignore
3127
- */
3128
- protected createDrawingLayerBaseCvs(width: number, height: number, objectFit?: string): HTMLCanvasElement;
3129
- /**
3130
- * Create drawing layer with specified id and size.
3131
- * Differ from 'createDrawingLayer()', the drawing layers created'createDrawingLayer()' can not Specified id, and their size is the same as video.
3132
- * @ignore
3133
- */
3134
- _createDrawingLayer(drawingLayerId: number, width?: number, height?: number, objectFit?: string): DrawingLayer;
3135
- /**
3136
- * Creates a new `DrawingLayer` object and returns it.
3137
- *
3138
- * @returns The created `DrawingLayer` object.
3139
- */
3140
- createDrawingLayer(): DrawingLayer;
3141
- /**
3142
- * Differ from 'deleteUserDefinedDrawingLayer()', 'deleteDrawingLayer()' can delete any layer, while 'deleteUserDefinedDrawingLayer()' can only delete user defined layer.
3143
- */
3144
- protected deleteDrawingLayer(drawingLayerId: number): void;
3145
- /**
3146
- * Deletes a user-defined `DrawingLayer` object specified by its unique identifier (ID).
3147
- * @param id The unique identifier (ID) of the `DrawingLayer` object.
3148
- */
3149
- deleteUserDefinedDrawingLayer(id: number): void;
3150
- /**
3151
- * Not used yet.
3152
- * @ignore
3153
- */
3154
- _clearDrawingLayers(): void;
3155
- /**
3156
- * Clears all user-defined `DrawingLayer` objects, resetting the drawing space without affecting default built-in `DrawingLayer` objects.
3157
- */
3158
- clearUserDefinedDrawingLayers(): void;
3159
- /**
3160
- * Retrieves a `DrawingLayer` object by its unique identifier (ID).
3161
- * @param id The unique identifier (ID) of the `DrawingLayer` object.
3162
- *
3163
- * @returns The `DrawingLayer` object specified by its unique identifier (ID) or `null`.
3164
- */
3165
- getDrawingLayer(drawingLayerId: number): DrawingLayer;
3166
- /**
3167
- * Returns an array of all `DrawingLayer` objects .
3168
- *
3169
- * @returns An array of all `DrawingLayer` objects.
3170
- */
3171
- getAllDrawingLayers(): Array<DrawingLayer>;
3172
- /**
3173
- * update drawing layers according to content(video/image) dimensions.
3174
- */
3175
- protected updateDrawingLayers(contentDimensions: {
3176
- width: number;
3177
- height: number;
3178
- objectFit: string;
3179
- }): void;
3180
- /**
3181
- * Returns an array of all selected DrawingItem instances across different layers, supporting complex selection scenarios.
3182
- *
3183
- * @returns An array of `DrawingItem` objects.
3184
- */
3185
- getSelectedDrawingItems(): Array<DrawingItem>;
3186
- /**
3187
- * Applies configuration settings to the tip message box.
3188
- * This includes its position, size, display duration, and the coordinate system basis.
3189
- * @param tipConfig Configuration object for the tip message box, including top-left position, width, display duration, and coordinate system basis.
3190
- */
3191
- setTipConfig(tipConfig: TipConfig): void;
3192
- /**
3193
- * Retrieves the current configuration of the tip message box, reflecting its position, size, display duration, and the coordinate system basis.
3194
- *
3195
- * @returns The current configuration settings of the tip message box.
3196
- */
3197
- getTipConfig(): TipConfig;
3198
- /**
3199
- * Controls the visibility of the tip message box on the screen.
3200
- * This can be used to show or hide the tip based on user interaction or other criteria.
3201
- * @param visible Boolean flag indicating whether the tip message box should be visible (`true`) or hidden (`false`).
3202
- */
3203
- setTipVisible(visible: boolean): void;
3204
- /**
3205
- * Checks whether the tip message box is currently visible to the user.
3206
- *
3207
- * @returns Boolean indicating the visibility of the tip message box (`true` for visible, `false` for hidden).
3208
- */
3209
- isTipVisible(): boolean;
3210
- /**
3211
- * Updates the message displayed in the tip message box.
3212
- * This can be used to provide dynamic feedback or information to the user.
3213
- * @param message The new message to be displayed in the tip message box.
3214
- */
3215
- updateTipMessage(message: string): void;
3216
- }
3217
-
3218
- declare class EventHandler {
3219
- #private;
3220
- get disposed(): boolean;
3221
- on(event: string, listener: Function): void;
3222
- off(event: string, listener: Function): void;
3223
- offAll(event: string): void;
3224
- fire(event: string, params?: Array<any>, options?: {
3225
- target?: object;
3226
- async?: boolean;
3227
- copy?: boolean;
3228
- }): void;
3229
- dispose(): void;
3230
- }
3231
-
3232
- declare class ImageDataGetter {
3233
- #private;
3234
- static _onLog: (message: any) => void;
3235
- static get version(): string;
3236
- static _webGLSupported: boolean;
3237
- static get webGLSupported(): boolean;
3238
- useWebGLByDefault: boolean;
3239
- _reusedCvs: HTMLCanvasElement;
3240
- _reusedWebGLCvs?: HTMLCanvasElement;
3241
- get disposed(): boolean;
3242
- constructor();
3243
- private sourceIsReady;
3244
- /**
3245
- * Draw a image to canvas.
3246
- * TODO: fix image is flipped when drawing in 'WebGL'.
3247
- * @param canvas
3248
- * @param source
3249
- * @param sourceWidth
3250
- * @param sourceHeight
3251
- * @param position
3252
- * @param options
3253
- * @param options.bufferContainer if it is set and WebGL is used, the image data will be put into this variable.
3254
- * @returns
3255
- */
3256
- drawImage(canvas: HTMLCanvasElement, source: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, sourceWidth: number, sourceHeight: number, position?: {
3257
- sx?: number;
3258
- sy?: number;
3259
- sWidth?: number;
3260
- sHeight?: number;
3261
- dx?: number;
3262
- dy?: number;
3263
- dWidth?: number;
3264
- dHeight?: number;
3265
- }, options?: {
3266
- pixelFormat?: EnumPixelFormat;
3267
- bUseWebGL?: boolean;
3268
- bufferContainer?: Uint8Array;
3269
- isEnableMirroring?: boolean;
3270
- }): {
3271
- context: CanvasRenderingContext2D | WebGLRenderingContext;
3272
- pixelFormat: EnumPixelFormat;
3273
- bUseWebGL: boolean;
3274
- };
3275
- /**
3276
- * Read 'Unit8Array' from context of canvas.
3277
- * @param context
3278
- * @param position
3279
- * @param bufferContainer If set, the data will be put into this variable, which will be useful when you want to reuse container.
3280
- * @returns
3281
- */
3282
- readCvsData(context: CanvasRenderingContext2D | WebGLRenderingContext, position?: {
3283
- x?: number;
3284
- y?: number;
3285
- width?: number;
3286
- height?: number;
3287
- }, bufferContainer?: Uint8Array): Uint8Array;
3288
- /**
3289
- * Transform pixel format.
3290
- * @param data
3291
- * @param originalFormat
3292
- * @param targetFormat
3293
- * @param copy
3294
- * @returns
3295
- */
3296
- transformPixelFormat(data: Uint8Array, originalFormat: EnumPixelFormat, targetFormat: EnumPixelFormat, copy?: boolean): Uint8Array;
3297
- /**
3298
- * Get image data from image.
3299
- * @param source
3300
- * @param sourceWidth
3301
- * @param sourceHeight
3302
- * @param position
3303
- * @param options
3304
- * @returns
3305
- */
3306
- getImageData(source: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap, position: {
3307
- sx: number;
3308
- sy: number;
3309
- sWidth: number;
3310
- sHeight: number;
3311
- dWidth: number;
3312
- dHeight: number;
3313
- }, options?: {
3314
- pixelFormat?: EnumPixelFormat.RGBA | EnumPixelFormat.GREY;
3315
- bufferContainer?: Uint8Array;
3316
- isEnableMirroring?: boolean;
3317
- }): {
3318
- data: Uint8Array;
3319
- pixelFormat: EnumPixelFormat;
3320
- width: number;
3321
- height: number;
3322
- bUseWebGL: boolean;
3323
- };
3324
- /**
3325
- * Draw image data to a canvas.
3326
- * @param data
3327
- * @param width
3328
- * @param height
3329
- * @param pixelFormat
3330
- * @returns
3331
- */
3332
- convertDataToCvs(data: Uint8Array | Uint8ClampedArray, width: number, height: number, pixelFormat: EnumPixelFormat): HTMLCanvasElement;
3333
- /**
3334
- * Force lose webgl context.
3335
- * @private
3336
- */
3337
- forceLoseContext(): void;
3338
- dispose(): void;
3339
- }
3340
-
3341
- interface CameraInfo {
3342
- deviceId: string;
3343
- label: string;
3344
- /** @ignore */
3345
- _checked: boolean;
3346
- }
3347
-
3348
- type CameraEvent = "before:open" | "opened" | "before:close" | "closed" | "before:camera:change" | "camera:changed" | "before:resolution:change" | "resolution:changed" | "played" | "paused" | "resumed" | "tapfocus";
3349
- declare class CameraManager {
3350
- #private;
3351
- static _onLog: (message: any) => void;
3352
- static get version(): string;
3353
- static browserInfo: {
3354
- browser: string;
3355
- version: number;
3356
- OS: string;
3357
- };
3358
- private static _tryToReopenTime;
3359
- static onWarning: (message: string) => void;
3360
- /**
3361
- * Check if storage is available.
3362
- * @ignore
3363
- */
3364
- static isStorageAvailable(type: string): boolean;
3365
- static findBestRearCameraInIOS(cameraList: Array<{
3366
- label: string;
3367
- deviceId: string;
3368
- }>, options?: {
3369
- getMainCamera?: boolean;
3370
- }): string;
3371
- static findBestRearCamera(cameraList: Array<{
3372
- label: string;
3373
- deviceId: string;
3374
- }>, options?: {
3375
- getMainCameraInIOS?: boolean;
3376
- }): string;
3377
- static findBestCamera(cameraList: Array<{
3378
- label: string;
3379
- deviceId: string;
3380
- }>, facingMode: "environment" | "user" | null, options?: {
3381
- getMainCameraInIOS?: boolean;
3382
- }): string;
3383
- static playVideo(videoEl: HTMLVideoElement, source: string | MediaStream | MediaSource | Blob, timeout?: number): Promise<HTMLVideoElement>;
3384
- static testCameraAccess(constraints?: MediaStreamConstraints): Promise<{
3385
- ok: boolean;
3386
- errorName?: string;
3387
- errorMessage?: string;
3388
- }>;
3389
- /**
3390
- * Camera/video state.
3391
- */
3392
- get state(): "closed" | "opening" | "opened";
3393
- _zoomPreSetting: {
3394
- factor: number;
3395
- centerPoint?: {
3396
- x: string;
3397
- y: string;
3398
- };
3399
- };
3400
- videoSrc: string;
3401
- _mediaStream: MediaStream;
3402
- defaultConstraints: MediaStreamConstraints;
3403
- cameraOpenTimeout: number;
3404
- /**
3405
- * @ignore
3406
- */
3407
- _arrCameras: Array<CameraInfo>;
3408
- /**
3409
- * Whether to record camera you selected after reload the page.
3410
- */
3411
- set ifSaveLastUsedCamera(value: boolean);
3412
- get ifSaveLastUsedCamera(): boolean;
3413
- /**
3414
- * Whether to skip the process of picking a proper rear camera when opening camera the first time.
3415
- */
3416
- ifSkipCameraInspection: boolean;
3417
- selectIOSRearMainCameraAsDefault: boolean;
3418
- get isVideoPlaying(): boolean;
3419
- _focusParameters: any;
3420
- _focusSupported: boolean;
3421
- calculateCoordInVideo: (clientX: number, clientY: number) => {
3422
- x: number;
3423
- y: number;
3424
- };
3425
- set tapFocusEventBoundEl(element: HTMLElement);
3426
- get tapFocusEventBoundEl(): HTMLElement;
3427
- updateVideoElWhenSoftwareScaled: () => void;
3428
- imageDataGetter: ImageDataGetter;
3429
- detectedResolutions: {
3430
- width: number;
3431
- height: number;
3432
- }[];
3433
- get disposed(): boolean;
3434
- constructor(videoEl?: HTMLVideoElement);
3435
- setVideoEl(videoEl: HTMLVideoElement): void;
3436
- getVideoEl(): HTMLVideoElement;
3437
- releaseVideoEl(): void;
3438
- isVideoLoaded(): boolean;
3439
- /**
3440
- * Open camera and play video.
3441
- * @returns
3442
- */
3443
- open(): Promise<void>;
3444
- close(): Promise<void>;
3445
- pause(): void;
3446
- resume(): Promise<void>;
3447
- setCamera(deviceId: string): Promise<CameraInfo>;
3448
- switchToFrontCamera(options?: {
3449
- resolution: {
3450
- width: number;
3451
- height: number;
3452
- };
3453
- }): Promise<CameraInfo>;
3454
- getCamera(): CameraInfo;
3455
- _getCameras(force?: boolean): Promise<Array<CameraInfo>>;
3456
- getCameras(): Promise<Array<CameraInfo>>;
3457
- getAllCameras(): Promise<CameraInfo[]>;
3458
- setResolution(width: number, height: number, exact?: boolean): Promise<{
3459
- width: number;
3460
- height: number;
3461
- }>;
3462
- getResolution(): {
3463
- width: number;
3464
- height: number;
3465
- };
3466
- getResolutions(reGet?: boolean): Promise<Array<{
3467
- width: number;
3468
- height: number;
3469
- }>>;
3470
- setMediaStreamConstraints(mediaStreamConstraints: MediaStreamConstraints, reOpen?: boolean): Promise<void>;
3471
- getMediaStreamConstraints(): MediaStreamConstraints;
3472
- resetMediaStreamConstraints(): void;
3473
- getCameraCapabilities(): MediaTrackCapabilities;
3474
- getCameraSettings(): MediaTrackSettings;
3475
- turnOnTorch(): Promise<void>;
3476
- turnOffTorch(): Promise<void>;
3477
- setColorTemperature(value: number, autoCorrect?: boolean): Promise<number>;
3478
- getColorTemperature(): number;
3479
- setExposureCompensation(value: number, autoCorrect?: boolean): Promise<number>;
3480
- getExposureCompensation(): number;
3481
- setFrameRate(value: number, autoCorrect?: boolean): Promise<number>;
3482
- getFrameRate(): number;
3483
- setFocus(settings: {
3484
- mode: string;
3485
- } | {
3486
- mode: "manual";
3487
- distance: number;
3488
- } | {
3489
- mode: "manual";
3490
- area: {
3491
- centerPoint: {
3492
- x: string;
3493
- y: string;
3494
- };
3495
- width?: string;
3496
- height?: string;
3497
- };
3498
- }, autoCorrect?: boolean): Promise<void>;
3499
- getFocus(): Object;
3500
- /**
3501
- * Attention: tap focus is a feature that requires payment in DCE JS 4.x. Please consult relevant members if you want to export it to customers.
3502
- */
3503
- enableTapToFocus(): void;
3504
- disableTapToFocus(): void;
3505
- isTapToFocusEnabled(): boolean;
3506
- /**
3507
- *
3508
- * @param settings factor: scale value; centerPoint: experimental argument, set the scale center. Video center by default.
3509
- */
3510
- setZoom(settings: {
3511
- factor: number;
3512
- centerPoint?: {
3513
- x: string;
3514
- y: string;
3515
- };
3516
- }): Promise<void>;
3517
- getZoom(): {
3518
- factor: number;
3519
- };
3520
- resetZoom(): Promise<void>;
3521
- setHardwareScale(value: number, autoCorrect?: boolean): Promise<number>;
3522
- getHardwareScale(): number;
3523
- /**
3524
- *
3525
- * @param value scale value
3526
- * @param center experimental argument, set the scale center. Video center by default.
3527
- */
3528
- setSoftwareScale(value: number, center?: {
3529
- x: string;
3530
- y: string;
3531
- }): void;
3532
- getSoftwareScale(): number;
3533
- /**
3534
- * Reset scale center to video center.
3535
- * @experimental
3536
- */
3537
- resetScaleCenter(): void;
3538
- resetSoftwareScale(): void;
3539
- getFrameData(options?: {
3540
- position?: {
3541
- sx: number;
3542
- sy: number;
3543
- sWidth: number;
3544
- sHeight: number;
3545
- dWidth: number;
3546
- dHeight: number;
3547
- };
3548
- pixelFormat?: EnumPixelFormat.GREY | EnumPixelFormat.RGBA;
3549
- scale?: number;
3550
- scaleCenter?: {
3551
- x: string;
3552
- y: string;
3553
- };
3554
- bufferContainer?: Uint8Array;
3555
- isEnableMirroring?: boolean;
3556
- }): {
3557
- data: Uint8Array;
3558
- width: number;
3559
- height: number;
3560
- pixelFormat: EnumPixelFormat;
3561
- timeSpent: number;
3562
- timeStamp: number;
3563
- toCanvas: () => HTMLCanvasElement;
3564
- };
3565
- /**
3566
- *
3567
- * @param event {@link CameraEvent}
3568
- * @param listener
3569
- * @see {@link CameraEvent}
3570
- * @see {@link off}
3571
- */
3572
- on(event: CameraEvent, listener: Function): void;
3573
- /**
3574
- *
3575
- * @param event
3576
- * @param listener
3577
- * @see {@link CameraEvent}
3578
- * @see {@link on}
3579
- */
3580
- off(event: CameraEvent, listener: Function): void;
3581
- dispose(): Promise<void>;
3582
- }
3583
-
3584
- declare class CameraEnhancer extends ImageSourceAdapter {
3585
- #private;
3586
- /** @ignore */
3587
- static _debug: boolean;
3588
- private static _isRTU;
3589
- static set _onLog(value: (message: any) => void);
3590
- static get _onLog(): (message: any) => void;
3591
- /**
3592
- * @ignore
3593
- */
3594
- static browserInfo: {
3595
- browser: string;
3596
- version: number;
3597
- OS: string;
3598
- };
3599
- /**
3600
- * Event triggered when the running environment is not ideal.
3601
- * @param warning The warning message.
3602
- */
3603
- static onWarning: (warning: Warning) => void;
3604
- /**
3605
- * Detect environment and get a report.
3606
- * ```js
3607
- * console.log(Dynamsoft.DCE.CameraEnhancer.detectEnvironment());
3608
- * // {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"}
3609
- * ```
3610
- */
3611
- static detectEnvironment(): Promise<any>;
3612
- /**
3613
- * Tests whether the application has access to the camera.
3614
- * This static method can be used before initializing a `CameraEnhancer` instance to ensure that the device's camera can be accessed, providing a way to handle permissions or other access issues preemptively.
3615
- * This method offers the additional advantage of accelerating the camera opening process for the first time.
3616
- *
3617
- * @returns A promise that resolves with an object containing:
3618
- * - `ok`: Boolean indicating whether camera access is available.
3619
- * - `message`: A string providing additional information or the reason why camera access is not available, if applicable.
3620
- */
3621
- static testCameraAccess(): Promise<{
3622
- ok: boolean;
3623
- message: string;
3624
- }>;
3625
- /**
3626
- * Initializes a new instance of the `CameraEnhancer` class.
3627
- * @param view [Optional] Specifies a `CameraView` instance to provide the user interface element to display the live feed from the camera.
3628
- *
3629
- * @returns A promise that resolves with the initialized `CameraEnhancer` instance.
3630
- */
3631
- static createInstance(view?: CameraView): Promise<CameraEnhancer>;
3632
- cameraManager: CameraManager;
3633
- private cameraView;
3634
- /**
3635
- * @ignore
3636
- */
3637
- private _imageDataGetter;
3638
- private _isEnableMirroring;
3639
- get isEnableMirroring(): boolean;
3640
- /**
3641
- * @ignore
3642
- */
3643
- get video(): HTMLVideoElement;
3644
- /**
3645
- * Sets or returns the source URL for the video stream to be used by the `CameraEnhancer`.
3646
- * 1. You can use this property to specify an existing video as the source to play which will be processed the same way as the video feed from a live camera.
3647
- * 2. When playing an existing video, the camera selection and video selection boxes will be hidden.
3648
- *
3649
- * It is particularly useful for applications that need to process or display video from a specific source rather than the device's default camera.
3650
- */
3651
- set videoSrc(src: string);
3652
- get videoSrc(): string;
3653
- /**
3654
- * Determines whether the last used camera settings should be saved and reused the next time the `CameraEnhancer` is initialized.
3655
- *
3656
- * The default is `false`.
3657
- *
3658
- * When set to `true`, the enhancer attempts to restore the previously used camera settings, offering a more seamless user experience across sessions.
3659
- *
3660
- * - This feature makes use of the [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) of the browser.
3661
- * - This feature only works on mainstream browsers like Chrome, Firefox, and Safari. Other browsers may change the device IDs dynamically thus making it impossible to track the camera.
3662
- */
3663
- set ifSaveLastUsedCamera(value: boolean);
3664
- get ifSaveLastUsedCamera(): boolean;
3665
- /**
3666
- * Determines whether to skip the initial camera inspection process.
3667
- *
3668
- * The default is `false`, which means to opt for an optimal rear camera at the first `open()`.
3669
- *
3670
- * Setting this property to `true` bypasses the automatic inspection and configuration that typically occurs when a camera connection is established.
3671
- * This can be useful for scenarios where the default inspection process may not be desirable or necessary.
3672
- *
3673
- * Note that if a previously used camera is already available in the [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage), the inspection is skipped automatically. Read more on `ifSaveLastUsedCamera`.
3674
- */
3675
- set ifSkipCameraInspection(value: boolean);
3676
- get ifSkipCameraInspection(): boolean;
3677
- /**
3678
- * Specifies the timeout in milliseconds for opening the camera. The default value is 15000 ms.
3679
- *
3680
- * Setting 0 means canceling the timeout or waiting indefinitely.
3681
- *
3682
- * This property sets a limit on how long the `CameraEnhancer` will attempt to open the camera before timing out.
3683
- * It can be adjusted to accommodate different devices and scenarios, ensuring that the application does not hang indefinitely while trying to access the camera.
3684
- */
3685
- set cameraOpenTimeout(value: number);
3686
- get cameraOpenTimeout(): number;
3687
- isTorchOn: undefined | boolean;
3688
- set singleFrameMode(value: "disabled" | "camera" | "image");
3689
- get singleFrameMode(): "disabled" | "camera" | "image";
3690
- /**
3691
- * Event handler in camera selection in default UI.
3692
- * @ignore
3693
- */
3694
- private _onCameraSelChange;
3695
- /**
3696
- * Event handler in resolution selection in default UI.
3697
- * @ignore
3698
- */
3699
- private _onResolutionSelChange;
3700
- /**
3701
- * Event handler in close button in default UI.
3702
- *
3703
- * Now the close button is removed, so it is useless.
3704
- * @ignore
3705
- */
3706
- private _onCloseBtnClick;
3707
- /**
3708
- * Event handler for single frame mode.
3709
- * @ignore
3710
- */
3711
- private _onSingleFrameAcquired;
3712
- _intermediateResultReceiver: any;
3713
- /**
3714
- * @ignore
3715
- */
3716
- get _isFetchingStarted(): boolean;
3717
- /**
3718
- * Set the size limit of the gotten images.
3719
- *
3720
- * By default, there is no limit.
3721
- * @ignore
3722
- */
3723
- canvasSizeLimit: number;
3724
- /**
3725
- * It is used in `DCEFrame.tag.imageId`.
3726
- * @ignore
3727
- */
3728
- _imageId: number;
3729
- private fetchInterval;
3730
- /**
3731
- * Returns whether the `CameraEnhancer` instance has been disposed of.
3732
- *
3733
- * @returns Boolean indicating whether the `CameraEnhancer` instance has been disposed of.
3734
- */
3735
- get disposed(): boolean;
3736
- readonly isCameraEnhancer = true;
3737
- private constructor();
3738
- /**
3739
- * Sets the `CameraView` instance to be used with the `CameraEnhancer`.
3740
- * This method allows for specifying a custom camera view, which can be used to display the camera feed and interface elements.
3741
- *
3742
- * @param view A `CameraView` instance that will be used to display the camera's video feed and any associated UI components.
3743
- */
3744
- setCameraView(view: CameraView): void;
3745
- /**
3746
- * Retrieves the current `CameraView` instance associated with the `CameraEnhancer`.
3747
- * This method allows for accessing the camera view, which can be useful for manipulating the view or accessing its properties and methods.
3748
- *
3749
- * @returns The current `CameraView` instance used by the `CameraEnhancer`.
3750
- */
3751
- getCameraView(): CameraView;
3752
- /**
3753
- *
3754
- * @returns
3755
- * @ignore
3756
- */
3757
- private releaseCameraView;
3758
- /**
3759
- * Add some event listeners to UI element in camera view.
3760
- * @returns
3761
- * @ignore
3762
- */
3763
- private addListenerToView;
3764
- /**
3765
- * Remove event listeners from UI element in camera view.
3766
- * @returns
3767
- */
3768
- private removeListenerFromView;
3769
- /**
3770
- * Retrieves the current state of the camera.
3771
- *
3772
- * @returns A string indicating the camera's current state, which can be "opening", "open", or "closed".
3773
- */
3774
- getCameraState(): string;
3775
- /**
3776
- * Checks if the camera is currently open and streaming video.
3777
- *
3778
- * @returns Boolean indicating whether the camera is open (`true`) or not (`false`).
3779
- */
3780
- isOpen(): boolean;
3781
- /**
3782
- * Retrieves the HTMLVideoElement used by the `CameraEnhancer` for displaying the camera feed.
3783
- * This method provides direct access to the video element, enabling further customization or interaction with the video stream.
3784
- *
3785
- * @returns The `HTMLVideoElement` that is being used to display the camera's video feed.
3786
- */
3787
- getVideoEl(): HTMLVideoElement;
3788
- /**
3789
- * Opens the currently selected camera and starts the video stream.
3790
- *
3791
- * @returns A promise that resolves with a `PlayCallbackInfo` object with details about the operation's outcome.
3792
- */
3793
- open(): Promise<PlayCallbackInfo>;
3794
- /**
3795
- * Closes the currently active camera and stops the video stream.
3796
- */
3797
- close(): void;
3798
- /**
3799
- * Pauses the video stream without closing the camera.
3800
- * This can be useful for temporarily halting video processing while keeping the camera ready.
3801
- */
3802
- pause(): void;
3803
- /**
3804
- * Checks if the video stream is currently paused.
3805
- *
3806
- * @returns Boolean indicating whether the video stream is paused (`true`) or active (`false`).
3807
- */
3808
- isPaused(): boolean;
3809
- /**
3810
- * Resumes the video stream from a paused state.
3811
- *
3812
- * @returns A promise that resolves when the video stream resumes. It does not provide any value upon resolution.
3813
- */
3814
- resume(): Promise<void>;
3815
- /**
3816
- * Selects a specific camera for use by the `CameraEnhancer`. The camera can be specified by a `VideoDeviceInfo` object or by its device ID.
3817
- * If called before `open()` or `show()`, the selected camera will be used. Otherwise, the system will decide which one to use.
3818
- * @param cameraObjectOrDeviceID The `VideoDeviceInfo` object or device ID string of the camera to select.
3819
- *
3820
- * @returns A promise that resolves with a `PlayCallbackInfo` object indicating the outcome of the camera selection operation.
3821
- */
3822
- selectCamera(videoDeviceInfoOrDeviceId: VideoDeviceInfo | string): Promise<PlayCallbackInfo>;
3823
- /**
3824
- * Returns the currently selected camera device.
3825
- *
3826
- * @returns The `VideoDeviceInfo` object representing the currently active camera.
3827
- */
3828
- getSelectedCamera(): VideoDeviceInfo;
3829
- /**
3830
- * Retrieves a list of all available video input devices (cameras) on the current device.
3831
- *
3832
- * @returns A promise that resolves with an array of `VideoDeviceInfo` objects representing each available camera.
3833
- */
3834
- getAllCameras(): Promise<Array<VideoDeviceInfo>>;
3835
- /**
3836
- * Sets the resolution of the video stream to a specified value.
3837
- * If the specified resolution is not exactly supported, the closest resolution will be applied.
3838
- * If called before `open()` or `show()`, the camera will use the set resolution when it opens. Otherwise, the default resolution used is 1920x1080 on desktop and 1280x720 on mobile devices.
3839
- * @param resolution The `Resolution` to which the video stream should be set.
3840
- *
3841
- * @returns A promise that resolves with a `PlayCallbackInfo` object with details about the operation's outcome.
3842
- */
3843
- setResolution(resolution: Resolution): Promise<PlayCallbackInfo>;
3844
- /**
3845
- * Gets the current resolution of the video stream.
3846
- *
3847
- * @returns The current `Resolution` of the video stream.
3848
- */
3849
- getResolution(): Resolution;
3850
- /**
3851
- * Retrieves a list of available resolutions supported by the currently selected camera.
3852
- *
3853
- * - The returned resolutions are limited to these values "160 by 120", "320 by 240", "480 by 360", "640 by 480", "800 by 600", "960 by 720", "1280 by 720", "1920 by 1080", "2560 by 1440", "3840 by 2160".
3854
- * - The SDK tests all these resolutions to find out which ones are supported. As a result, the method may be time-consuming.
3855
- *
3856
- * @returns A promise that resolves with an array of `Resolution` objects representing each supported resolution.
3857
- */
3858
- getAvailableResolutions(): Promise<Array<Resolution>>;
3859
- /**
3860
- * 'on()' is the wrapper of '_on()'.
3861
- * @param event includes
3862
- * @param listener
3863
- * @ignore
3864
- */
3865
- private _on;
3866
- /**
3867
- * 'off()' is the wrapper of '_off()'.
3868
- * @param event
3869
- * @param listener
3870
- * @ignore
3871
- */
3872
- private _off;
3873
- /**
3874
- * Registers an event listener for specific camera-related events.
3875
- * This method allows you to respond to various changes and states in the camera lifecycle.
3876
- * @param eventName The name of the event to listen for. Possible values include "cameraOpen", "cameraClose", "cameraChange", "resolutionChange", "played", "singleFrameAcquired", and "frameAddedToBuffer".
3877
- * @param listener The callback function to be invoked when the event occurs.
3878
- */
3879
- on(eventName: "cameraOpen" | "cameraClose" | "cameraChange" | "resolutionChange" | "played" | "singleFrameAcquired" | "frameAddedToBuffer", listener: Function): void;
3880
- /**
3881
- * Removes an event listener previously registered with the `on` method.
3882
- * @param eventName The name of the event for which to remove the listener.
3883
- * @param listener The callback function that was originally registered for the event.
3884
- */
3885
- off(eventName: "cameraOpen" | "cameraClose" | "cameraChange" | "resolutionChange" | "played" | "singleFrameAcquired" | "frameAddedToBuffer", listener: Function): void;
3886
- /**
3887
- * Retrieves the current video settings applied to the camera stream.
3888
- *
3889
- * @returns The current `MediaStreamConstraints` object representing the video stream's settings.
3890
- */
3891
- getVideoSettings(): MediaStreamConstraints;
3892
- /**
3893
- * Updates the video settings for the camera stream with new constraints.
3894
- * @param constraints The new `MediaStreamConstraints` to apply to the video stream.
3895
- *
3896
- * @returns A promise that resolves when the new `MediaStreamConstraints` is applied. It does not provide any value upon resolution.
3897
- */
3898
- updateVideoSettings(mediaStreamConstraints: MediaStreamConstraints): Promise<void>;
3899
- /**
3900
- * Gets the capabilities of the current camera.
3901
- *
3902
- * At present, this method only works in Edge, Safari, Chrome and other Chromium-based browsers (Firefox is not supported). Also, it should be called when a camera is open.
3903
- * @returns A `MediaTrackCapabilities` object representing the capabilities of the camera's video track.
3904
- */
3905
- getCapabilities(): MediaTrackCapabilities;
3906
- /**
3907
- * Retrieves the current settings of the camera.
3908
- *
3909
- * @returns The `MediaTrackSettings` object representing the current settings of the camera's video track.
3910
- */
3911
- getCameraSettings(): MediaTrackSettings;
3912
- /**
3913
- * Turns on the camera's torch (flashlight) mode, if supported.
3914
- * This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported.
3915
- * @returns A promise that resolves when the torch has been successfully turned on. It does not provide any value upon resolution.
3916
- */
3917
- turnOnTorch(): Promise<void>;
3918
- /**
3919
- * Turns off the camera's torch (flashlight) mode.
3920
- * This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported.
3921
- *
3922
- * @returns A promise that resolves when the torch has been successfully turned off. It does not provide any value upon resolution.
3923
- */
3924
- turnOffTorch(): Promise<void>;
3925
- _taskid4AutoTorch: any;
3926
- _delay4AutoTorch: number;
3927
- grayThreshold4AutoTorch: number;
3928
- maxDarkCount4AutoTroch: number;
3929
- turnAutoTorch(delay?: number): Promise<void>;
3930
- /**
3931
- * Sets the color temperature of the camera's video feed.
3932
- * This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported.
3933
- * @param colorTemperature The desired color temperature in Kelvin.
3934
- *
3935
- * @returns A promise that resolves when the color temperature has been successfully set. It does not provide any value upon resolution.
3936
- */
3937
- setColorTemperature(value: number): Promise<void>;
3938
- /**
3939
- * Retrieves the current color temperature setting of the camera's video feed.
3940
- *
3941
- * This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported.
3942
- *
3943
- * @returns The current color temperature in Kelvin.
3944
- */
3945
- getColorTemperature(): number;
3946
- /**
3947
- * Sets the exposure compensation of the camera's video feed.
3948
- * This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported.
3949
- * @param exposureCompensation The desired exposure compensation value.
3950
- *
3951
- * @returns A promise that resolves when the exposure compensation has been successfully set. It does not provide any value upon resolution.
3952
- */
3953
- setExposureCompensation(value: number): Promise<void>;
3954
- /**
3955
- * Retrieves the current exposure compensation setting of the camera's video feed.
3956
- * This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported.
3957
- *
3958
- * @returns The current exposure compensation value.
3959
- */
3960
- getExposureCompensation(): number;
3961
- /**
3962
- * 'setZoom()' is the wrapper of '_setZoom()'. '_setZoom()' can set the zoom center, which is not tested and there are no plans to make it open to clients.
3963
- * @ignore
3964
- */
3965
- private _setZoom;
3966
- /**
3967
- * Sets the zoom level of the camera.
3968
- *
3969
- * - How it works:
3970
- * 1. If the camera supports zooming and the zoom factor is within its supported range, zooming is done directly by the camera.
3971
- * 2. If the camera does not support zooming, software-based magnification is used instead.
3972
- * 3. If the camera supports zooming but the zoom factor is beyond what it supports, the camera's maximum zoom is used, and software-based magnification is used to do the rest. (In this case, you may see a brief video flicker between the two zooming processes).
3973
- * @param settings An object containing the zoom settings.
3974
- * @param settings.factor: A number specifying the zoom level. At present, it is the only available setting.
3975
- *
3976
- * @returns A promise that resolves when the zoom level has been successfully set. It does not provide any value upon resolution.
3977
- */
3978
- setZoom(settings: {
3979
- factor: number;
3980
- }): Promise<void>;
3981
- /**
3982
- * Retrieves the current zoom settings of the camera.
3983
- *
3984
- * @returns An object containing the current zoom settings. As present, it contains only the zoom factor.
3985
- */
3986
- getZoomSettings(): {
3987
- factor: number;
3988
- };
3989
- /**
3990
- * Resets the zoom level of the camera to its default value.
3991
- *
3992
- * @returns A promise that resolves when the zoom level has been successfully reset. It does not provide any value upon resolution.
3993
- */
3994
- resetZoom(): Promise<void>;
3995
- /**
3996
- * Sets the frame rate of the camera's video stream.
3997
- * - At present, this method only works in Edge, Safari, Chrome and other Chromium-based browsers (Firefox is not supported). Also, it should be called when a camera is open.
3998
- * - If you provide a value that exceeds the camera's capabilities, we will automatically adjust it to the maximum value that can be applied.
3999
- *
4000
- * @param rate The desired frame rate in frames per second (fps).
4001
- *
4002
- * @returns A promise that resolves when the frame rate has been successfully set. It does not provide any value upon resolution.
4003
- */
4004
- setFrameRate(value: number): Promise<void>;
4005
- /**
4006
- * Retrieves the current frame rate of the camera's video stream.
4007
- *
4008
- * @returns The current frame rate in frames per second (fps).
4009
- */
4010
- getFrameRate(): number;
4011
- /**
4012
- * Sets the focus mode of the camera. This method allows for both manual and continuous focus configurations, as well as specifying a focus area.
4013
- * - This method should be called when the camera is turned on. Note that it only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported.
4014
- * - Typically, `continuous` mode works best. `manual` mode based on a specific area helps the camera focus on that particular area which may seem blurry under `continuous` mode. `manual` mode with specified distances is for those rare cases where the camera distance must be fine-tuned to get the best results.
4015
- * @param settings An object describing the focus settings. The structure of this object varies depending on the mode specified (`continuous`, `manual` with fixed `distance`, or `manual` with specific `area`).
4016
- *
4017
- * @returns A promise that resolves when the focus settings have been successfully applied. It does not provide any value upon resolution.
4018
- */
4019
- setFocus(settings: {
4020
- mode: string;
4021
- } | {
4022
- mode: "manual";
4023
- distance: number;
4024
- } | {
4025
- mode: "manual";
4026
- area: {
4027
- centerPoint: {
4028
- x: string;
4029
- y: string;
4030
- };
4031
- width?: string;
4032
- height?: string;
4033
- };
4034
- }): Promise<void>;
4035
- /**
4036
- * Retrieves the current focus settings of the camera.
4037
- *
4038
- * @returns An object representing the current focus settings or null.
4039
- */
4040
- getFocusSettings(): Object;
4041
- /**
4042
- * Sets the auto zoom range for the camera.
4043
- * `EF_AUTO_ZOOM` is one of the enhanced features that require a license, and is only effective when used in conjunction with other functional products of Dynamsoft.
4044
- * This method allows for specifying the minimum and maximum zoom levels that the camera can automatically adjust to.
4045
- *
4046
- * @param range An object specifying the minimum and maximum zoom levels. Both `min` and `max` should be positive numbers, with `min` less than or equal to `max`. The default is `{min: 1, max: 999}`.
4047
- */
4048
- setAutoZoomRange(range: {
4049
- min: number;
4050
- max: number;
4051
- }): void;
4052
- /**
4053
- * Retrieves the current auto zoom range settings for the camera.
4054
- * `EF_AUTO_ZOOM` is one of the enhanced features that require a license, and is only effective when used in conjunction with other functional products of Dynamsoft.
4055
- *
4056
- * @returns An object representing the current auto zoom range, including the minimum and maximum zoom levels.
4057
- */
4058
- getAutoZoomRange(): {
4059
- min: number;
4060
- max: number;
4061
- };
4062
- /**
4063
- * Enables one or more enhanced features.
4064
- * This method allows for activating specific advanced capabilities that may be available.
4065
- *
4066
- * - The enhanced features require a license, and only take effect when used in conjunction with other functional products under the Dynamsoft Capture Vision(DCV)architecture.
4067
- * - `EF_ENHANCED_FOCUS` and `EF_TAP_TO_FOCUS` only works with Chromium-based browsers such as Edge and Chrome on Windows or Android. Other browsers such as Firefox or Safari are not supported. Note that all browsers on iOS (including Chrome) use WebKit as the rendering engine and are not supported.
4068
- * @param enhancedFeatures An enum value or a bitwise combination of `EnumEnhancedFeatures` indicating the features to be enabled.
4069
- */
4070
- enableEnhancedFeatures(enhancedFeatures: EnumEnhancedFeatures): void;
4071
- /**
4072
- * Disables one or more previously enabled enhanced features.
4073
- * This method can be used to deactivate specific features that are no longer needed or to revert to default behavior.
4074
- *
4075
- * @param enhancedFeatures An enum value or a bitwise combination of `EnumEnhancedFeatures` indicating the features to be disabled.
4076
- */
4077
- disableEnhancedFeatures(enhancedFeatures: EnumEnhancedFeatures): void;
4078
- /**
4079
- * Differ from 'setScanRegion()', 'setScanRegion()' will update the UI in camera view, while '_setScanRegion()' not.
4080
- * @param region
4081
- * @ignore
4082
- */
4083
- private _setScanRegion;
4084
- /**
4085
- * Sets the scan region within the camera's view which limits the frame acquisition to a specific area of the video feed.
4086
- *
4087
- * Note: The region is always specified relative to the original video size, regardless of any transformations or zoom applied to the video display.
4088
- *
4089
- * @param region Specifies the scan region.
4090
- */
4091
- setScanRegion(region: DSRect | Rect): void;
4092
- /**
4093
- * Retrieves the current scan region set within the camera's view.
4094
- *
4095
- * Note: If no scan region has been explicitly set before calling this method, an error may be thrown, indicating the necessity to define a scan region beforehand.
4096
- *
4097
- * @returns A `DSRect` or `Rect` object representing the current scan region.
4098
- *
4099
- * @throws Error indicating that no scan region has been set, if applicable.
4100
- */
4101
- getScanRegion(): DSRect | Rect;
4102
- /**
4103
- * Sets an error listener to receive notifications about errors that occur during image source operations.
4104
- *
4105
- * @param listener An instance of `ImageSourceErrorListener` or its derived class to handle error notifications.
4106
- */
4107
- setErrorListener(listener: ImageSourceErrorListener): void;
4108
- /**
4109
- * Determines whether there are more images available to fetch.
4110
- *
4111
- * @returns Boolean indicating whether more images can be fetched. `false` means the image source is closed or exhausted.
4112
- */
4113
- hasNextImageToFetch(): boolean;
4114
- /**
4115
- * Starts the process of fetching images.
4116
- */
4117
- startFetching(): void;
4118
- /**
4119
- * Stops the process of fetching images.
4120
- * to false, indicating that image fetching has been halted.
4121
- */
4122
- stopFetching(): void;
4123
- /**
4124
- * Toggles the mirroring of the camera's video stream.
4125
- * This method flips the video stream horizontally when enabled, creating a mirror effect.
4126
- * It is useful for applications using the front-facing camera where a mirrored view is more intuitive for users.
4127
- *
4128
- * @param enable - If true, enables the mirroring; if false, disables the mirroring.
4129
- */
4130
- toggleMirroring(enable: boolean): void;
4131
- /**
4132
- * Fetches the current frame from the camera's video feed.
4133
- * This method is used to obtain the latest image captured by the camera.
4134
- *
4135
- * @returns A `DCEFrame` object representing the current frame.
4136
- * The structure and content of this object will depend on the pixel format set by `setPixelFormat()` and other settings.
4137
- */
4138
- fetchImage(isUserCall?: boolean): DCEFrame;
4139
- /**
4140
- * Sets the interval at which images are continuously fetched from the camera's video feed.
4141
- * This method allows for controlling how frequently new frames are obtained when `startFetching()` is invoked,
4142
- * which can be useful for reducing computational load or for pacing the frame processing rate.
4143
- *
4144
- * @param interval The desired interval between fetches, specified in milliseconds.
4145
- */
4146
- setImageFetchInterval(interval: number): void;
4147
- /**
4148
- * Retrieves the current interval at which images are continuously fetched from the camera's video feed.
4149
- *
4150
- * @returns The current fetch interval, specified in milliseconds.
4151
- */
4152
- getImageFetchInterval(): number;
4153
- /**
4154
- * Sets the pixel format for the images fetched from the camera, which determines the format of the images added to the buffer when the `fetchImage()` or `startFetching()` method is called.
4155
- * It can affect both the performance of image processing tasks and the compatibility with certain analysis algorithms.
4156
- *
4157
- * @param pixelFormat The desired pixel format for the images. Supported formats include `IPF_GRAYSCALED`, `IPF_ABGR_8888`.
4158
- */
4159
- setPixelFormat(format: EnumImagePixelFormat.IPF_GRAYSCALED | EnumImagePixelFormat.IPF_ABGR_8888): void;
4160
- /**
4161
- * Retrieves the current pixel format used for images fetched from the camera.
4162
- *
4163
- * @returns The current pixel format, which could be one of the following: `IPF_GRAYSCALED`, `IPF_ABGR_8888`, and `IPF_ARGB_8888`.
4164
- */
4165
- getPixelFormat(): EnumImagePixelFormat;
4166
- /**
4167
- * Initiates a sequence to capture a single frame from the camera, only valid when the camera was open. halting the video stream temporarily.
4168
- * This method prompts the user to either select a local image or capture a new one using the system camera, similar to the behavior in `singleFrameMode` but without changing the mode.
4169
- *
4170
- * Note: This method is intended for use cases where capturing a single, user-obtained image is necessary while the application is otherwise utilizing a live video stream.
4171
- *
4172
- * Steps performed by `takePhoto`:
4173
- * 1. Stops the video stream and releases the camera, if it was in use.
4174
- * 2. Prompts the user to take a new image with the system camera (on desktop, it prompts the user to select an image from the disk). This behavior mirrors that of `singleFrameMode[=="camera"]`
4175
- * 3. Returns the obtained image in a callback function, this differs from `singleFrameMode` which would display the image in the view.
4176
- * NOTE: user should resume the video stream after the image has been obtained to keep the video stream going.
4177
- * @param listener A callback function that is invoked with a `DCEFrame` object containing the obtained image.
4178
- */
4179
- takePhoto(listener: (dceFrame: DCEFrame) => void): void;
4180
- /**
4181
- * Converts coordinates from the video's coordinate system to coordinates relative to the whole page.
4182
- * This is useful for overlaying HTML elements on top of specific points in the video, aligning with the page's layout.
4183
- *
4184
- * @param point A `Point` object representing the x and y coordinates within the video's coordinate system.
4185
- *
4186
- * @returns A `Point` object representing the converted x and y coordinates relative to the page.
4187
- */
4188
- convertToPageCoordinates(point: Point): Point;
4189
- /**
4190
- * Converts coordinates from the video's coordinate system to coordinates relative to the viewport.
4191
- * This is useful for positioning HTML elements in relation to the video element on the screen, regardless of page scrolling.
4192
- *
4193
- * @param point A `Point` object representing the x and y coordinates within the video's coordinate system.
4194
- *
4195
- * @returns A `Point` object representing the converted x and y coordinates relative to the viewport.
4196
- */
4197
- convertToClientCoordinates(point: Point): Point;
4198
- /**
4199
- * Converts coordinates from the video's coordinate system to coordinates relative to the viewport.
4200
- * This is useful for positioning HTML elements in relation to the video element on the screen, regardless of page scrolling.
4201
- *
4202
- * @param point A `Point` object representing the x and y coordinates within the video's coordinate system.
4203
- *
4204
- * @returns A `Point` object representing the converted x and y coordinates relative to the viewport.
4205
- */
4206
- convertToScanRegionCoordinates(point: Point): Point;
4207
- /**
4208
- * Converts coordinates from the video's coordinate system under `fit: cover` mode
4209
- * back to coordinates under `fit: contain` mode.
4210
- * This is useful when you need to map points detected in a cropped/resized video (cover)
4211
- * back to the original video dimensions (contain).
4212
- *
4213
- * @param point A `Point` object representing the x and y coordinates within the video's `cover` coordinate system.
4214
- *
4215
- * @returns A `Point` object representing the converted x and y coordinates under `contain` mode.
4216
- */
4217
- convertToContainCoordinates(point: Point): Point;
4218
- /**
4219
- * Releases all resources used by the `CameraEnhancer` instance.
4220
- */
4221
- dispose(): void;
4222
- }
4223
-
4224
- declare class CameraView extends View {
4225
- #private;
4226
- /**
4227
- * @ignore
4228
- */
4229
- static _onLog: (message: any) => void;
4230
- private static get engineResourcePath();
4231
- private static _defaultUIElementURL;
4232
- /**
4233
- * Specifies the URL to a default UI definition file.
4234
- * This URL is used as a fallback source for the UI of the `CameraView` class when the `createInstance()` method is invoked without specifying a `HTMLDivElement`.
4235
- * This ensures that `CameraView` has a user interface even when no custom UI is provided.
4236
- */
4237
- static set defaultUIElementURL(value: string);
4238
- static get defaultUIElementURL(): string;
4239
- /**
4240
- * Initializes a new instance of the `CameraView` class.
4241
- * This method allows for optional customization of the user interface (UI) through a specified HTML element or an HTML file.
4242
- */
4243
- static createInstance(elementOrUrl?: HTMLElement | string): Promise<CameraView>;
4244
- /**
4245
- * Transform the coordinates from related to scan region to related to the whole video/image.
4246
- * @param coord The coordinates related to scan region.
4247
- * @param sx The x coordinate of scan region related to the whole video/image.
4248
- * @param sy The y coordinate of scan region related to the whole video/image.
4249
- * @param sWidth The width of scan region.
4250
- * @param sHeight The height of scan region.
4251
- * @param dWidth The width of cropped image. Its value is different from `sWidth` when the image is compressed.
4252
- * @param dHeight The height of cropped image. Its value is different from `sHeight` when the image is compressed.
4253
- * @ignore
4254
- */
4255
- static _transformCoordinates(coord: {
4256
- x: number;
4257
- y: number;
4258
- }, sx: number, sy: number, sWidth: number, sHeight: number, dWidth: number, dHeight: number): void;
4259
- cameraEnhancer: CameraEnhancer;
4260
- /**
4261
- * @ignore
4262
- */
4263
- eventHandler: EventHandler;
4264
- private UIElement;
4265
- private _poweredByVisible;
4266
- /**
4267
- * @ignore
4268
- */
4269
- containerClassName: string;
4270
- _videoContainer: HTMLDivElement;
4271
- private videoFit;
4272
- /** @ignore */
4273
- _hideDefaultSelection: boolean;
4274
- /** @ignore */
4275
- _divScanArea: any;
4276
- /** @ignore */
4277
- _divScanLight: any;
4278
- /** @ignore */
4279
- _bgLoading: any;
4280
- /** @ignore */
4281
- _selCam: any;
4282
- /** @ignore */
4283
- _bgCamera: any;
4284
- /** @ignore */
4285
- _selRsl: any;
4286
- /** @ignore */
4287
- _optGotRsl: any;
4288
- /** @ignore */
4289
- _btnClose: any;
4290
- /** @ignore */
4291
- _selMinLtr: any;
4292
- /** @ignore */
4293
- _optGotMinLtr: any;
4294
- /** @ignore */
4295
- _poweredBy: any;
4296
- /** @ignore */
4297
- _cvsSingleFrameMode: HTMLCanvasElement;
4298
- private scanRegion;
4299
- private _drawingLayerOfMask;
4300
- private _maskBackRectStyleId;
4301
- private _maskCenterRectStyleId;
4302
- private regionMaskFillStyle;
4303
- private regionMaskStrokeStyle;
4304
- private regionMaskLineWidth;
4305
- /**
4306
- * @ignore
4307
- */
4308
- _userSetMaskVisible: boolean;
4309
- /**
4310
- * @ignore
4311
- */
4312
- _userSetLaserVisible: boolean;
4313
- private _updateLayersTimeoutId;
4314
- private _updateLayersTimeout;
4315
- /**
4316
- * Trigger when the css dimensions of the container of video element changed, or window changed.
4317
- */
4318
- private _videoResizeListener;
4319
- private _windowResizeListener;
4320
- private _resizeObserver;
4321
- /**
4322
- * @ignore
4323
- */
4324
- set _singleFrameMode(value: "disabled" | "camera" | "image");
4325
- get _singleFrameMode(): "disabled" | "camera" | "image";
4326
- _onSingleFrameAcquired: (canvas: HTMLCanvasElement) => void;
4327
- private _singleFrameInputContainer;
4328
- _clickIptSingleFrameMode: () => void;
4329
- _capturedResultReceiver: any;
4330
- /**
4331
- * Returns whether the `CameraView` instance has been disposed of.
4332
- *
4333
- * @returns Boolean indicating whether the `CameraView` instance has been disposed of.
4334
- */
4335
- get disposed(): boolean;
4336
- private constructor();
4337
- /**
4338
- * Differ from 'setUIElement()', 'setUIElement()' allow parameter of 'string' type, which means a url, '_setUIElement()' only accept parameter of 'HTMLElement' type.
4339
- * @param element
4340
- */
4341
- private _setUIElement;
4342
- setUIElement(elementOrUrl: HTMLElement | string): Promise<void>;
4343
- getUIElement(): HTMLElement;
4344
- private _bindUI;
4345
- private _unbindUI;
4346
- /**
4347
- * Show loading animation.
4348
- * @ignore
4349
- */
4350
- _startLoading(): void;
4351
- /**
4352
- * Hide loading animation.
4353
- * @ignore
4354
- */
4355
- _stopLoading(): void;
4356
- /**
4357
- * Render cameras info in camera selection in default UI.
4358
- * @ignore
4359
- */
4360
- _renderCamerasInfo(curCamera: {
4361
- deviceId: string;
4362
- label: string;
4363
- }, cameraList: Array<{
4364
- deviceId: string;
4365
- label: string;
4366
- }>): void;
4367
- /**
4368
- * Render resolution list in resolution selection in default UI.
4369
- * @ignore
4370
- */
4371
- _renderResolutionInfo(curResolution: {
4372
- width: number;
4373
- height: number;
4374
- }): void;
4375
- /**
4376
- * Retrieves the `HTMLVideoElement` that is currently being used for displaying the video in this `CameraView` instance.
4377
- * This method allows access to the underlying video element, enabling direct interaction or further customization.
4378
- *
4379
- * @returns The `HTMLVideoElement` currently used by this `CameraView` instance for video display.
4380
- */
4381
- getVideoElement(): HTMLVideoElement;
4382
- /**
4383
- * tell if video is loaded.
4384
- * @ignore
4385
- */
4386
- isVideoLoaded(): boolean;
4387
- /**
4388
- * Sets the `object-fit` CSS property of the `HTMLVideoElement` used by this `CameraView` instance.
4389
- * The `object-fit` property specifies how the video content should be resized to fit the container in a way that maintains its aspect ratio.
4390
- * @param objectFit The value for the `object-fit` property. At present, only "cover" and "contain" are allowed and the default is "contain".
4391
- * Check out more on [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit).
4392
- */
4393
- setVideoFit(value: "contain" | "cover"): void;
4394
- /**
4395
- * Retrieves the current value of the `object-fit` CSS property from the `HTMLVideoElement` used by this `CameraView` instance.
4396
- * The `object-fit` property determines how the video content is resized to fit its container.
4397
- *
4398
- * @returns The current value of the `object-fit` property applied to the video element. At present, the value is limited to "cover" and "contain".
4399
- * Check out more on [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit).
4400
- */
4401
- getVideoFit(): "contain" | "cover";
4402
- /**
4403
- * Get dimensions of content(video, or image in single frame mode). It decides what dimensions the layers should be created.
4404
- * @returns
4405
- */
4406
- protected getContentDimensions(): {
4407
- width: number;
4408
- height: number;
4409
- objectFit: string;
4410
- };
4411
- /**
4412
- * Update prop '#convertedRegion' and update related UI.
4413
- * @param contentDimensions
4414
- * @ignore
4415
- */
4416
- private updateConvertedRegion;
4417
- /**
4418
- * @ignore
4419
- */
4420
- getConvertedRegion(): {
4421
- x: number;
4422
- y: number;
4423
- width: number;
4424
- height: number;
4425
- };
4426
- /**
4427
- * @ignore
4428
- */
4429
- setScanRegion(region: DSRect | Rect): void;
4430
- /**
4431
- * @ignore
4432
- */
4433
- getScanRegion(): any;
4434
- /**
4435
- * Returns the region of the video that is currently visible to the user.
4436
- * @param options [Optional] Specifies how the visible region should be returned.
4437
- * @param options.inPixels [Optional] If `true`, the coordinates of the visible region are returned in pixels. If `false` or omitted, the coordinates are returned as a percentage of the video element's size.
4438
- *
4439
- * @returns An object representing the visible region of the video.
4440
- */
4441
- getVisibleRegionOfVideo(options: {
4442
- inPixels?: boolean;
4443
- }): Rect;
4444
- private setScanRegionMask;
4445
- private clearScanRegionMask;
4446
- /**
4447
- * Not used yet.
4448
- * @ignore
4449
- */
4450
- private deleteScanRegionMask;
4451
- /**
4452
- *
4453
- * @param visible
4454
- * @ignore
4455
- */
4456
- _setScanRegionMaskVisible(visible: boolean): void;
4457
- /**
4458
- * Sets the visibility of the scan region mask. This can be used to show or hide the mask.
4459
- * @param visible Boolean indicating whether the scan region mask should be visible (`true`) or not (`false`).
4460
- */
4461
- setScanRegionMaskVisible(visible: boolean): void;
4462
- /**
4463
- * Checks if the scan region mask is currently visible.
4464
- *
4465
- * @returns Boolean indicating whether the scan region mask is visible (`true`) or not (`false`).
4466
- */
4467
- isScanRegionMaskVisible(): boolean;
4468
- /**
4469
- * Sets the style of the scan region mask. This style includes the line width, stroke color, and fill color.
4470
- * @param style An object containing the new style settings for the scan region mask.
4471
- * @param style.lineWidth The width of the line used to draw the border of the scan region mask.
4472
- * @param style.strokeStyle The color of the stroke (border) of the scan region mask.
4473
- * @param style.fillStyle The fill color of the scan region mask.
4474
- */
4475
- setScanRegionMaskStyle(style: {
4476
- lineWidth: number;
4477
- strokeStyle: string;
4478
- fillStyle: string;
4479
- }): void;
4480
- /**
4481
- * Retrieves the current style of the scan region mask. This includes the line width, stroke color, and fill color.
4482
- */
4483
- getScanRegionMaskStyle(): {
4484
- fillStyle: string;
4485
- strokeStyle: string;
4486
- lineWidth: number;
4487
- };
4488
- /**
4489
- * @ignore
4490
- */
4491
- private _setScanLaserVisible;
4492
- /**
4493
- * Sets the visibility of the scan laser effect. This can be used to show or hide the scan laser.
4494
- * @param visible Boolean indicating whether the scan laser should be visible (`true`) or not (`false`).
4495
- */
4496
- setScanLaserVisible(visible: boolean): void;
4497
- /**
4498
- * Checks if the scan laser effect is currently visible.
4499
- *
4500
- * @returns Boolean indicating whether the scan laser is visible (`true`) or not (`false`).
4501
- */
4502
- isScanLaserVisible(): boolean;
4503
- /**
4504
- * @ignore
4505
- */
4506
- _updateVideoContainer(): void;
4507
- /**
4508
- * Sets the visibility of the `power by Dynamsoft` message. This can be used to show or hide the message.
4509
- * @param visible Boolean indicating whether the message should be visible (`true`) or not (`false`).
4510
- */
4511
- setPowerByMessageVisible(visible: boolean): void;
4512
- /**
4513
- * Checks if the `power by Dynamsoft` message is currently visible.
4514
- *
4515
- * @returns Boolean indicating whether the message is visible (`true`) or not (`false`).
4516
- */
4517
- isPowerByMessageVisible(): boolean;
4518
- /**
4519
- * Update all layers(scan laser, drawing layers, scan region mask). Not used yet.
4520
- * @ignore
4521
- */
4522
- private updateLayers;
4523
- /**
4524
- * Clears all system-defined `DrawingItem` objects while keeping user-defined ones.
4525
- */
4526
- clearAllInnerDrawingItems(): void;
4527
- /**
4528
- * Remove added elements. Remove event listeners.
4529
- */
4530
- dispose(): void;
4531
- }
4532
-
4533
- declare class ImageEditorView extends View {
4534
- #private;
4535
- static createInstance(elementOrUrl?: HTMLElement | string): Promise<ImageEditorView>;
4536
- private UIElement;
4537
- /**
4538
- * @ignore
4539
- */
4540
- containerClassName: string;
4541
- /**
4542
- * Control if enable magnifier function.
4543
- * @ignore
4544
- */
4545
- private isUseMagnifier;
4546
- /**
4547
- * Returns whether the `ImageEditorView` instance has been disposed of.
4548
- *
4549
- * @returns Boolean indicating whether the `ImageEditorView` instance has been disposed of.
4550
- */
4551
- get disposed(): boolean;
4552
- private constructor();
4553
- /**
4554
- * Differ from 'setUIElement()', 'setUIElement()' allow parameter of 'string' type, which means a url, '_setUIElement()' only accept parameter of 'HTMLElement' type.
4555
- * @param element
4556
- */
4557
- private _setUIElement;
4558
- setUIElement(elementOrUrl: HTMLElement | string): Promise<void>;
4559
- getUIElement(): HTMLElement;
4560
- private _bindUI;
4561
- private _unbindUI;
4562
- /**
4563
- * Draw image in inner canvas.
4564
- * @ignore
4565
- */
4566
- private setImage;
4567
- /**
4568
- * Not used yet.
4569
- * @ignore
4570
- */
4571
- private getImage;
4572
- /**
4573
- * Not used yet.
4574
- * @ignore
4575
- */
4576
- private clearImage;
4577
- /**
4578
- * Not used yet.
4579
- * @ignore
4580
- */
4581
- private removeImage;
4582
- /**
4583
- * Sets the image to be drawn on the `ImageEditorView`.
4584
- * This method allows for the initialization or updating of the image.
4585
- * @param image The image to be drawn on the `ImageEditorView`.
4586
- */
4587
- setOriginalImage(img: DSImageData | HTMLCanvasElement | HTMLImageElement): void;
4588
- /**
4589
- * Returns the current image drawn on the `ImageEditorView`.
4590
- *
4591
- * @returns The current image drawn on the `ImageEditorView`. The returned type will match the format of the image originally set via `setOriginalImage()`.
4592
- */
4593
- getOriginalImage(): DSImageData | HTMLCanvasElement | HTMLImageElement;
4594
- /**
4595
- * Get dimensions of content(that is, the image). It decides what dimensions the layers should be created.
4596
- * @returns
4597
- */
4598
- protected getContentDimensions(): {
4599
- width: number;
4600
- height: number;
4601
- objectFit: string;
4602
- };
4603
- /**
4604
- * Create drawing layer with specified id and size.
4605
- * Differ from 'createDrawingLayer()', the drawing layers created'createDrawingLayer()' can not Specified id, and their size is the same as video.
4606
- * @ignore
4607
- */
4608
- _createDrawingLayer(drawingLayerId: number, width?: number, height?: number, objectFit?: string): DrawingLayer;
4609
- /**
4610
- * Releases all resources used by the `ImageEditorView` instance.
4611
- */
4612
- dispose(): void;
4613
- }
4614
-
4615
- declare class Feedback {
4616
- #private;
4617
- static allowBeep: boolean;
4618
- /** Returns or sets the beep's sound source. */
4619
- static beepSoundSource: string;
4620
- /** Initiates a beep sound upon invocation. */
4621
- static beep(): void;
4622
- static allowVibrate: boolean;
4623
- /** Determines the vibration's duration in milliseconds. */
4624
- static vibrateDuration: number;
4625
- /** Activates device vibration upon invocation. */
4626
- static vibrate(): void;
4627
- }
4628
-
4629
- declare class DrawingStyleManager {
4630
- #private;
4631
- static STYLE_BLUE_STROKE: number;
4632
- static STYLE_GREEN_STROKE: number;
4633
- static STYLE_ORANGE_STROKE: number;
4634
- static STYLE_YELLOW_STROKE: number;
4635
- static STYLE_BLUE_STROKE_FILL: number;
4636
- static STYLE_GREEN_STROKE_FILL: number;
4637
- static STYLE_ORANGE_STROKE_FILL: number;
4638
- static STYLE_YELLOW_STROKE_FILL: number;
4639
- static STYLE_BLUE_STROKE_TRANSPARENT: number;
4640
- static STYLE_GREEN_STROKE_TRANSPARENT: number;
4641
- static STYLE_ORANGE_STROKE_TRANSPARENT: number;
4642
- static USER_START_STYLE_ID: number;
4643
- /**
4644
- * Generates a new `DrawingStyle` object, providing its unique ID.
4645
- * The ID starts from 1024 and increases in a sequential order.
4646
- * @param styleDefinition The properties and values defining the drawing style.
4647
- *
4648
- * @returns The unique ID of the newly created DrawingStyle object.
4649
- */
4650
- static createDrawingStyle(styleDefinition: DrawingStyle): number;
4651
- private static _getDrawingStyle;
4652
- /**
4653
- * Retrieves a specific `DrawingStyle` object using its ID.
4654
- * @param styleId The unique ID of the `DrawingStyle` to retrieve.
4655
- *
4656
- * @returns The `DrawingStyle` object associated with the given ID.
4657
- */
4658
- static getDrawingStyle(styleId: number): DrawingStyle;
4659
- /**
4660
- * Fetches a collection of all available `DrawingStyle` objects.
4661
- *
4662
- * @returns An array of `DrawingStyle` objects.
4663
- * [NOTE]: used to be called getDrawingStyles in v4.0.1
4664
- */
4665
- static getAllDrawingStyles(): Array<DrawingStyle>;
4666
- private static _updateDrawingStyle;
4667
- /**
4668
- * Modifies an identified `DrawingStyle` object by its ID.
4669
- * @param styleId The unique ID of the `DrawingStyle` to update.
4670
- * @param styleDefinition The new properties and values to update the drawing style with.
4671
- */
4672
- static updateDrawingStyle(styleId: number, styleDefinition: DrawingStyle): void;
4673
- }
4674
-
4675
- export { CameraEnhancer, CameraEnhancerModule, CameraManager, CameraView, DCEFrame, DrawingItem, DrawingItemEvent, DrawingLayer, DrawingStyle, DrawingStyleManager, EnumDrawingItemMediaType, EnumDrawingItemState, EnumEnhancedFeatures, Feedback, DT_Group as GroupDrawingItem, ImageDataGetter, DT_Image as ImageDrawingItem, ImageEditorView, DT_Line as LineDrawingItem, Note, PlayCallbackInfo, DT_Quad as QuadDrawingItem, DT_Rect as RectDrawingItem, Resolution, DT_Text as TextDrawingItem, TipConfig, VideoDeviceInfo, VideoFrameTag };
4676
-
4677
-
4678
- interface ParsedResultItem extends CapturedResultItem {
4679
- /**
4680
- * The code type of the parsed result.
4681
- */
4682
- codeType: string;
4683
- /**
4684
- * The parsed result represented as a JSON-formatted string.
4685
- */
4686
- jsonString: string;
4687
- /**
4688
- * Retrieves the value of a specified field.
4689
- * @param fieldName The name of the field whose value is being requested.
4690
- *
4691
- * @returns The value of the field.
4692
- */
4693
- getFieldValue(fieldName: string): string;
4694
- /**
4695
- * Retrieves the value of a specified field from the parsed result, without mapping process.
4696
- * @param fieldName The name of the field whose raw value is being requested.
4697
- *
4698
- * @returns The raw value of the field.
4699
- */
4700
- getFieldRawValue(fieldName: string): string;
4701
- /**
4702
- * Retrieves the mapping status for a specified field name.
4703
- * @param fieldName The name of the field whose mapping status is being queried.
4704
- *
4705
- * @returns The mapping status of the specified field as an EnumMappingStatus value.
4706
- */
4707
- getFieldMappingStatus: (fieldName: string) => EnumMappingStatus;
4708
- /**
4709
- * Retrieves the validation status for a specified field name.
4710
- * @param fieldName The name of the field whose validation status is being queried.
4711
- *
4712
- * @returns The validation status of the specified field as an EnumValidationStatus value.
4713
- */
4714
- getFieldValidationStatus: (fieldName: string) => EnumValidationStatus;
4715
- }
4716
-
4717
- declare class CodeParser {
4718
- private _instanceID;
4719
- /**
4720
- * Initializes a new instance of the `CodeParser` class.
4721
- *
4722
- * @returns A promise that resolves with the initialized `CodeParser` instance.
4723
- */
4724
- static createInstance(): Promise<CodeParser>;
4725
- /**
4726
- * Releases all resources used by the `CodeParser` instance.
4727
- *
4728
- * @returns A promise that resolves when the resources have been successfully released. It does not provide any value upon resolution.
4729
- */
4730
- dispose(): Promise<void>;
4731
- /**
4732
- * Returns whether the `CodeParser` instance has been disposed of.
4733
- *
4734
- * @returns Boolean indicating whether the `CodeParser` instance has been disposed of.
4735
- */
4736
- protected bDestroyed: boolean;
4737
- get disposed(): boolean;
4738
- /**
4739
- * Configures runtime settings using a provided JSON string.
4740
- * @param settings A JSON string that represents the content of the settings which contain at least one `CodeParserTaskSetting` object.
4741
- *
4742
- * @returns A promise that resolves when the operation has completed. It does not provide any value upon resolution.
4743
- */
4744
- initSettings(settings: string): Promise<ErrorInfo>;
2343
+ initSettings(settings: string): Promise<ErrorInfo>;
4745
2344
  /**
4746
2345
  * Restores all runtime settings to their original default values.
4747
2346
  *
@@ -4770,7 +2369,7 @@ declare class CodeParserModule {
4770
2369
  *
4771
2370
  * @returns A promise that resolves when the specification is loaded. It does not provide any value upon resolution.
4772
2371
  */
4773
- static loadSpec(specificationName: string | Array<string>, specificationPath?: string): Promise<void>;
2372
+ static loadSpec(specificationName: string | Array<string>, specificationPath?: string): Promise<ErrorInfo>;
4774
2373
  /**
4775
2374
  * An event that repeatedly fires during the loading of specification files.
4776
2375
  * @param filePath Returns the path of the specification file.
@@ -4813,6 +2412,21 @@ declare enum EnumValidationStatus {
4813
2412
  VS_FAILED = 2
4814
2413
  }
4815
2414
 
2415
+ declare enum EnumCodeType {
2416
+ CT_MRTD_TD1_ID = "MRTD_TD1_ID",
2417
+ CT_MRTD_TD2_ID = "MRTD_TD2_ID",
2418
+ CT_MRTD_TD2_VISA = "MRTD_TD2_VISA",
2419
+ CT_MRTD_TD3_PASSPORT = "MRTD_TD3_PASSPORT",
2420
+ CT_MRTD_TD3_VISA = "MRTD_TD3_VISA",
2421
+ CT_MRTD_TD2_FRENCH_ID = "MRTD_TD2_FRENCH_ID",
2422
+ CT_AAMVA_DL_ID = "AAMVA_DL_ID",
2423
+ CT_AAMVA_DL_ID_WITH_MAG_STRIPE = "AAMVA_DL_ID_WITH_MAG_STRIPE",
2424
+ CT_SOUTH_AFRICA_DL = "SOUTH_AFRICA_DL",
2425
+ CT_AADHAAR = "AADHAAR",
2426
+ CT_VIN = "VIN",
2427
+ CT_GS1_AI = "GS1_AI"
2428
+ }
2429
+
4816
2430
  interface ParsedResult extends CapturedResultBase {
4817
2431
  /**
4818
2432
  * An array of `ParsedResultItem` objects.
@@ -4820,7 +2434,7 @@ interface ParsedResult extends CapturedResultBase {
4820
2434
  parsedResultItems: Array<ParsedResultItem>;
4821
2435
  }
4822
2436
 
4823
- export { CodeParser, CodeParserModule, EnumMappingStatus, EnumValidationStatus, ParsedResult, ParsedResultItem };
2437
+ export { CodeParser, CodeParserModule, EnumCodeType, EnumMappingStatus, EnumValidationStatus, ParsedResult, ParsedResultItem };
4824
2438
 
4825
2439
 
4826
2440
  declare class DocumentNormalizerModule {
@@ -4847,8 +2461,8 @@ interface DetectedQuadResultItem extends CapturedResultItem {
4847
2461
  location: Quadrilateral;
4848
2462
  /** A confidence score related to the detected quadrilateral's accuracy as a document boundary. */
4849
2463
  confidenceAsDocumentBoundary: number;
4850
- /** Indicates whether the DetectedQuadResultItem has passed corss verification. */
4851
- CrossVerificationStatus: EnumCrossVerificationStatus;
2464
+ /** Indicates whether the DetectedQuadResultItem has passed cross verification. */
2465
+ crossVerificationStatus: EnumCrossVerificationStatus;
4852
2466
  }
4853
2467
 
4854
2468
  interface DeskewedImageResultItem extends CapturedResultItem {
@@ -4856,13 +2470,14 @@ interface DeskewedImageResultItem extends CapturedResultItem {
4856
2470
  imageData: DSImageData;
4857
2471
  /** The location where the deskewed image was extracted from within the input image image of the deskew section, represented as a quadrilateral. */
4858
2472
  sourceLocation: Quadrilateral;
2473
+ /** Indicates whether the DeskewedImageResultItem has passed cross verification. */
2474
+ crossVerificationStatus: EnumCrossVerificationStatus;
4859
2475
  toCanvas: () => HTMLCanvasElement;
4860
2476
  toImage: (MIMEType: "image/png" | "image/jpeg") => HTMLImageElement;
4861
2477
  toBlob: (MIMEType: "image/png" | "image/jpeg") => Promise<Blob>;
4862
2478
  }
4863
2479
 
4864
2480
  interface EnhancedImageElement extends RegionObjectElement {
4865
- /** The image data for the enhanced image. */
4866
2481
  imageData: DSImageData;
4867
2482
  }
4868
2483
 
@@ -4913,10 +2528,9 @@ interface LogicLinesUnit extends IntermediateResultUnit {
4913
2528
  }
4914
2529
 
4915
2530
  interface DeskewedImageElement extends RegionObjectElement {
4916
- /** The image data for the deskewed image. */
2531
+ /** A quadrilateral representing the four corners of the quadrilateral used to deskew the image. */
2532
+ sourceLocation: Quadrilateral;
4917
2533
  imageData: DSImageData;
4918
- /** A reference to another `RegionObjectElement`. */
4919
- referencedElement: RegionObjectElement;
4920
2534
  }
4921
2535
 
4922
2536
  interface DeskewedImageUnit extends IntermediateResultUnit {
@@ -5079,6 +2693,8 @@ interface LocalizedTextLineElement extends RegionObjectElement {
5079
2693
  interface LocalizedTextLinesUnit extends IntermediateResultUnit {
5080
2694
  /** An array of `LocalizedTextLineElement` objects, each representing a localized text line. */
5081
2695
  localizedTextLines: Array<LocalizedTextLineElement>;
2696
+ /** An array of `AuxiliaryRegionElement` objects, each representing an auxiliary region. */
2697
+ auxiliaryRegionElements: Array<AuxiliaryRegionElement>;
5082
2698
  }
5083
2699
 
5084
2700
  interface RecognizedTextLineElement extends RegionObjectElement {
@@ -5121,7 +2737,7 @@ interface BufferedCharacterItem {
5121
2737
  /** The buffered character value. */
5122
2738
  character: string;
5123
2739
  /** The image data of the buffered character. */
5124
- image: DSImageData;
2740
+ imageData: DSImageData;
5125
2741
  /** An array of features, each feature object contains feature id and value of the buffered character.*/
5126
2742
  features: Map<number, number>;
5127
2743
  }
@@ -5146,7 +2762,7 @@ interface BufferedCharacterItemSet {
5146
2762
  * - `TLS_RECOGNITION_FAILED`: Recognition failed.
5147
2763
  * - `TLS_RECOGNIZED_SUCCESSFULLY`: Successfully recognized.
5148
2764
  */
5149
- interface RawTextLine extends RegionObjectElement {
2765
+ interface RawTextLine {
5150
2766
  /** The recognized text of the line. */
5151
2767
  text: string;
5152
2768
  /** Confidence score for the recognized text line. */
@@ -5219,9 +2835,24 @@ declare class LicenseManager {
5219
2835
  * @returns A promise which, upon resolution, yields a string corresponding to the device's UUID.
5220
2836
  */
5221
2837
  static getDeviceUUID(): Promise<string>;
2838
+ static _e: boolean;
5222
2839
  }
5223
2840
 
5224
- export { LicenseManager, LicenseModule };
2841
+ interface InitConfig {
2842
+ pk: string;
2843
+ dm: string;
2844
+ bd?: boolean;
2845
+ trial?: boolean;
2846
+ msg?: string;
2847
+ mli?: any;
2848
+ om?: any;
2849
+ ic?: any;
2850
+ mlo?: any;
2851
+ pv?: any;
2852
+ }
2853
+
2854
+ export { InitConfig, LicenseManager, LicenseModule };
2855
+
5225
2856
 
5226
2857
 
5227
2858
 
@@ -5232,7 +2863,24 @@ declare class UtilityModule {
5232
2863
  static getVersion(): string;
5233
2864
  }
5234
2865
 
5235
- type resultItemTypesString = "barcode" | "text_line" | "detected_quad" | "deskewed_image" | "enhanced_image";
2866
+ type CEdge = [Point, Point];
2867
+ type CQuadrilateral = Quadrilateral & {
2868
+ area: number;
2869
+ };
2870
+ type CBarcodeResultItem = BarcodeResultItem & {
2871
+ location: CQuadrilateral;
2872
+ };
2873
+ interface CDecodedBarcodeElement extends DecodedBarcodeElement {
2874
+ location: CQuadrilateral;
2875
+ }
2876
+ interface CLocalizedBarcodeElement extends LocalizedBarcodeElement {
2877
+ location: CQuadrilateral;
2878
+ }
2879
+ type resultItemTypeString = "barcode" | "text_line" | "detected_quad" | "deskewed_image";
2880
+ type CrossVerificationCriteria = {
2881
+ frameWindow: number;
2882
+ minConsistentFrames: number;
2883
+ };
5236
2884
  type CapturedResultMap<T> = {
5237
2885
  [K in EnumCapturedResultItemType]?: T;
5238
2886
  };
@@ -5243,44 +2891,74 @@ declare class MultiFrameResultCrossFilter implements CapturedResultFilter {
5243
2891
  verificationEnabled: CapturedResultMap<boolean>;
5244
2892
  duplicateFilterEnabled: CapturedResultMap<boolean>;
5245
2893
  duplicateForgetTime: CapturedResultMap<number>;
2894
+ crossVerificationCriteria: CapturedResultMap<CrossVerificationCriteria>;
5246
2895
  private _dynamsoft;
5247
2896
  /**
5248
2897
  * Enables or disables the verification of one or multiple specific result item types.
5249
- * @param resultItemTypes Specifies one or multiple specific result item types, which can be defined using EnumCapturedResultItemType or a string. If using a string, only one type can be specified, and valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2898
+ * @param resultItemType Specifies one or multiple specific result item types, which can be defined using EnumCapturedResultItemType or a string. If using a string, only one type can be specified, and valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5250
2899
  * @param enabled Boolean to toggle verification on or off.
5251
2900
  */
5252
- enableResultCrossVerification(resultItemTypes: EnumCapturedResultItemType | resultItemTypesString, enabled: boolean): void;
2901
+ enableResultCrossVerification(resultItemType: EnumCapturedResultItemType | resultItemTypeString, enabled?: boolean): void;
5253
2902
  /**
5254
2903
  * Checks if verification is active for a given result item type.
5255
- * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2904
+ * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5256
2905
  * @returns Boolean indicating the status of verification for the specified type.
5257
2906
  */
5258
- isResultCrossVerificationEnabled(resultItemTypes: EnumCapturedResultItemType | resultItemTypesString): boolean;
2907
+ isResultCrossVerificationEnabled(resultItemType: EnumCapturedResultItemType | resultItemTypeString): boolean;
5259
2908
  /**
5260
2909
  * Enables or disables the deduplication process for one or multiple specific result item types.
5261
- * @param resultItemTypes Specifies one or multiple specific result item types, which can be defined using EnumCapturedResultItemType or a string. If using a string, only one type can be specified, and valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2910
+ * @param resultItemType Specifies one or multiple specific result item types, which can be defined using EnumCapturedResultItemType or a string. If using a string, only one type can be specified, and valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5262
2911
  * @param enabled Boolean to toggle deduplication on or off.
5263
2912
  */
5264
- enableResultDeduplication(resultItemTypes: EnumCapturedResultItemType | resultItemTypesString, enabled: boolean): void;
2913
+ enableResultDeduplication(resultItemType: EnumCapturedResultItemType | resultItemTypeString, enabled?: boolean): void;
5265
2914
  /**
5266
2915
  * Checks if deduplication is active for a given result item type.
5267
- * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2916
+ * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5268
2917
  * @returns Boolean indicating the deduplication status for the specified type.
5269
2918
  */
5270
- isResultDeduplicationEnabled(resultItemTypes: EnumCapturedResultItemType | resultItemTypesString): boolean;
2919
+ isResultDeduplicationEnabled(resultItemType: EnumCapturedResultItemType | resultItemTypeString): boolean;
5271
2920
  /**
5272
2921
  * Sets the interval during which duplicates are disregarded for specific result item types.
5273
- * @param resultItemTypes Specifies one or multiple specific result item types, which can be defined using EnumCapturedResultItemType or a string. If using a string, only one type can be specified, and valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2922
+ * @param resultItemType Specifies one or multiple specific result item types, which can be defined using EnumCapturedResultItemType or a string. If using a string, only one type can be specified, and valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5274
2923
  * @param time Time in milliseconds during which duplicates are disregarded.
5275
2924
  */
5276
- setDuplicateForgetTime(resultItemTypes: EnumCapturedResultItemType | resultItemTypesString, time: number): void;
2925
+ setDuplicateForgetTime(resultItemType: EnumCapturedResultItemType | resultItemTypeString, time: number): void;
5277
2926
  /**
5278
2927
  * Retrieves the interval during which duplicates are disregarded for a given result item type.
5279
- * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2928
+ * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5280
2929
  * @returns The set interval for the specified item type.
5281
2930
  */
5282
- getDuplicateForgetTime(resultItemTypes: EnumCapturedResultItemType | resultItemTypesString): number;
2931
+ getDuplicateForgetTime(resultItemType: EnumCapturedResultItemType | resultItemTypeString): number;
5283
2932
  getFilteredResultItemTypes(): number;
2933
+ /**
2934
+ * Sets the cross-verification criteria for one or more result item types.
2935
+ * This configuration determines how many frames are considered
2936
+ * and the minimum number of consistent frames required before a result is accepted.
2937
+ *
2938
+ * @param resultItemType Specifies one or multiple specific result item types.
2939
+ * It can be defined using `EnumCapturedResultItemType` or a string.
2940
+ * When using a string, only one type can be specified, and valid values include:
2941
+ * `"barcode"`, `"text_line"`, `"detected_quad"`, and `"deskewed_image"`.
2942
+ *
2943
+ * @param frameWindow The number of consecutive frames considered for verification.
2944
+ * @param minConsistentFrames The minimum number of consistent frames required
2945
+ * for a result to be considered valid.
2946
+ */
2947
+ setResultCrossVerificationCriteria(resultItemType: EnumCapturedResultItemType | resultItemTypeString, frameWindow: number, minConsistentFrames: number): void;
2948
+ /**
2949
+ * Retrieves the cross-verification criteria for a specified result item type.
2950
+ * Returns the configured frame window and consistency requirement.
2951
+ *
2952
+ * @param resultItemType Specifies the result item type,
2953
+ * either with `EnumCapturedResultItemType` or a string.
2954
+ * When using a string, valid values include:
2955
+ * `"barcode"`, `"text_line"`, `"detected_quad"`, and `"deskewed_image"`.
2956
+ *
2957
+ * @returns An object containing:
2958
+ * - `frameWindow`: number — the number of consecutive frames considered.
2959
+ * - `minConsistentFrames`: number — the minimum consistent frames required.
2960
+ */
2961
+ getResultCrossVerificationCriteria(resultItemType: EnumCapturedResultItemType | resultItemTypeString): CrossVerificationCriteria;
5284
2962
  private overlapSet;
5285
2963
  private stabilityCount;
5286
2964
  private crossVerificationFrames;
@@ -5288,27 +2966,27 @@ declare class MultiFrameResultCrossFilter implements CapturedResultFilter {
5288
2966
  private maxOverlappingFrames;
5289
2967
  /**
5290
2968
  * Enables or disables the deduplication process for one or multiple specific result item types.
5291
- * @param resultItemTypes Specifies one or multiple specific result item types, which can be defined using EnumCapturedResultItemType or a string. If using a string, only one type can be specified, and valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2969
+ * @param resultItemType Specifies one or multiple specific result item types, which can be defined using EnumCapturedResultItemType or a string. If using a string, only one type can be specified, and valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5292
2970
  * @param enabled Boolean to toggle deduplication on or off.
5293
2971
  */
5294
- enableLatestOverlapping(resultItemTypes: EnumCapturedResultItemType | resultItemTypesString, enabled: boolean): void;
2972
+ enableLatestOverlapping(resultItemType: EnumCapturedResultItemType | resultItemTypeString, enabled?: boolean): void;
5295
2973
  /**
5296
2974
  * Checks if deduplication is active for a given result item type.
5297
- * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2975
+ * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5298
2976
  *
5299
2977
  * @returns Boolean indicating the deduplication status for the specified type.
5300
2978
  */
5301
- isLatestOverlappingEnabled(resultItemType: EnumCapturedResultItemType | resultItemTypesString): boolean;
2979
+ isLatestOverlappingEnabled(resultItemType: EnumCapturedResultItemType | resultItemTypeString): boolean;
5302
2980
  /**
5303
2981
  * Set the max referencing frames count for the to-the-latest overlapping feature.
5304
2982
  *
5305
- * @param resultItemTypes Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2983
+ * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5306
2984
  * @param maxOverlappingFrames The max referencing frames count for the to-the-latest overlapping feature.
5307
2985
  */
5308
- setMaxOverlappingFrames(resultItemTypes: EnumCapturedResultItemType | resultItemTypesString, maxOverlappingFrames: number): void;
2986
+ setMaxOverlappingFrames(resultItemType: EnumCapturedResultItemType | resultItemTypeString, maxOverlappingFrames: number): void;
5309
2987
  /**
5310
2988
  * Get the max referencing frames count for the to-the-latest overlapping feature.
5311
- * @param resultItemTypes Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "normalized_image".
2989
+ * @param resultItemType Specifies the result item type, either with EnumCapturedResultItemType or a string. When using a string, the valid values include "barcode", "text_line", "detected_quad", and "deskewed_image".
5312
2990
  * @return Returns the max referencing frames count for the to-the-latest overlapping feature.
5313
2991
  */
5314
2992
  getMaxOverlappingFrames(resultItemType: EnumCapturedResultItemType): number;
@@ -5320,11 +2998,11 @@ declare class ImageIO {
5320
2998
  /**
5321
2999
  * This method reads an image from a file. The file format is automatically detected based on the file extensioor content.
5322
3000
  *
5323
- * @param file The file to read, as a File object.
3001
+ * @param file The file to read, as a Blob object.
5324
3002
  *
5325
3003
  * @returns A promise that resolves with the loaded image of type `DSImageData`.
5326
3004
  */
5327
- readFromFile(file: File): Promise<DSImageData>;
3005
+ static readFromFile(file: Blob | string): Promise<DSImageData>;
5328
3006
  /**
5329
3007
  * This method saves an image in either PNG or JPG format. The desired file format is inferred from the filextension provided in the 'name' parameter. Should the specified file format be omitted or unsupported, thdata will default to being exported in PNG format.
5330
3008
  *
@@ -5334,7 +3012,7 @@ declare class ImageIO {
5334
3012
  *
5335
3013
  * @returns A promise that resolves with the saved File object.
5336
3014
  */
5337
- saveToFile(image: DSImageData, name: string, download?: boolean): Promise<File>;
3015
+ static saveToFile(image: DSImageData, name: string, download?: boolean): Promise<File>;
5338
3016
  /**
5339
3017
  * Reads image data from memory using the specified ID.
5340
3018
  *
@@ -5342,16 +3020,16 @@ declare class ImageIO {
5342
3020
  *
5343
3021
  * @returns A Promise that resolves to the `DSImageData` object.
5344
3022
  */
5345
- readFromMemory(id: number): Promise<DSImageData>;
3023
+ static readFromMemory(id: number): Promise<DSImageData>;
5346
3024
  /**
5347
3025
  * This method saves an image to memory. The desired file format is inferred from the 'format' parameter. Should the specified file format be omitted or unsupported, the data will default to being exported in PNG format.
5348
3026
  *
5349
- * @param image A `Blob` representing the image to be saved.
5350
- * @param fileFormat The desired image format.
3027
+ * @param image The image to be saved, of type `DSImageData`.
3028
+ * @param format The desired image format.
5351
3029
  *
5352
- * @returns A Promise that resolves to a memory ID which can later be used to retrieve the image via readFromMemory.
3030
+ * @returns A promise that resolves with an object containing the image data as a Uint8Array and the file format.
5353
3031
  */
5354
- saveToMemory(image: Blob, fileFormat: EnumImageFileFormat): Promise<number>;
3032
+ static saveToMemory(image: Blob, fileFormat: string): Promise<number>;
5355
3033
  /**
5356
3034
  * This method reads an image from a Base64-encoded string. The image format is automatically detected based on the content of the string.
5357
3035
  *
@@ -5359,7 +3037,7 @@ declare class ImageIO {
5359
3037
  *
5360
3038
  * @returns A promise that resolves with the loaded image of type `DSImageData`.
5361
3039
  */
5362
- readFromBase64String(base64String: string): Promise<DSImageData>;
3040
+ static readFromBase64String(base64String: string): Promise<DSImageData>;
5363
3041
  /**
5364
3042
  * This method saves an image to a Base64-encoded string. The desired file format is inferred from the 'format' parameter. Should the specified file format be omitted or unsupported, the data will default to being exported in PNG format.
5365
3043
  *
@@ -5368,7 +3046,7 @@ declare class ImageIO {
5368
3046
  *
5369
3047
  * @returns A promise that resolves with a Base64-encoded string representing the image.
5370
3048
  */
5371
- saveToBase64String(image: Blob, fileFormat: EnumImageFileFormat): Promise<string>;
3049
+ static saveToBase64String(image: Blob | DSImageData, fileFormat: string): Promise<string>;
5372
3050
  }
5373
3051
 
5374
3052
  declare class ImageDrawer {
@@ -5384,7 +3062,7 @@ declare class ImageDrawer {
5384
3062
  *
5385
3063
  * @returns A promise that resolves with the saved File object.
5386
3064
  */
5387
- drawOnImage(image: Blob | string | DSImageData, drawingItem: Array<Quadrilateral> | Quadrilateral | Array<LineSegment> | LineSegment | Array<Contour> | Contour | Array<Corner> | Corner | Array<Edge> | Edge, type: "quads" | "lines" | "contours" | "corners" | "edges", color?: number, thickness?: number, name?: string, download?: boolean): Promise<DSImageData>;
3065
+ static drawOnImage(image: Blob | string | DSImageData, drawingItem: Array<Quadrilateral> | Quadrilateral | Array<LineSegment> | LineSegment | Array<Contour> | Contour | Array<Corner> | Corner | Array<Edge> | Edge, type: "quads" | "lines" | "contours" | "corners" | "edges", color?: number, thickness?: number, name?: string, download?: boolean): Promise<DSImageData>;
5388
3066
  }
5389
3067
 
5390
3068
  declare enum EnumFilterType {
@@ -5404,7 +3082,7 @@ declare class ImageProcessor {
5404
3082
  *
5405
3083
  * @returns A promise that resolves with the cropped image data.
5406
3084
  */
5407
- cropImage(image: Blob, roi: DSRect): Promise<DSImageData>;
3085
+ static cropImage(image: Blob | DSImageData, roi: DSRect): Promise<DSImageData>;
5408
3086
  /**
5409
3087
  * Adjusts the brightness of the image.
5410
3088
  * @param image The image data to be adjusted.
@@ -5412,7 +3090,7 @@ declare class ImageProcessor {
5412
3090
  *
5413
3091
  * @returns A promise that resolves with the adjusted image data.
5414
3092
  */
5415
- adjustBrightness(image: Blob, brightness: number): Promise<DSImageData>;
3093
+ static adjustBrightness(image: Blob | DSImageData, brightness: number): Promise<DSImageData>;
5416
3094
  /**
5417
3095
  * Adjusts the contrast of the image.
5418
3096
  * @param image The image data to be adjusted.
@@ -5420,14 +3098,14 @@ declare class ImageProcessor {
5420
3098
  *
5421
3099
  * @returns A promise that resolves with the adjusted image data.
5422
3100
  */
5423
- adjustContrast(image: Blob, contrast: number): Promise<DSImageData>;
3101
+ static adjustContrast(image: Blob | DSImageData, contrast: number): Promise<DSImageData>;
5424
3102
  /**
5425
3103
  * Applies a specified image filter to an input image.
5426
3104
  * @param image The image data to be filtered.
5427
3105
  * @param filterType The type of filter to apply.
5428
3106
  * @returns A promise that resolves with the filtered image data.
5429
3107
  */
5430
- filterImage(image: Blob, filterType: EnumFilterType): Promise<DSImageData>;
3108
+ static filterImage(image: Blob | DSImageData, filterType: EnumFilterType): Promise<DSImageData>;
5431
3109
  /**
5432
3110
  * Converts a colour image to grayscale.
5433
3111
  * @param image The image data to be converted.
@@ -5436,24 +3114,24 @@ declare class ImageProcessor {
5436
3114
  * @param B [B=0.11] - Weight for the blue channel.
5437
3115
  * @returns A promise that resolves with the grayscale image data.
5438
3116
  */
5439
- convertToGray(image: Blob, R?: number, G?: number, B?: number): Promise<DSImageData>;
3117
+ static convertToGray(image: Blob | DSImageData, R?: number, G?: number, B?: number): Promise<DSImageData>;
5440
3118
  /**
5441
- * Converts a grayscale image to a binary image using a global threshold.
5442
- * @param image The grayscale image data.
3119
+ * Converts an image to a binary image using a global threshold.
3120
+ * @param image The image data (grayscale, color, or binary).
5443
3121
  * @param threshold [threshold=-1] Global threshold for binarization (-1 for automatic calculation).
5444
3122
  * @param invert [invert=false] Whether to invert the binary image.
5445
3123
  * @returns A promise that resolves with the binary image data.
5446
3124
  */
5447
- convertToBinaryGlobal(image: Blob, threshold?: number, invert?: boolean): Promise<DSImageData>;
3125
+ static convertToBinaryGlobal(image: Blob | DSImageData, threshold?: number, invert?: boolean): Promise<DSImageData>;
5448
3126
  /**
5449
3127
  * Converts a grayscale image to a binary image using local (adaptive) binarization.
5450
3128
  * @param image The grayscale image data.
5451
3129
  * @param blockSize [blockSize=0] Size of the block for local binarization.
5452
- * @param compensation [compensation=0] Adjustment value to modify the threshold.
3130
+ * @param compensation [compensation=10] Adjustment value to modify the threshold.
5453
3131
  * @param invert [invert=false] Whether to invert the binary image.
5454
3132
  * @returns A promise that resolves with the binary image data.
5455
3133
  */
5456
- convertToBinaryLocal(image: Blob, blockSize?: number, compensation?: number, invert?: boolean): Promise<DSImageData>;
3134
+ static convertToBinaryLocal(image: Blob | DSImageData, blockSize?: number, compensation?: number, invert?: boolean): Promise<DSImageData>;
5457
3135
  /**
5458
3136
  * Crops and deskews an image using a quadrilateral.
5459
3137
  * @param image The image data to be cropped and deskewed.
@@ -5461,10 +3139,10 @@ declare class ImageProcessor {
5461
3139
  *
5462
3140
  * @returns A promise that resolves with the cropped and deskewed image data.
5463
3141
  */
5464
- cropAndDeskewImage(image: Blob, roi: Quadrilateral): Promise<DSImageData>;
3142
+ static cropAndDeskewImage(image: Blob | DSImageData, roi: Quadrilateral, dstWidth?: number, dstHeight?: number, padding?: number): Promise<DSImageData>;
5465
3143
  }
5466
3144
 
5467
- export { EnumFilterType, ImageDrawer, ImageIO, ImageProcessor, MultiFrameResultCrossFilter, UtilityModule };
3145
+ export { CBarcodeResultItem, CDecodedBarcodeElement, CEdge, CLocalizedBarcodeElement, CQuadrilateral, CapturedResultMap, CrossVerificationCriteria, EnumFilterType, ImageDrawer, ImageIO, ImageProcessor, MultiFrameResultCrossFilter, UtilityModule, resultItemTypeString };
5468
3146
 
5469
3147
 
5470
3148
 
@@ -5488,25 +3166,39 @@ declare enum EnumScanMode {
5488
3166
  SM_SINGLE = 0,
5489
3167
  SM_MULTI_UNIQUE = 1
5490
3168
  }
5491
- declare enum EnumOptimizationMode {
5492
- OM_NONE = 0,
5493
- OM_SPEED = 1,
5494
- OM_COVERAGE = 2,
5495
- OM_BALANCE = 3,
5496
- OM_DPM = 4,
5497
- OM_DENSE = 5
5498
- }
5499
3169
  declare enum EnumResultStatus {
5500
3170
  RS_SUCCESS = 0,
5501
3171
  RS_CANCELLED = 1,
5502
3172
  RS_FAILED = 2
5503
3173
  }
5504
3174
 
3175
+ type CacheKeys = "dceUI" | "dbsUI" | "presetTemplates" | "templateFile";
5505
3176
  type CameraSwitchControlMode = "hidden" | "listAll" | "toggleFrontBack";
3177
+ type PathConfig = {
3178
+ path: string;
3179
+ reloadResource?: boolean;
3180
+ };
3181
+ declare function isPathConfig(obj: any): obj is PathConfig;
3182
+ interface ScannerViewConfig {
3183
+ container?: HTMLElement | string;
3184
+ showCloseButton?: boolean;
3185
+ mirrorFrontCamera?: boolean;
3186
+ cameraSwitchControl?: CameraSwitchControlMode;
3187
+ showFlashButton?: boolean;
3188
+ customHighlightForBarcode?: (result: BarcodeResultItem) => QuadDrawingItem;
3189
+ }
3190
+ interface BarcodeResultViewToolbarButtonsConfig {
3191
+ clear?: ToolbarButtonConfig;
3192
+ done?: ToolbarButtonConfig;
3193
+ }
3194
+ interface ResultViewConfig {
3195
+ container?: HTMLElement | string;
3196
+ toolbarButtonsConfig?: BarcodeResultViewToolbarButtonsConfig;
3197
+ }
5506
3198
  interface BarcodeScannerConfig {
5507
3199
  license?: string;
5508
3200
  scanMode?: EnumScanMode;
5509
- templateFilePath?: string;
3201
+ templateFilePath?: string | PathConfig;
5510
3202
  utilizedTemplateNames?: UtilizedTemplateNames;
5511
3203
  engineResourcePaths?: EngineResourcePaths;
5512
3204
  barcodeFormats?: Array<EnumBarcodeFormat> | EnumBarcodeFormat;
@@ -5518,7 +3210,7 @@ interface BarcodeScannerConfig {
5518
3210
  autoStartCapturing?: boolean;
5519
3211
  scannerViewConfig?: ScannerViewConfig;
5520
3212
  resultViewConfig?: ResultViewConfig;
5521
- uiPath?: string;
3213
+ uiPath?: string | PathConfig;
5522
3214
  onUniqueBarcodeScanned?: (result: BarcodeResultItem) => void | Promise<void>;
5523
3215
  onInitPrepare?: () => void;
5524
3216
  onInitReady?: (components: {
@@ -5536,22 +3228,7 @@ interface BarcodeScannerConfig {
5536
3228
  cameraEnhancer: CameraEnhancer;
5537
3229
  cvRouter: CaptureVisionRouter;
5538
3230
  }) => void;
5539
- }
5540
- interface ScannerViewConfig {
5541
- container?: HTMLElement | string;
5542
- showCloseButton?: boolean;
5543
- mirrorFrontCamera?: boolean;
5544
- cameraSwitchControl?: CameraSwitchControlMode;
5545
- showFlashButton?: boolean;
5546
- customHighlightForBarcode?: (result: BarcodeResultItem) => DrawingItem;
5547
- }
5548
- interface BarcodeResultViewToolbarButtonsConfig {
5549
- clear?: ToolbarButtonConfig;
5550
- done?: ToolbarButtonConfig;
5551
- }
5552
- interface ResultViewConfig {
5553
- container?: HTMLElement | string;
5554
- toolbarButtonsConfig?: BarcodeResultViewToolbarButtonsConfig;
3231
+ onCameraOpenFailed?: (ex: Error) => void;
5555
3232
  }
5556
3233
 
5557
3234
  type ResultStatus = {
@@ -5588,5 +3265,1216 @@ declare class BarcodeScanner {
5588
3265
  dispose(): void;
5589
3266
  }
5590
3267
 
5591
- export { BarcodeScanner, EnumOptimizationMode, EnumResultStatus, EnumScanMode };
5592
- export type { BarcodeResultViewToolbarButtonsConfig, BarcodeScanResult, BarcodeScannerConfig, ResultStatus, ResultViewConfig, ScannerViewConfig, ToolbarButtonConfig, UtilizedTemplateNames };
3268
+ export { BarcodeScanner, EnumResultStatus, EnumScanMode, isPathConfig };
3269
+ export type { BarcodeScanResult, BarcodeScannerConfig, CacheKeys, ResultStatus, ToolbarButtonConfig, UtilizedTemplateNames };
3270
+ interface CameraInfo extends InputDeviceInfo {
3271
+ trackLabel: string;
3272
+ capabilities: DMMoreMediaTrackCapabilities;
3273
+ isFront: boolean;
3274
+ }
3275
+ interface DMMoreMediaTrackCapabilities extends MediaTrackCapabilities {
3276
+ focusMode?: ('continuous' | 'single-shot' | 'manual')[];
3277
+ focusDistance?: {
3278
+ max?: number;
3279
+ min: number;
3280
+ };
3281
+ zoom?: {
3282
+ max: number;
3283
+ min: number;
3284
+ };
3285
+ torch?: true;
3286
+ }
3287
+ type CameraZsFunc = (this: Camera, ...argArray: any[]) => void | any;
3288
+ interface Camera {
3289
+ /**
3290
+ * The `opened` event is triggered when the camera `open()` from the `paused`/`closed`
3291
+ * or when call `requestResolution()` and camera is `opened`.
3292
+ */
3293
+ addEventListener(type: 'opened', listener: (this: Camera) => void | any): void;
3294
+ removeEventListener(type: 'opened', listener: (this: Camera) => void | any): void;
3295
+ /** The `closed` event is triggered when camera is `closed`. */
3296
+ addEventListener(type: 'closed', listener: (this: Camera) => void | any): void;
3297
+ removeEventListener(type: 'closed', listener: (this: Camera) => void | any): void;
3298
+ }
3299
+ declare class Camera {
3300
+ static _cameraNameMatcher: string[][];
3301
+ static _mapDeviceInfo: {
3302
+ [deviceId: string]: CameraInfo;
3303
+ };
3304
+ _coreShell: HTMLElement;
3305
+ _video: HTMLVideoElement;
3306
+ _coreInnerLayer: HTMLElement;
3307
+ _coreOuterLayer: HTMLElement;
3308
+ _regionBoxWrapper: HTMLElement;
3309
+ _regionBoxMask: HTMLElement;
3310
+ _regionBoxBorder: HTMLElement;
3311
+ _objectFit: 'contain' | 'cover' | 'fill';
3312
+ _uiInlineScript2Blob: boolean;
3313
+ _uiInternalCss2Blob: boolean;
3314
+ _uiInternalCss2ExistedSheet: boolean;
3315
+ _ui?: HTMLElement;
3316
+ _pOpen: Promise<void> & {
3317
+ isPending: boolean;
3318
+ resolve: () => void;
3319
+ reject: () => void;
3320
+ };
3321
+ _openTimeout: number;
3322
+ _paused: boolean;
3323
+ _shouldClose: boolean;
3324
+ _cameraChangedWhenPaused: boolean;
3325
+ _requestedCamera: CameraPreset | MediaTrackConstraints;
3326
+ _requestedResolution: MediaTrackConstraints;
3327
+ _regionBox: {
3328
+ width?: number;
3329
+ height?: number;
3330
+ unit: 'view-size' | 'view-min';
3331
+ center: {
3332
+ x: number;
3333
+ y: number;
3334
+ };
3335
+ maskStyle?: Partial<CSSStyleDeclaration>;
3336
+ borderStyle?: Partial<CSSStyleDeclaration>;
3337
+ innerUi?: Node | NodeList;
3338
+ };
3339
+ _eventListeners: {
3340
+ [key: string]: Set<Function>;
3341
+ };
3342
+ static _delayBeforeEnumerateDevices: number;
3343
+ static _delayBeforeGetUserMedia: number;
3344
+ static _delayBeforeApplyConstraints: number;
3345
+ static _countEnsureResolution: number;
3346
+ static _arrConstructors: CameraZsFunc[];
3347
+ static _arrOnOpen: CameraZsFunc[];
3348
+ static _arrBeforeClose: CameraZsFunc[];
3349
+ static _arrOnClose: CameraZsFunc[];
3350
+ constructor();
3351
+ _taskIdIOSResizeProblem: any;
3352
+ _updateObjectFit(): void;
3353
+ get video(): HTMLVideoElement;
3354
+ get track(): MediaStreamTrack;
3355
+ get objectFit(): "contain" | "cover" | "fill";
3356
+ set objectFit(value: "contain" | "cover" | "fill");
3357
+ /**
3358
+ * While `ui` can accept various types during assignment, its value will always be an `HTMLElement` upon retrieval.
3359
+ */
3360
+ get ui(): HTMLElement;
3361
+ /**
3362
+ * Generally, the `value` can be an `HTMLElement`, `DocumentFragment` or a string of serialized html.
3363
+ * This `ui` or one of its descendants, must have class `dm-camera-core-container`.
3364
+ * If the `value` already contains the `coreShell`, `coreShell` does not move.
3365
+ * Otherwise the `coreShell` of `DMCamera` is appended to the first element that has the class `dm-camera-core-container`.
3366
+ *
3367
+ * If `value` is a falsy value, `coreShell` is used as `ui`.
3368
+ **/
3369
+ set ui(value: HTMLElement | DocumentFragment | string | undefined);
3370
+ get status(): CameraStatus;
3371
+ get requestedCamera(): "back" | "front" | "macro-back" | "quick-back" | "customized-video" | MediaTrackConstraints;
3372
+ get requestedResolution(): {
3373
+ width: number;
3374
+ height: number;
3375
+ };
3376
+ get currentCamera(): CameraInfo;
3377
+ get currentResolution(): {
3378
+ width: number;
3379
+ height: number;
3380
+ };
3381
+ /** width 0 ~ 1, height 0 ~ 1, center.x -0.5 ~ 0.5, center.y -0.5 ~ 0.5 */
3382
+ get regionBox(): {
3383
+ width?: number;
3384
+ height?: number;
3385
+ unit: "view-size" | "view-min";
3386
+ center: {
3387
+ x: number;
3388
+ y: number;
3389
+ };
3390
+ maskStyle?: Partial<CSSStyleDeclaration>;
3391
+ borderStyle?: Partial<CSSStyleDeclaration>;
3392
+ innerUi?: Node | NodeList;
3393
+ };
3394
+ onOpened: (camera: Camera) => void | any;
3395
+ static hasCamera(): Promise<boolean>;
3396
+ static hasMacroCamera(): Promise<boolean>;
3397
+ static hasFrontCamera(): Promise<boolean>;
3398
+ /**
3399
+ * tips:
3400
+ * Call getDeviceInfos() will ask for camera permission, then open camera and close internally.
3401
+ * 2nd time open camera will be a lot faster.
3402
+ **/
3403
+ static getDeviceInfos(): Promise<Readonly<CameraInfo>[]>;
3404
+ static _setCapabilities(deviceInfos: CameraInfo[]): Promise<void>;
3405
+ /** `pause()` is an idempotent operation, you can call it repeatedly without error. */
3406
+ pause(): Promise<void>;
3407
+ /** `close()` is an idempotent operation, you can call it repeatedly without error. */
3408
+ close(): Promise<void>;
3409
+ /** If call `requestCamera()` when the camera is `opened`, it will call `close()` then re`open()` Internally. */
3410
+ requestCamera(cameraPreset: CameraPreset): Promise<void>;
3411
+ /** If call `requestCamera()` when the camera is `opened`, it will call `close()` then re`open()` Internally. */
3412
+ requestCamera(deviceId: string): Promise<void>;
3413
+ /** If call `requestCamera()` when the camera is `opened`, it will call `close()` then re`open()` Internally. */
3414
+ requestCamera(deviceInfo: CameraInfo): Promise<void>;
3415
+ /** If call `requestCamera()` when the camera is `opened`, it will call `close()` then re`open()` Internally. */
3416
+ requestCamera(constraints: MediaTrackConstraints): Promise<void>;
3417
+ /**
3418
+ * If call `requestCamera()` when the camera is `opened`, it will call `close()` then re`open()` Internally.
3419
+ * @param notRequired Let browser choose use what camera.
3420
+ * */
3421
+ requestCamera(notRequired: null): Promise<void>;
3422
+ /**
3423
+ * If call `requestCamera()` when the camera is `opened`, it will call `close()` then re`open()` Internally.
3424
+ * @param resetToDefault Use SDK's dafault logic.
3425
+ * */
3426
+ requestCamera(resetToDefault: undefined): Promise<void>;
3427
+ /** If call `requestCamera()` when the camera is `opened`, it will call `close()` then re`open()` Internally. */
3428
+ requestCamera(camera: string | CameraInfo | MediaTrackConstraints): Promise<void>;
3429
+ requestResolution(width: number, height?: number): Promise<void>;
3430
+ requestResolution(widthHeightPair: [number, number] | number[]): Promise<void>;
3431
+ requestResolution(constraints: {
3432
+ width?: ConstrainULong;
3433
+ height?: ConstrainULong;
3434
+ aspectRatio?: ConstrainDouble;
3435
+ }): Promise<void>;
3436
+ requestResolution(notRequired: null): Promise<void>;
3437
+ requestResolution(resetToDefault: undefined): Promise<void>;
3438
+ /**
3439
+ * @param config
3440
+ * `x`/`y`/`width`/`height` is normally `0 ~ video.videoWidth` or `0 ~ video.videoHeight`,
3441
+ * same as [drawImage](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/drawImage).
3442
+ * If values contain decimals, it will be rounded.
3443
+ * Note that the round method takes the effect of `x` into account when rounding `width` to minimize the cumulative error.
3444
+ * The same logic applies to `height`.
3445
+ */
3446
+ getFrame(config?: {
3447
+ x?: number;
3448
+ y?: number;
3449
+ width?: number;
3450
+ height?: number;
3451
+ reusedContext?: CanvasRenderingContext2D;
3452
+ }): HTMLCanvasElement;
3453
+ /**
3454
+ * @param regionBox width 0 ~ 1, height 0 ~ 1, center.x -0.5 ~ 0.5, center.y -0.5 ~ 0.5
3455
+ * TODO: support unit pixel
3456
+ */
3457
+ setRegionBox(regionBox: {
3458
+ width?: number;
3459
+ height?: number;
3460
+ unit?: 'view-size' | 'view-min';
3461
+ center?: {
3462
+ x: number;
3463
+ y: number;
3464
+ };
3465
+ maskStyle?: Partial<CSSStyleDeclaration>;
3466
+ borderStyle?: Partial<CSSStyleDeclaration>;
3467
+ innerUi?: Node | NodeList | DocumentFragment | Node[] | string;
3468
+ }): void;
3469
+ /**
3470
+ * Add a canvas dynamically keep with the same size of the video resolution, as a overlay.
3471
+ * You can remove it by `camera.video.parentElement.removeChild(thatCanvas)` or `thatCanvas.remove()`.
3472
+ * When you add multiple canvases, you can also use `camera.video.parentElement` to control stack order.
3473
+ */
3474
+ addCanvas(): HTMLCanvasElement;
3475
+ _updateCanvasSize(): void;
3476
+ _callOpenedListeners(): void;
3477
+ /**
3478
+ * Convert video x/y to absolute left/top in `document.body`.
3479
+ * So you can easily add a overlay with absolute position.
3480
+ * Processing multiple points at once has higher performance than calling multiple times.
3481
+ */
3482
+ videoXY2AbsoluteLT(points: {
3483
+ x: number;
3484
+ y: number;
3485
+ }[]): {
3486
+ left: number;
3487
+ top: number;
3488
+ }[];
3489
+ /**
3490
+ * Convert video x/y to fixed left/top in `document.body`.
3491
+ * So you can easily add a overlay with fixed position.
3492
+ * Processing multiple points at once has higher performance than calling multiple times.
3493
+ */
3494
+ videoXY2FixedLT(points: {
3495
+ x: number;
3496
+ y: number;
3497
+ }[]): {
3498
+ left: number;
3499
+ top: number;
3500
+ }[];
3501
+ /**
3502
+ * @param isConsiderRegionBox Default is `false`. Only consider the visible area in the region box.
3503
+ * @param rounded Default is `false`. Controls whether the result should be rounded.
3504
+ * Note that the round method takes the effect of `x` into account when rounding `width` to minimize the cumulative error.
3505
+ * The same logic applies to `height`.
3506
+ * @returns
3507
+ * `x`/`width` is `0 ~ video.videoWidth`, `y`/`height` is `0 ~ video.videoHeight`.
3508
+ */
3509
+ getVisibleAreaInVideoXY(config?: {
3510
+ isConsiderRegionBox?: boolean;
3511
+ rounded?: boolean;
3512
+ }): {
3513
+ x: number;
3514
+ y: number;
3515
+ width: number;
3516
+ height: number;
3517
+ };
3518
+ }
3519
+ type CameraStatus = 'closed' | 'opening' | 'opened' | 'paused' | 'closing';
3520
+ declare const ArrCameraPreset: readonly ["back", "front", "macro-back", "quick-back", "customized-video"];
3521
+ type CameraPreset = typeof ArrCameraPreset[number];
3522
+
3523
+
3524
+ interface Camera {
3525
+ correctAdvancedConstraint(constraints?: MediaTrackConstraints): MediaTrackConstraints;
3526
+ }
3527
+
3528
+
3529
+ interface Camera {
3530
+ _softZoom: {
3531
+ zoom: number;
3532
+ center: {
3533
+ x: number;
3534
+ y: number;
3535
+ };
3536
+ };
3537
+ get softZoom(): {
3538
+ zoom: number;
3539
+ center: {
3540
+ x: number;
3541
+ y: number;
3542
+ };
3543
+ };
3544
+ _isMirrored: boolean;
3545
+ get isMirrored(): boolean;
3546
+ set isMirrored(value: boolean);
3547
+ maxZoom4GestureWheel: number;
3548
+ _lastZoomTime: number;
3549
+ _mapZoomTouchs: Map<number, {
3550
+ x: number;
3551
+ y: number;
3552
+ }>;
3553
+ _gestureZoomListener: EventListener;
3554
+ get enableGestureZoom(): boolean;
3555
+ set enableGestureZoom(value: boolean);
3556
+ _wheelZoomListener: EventListener;
3557
+ get enableWheelZoom(): boolean;
3558
+ set enableWheelZoom(value: boolean);
3559
+ getZoomRange(): {
3560
+ min: number;
3561
+ max: number;
3562
+ } | undefined;
3563
+ setZoom(zoom: number): Promise<void>;
3564
+ /**
3565
+ * Js software-level zoom.
3566
+ * It does not rely on camera device and camera driver support for zoom.
3567
+ * @param center
3568
+ * zoomed camera center in orignal frame.
3569
+ * `x`: -0.5 ~ 0.5, `y`: -0.5 ~ 0.5.
3570
+ * @param limit
3571
+ * limit `zoom` >= 1.
3572
+ * limit the center point position according to `zoom`,
3573
+ * so zoomed frame is inside video boundary;
3574
+ */
3575
+ setSoftZoom(zoom: number, config?: {
3576
+ center?: {
3577
+ x: number;
3578
+ y: number;
3579
+ };
3580
+ limit?: boolean;
3581
+ }): void;
3582
+ _changeZoomByWheel(ev: WheelEvent): void;
3583
+ _changeZoomByTouch(ev: TouchEvent): void;
3584
+ /** The `zoom` event is triggered when zoom updated via a touch gesture or mouse wheel. */
3585
+ addEventListener(type: 'zoom', listener: (this: Camera, softZoom?: {
3586
+ zoom: number;
3587
+ center: {
3588
+ x: number;
3589
+ y: number;
3590
+ };
3591
+ }) => void | any): void;
3592
+ removeEventListener(type: 'zoom', listener: (this: Camera, softZoom?: {
3593
+ zoom: number;
3594
+ center: {
3595
+ x: number;
3596
+ y: number;
3597
+ };
3598
+ }) => void | any): void;
3599
+ }
3600
+
3601
+ interface AdvancedFocusParameters {
3602
+ minFocusDistanceLimit?: number;
3603
+ maxFocusDistanceLimit?: number;
3604
+ firstStepWaitDuration?: number;
3605
+ coarseStepWaitDuration?: number;
3606
+ switchStepWaitDuration?: number;
3607
+ fineStepWaitDuration?: number;
3608
+ maxStepCount?: number;
3609
+ /** value < 0 means no never */
3610
+ backToContinousDuration?: number;
3611
+ /** The focus width and height, 0 ~ 1, represents the ratio of the length to the `Math.min(video.videoWidth, video.videoHeight)` */
3612
+ focusWH?: number;
3613
+ /** From far to near, 0 ~ 1. The closer to 1, the more sensitive but more slow. */
3614
+ coarseTuneRate?: number;
3615
+ /**
3616
+ * 0 ~ 1.
3617
+ * When the correct focus is closer, the far focus contrast data is unreliable
3618
+ * and requires a certain degree of error tolerance.
3619
+ * When closer to 1, it will be more sensitive to contrast changes and may also cause the focus to be too far.
3620
+ * When closer to 0, there will be more error tolerance,
3621
+ * and it may also cause the focus to be too close and the process to be too slow.
3622
+ **/
3623
+ coarseTuneTolerance?: number;
3624
+ /** From near to far, 1 ~ 1.xx. The closer to 1, the more sensitive but more slow. */
3625
+ fineTuneRate?: number;
3626
+ }
3627
+ declare namespace Camera {
3628
+ function _getImageContrast(data: Uint8Array | Uint8ClampedArray, width: number, height: number): number;
3629
+ }
3630
+ interface Camera {
3631
+ _enableTapToFocus: false | 'simple' | 'experimental-advanced';
3632
+ _isFocusing: boolean;
3633
+ _tapToFocusListner: EventListener;
3634
+ _simpleFocus(): Promise<void>;
3635
+ _advancedFocusParameters: AdvancedFocusParameters;
3636
+ _advancedFocusTaskId: number;
3637
+ _advancedFocus(center?: {
3638
+ x: number;
3639
+ y: number;
3640
+ }, width?: number, height?: number): Promise<void>;
3641
+ get enableTapToFocus(): false | "simple" | "experimental-advanced";
3642
+ set enableTapToFocus(value: false | 'simple' | 'experimental-advanced');
3643
+ }
3644
+
3645
+ interface AutoTorchParameters {
3646
+ shortDelay: number;
3647
+ longDelay: number;
3648
+ shortLongDelaySwitchCount: number;
3649
+ /** 0 ~ 255 */
3650
+ grayThreshold: number;
3651
+ maxDarkCount: number;
3652
+ }
3653
+
3654
+ interface Camera {
3655
+ get isSupportTorch(): boolean;
3656
+ _isTorchOn: boolean | undefined;
3657
+ /** `undefined` means in auto torch mode */
3658
+ get isTorchOn(): boolean | undefined;
3659
+ turnOnTorch(): Promise<void>;
3660
+ turnOffTorch(): Promise<void>;
3661
+ _autoTorchParameters: AutoTorchParameters;
3662
+ /**
3663
+ * Detect how dark the picture and turn on torch automatically.
3664
+ * After camera open, it may take a few seconds for picture to be ready.
3665
+ * So it's suggested not to `turnAutoTorch()` immediately.
3666
+ * Waiting for 3 seconds may bring a better user experience.
3667
+ **/
3668
+ turnAutoTorch(): void;
3669
+ /** The auto torch logic detected that the image was too dark and turn on the torch. */
3670
+ addEventListener(type: 'torchAutoOn', listener: (this: Camera) => void | any): void;
3671
+ removeEventListener(type: 'torchAutoOn', listener: (this: Camera) => void | any): void;
3672
+ }
3673
+
3674
+
3675
+ interface Camera {
3676
+ _shouldCloseWhenHide: boolean;
3677
+ _isDuringCloseWhenHide: boolean;
3678
+ _isOpenBeforeHide: boolean;
3679
+ _maxReopenTry4CloseWhenHide: number;
3680
+ get shouldCloseWhenHide(): boolean;
3681
+ set shouldCloseWhenHide(value: boolean);
3682
+ _closeWhenHide(): Promise<void>;
3683
+ _closeWhenHideListener: EventListener;
3684
+ }
3685
+ declare namespace Camera {
3686
+ function showFilePicker(inputOptions?: {
3687
+ accept?: string;
3688
+ multiple: boolean;
3689
+ capture?: 'user' | 'environment' | '';
3690
+ onchange?: (this: HTMLInputElement, ev: Event) => any;
3691
+ }): Promise<File[]>;
3692
+ function showFilePicker(inputOptions?: any): Promise<File[]>;
3693
+ }
3694
+
3695
+ /**
3696
+ * Return `Element` if possible, otherwise return `DocumentFragment`.
3697
+ */
3698
+ declare const stringToHtml: (str: string, config?: {
3699
+ inlineScript2Blob?: boolean;
3700
+ internalCss2Blob: boolean;
3701
+ insertInternalCss2ExistedSheet?: boolean;
3702
+ }) => Node;
3703
+
3704
+ declare class FramePipeline {
3705
+ camera: Camera;
3706
+ _ctx: CanvasRenderingContext2D;
3707
+ _data: Uint8Array<ArrayBuffer>;
3708
+ _dataTime: number;
3709
+ _x: number;
3710
+ _y: number;
3711
+ _w: number;
3712
+ _h: number;
3713
+ _type: string;
3714
+ maxTimeout: number;
3715
+ _pipeTaskId: any;
3716
+ isSaveOriginalRgba: boolean;
3717
+ /**
3718
+ * The `originalRgba` share `ArrayBuffer` with the `data` returned by `getData(..., type: 'rgba')`.
3719
+ * So you should be careful when transferring `data` to other thread.
3720
+ */
3721
+ originalRgba: Uint8ClampedArray<ArrayBuffer>;
3722
+ constructor(camera?: Camera);
3723
+ _getData(): Uint8Array<ArrayBuffer>;
3724
+ /**
3725
+ * @param config
3726
+ * Each parameter should be kept as stable as possible.
3727
+ * If you need to switch between multiple parameters frequently, please create multiple `FramePipeline` instances.
3728
+ *
3729
+ * `x`, `y`, `width`, `height` will be rounded.
3730
+ * Note that the round method takes the effect of `x` into account when rounding `width` to minimize the cumulative error.
3731
+ * The same logic applies to `height`.
3732
+ */
3733
+ getData(config?: {
3734
+ x?: number;
3735
+ y?: number;
3736
+ width?: number;
3737
+ height?: number;
3738
+ type?: 'rgba' | 'gray';
3739
+ }): Uint8Array;
3740
+ }
3741
+
3742
+ declare class Beep {
3743
+ _stAudioFree: Set<unknown>;
3744
+ _stAudioPlaying: Set<unknown>;
3745
+ _timeLastPlay: number;
3746
+ _bWarnedMaxTrack: boolean;
3747
+ maxPlayingBeep: number;
3748
+ beepSoundSource: string;
3749
+ beep(): void;
3750
+ }
3751
+ /**
3752
+ * The function will play the default beep sound.
3753
+ * To play different beep sound, you need create another `Beep` instance.
3754
+ **/
3755
+ declare const beep: () => void;
3756
+ declare const vibrate: (duration?: number) => void;
3757
+
3758
+ declare const CameraEnhancerModule: {
3759
+ getVersion(): string;
3760
+ };
3761
+ declare const CameraEnhancer: typeof Camera;
3762
+ type CameraEnhancer = Camera;
3763
+ declare const CameraView: typeof Camera;
3764
+ type CameraView = Camera;
3765
+ declare namespace Camera {
3766
+ function createInstance(_?: any): Promise<CameraEnhancer>;
3767
+ function testCameraAccess(): Promise<{
3768
+ ok: boolean;
3769
+ message?: string;
3770
+ }>;
3771
+ let defaultUIElementURL: string;
3772
+ let onWarning: any;
3773
+ }
3774
+ interface Camera {
3775
+ isCameraEnhancer: true;
3776
+ disposed: boolean;
3777
+ dispose(): void;
3778
+ _cameraEnhancer: CameraEnhancer;
3779
+ _cameraView: CameraView;
3780
+ _dceLastDeviceId: any;
3781
+ _dceLastResolution: any;
3782
+ cameraOpenTimeout: any;
3783
+ _bTryAnotherCameraWhenFailToOpen: boolean;
3784
+ _oriOpen(): Promise<void>;
3785
+ open(): Promise<void | {
3786
+ deviceId: string;
3787
+ width: number;
3788
+ height: number;
3789
+ }>;
3790
+ _oriUpdateCanvasSize(): void;
3791
+ _oriAddCanvas(): HTMLCanvasElement;
3792
+ getAllCameras(): Promise<{
3793
+ deviceId: string;
3794
+ label: string;
3795
+ }[]>;
3796
+ getAvailableResolutions(): Promise<{
3797
+ width: number;
3798
+ height: number;
3799
+ }[]>;
3800
+ getCameraState(): 'opening' | 'open' | 'closed';
3801
+ getResolution(): {
3802
+ width: number;
3803
+ height: number;
3804
+ };
3805
+ getSelectedCamera(): {
3806
+ deviceId: string;
3807
+ label: string;
3808
+ };
3809
+ getVideoSettings(): MediaStreamConstraints;
3810
+ _ifSaveLastUsedCamera: boolean;
3811
+ get ifSaveLastUsedCamera(): boolean;
3812
+ set ifSaveLastUsedCamera(value: boolean);
3813
+ get ifSkipCameraInspection(): boolean;
3814
+ set ifSkipCameraInspection(value: boolean);
3815
+ isOpen(): boolean;
3816
+ isPaused(): boolean;
3817
+ resume(): Promise<void>;
3818
+ selectCamera(device: string | {
3819
+ deviceId: string;
3820
+ label: string;
3821
+ }): Promise<{
3822
+ deviceId: string;
3823
+ width: number;
3824
+ height: number;
3825
+ }>;
3826
+ setResolution(resolution: {
3827
+ width: number;
3828
+ height: number;
3829
+ }): Promise<{
3830
+ deviceId: string;
3831
+ width: number;
3832
+ height: number;
3833
+ }>;
3834
+ updateVideoSettings(constraints: MediaStreamConstraints): Promise<void>;
3835
+ _dceVideoSrc: string;
3836
+ get videoSrc(): string;
3837
+ set videoSrc(value: string | null);
3838
+ _dceEnhancedFeatures: any;
3839
+ _dceAutoZoomRange: {
3840
+ min: number;
3841
+ max: number;
3842
+ };
3843
+ disableEnhancedFeatures(feature: any): void;
3844
+ enableEnhancedFeatures(feature: any): void;
3845
+ getCameraSettings(): MediaTrackSettings;
3846
+ getCapabilities(): MediaTrackCapabilities;
3847
+ getColorTemperature(): number;
3848
+ getExposureCompensation(): number;
3849
+ getFrameRate(): number;
3850
+ setColorTemperature(value: number): Promise<void>;
3851
+ setExposureCompensation(value: number): Promise<void>;
3852
+ setFrameRate(value: number): Promise<void>;
3853
+ getZoomSettings(): {
3854
+ factor: number;
3855
+ };
3856
+ _oriSetZoom(zoom: number): Promise<void>;
3857
+ _dceZoom: number;
3858
+ setZoom(settings: {
3859
+ factor: number;
3860
+ }): Promise<void>;
3861
+ resetZoom(): void;
3862
+ _dceFocusSettings: any;
3863
+ getFocusSettings(): {
3864
+ mode: string;
3865
+ } | {
3866
+ mode: 'manual';
3867
+ distance: number;
3868
+ } | {
3869
+ mode: 'manual';
3870
+ area: {
3871
+ centerPoint: {
3872
+ x: string;
3873
+ y: string;
3874
+ };
3875
+ width?: string;
3876
+ height?: string;
3877
+ };
3878
+ };
3879
+ setFocus(settings: {
3880
+ mode: string;
3881
+ } | {
3882
+ mode: 'manual';
3883
+ distance: number;
3884
+ } | {
3885
+ mode: 'manual';
3886
+ area: {
3887
+ centerPoint: {
3888
+ x: string;
3889
+ y: string;
3890
+ };
3891
+ width?: string;
3892
+ height?: string;
3893
+ };
3894
+ }): Promise<void>;
3895
+ setAutoZoomRange(value: {
3896
+ min: number;
3897
+ max: number;
3898
+ }): void;
3899
+ getAutoZoomRange(): {
3900
+ min: number;
3901
+ max: number;
3902
+ };
3903
+ toggleMirroring(enable: boolean): void;
3904
+ _framePipeline: FramePipeline;
3905
+ fetchImage(): {
3906
+ bytes: Uint8Array;
3907
+ width: number;
3908
+ height: number;
3909
+ stride: number;
3910
+ format: any;
3911
+ toCanvas(): HTMLCanvasElement;
3912
+ };
3913
+ getImage(): {
3914
+ bytes: Uint8Array;
3915
+ width: number;
3916
+ height: number;
3917
+ stride: number;
3918
+ format: any;
3919
+ toCanvas(): HTMLCanvasElement;
3920
+ };
3921
+ _dceScanRegion: {
3922
+ x: number;
3923
+ y: number;
3924
+ width: number;
3925
+ height: number;
3926
+ isMeasuredInPercentage?: boolean;
3927
+ } | {
3928
+ left: number;
3929
+ top: number;
3930
+ right: number;
3931
+ bottom: number;
3932
+ isMeasuredInPercentage?: boolean;
3933
+ };
3934
+ getScanRegion(): {
3935
+ x: number;
3936
+ y: number;
3937
+ width: number;
3938
+ height: number;
3939
+ isMeasuredInPercentage?: boolean;
3940
+ } | {
3941
+ left: number;
3942
+ top: number;
3943
+ right: number;
3944
+ bottom: number;
3945
+ isMeasuredInPercentage?: boolean;
3946
+ };
3947
+ hasNextImageToFetch(): boolean;
3948
+ isBufferEmpty(): boolean;
3949
+ startFetching(): void;
3950
+ _pixelFormat: number;
3951
+ getPixelFormat(): number;
3952
+ setPixelFormat(format: number): void;
3953
+ _colourChannelUsageType: number;
3954
+ setColourChannelUsageType(format: number): void;
3955
+ getColourChannelUsageType(): number;
3956
+ setScanRegion(region?: {
3957
+ x: number;
3958
+ y: number;
3959
+ width: number;
3960
+ height: number;
3961
+ isMeasuredInPercentage?: boolean;
3962
+ } | {
3963
+ left: number;
3964
+ top: number;
3965
+ right: number;
3966
+ bottom: number;
3967
+ isMeasuredInPercentage?: boolean;
3968
+ }): void;
3969
+ stopFetching(): void;
3970
+ takePhoto(listener: (dceFrame: {
3971
+ bytes: Uint8Array;
3972
+ width: number;
3973
+ height: number;
3974
+ stride: number;
3975
+ format: any;
3976
+ toCanvas(): HTMLCanvasElement;
3977
+ }) => void): Promise<{
3978
+ bytes: Uint8Array;
3979
+ width: number;
3980
+ height: number;
3981
+ stride: number;
3982
+ format: any;
3983
+ toCanvas(): HTMLCanvasElement;
3984
+ }>;
3985
+ addImageToBuffer: any;
3986
+ clearBuffer: any;
3987
+ getBufferOverflowProtectionMode: any;
3988
+ getImageCount: any;
3989
+ getImageFetchInterval: any;
3990
+ getMaxImageCount: any;
3991
+ hasImage: any;
3992
+ setBufferOverflowProtectionMode: any;
3993
+ setErrorListener: any;
3994
+ setImageFetchInterval: any;
3995
+ setMaxImageCount: any;
3996
+ setNextImageToReturn: any;
3997
+ _dceSettingsBeforeSingleFrameMode: any;
3998
+ _singleFrameMode: "disabled" | "camera" | "image";
3999
+ _singleFrameModeClickCallback: any;
4000
+ _singleFrameModeResultForDcv: DCEFrame;
4001
+ _singleFrameModeCvs: HTMLCanvasElement;
4002
+ get singleFrameMode(): "disabled" | "camera" | "image";
4003
+ set singleFrameMode(value: "disabled" | "camera" | "image");
4004
+ setCameraView(view: CameraView): void;
4005
+ getCameraView(): CameraView;
4006
+ getVideoEl(): HTMLVideoElement;
4007
+ convertToPageCoordinates(point: {
4008
+ x: number;
4009
+ y: number;
4010
+ }): {
4011
+ x: number;
4012
+ y: number;
4013
+ };
4014
+ convertToClientCoordinates(point: {
4015
+ x: number;
4016
+ y: number;
4017
+ }): {
4018
+ x: number;
4019
+ y: number;
4020
+ };
4021
+ convertToScanRegionCoordinates(point: {
4022
+ x: number;
4023
+ y: number;
4024
+ }): {
4025
+ x: number;
4026
+ y: number;
4027
+ };
4028
+ convertToContainCoordinates(point: {
4029
+ x: number;
4030
+ y: number;
4031
+ }): {
4032
+ x: number;
4033
+ y: number;
4034
+ };
4035
+ _dceEventListeners: {
4036
+ [key: string]: Set<Function>;
4037
+ };
4038
+ on(eventName: string, listener: Function): void;
4039
+ off(eventName: string, listener: Function): void;
4040
+ _dceMNIsBeepBarcode: boolean;
4041
+ _dceMNIsVibrateBarcode: boolean;
4042
+ getUIElement(): HTMLElement;
4043
+ setUIElement(ui: HTMLDivElement | string): Promise<void>;
4044
+ getVideoElement(): HTMLVideoElement;
4045
+ setVideoFit(fit: 'contain' | 'cover' | 'fill'): void;
4046
+ getVideoFit(): 'contain' | 'cover' | 'fill';
4047
+ getVisibleRegionOfVideo(options?: {
4048
+ inPixels?: boolean;
4049
+ }): {
4050
+ x: number;
4051
+ y: number;
4052
+ width: number;
4053
+ height: number;
4054
+ isMeasuredInPercentage?: boolean;
4055
+ };
4056
+ _dceRegionMaskStyle: {
4057
+ lineWidth: number;
4058
+ strokeStyle: string;
4059
+ fillStyle: string;
4060
+ };
4061
+ setScanRegionMaskStyle(style: {
4062
+ lineWidth: number;
4063
+ strokeStyle: string;
4064
+ fillStyle: string;
4065
+ }): void;
4066
+ getScanRegionMaskStyle(): {
4067
+ lineWidth: number;
4068
+ strokeStyle: string;
4069
+ fillStyle: string;
4070
+ };
4071
+ _dceRegionMaskVisible: boolean;
4072
+ setScanRegionMaskVisible(visible: boolean): void;
4073
+ isScanRegionMaskVisible(): boolean;
4074
+ setScanLaserVisible(visible: boolean): void;
4075
+ isScanLaserVisible(): boolean;
4076
+ setPowerByMessageVisible(visible: boolean): void;
4077
+ isPowerByMessageVisible(): boolean;
4078
+ _dceTipDuration: number;
4079
+ _dceTipMessage: string;
4080
+ getTipConfig(): TipConfig;
4081
+ setTipConfig(tipConfig: TipConfig): void;
4082
+ setTipVisible(visible: boolean): void;
4083
+ isTipVisible(): boolean;
4084
+ updateTipMessage(message: string): void;
4085
+ _drawingLayers: DrawingLayer[];
4086
+ createDrawingLayer(): DrawingLayer;
4087
+ getDrawingLayer(id: number): DrawingLayer;
4088
+ getAllDrawingLayers(): DrawingLayer[];
4089
+ clearUserDefinedDrawingLayers(): void;
4090
+ deleteUserDefinedDrawingLayer(id: number): void;
4091
+ clearAllInnerDrawingItems(_?: boolean): void;
4092
+ _capturedResultReceiver: any;
4093
+ }
4094
+ declare function _bufferToCanvas(uint8Array: Uint8Array, width: number, height: number, format: number): HTMLCanvasElement;
4095
+ declare class Feedback {
4096
+ static _beepInstance: Beep;
4097
+ static beep(): void;
4098
+ static get beepSoundSource(): string;
4099
+ static set beepSoundSource(value: string);
4100
+ static vibrate(): void;
4101
+ static vibrateDuration: number;
4102
+ }
4103
+ declare const DrawingStyleManager: {
4104
+ STYLE_GREEN_STROKE: any;
4105
+ STYLE_GREEN_STROKE_FILL: any;
4106
+ STYLE_GREEN_STROKE_TRANSPARENT: any;
4107
+ STYLE_BLUE_STROKE: any;
4108
+ STYLE_BLUE_STROKE_FILL: any;
4109
+ STYLE_BLUE_STROKE_TRANSPARENT: any;
4110
+ STYLE_ORANGE_STROKE: any;
4111
+ STYLE_ORANGE_STROKE_FILL: any;
4112
+ STYLE_ORANGE_STROKE_TRANSPARENT: any;
4113
+ STYLE_YELLOW_STROKE: any;
4114
+ STYLE_YELLOW_STROKE_FILL: any;
4115
+ STYLE_YELLOW_STROKE_TRANSPARENT: any;
4116
+ createDrawingStyle(style: any): any;
4117
+ getDrawingStyle(id: any): any;
4118
+ getAllDrawingStyles(): any[];
4119
+ updateDrawingStyle(id: any, style: any): void;
4120
+ };
4121
+ declare class DrawingLayer {
4122
+ _visible: boolean;
4123
+ _dce: CameraView;
4124
+ _ctx: CanvasRenderingContext2D;
4125
+ _defaultStyle: any;
4126
+ _drawingItems: DrawingItem[];
4127
+ _mode: 'editor' | 'viewer';
4128
+ _editorView: any;
4129
+ _renderTask: any;
4130
+ _newSelectedDrawingItems: DrawingItem[];
4131
+ _newDeselectedDrawingItems: DrawingItem[];
4132
+ _selectionChangedTask: any;
4133
+ _onSelectionChanged: (newSelectedDrawingItems: DrawingItem[], newDeselectedDrawingItems: DrawingItem[]) => void;
4134
+ getId(): this;
4135
+ isVisible(): boolean;
4136
+ setVisible(value: boolean): void;
4137
+ setDefaultStyle(drawingStyleId: any, _1?: any, _2?: any): void;
4138
+ addDrawingItems(drawingItems: DrawingItem[]): void;
4139
+ removeDrawingItems(drawingItems: DrawingItem[]): void;
4140
+ setDrawingItems(drawingItems: DrawingItem[]): void;
4141
+ getDrawingItems(filter?: (drawingItem: DrawingItem) => boolean): DrawingItem[];
4142
+ hasDrawingItem(drawingItem: DrawingItem): boolean;
4143
+ getSelectedDrawingItems(): any;
4144
+ clearDrawingItems(): void;
4145
+ _delayRenderAll(): void;
4146
+ renderAll(): void;
4147
+ getMode(): "editor" | "viewer";
4148
+ setMode(mode: 'editor' | 'viewer'): Promise<void>;
4149
+ _delaySelectionChanged(): void;
4150
+ get onSelectionChanged(): (newSelectedDrawingItems: DrawingItem[], newDeselectedDrawingItems: DrawingItem[]) => void;
4151
+ set onSelectionChanged(value: (newSelectedDrawingItems: DrawingItem[], newDeselectedDrawingItems: DrawingItem[]) => void);
4152
+ }
4153
+ /**
4154
+ * Determines if a point is inside a quadrilateral.
4155
+ * @param {number[]} point - [x, y] coordinates of the point.
4156
+ * @param {number[][]} polygon - Array of points [[x0, y0], [x1, y1], [x2, y2], [x3, y3]].
4157
+ * @returns {boolean} - True if the point is inside.
4158
+ */
4159
+ declare function _isPointInPolygon(point: number[], polygon: number[][]): boolean;
4160
+ /**
4161
+ * Calculates the shortest distance from a point to a line segment.
4162
+ * @param {number[]} p - The point [x, y]
4163
+ * @param {number[][]} segment - The segment [[x1, y1], [x2, y2]]
4164
+ * @returns {number} The shortest distance
4165
+ */
4166
+ declare function _distToSegment(p: number[], segment: number[][]): number;
4167
+ declare class DrawingItem {
4168
+ coordinateBase: string;
4169
+ drawingLayerId: any;
4170
+ drawingStyleId: any;
4171
+ mediaType: EnumDrawingItemMediaType;
4172
+ _notes: Note[];
4173
+ _bSelected: boolean;
4174
+ _dceEventListeners: {
4175
+ [key: string]: Set<Function>;
4176
+ };
4177
+ get _ps(): {
4178
+ x: number;
4179
+ y: number;
4180
+ }[];
4181
+ getState(): EnumDrawingItemState;
4182
+ addNote(note: Note, replace?: boolean): void;
4183
+ getNote(name: string): Note;
4184
+ getNotes(): Note[];
4185
+ hasNote(name: string): boolean;
4186
+ updateNote(name: string, content: any, isMergeContent?: boolean): void;
4187
+ deleteNote(name: string): void;
4188
+ clearNotes(): void;
4189
+ _delayRenderAll(): void;
4190
+ _setSelected(value: boolean): void;
4191
+ on(type: string, listener: Function): void;
4192
+ off(type: string, listener: Function): void;
4193
+ }
4194
+ declare class LineDrawingItem extends DrawingItem {
4195
+ line: {
4196
+ startPoint: {
4197
+ x: number;
4198
+ y: number;
4199
+ };
4200
+ endPoint: {
4201
+ x: number;
4202
+ y: number;
4203
+ };
4204
+ };
4205
+ get _ps(): {
4206
+ x: number;
4207
+ y: number;
4208
+ }[];
4209
+ constructor(line: {
4210
+ startPoint: {
4211
+ x: number;
4212
+ y: number;
4213
+ };
4214
+ endPoint: {
4215
+ x: number;
4216
+ y: number;
4217
+ };
4218
+ }, drawingStyleId?: any);
4219
+ getLine(): {
4220
+ startPoint: {
4221
+ x: number;
4222
+ y: number;
4223
+ };
4224
+ endPoint: {
4225
+ x: number;
4226
+ y: number;
4227
+ };
4228
+ };
4229
+ setLine(value: any): void;
4230
+ }
4231
+ declare class QuadDrawingItem extends DrawingItem {
4232
+ quad: {
4233
+ points: {
4234
+ x: number;
4235
+ y: number;
4236
+ }[];
4237
+ };
4238
+ get _ps(): {
4239
+ x: number;
4240
+ y: number;
4241
+ }[];
4242
+ constructor(quad: {
4243
+ points: {
4244
+ x: number;
4245
+ y: number;
4246
+ }[];
4247
+ }, drawingStyleId?: any);
4248
+ getQuad(): {
4249
+ points: {
4250
+ x: number;
4251
+ y: number;
4252
+ }[];
4253
+ };
4254
+ setQuad(value: any): void;
4255
+ }
4256
+ declare class RectDrawingItem extends DrawingItem {
4257
+ rect: {
4258
+ x: number;
4259
+ y: number;
4260
+ width: number;
4261
+ height: number;
4262
+ };
4263
+ get _ps(): {
4264
+ x: number;
4265
+ y: number;
4266
+ }[];
4267
+ constructor(rect: {
4268
+ x: number;
4269
+ y: number;
4270
+ width: number;
4271
+ height: number;
4272
+ }, drawingStyleId?: any);
4273
+ getRect(): {
4274
+ x: number;
4275
+ y: number;
4276
+ width: number;
4277
+ height: number;
4278
+ };
4279
+ setRect(value: any): void;
4280
+ }
4281
+ declare class TextDrawingItem extends DrawingItem {
4282
+ text: string;
4283
+ rect: {
4284
+ x: number;
4285
+ y: number;
4286
+ width: number;
4287
+ height: number;
4288
+ };
4289
+ get _ps(): {
4290
+ x: number;
4291
+ y: number;
4292
+ }[];
4293
+ constructor(text: string, rect: {
4294
+ x: number;
4295
+ y: number;
4296
+ width: number;
4297
+ height: number;
4298
+ }, drawingStyleId?: any);
4299
+ getText(): string;
4300
+ setText(value: any): void;
4301
+ getRect(): {
4302
+ x: number;
4303
+ y: number;
4304
+ width: number;
4305
+ height: number;
4306
+ };
4307
+ setRect(value: any): void;
4308
+ }
4309
+ declare class ImageDrawingItem extends DrawingItem {
4310
+ image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
4311
+ rect: {
4312
+ x: number;
4313
+ y: number;
4314
+ width: number;
4315
+ height: number;
4316
+ };
4317
+ maintainAspectRatio: boolean;
4318
+ get _ps(): {
4319
+ x: number;
4320
+ y: number;
4321
+ }[];
4322
+ constructor(image: {
4323
+ bytes: Uint8Array;
4324
+ width: number;
4325
+ height: number;
4326
+ stride: number;
4327
+ format: any;
4328
+ } | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, rect: {
4329
+ x: number;
4330
+ y: number;
4331
+ width: number;
4332
+ height: number;
4333
+ }, maintainAspectRatio: boolean, drawingStyleId?: any);
4334
+ getImage(): HTMLVideoElement | HTMLCanvasElement | HTMLImageElement;
4335
+ setImage(value: any): void;
4336
+ getRect(): {
4337
+ x: number;
4338
+ y: number;
4339
+ width: number;
4340
+ height: number;
4341
+ };
4342
+ setRect(value: any): void;
4343
+ }
4344
+
4345
+ declare enum EnumDrawingItemMediaType {
4346
+ /**
4347
+ * Represents a rectangle, a basic geometric shape with four sides where opposite sides are equal in length and it has four right angles.
4348
+ */
4349
+ DIMT_RECTANGLE = 1,
4350
+ /**
4351
+ * Represents any four-sided figure. This includes squares, rectangles, rhombuses, and more general forms that do not necessarily have right angles or equal sides.
4352
+ */
4353
+ DIMT_QUADRILATERAL = 2,
4354
+ /**
4355
+ * Represents a text element. This allows for the inclusion of textual content as a distinct drawing item within the graphic representation.
4356
+ */
4357
+ DIMT_TEXT = 4,
4358
+ /**
4359
+ * Represents an arc, which is a portion of the circumference of a circle or an ellipse. Arcs are used to create curved shapes and segments.
4360
+ */
4361
+ DIMT_ARC = 8,
4362
+ /**
4363
+ * Represents an image. This enables embedding bitmap images within the drawing context.
4364
+ */
4365
+ DIMT_IMAGE = 16,
4366
+ /**
4367
+ * Represents a polygon, which is a plane figure that is described by a finite number of straight line segments connected to form a closed polygonal chain or circuit.
4368
+ */
4369
+ DIMT_POLYGON = 32,
4370
+ /**
4371
+ * Represents a line segment. This is the simplest form of a drawing item, defined by two endpoints and the straight path connecting them.
4372
+ */
4373
+ DIMT_LINE = 64,
4374
+ /**
4375
+ * Represents a group of drawing items. This allows for the logical grouping of multiple items, treating them as a single entity for manipulation or transformation purposes.
4376
+ */
4377
+ DIMT_GROUP = 128
4378
+ }
4379
+ declare enum EnumDrawingItemState {
4380
+ /**
4381
+ * DIS_DEFAULT: The default state of a drawing item. This state indicates that the drawing item is in its normal, unselected state.
4382
+ */
4383
+ DIS_DEFAULT = 1,
4384
+ /**
4385
+ * DIS_SELECTED: Indicates that the drawing item is currently selected. This state can trigger different behaviors or visual styles, such as highlighting the item to show it is active or the focus of user interaction.
4386
+ */
4387
+ DIS_SELECTED = 2
4388
+ }
4389
+ declare enum EnumEnhancedFeatures {
4390
+ /**
4391
+ * Enables auto-focus on areas likely to contain barcodes, assisting in their identification and interpretation.
4392
+ */
4393
+ EF_ENHANCED_FOCUS = 4,
4394
+ /**
4395
+ * Facilitates automatic zooming in on areas likely to contain barcodes, aiding in their detection and decoding.
4396
+ */
4397
+ EF_AUTO_ZOOM = 16,
4398
+ /**
4399
+ * Allows users to tap on a specific item or area in the video feed to focus on, simplifying the interaction for selecting or highlighting important elements.
4400
+ */
4401
+ EF_TAP_TO_FOCUS = 64
4402
+ }
4403
+ declare enum EnumPixelFormat {
4404
+ GREY = "grey",
4405
+ GREY32 = "grey32",
4406
+ RGBA = "rgba",
4407
+ RBGA = "rbga",
4408
+ GRBA = "grba",
4409
+ GBRA = "gbra",
4410
+ BRGA = "brga",
4411
+ BGRA = "bgra"
4412
+ }
4413
+ interface Resolution {
4414
+ width: number;
4415
+ height: number;
4416
+ }
4417
+ interface DCEFrame {
4418
+ bytes: Uint8Array;
4419
+ width: number;
4420
+ height: number;
4421
+ stride: number;
4422
+ format: any;
4423
+ toCanvas(): HTMLCanvasElement;
4424
+ }
4425
+ interface DrawingStyle {
4426
+ fillStyle?: string;
4427
+ lineWidth?: number;
4428
+ paintMode?: string;
4429
+ strokeStyle?: string;
4430
+ }
4431
+ interface PlayCallbackInfo {
4432
+ deviceId: string;
4433
+ width: number;
4434
+ height: number;
4435
+ }
4436
+ interface VideoDeviceInfo {
4437
+ deviceId: string;
4438
+ label: string;
4439
+ }
4440
+ interface VideoFrameTag {
4441
+ /** The unique identifier of the image. */
4442
+ imageId: number;
4443
+ /** The type of the image. */
4444
+ type: any;
4445
+ /** Indicates whether the video frame is cropped. */
4446
+ isCropped: boolean;
4447
+ /** The region based on which the original frame was cropped. If `isCropped` is false, the region covers the entire original image. */
4448
+ cropRegion: any;
4449
+ /** The original width of the video frame before any cropping. */
4450
+ originalWidth: number;
4451
+ /** The original height of the video frame before any cropping. */
4452
+ originalHeight: number;
4453
+ /** The current width of the video frame after cropping. */
4454
+ currentWidth: number;
4455
+ /** The current height of the video frame after cropping. */
4456
+ currentHeight: number;
4457
+ /** The time spent acquiring the frame, in milliseconds. */
4458
+ timeSpent: number;
4459
+ /** The timestamp marking the completion of the frame acquisition. */
4460
+ timeStamp: number;
4461
+ }
4462
+ interface TipConfig {
4463
+ /** The top left point of the tip message box. */
4464
+ topLeftPoint?: any;
4465
+ /** The width of the tip message box. */
4466
+ width?: number;
4467
+ /** The display duration of the tip in milliseconds. */
4468
+ duration: number;
4469
+ /** The base coordinate system used (e.g., "view" or "image"). */
4470
+ coordinateBase?: "view" | "image";
4471
+ }
4472
+ interface Note {
4473
+ /** The name of the note. */
4474
+ name: string;
4475
+ /** The content of the note, can be of any type. */
4476
+ content: any;
4477
+ }
4478
+
4479
+ export { Beep, Camera, CameraEnhancer, CameraEnhancerModule, CameraInfo, CameraPreset, CameraStatus, CameraView, CameraZsFunc, DCEFrame, DMMoreMediaTrackCapabilities, DrawingItem, DrawingLayer, DrawingStyle, DrawingStyleManager, EnumDrawingItemMediaType, EnumDrawingItemState, EnumEnhancedFeatures, EnumPixelFormat, Feedback, FramePipeline, ImageDrawingItem, LineDrawingItem, Note, PlayCallbackInfo, QuadDrawingItem, RectDrawingItem, Resolution, TextDrawingItem, TipConfig, VideoDeviceInfo, VideoFrameTag, _bufferToCanvas, _distToSegment, _isPointInPolygon, beep, stringToHtml, vibrate };
4480
+