dynamsoft-barcode-reader-bundle 10.4.3100 → 10.5.1000-iv-singlewasm

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 (66) hide show
  1. package/dynamsoft-barcode-reader@10.4.31/dist/DBR-PresetTemplates.json +628 -0
  2. package/dynamsoft-barcode-reader@10.4.31/dist/dbr.d.ts +383 -0
  3. package/dynamsoft-barcode-reader@10.4.31/dist/dbr.esm.js +11 -0
  4. package/dynamsoft-barcode-reader@10.4.31/dist/dbr.js +11 -0
  5. package/dynamsoft-barcode-reader@10.4.31/dist/dbr.mjs +11 -0
  6. package/dynamsoft-camera-enhancer@4.1.1/dist/dce.d.ts +1877 -0
  7. package/dynamsoft-camera-enhancer@4.1.1/dist/dce.esm.js +11 -0
  8. package/dynamsoft-camera-enhancer@4.1.1/dist/dce.js +11 -0
  9. package/dynamsoft-camera-enhancer@4.1.1/dist/dce.mjs +11 -0
  10. package/dynamsoft-camera-enhancer@4.1.1/dist/dce.mobile-native.ui.html +222 -0
  11. package/dynamsoft-camera-enhancer@4.1.1/dist/dce.ui.html +115 -0
  12. package/dynamsoft-capture-vision-router@2.4.33/dist/cvr.d.ts +663 -0
  13. package/dynamsoft-capture-vision-router@2.4.33/dist/cvr.esm.js +2121 -0
  14. package/dynamsoft-capture-vision-router@2.4.33/dist/cvr.js +11 -0
  15. package/dynamsoft-capture-vision-router@2.4.33/dist/cvr.mjs +2121 -0
  16. package/dynamsoft-capture-vision-router@2.4.33/dist/cvr.worker.js +21 -0
  17. package/dynamsoft-capture-vision-std@1.4.21/dist/std.js +1 -0
  18. package/dynamsoft-capture-vision-std@1.4.21/dist/std.wasm +0 -0
  19. package/dynamsoft-code-parser@2.4.32/dist/dcp.d.ts +90 -0
  20. package/dynamsoft-code-parser@2.4.32/dist/dcp.esm.js +11 -0
  21. package/dynamsoft-code-parser@2.4.32/dist/dcp.js +11 -0
  22. package/dynamsoft-code-parser@2.4.32/dist/dcp.worker.js +21 -0
  23. package/dynamsoft-code-parser@2.4.32/dist/specification/AADHAAR.data +0 -0
  24. package/dynamsoft-code-parser@2.4.32/dist/specification/AADHAAR_Map.txt +3 -0
  25. package/dynamsoft-code-parser@2.4.32/dist/specification/AAMVA_DL_ID.data +0 -0
  26. package/dynamsoft-code-parser@2.4.32/dist/specification/AAMVA_DL_ID_WITH_MAG_STRIPE.data +0 -0
  27. package/dynamsoft-code-parser@2.4.32/dist/specification/AAMVA_Map.txt +70 -0
  28. package/dynamsoft-code-parser@2.4.32/dist/specification/MRTD_Map.txt +255 -0
  29. package/dynamsoft-code-parser@2.4.32/dist/specification/MRTD_TD1_ID.data +0 -0
  30. package/dynamsoft-code-parser@2.4.32/dist/specification/MRTD_TD2_FRENCH_ID.data +0 -0
  31. package/dynamsoft-code-parser@2.4.32/dist/specification/MRTD_TD2_ID.data +0 -0
  32. package/dynamsoft-code-parser@2.4.32/dist/specification/MRTD_TD2_VISA.data +0 -0
  33. package/dynamsoft-code-parser@2.4.32/dist/specification/MRTD_TD3_PASSPORT.data +0 -0
  34. package/dynamsoft-code-parser@2.4.32/dist/specification/MRTD_TD3_VISA.data +0 -0
  35. package/dynamsoft-code-parser@2.4.32/dist/specification/SOUTH_AFRICA_DL.data +0 -0
  36. package/dynamsoft-code-parser@2.4.32/dist/specification/SouthAfricaDL_Map.txt +3 -0
  37. package/dynamsoft-code-parser@2.4.32/dist/specification/VIN.data +0 -0
  38. package/dynamsoft-code-parser@2.4.32/dist/specification/VIN_Map.txt +150 -0
  39. package/dynamsoft-core@3.4.31/dist/core.d.ts +1019 -0
  40. package/dynamsoft-core@3.4.31/dist/core.esm.js +11 -0
  41. package/dynamsoft-core@3.4.31/dist/core.js +11 -0
  42. package/dynamsoft-core@3.4.31/dist/core.mjs +11 -0
  43. package/dynamsoft-core@3.4.31/dist/core.worker.js +11 -0
  44. package/dynamsoft-license@3.4.31/dist/dls.license.dialog.html +20 -0
  45. package/dynamsoft-license@3.4.31/dist/license.d.ts +40 -0
  46. package/dynamsoft-license@3.4.31/dist/license.esm.js +11 -0
  47. package/dynamsoft-license@3.4.31/dist/license.js +11 -0
  48. package/dynamsoft-license@3.4.31/dist/license.mjs +11 -0
  49. package/dynamsoft-license@3.4.31/dist/license.worker.js +11 -0
  50. package/dynamsoft-utility@1.4.32/dist/utility.d.ts +118 -0
  51. package/dynamsoft-utility@1.4.32/dist/utility.esm.js +11 -0
  52. package/dynamsoft-utility@1.4.32/dist/utility.js +11 -0
  53. package/dynamsoft-utility@1.4.32/dist/utility.mjs +11 -0
  54. package/dynamsoft-utility@1.4.32/dist/utility.worker.js +11 -0
  55. package/package.json +9 -82
  56. package/API Reference.url +0 -2
  57. package/LEGAL.txt +0 -353
  58. package/LICENSE +0 -4
  59. package/README.html +0 -836
  60. package/README.md +0 -735
  61. package/samples.url +0 -2
  62. /package/{dist → dynamsoft-barcode-reader-bundle@10.4.3100/dist}/dbr.bundle.d.ts +0 -0
  63. /package/{dist → dynamsoft-barcode-reader-bundle@10.4.3100/dist}/dbr.bundle.esm.d.ts +0 -0
  64. /package/{dist → dynamsoft-barcode-reader-bundle@10.4.3100/dist}/dbr.bundle.js +0 -0
  65. /package/{dist → dynamsoft-barcode-reader-bundle@10.4.3100/dist}/dbr.bundle.mjs +0 -0
  66. /package/{dist → dynamsoft-barcode-reader-bundle@10.4.3100/dist}/dbr.no-content-bundle.esm.js +0 -0
@@ -0,0 +1,1877 @@
1
+ import { ImageTag, DSRect, DSImageData, Point, Rect, Polygon, LineSegment, Quadrilateral, ImageSourceAdapter, Warning, ImageSourceErrorListener, EnumImagePixelFormat } from 'dynamsoft-core';
2
+
3
+ declare class CameraEnhancerModule {
4
+ static getVersion(): string;
5
+ }
6
+
7
+ interface VideoFrameTag extends ImageTag {
8
+ isCropped: boolean;
9
+ cropRegion: DSRect;
10
+ originalWidth: number;
11
+ originalHeight: number;
12
+ currentWidth: number;
13
+ currentHeight: number;
14
+ timeSpent: number;
15
+ timeStamp: number;
16
+ }
17
+
18
+ interface DCEFrame extends DSImageData {
19
+ toCanvas: () => HTMLCanvasElement;
20
+ isDCEFrame: boolean;
21
+ tag?: VideoFrameTag;
22
+ }
23
+
24
+ interface DrawingItemEvent extends Event {
25
+ targetItem: DrawingItem;
26
+ itemClientX: number;
27
+ itemClientY: number;
28
+ itemPageX: number;
29
+ itemPageY: number;
30
+ }
31
+
32
+ interface DrawingStyle {
33
+ id?: number;
34
+ lineWidth?: number;
35
+ fillStyle?: string;
36
+ strokeStyle?: string;
37
+ paintMode?: "fill" | "stroke" | "strokeAndFill";
38
+ fontFamily?: string;
39
+ fontSize?: number;
40
+ }
41
+
42
+ interface Note {
43
+ name: string;
44
+ content: any;
45
+ }
46
+
47
+ interface PlayCallbackInfo {
48
+ height: number;
49
+ width: number;
50
+ deviceId: string;
51
+ }
52
+
53
+ interface Resolution {
54
+ width: number;
55
+ height: number;
56
+ }
57
+
58
+ interface TipConfig {
59
+ topLeftPoint: Point;
60
+ width: number;
61
+ duration: number;
62
+ coordinateBase?: "view" | "image";
63
+ }
64
+
65
+ interface VideoDeviceInfo {
66
+ deviceId: string;
67
+ label: string;
68
+ /** @ignore */
69
+ _checked: boolean;
70
+ }
71
+
72
+ declare enum EnumDrawingItemMediaType {
73
+ DIMT_RECTANGLE = 1,
74
+ DIMT_QUADRILATERAL = 2,
75
+ DIMT_TEXT = 4,
76
+ DIMT_ARC = 8,
77
+ DIMT_IMAGE = 16,
78
+ DIMT_POLYGON = 32,
79
+ DIMT_LINE = 64,
80
+ DIMT_GROUP = 128
81
+ }
82
+
83
+ declare enum EnumDrawingItemState {
84
+ DIS_DEFAULT = 1,
85
+ DIS_SELECTED = 2
86
+ }
87
+
88
+ declare enum EnumEnhancedFeatures {
89
+ EF_ENHANCED_FOCUS = 4,
90
+ EF_AUTO_ZOOM = 16,
91
+ EF_TAP_TO_FOCUS = 64
92
+ }
93
+
94
+ declare enum EnumItemType {
95
+ ARC = 0,
96
+ IMAGE = 1,
97
+ LINE = 2,
98
+ POLYGON = 3,
99
+ QUAD = 4,
100
+ RECT = 5,
101
+ TEXT = 6,
102
+ GROUP = 7
103
+ }
104
+ declare enum EnumItemState {
105
+ DEFAULT = 0,
106
+ SELECTED = 1
107
+ }
108
+ declare abstract class DrawingItem {
109
+ #private;
110
+ /**
111
+ * TODO: replace with enum
112
+ * @ignore
113
+ */
114
+ static arrMediaTypes: string[];
115
+ /**
116
+ * @ignore
117
+ */
118
+ static mapItemType: Map<EnumItemType, string>;
119
+ /**
120
+ * TOOD: replace with enum
121
+ * @ignore
122
+ */
123
+ static arrStyleSelectors: string[];
124
+ /**
125
+ * @ignore
126
+ */
127
+ static mapItemState: Map<EnumItemState, string>;
128
+ protected _fabricObject: any;
129
+ /**
130
+ * TODO: make it private and replace it with 'mediaType'
131
+ * @ignore
132
+ */
133
+ _mediaType: string;
134
+ /**
135
+ * @ignore
136
+ */
137
+ get mediaType(): EnumDrawingItemMediaType;
138
+ /**
139
+ * TODO: rename it to 'state' and return enum
140
+ */
141
+ get styleSelector(): string;
142
+ /**
143
+ * @ignore
144
+ */
145
+ styleId?: number;
146
+ /**
147
+ * Returns or sets the numeric ID for the `DrawingStyle` that applies to this `DrawingItem`.
148
+ * Invoke `renderAll()` for the new `DrawingStyle` to take effect.
149
+ */
150
+ set drawingStyleId(id: number);
151
+ get drawingStyleId(): number;
152
+ /**
153
+ * Returns or sets the coordinate system base with a string:
154
+ * - "view" for viewport-based coordinates or
155
+ * - "image" for image-based coordinates.
156
+ */
157
+ set coordinateBase(base: "view" | "image");
158
+ get coordinateBase(): "view" | "image";
159
+ /**
160
+ * @ignore
161
+ */
162
+ _zIndex?: number;
163
+ /**
164
+ * @ignore
165
+ */
166
+ _drawingLayer: any;
167
+ /**
168
+ * @ignore
169
+ */
170
+ _drawingLayerId: number;
171
+ /**
172
+ * Returns the numeric ID for the `DrawingLayer` this `DrawingItem` belongs to.
173
+ */
174
+ get drawingLayerId(): number;
175
+ /**
176
+ * record the item's styles
177
+ * TODO: use enum
178
+ * @ignore
179
+ */
180
+ _mapState_StyleId: Map<string, number>;
181
+ protected mapEvent_Callbacks: Map<string, Map<Function, Function>>;
182
+ protected mapNoteName_Content: Map<string, Array<any>>;
183
+ /**
184
+ * @ignore
185
+ */
186
+ readonly isDrawingItem: boolean;
187
+ /**
188
+ *
189
+ * @param fabricObject
190
+ * @param drawingStyleId
191
+ * @ignore
192
+ */
193
+ constructor(fabricObject?: any, drawingStyleId?: number);
194
+ protected _setFabricObject(fabricObject: any): void;
195
+ /**
196
+ *
197
+ * @returns
198
+ * @ignore
199
+ */
200
+ _getFabricObject(): any;
201
+ /**
202
+ *
203
+ * @param state
204
+ * @ignore
205
+ */
206
+ setState(state: EnumDrawingItemState): void;
207
+ /**
208
+ * Returns the current state of the `DrawingItem`.
209
+ *
210
+ * @returns The current state of the `DrawingItem`, of type `EnumDrawingItemState`.
211
+ */
212
+ getState(): EnumDrawingItemState;
213
+ /**
214
+ * @ignore
215
+ */
216
+ _on(eventName: string, listener: (event: DrawingItemEvent) => void): void;
217
+ /**
218
+ * Binds a listener for a specific event.
219
+ * The event name is limited to "mousedown" | "mouseup" | "dblclick" | "mouseover" | "mouseout".
220
+ * @param eventName Specifies the event by its name.
221
+ * @param listener The event listener.
222
+ */
223
+ on(eventName: "mousedown" | "mouseup" | "dblclick" | "mouseover" | "mouseout", listener: (event: DrawingItemEvent) => void): void;
224
+ /**
225
+ * @ignore
226
+ */
227
+ _off(eventName: string, listener: (event: DrawingItemEvent) => void): void;
228
+ /**
229
+ * Unbinds a listener for a specific event.
230
+ * The event name is limited to "mousedown" | "mouseup" | "dblclick" | "mouseover" | "mouseout".
231
+ * @param eventName Specifies the event by its name.
232
+ * @param listener The event listener.
233
+ */
234
+ off(eventName: "mousedown" | "mouseup" | "dblclick" | "mouseover" | "mouseout", listener: (event: DrawingItemEvent) => void): void;
235
+ /**
236
+ * Set if this item can be edited.
237
+ * @param editable
238
+ * @ignore
239
+ */
240
+ _setEditable(editable: boolean): void;
241
+ /**
242
+ * Checks if a `Note` object with the specified name exists.
243
+ * @param name Specifies the name of the `Note` object.
244
+ *
245
+ * @returns Boolean indicating whether the `Note` object exists.
246
+ */
247
+ hasNote(name: string): boolean;
248
+ /**
249
+ * Adds a `Note` object to this `DrawingItem`.
250
+ * @param note Specifies the `Note` object.
251
+ * @param replace [Optional] Whether to replace an existing note if the notes share the same name.
252
+ */
253
+ addNote(note: Note, replace?: boolean): void;
254
+ /**
255
+ * Returns a `Note` object specified by its name, if it exists.
256
+ * @param name Specifies the name of the `Note` object.
257
+ *
258
+ * @returns The corresponding `Note` object specified by its name, if it exists.
259
+ */
260
+ getNote(name: string): Note;
261
+ /**
262
+ * Returns a collection of all existing `Note` objects on this `DrawingItem`.
263
+ *
264
+ * @returns All existing `Note` objects on this `DrawingItem`.
265
+ */
266
+ getNotes(): Array<Note>;
267
+ /**
268
+ * Updates the content of a specified `Note` object.
269
+ * @param name Specifies the name of the `Note` object.
270
+ * @param content Specifies the new content, can be of any type.
271
+ * @param mergeContent [Optional] Whether to merge the new content with the existing one.
272
+ */
273
+ updateNote(name: string, content: any, mergeContent?: boolean): void;
274
+ /**
275
+ * Deletes a `Note` object specified by its name.
276
+ * @param name Specifies the name of the `Note` object.
277
+ */
278
+ deleteNote(name: string): void;
279
+ /**
280
+ * Deletes all `Note` objects on this `DrawingItem`.
281
+ */
282
+ clearNotes(): void;
283
+ protected abstract extendSet(property: string, value: any): boolean;
284
+ protected abstract extendGet(property: string): any;
285
+ /**
286
+ *
287
+ * @param property
288
+ * @returns
289
+ * @ignore
290
+ */
291
+ set(property: string, value: any): void;
292
+ /**
293
+ *
294
+ * @param property
295
+ * @returns
296
+ * @ignore
297
+ */
298
+ get(property: string): any;
299
+ /**
300
+ * Remove this item from drawing layer.
301
+ * @ignore
302
+ */
303
+ remove(): void;
304
+ /**
305
+ * Convert item's property(width, height, x, y, etc.) from related to image/video to related to view/page.
306
+ * @param value
307
+ * @returns
308
+ */
309
+ protected convertPropFromImageToView(value: number): number;
310
+ /**
311
+ * Convert item's property(width, height, x, y, etc.) from related to view/page to related to image/video.
312
+ * @param value
313
+ * @returns
314
+ */
315
+ protected convertPropFromViewToImage(value: number): number;
316
+ protected abstract updateCoordinateBaseFromImageToView(): void;
317
+ protected abstract updateCoordinateBaseFromViewToImage(): void;
318
+ /**
319
+ * @ignore
320
+ */
321
+ _setLineWidth(value: number): void;
322
+ /**
323
+ * @ignore
324
+ */
325
+ _getLineWidth(): number;
326
+ /**
327
+ * @ignore
328
+ */
329
+ _setFontSize(value: number): void;
330
+ /**
331
+ * @ignore
332
+ */
333
+ _getFontSize(): number;
334
+ /**
335
+ * @ignore
336
+ */
337
+ abstract setPosition(position: any): void;
338
+ /**
339
+ * @ignore
340
+ */
341
+ abstract getPosition(): any;
342
+ /**
343
+ * Update item's propertys(width, height, x, y, etc.).
344
+ * It is called when item is added to layer.
345
+ * @ignore
346
+ */
347
+ abstract updatePosition(): void;
348
+ }
349
+
350
+ declare class DT_Rect extends DrawingItem {
351
+ #private;
352
+ constructor(rect: Rect, drawingStyleId?: number);
353
+ protected extendSet(property: string, value: any): boolean;
354
+ protected extendGet(property: string): void;
355
+ protected updateCoordinateBaseFromImageToView(): void;
356
+ protected updateCoordinateBaseFromViewToImage(): void;
357
+ setPosition(position: any): void;
358
+ getPosition(): any;
359
+ updatePosition(): void;
360
+ setRect(rect: Rect): void;
361
+ getRect(): Rect;
362
+ }
363
+
364
+ declare class DT_Polygon extends DrawingItem {
365
+ #private;
366
+ constructor(polygon: Polygon, drawingStyleId?: number);
367
+ protected extendSet(property: string, value: any): boolean;
368
+ protected extendGet(property: string): any;
369
+ protected updateCoordinateBaseFromImageToView(): void;
370
+ protected updateCoordinateBaseFromViewToImage(): void;
371
+ setPosition(position: any): void;
372
+ getPosition(): any;
373
+ updatePosition(): void;
374
+ setPolygon(polygon: Polygon): void;
375
+ getPolygon(): Polygon;
376
+ }
377
+
378
+ declare class DT_Image extends DrawingItem {
379
+ #private;
380
+ private image;
381
+ set maintainAspectRatio(value: boolean);
382
+ get maintainAspectRatio(): boolean;
383
+ constructor(image: DSImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement, rect: Rect, maintainAspectRatio: boolean, drawingStyleId?: number);
384
+ protected extendSet(property: string, value: any): boolean;
385
+ protected extendGet(property: string): any;
386
+ protected updateCoordinateBaseFromImageToView(): void;
387
+ protected updateCoordinateBaseFromViewToImage(): void;
388
+ setPosition(position: any): void;
389
+ getPosition(): any;
390
+ updatePosition(): void;
391
+ setImage(image: DSImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement): void;
392
+ getImage(): DSImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
393
+ setImageRect(rect: Rect): void;
394
+ getImageRect(): Rect;
395
+ }
396
+
397
+ declare class DT_Text extends DrawingItem {
398
+ #private;
399
+ private _text;
400
+ constructor(text: string, rect: Rect, drawingStyleId?: number);
401
+ protected extendSet(property: string, value: any): boolean;
402
+ protected extendGet(property: string): any;
403
+ protected updateCoordinateBaseFromImageToView(): void;
404
+ protected updateCoordinateBaseFromViewToImage(): void;
405
+ setPosition(position: any): void;
406
+ getPosition(): any;
407
+ updatePosition(): void;
408
+ setText(text: string): void;
409
+ getText(): string;
410
+ setTextRect(rect: Rect): void;
411
+ getTextRect(): Rect;
412
+ }
413
+
414
+ declare class DT_Line extends DT_Polygon {
415
+ #private;
416
+ constructor(line: LineSegment, drawingStyleId?: number);
417
+ protected extendSet(property: string, value: any): boolean;
418
+ protected extendGet(property: string): any;
419
+ protected updateCoordinateBaseFromImageToView(): void;
420
+ protected updateCoordinateBaseFromViewToImage(): void;
421
+ setPosition(position: any): void;
422
+ getPosition(): any;
423
+ updatePosition(): void;
424
+ /**
425
+ * @ignore
426
+ */
427
+ setPolygon(): void;
428
+ /**
429
+ * @ignore
430
+ */
431
+ getPolygon(): Polygon;
432
+ setLine(line: LineSegment): void;
433
+ getLine(): LineSegment;
434
+ }
435
+
436
+ declare class DT_Quad extends DT_Polygon {
437
+ #private;
438
+ constructor(quad: Quadrilateral, drawingStyleId?: number);
439
+ setPosition(position: any): void;
440
+ getPosition(): any;
441
+ updatePosition(): void;
442
+ /**
443
+ * @ignore
444
+ */
445
+ setPolygon(): void;
446
+ /**
447
+ * @ignore
448
+ */
449
+ getPolygon(): Polygon;
450
+ setQuad(quad: Quadrilateral): void;
451
+ getQuad(): Quadrilateral;
452
+ }
453
+
454
+ declare class DT_Group extends DrawingItem {
455
+ constructor(childItems: Array<DrawingItem>);
456
+ protected extendSet(property: string, value: any): boolean;
457
+ protected extendGet(property: string): void;
458
+ protected updateCoordinateBaseFromImageToView(): void;
459
+ protected updateCoordinateBaseFromViewToImage(): void;
460
+ setPosition(): void;
461
+ getPosition(): any;
462
+ updatePosition(): void;
463
+ getChildDrawingItems(): Array<DrawingItem>;
464
+ setChildDrawingItems(item: DrawingItem): void;
465
+ removeChildItem(item: DrawingItem): void;
466
+ }
467
+
468
+ declare class DrawingLayer {
469
+ static DDN_LAYER_ID: number;
470
+ static DBR_LAYER_ID: number;
471
+ static DLR_LAYER_ID: number;
472
+ static USER_DEFINED_LAYER_BASE_ID: number;
473
+ /**
474
+ * @ignore
475
+ */
476
+ static TIP_LAYER_ID: number;
477
+ /**
478
+ * returns the 'fabric.Canvas' object
479
+ * @ignore
480
+ */
481
+ fabricCanvas: any;
482
+ private id;
483
+ /**
484
+ * @ignore
485
+ */
486
+ get width(): number;
487
+ /**
488
+ * @ignore
489
+ */
490
+ get height(): number;
491
+ private mapType_StateAndStyleId;
492
+ private mode;
493
+ /**
494
+ * Event triggered whenever there is a change in which `DrawingItem` objects are selected or deselected.
495
+ * @param selectedDrawingItems An array of `DrawingItem` objects that have been selected as a result of the latest selection change.
496
+ * @param deselectedDrawingItems An array of `DrawingItem` objects that have been deselected as a result of the latest selection change.
497
+ * [NOTE]: This event is only functional when the `DrawingLayer` in which it is defined belongs to an `ImageEditorView` instance.
498
+ */
499
+ onSelectionChanged: (selectedDrawingItems: Array<DrawingItem>, deselectedDrawingItems: Array<DrawingItem>) => void;
500
+ private _arrDrwaingItem;
501
+ private _arrFabricObject;
502
+ private _visible;
503
+ /**
504
+ * @ignore
505
+ */
506
+ _manager: any;
507
+ /**
508
+ * @ignore
509
+ */
510
+ set _allowMultiSelect(value: boolean);
511
+ get _allowMultiSelect(): boolean;
512
+ /**
513
+ * @ignore
514
+ */
515
+ constructor(canvas: HTMLCanvasElement, id: number, options?: Object);
516
+ /**
517
+ * Retrieves the unique identifier of the layer.
518
+ */
519
+ getId(): number;
520
+ /**
521
+ * Sets the visibility of the layer.
522
+ * @param visible Whether to show or hide the layer.
523
+ */
524
+ setVisible(visible: boolean): void;
525
+ /**
526
+ * Retrieves the visibility status of the layer.
527
+ *
528
+ * @returns Boolean indicating whether the layer is visible.
529
+ */
530
+ isVisible(): boolean;
531
+ private _getItemCurrentStyle;
532
+ /**
533
+ * Change style of drawingItems of specific media type in specific style selector.
534
+ * DrawingItems that have 'styleId' won't be changed.
535
+ * @param mediaType the mediaType of drawingItems that attend to change
536
+ * @param styleSelector
537
+ * @param drawingStyle
538
+ * @private
539
+ */
540
+ private _changeMediaTypeCurStyleInStyleSelector;
541
+ /**
542
+ * Change the style of specific drawingItem.
543
+ * DrawingItem that has 'styleId' won't be changed.
544
+ * @param drawingItem
545
+ * @param drawingStyle
546
+ * @private
547
+ */
548
+ private _changeItemStyle;
549
+ /**
550
+ *
551
+ * @param targetGroup
552
+ * @param item
553
+ * @param addOrRemove
554
+ * @returns
555
+ * @ignore
556
+ */
557
+ _updateGroupItem(targetGroup: DrawingItem, item: DrawingItem, addOrRemove: string): void;
558
+ private _addDrawingItem;
559
+ /**
560
+ * Add a drawing item to the drawing layer.
561
+ * Drawing items in drawing layer with higher id are always above those in drawing layer with lower id.
562
+ * In a same drawing layer, the later added is above the previous added.
563
+ * @param drawingItem
564
+ * @ignore
565
+ */
566
+ private addDrawingItem;
567
+ /**
568
+ * Adds an array of `DrawingItem` objects to the layer.
569
+ * @param drawingItems An array of `DrawingItem` objects.
570
+ */
571
+ addDrawingItems(drawingItems: Array<DrawingItem>): void;
572
+ /**
573
+ *
574
+ * @param drawingItem
575
+ * @returns
576
+ * @ignore
577
+ */
578
+ private removeDrawingItem;
579
+ /**
580
+ * Removes specified `DrawingItem` objects from the layer.
581
+ * @param drawingItems An array of `DrawingItem` objects.
582
+ */
583
+ removeDrawingItems(drawingItems: Array<DrawingItem>): void;
584
+ /**
585
+ * Sets the layer's `DrawingItem` objects, replacing any existing items.
586
+ * @param drawingItems An array of `DrawingItem` objects.
587
+ */
588
+ setDrawingItems(drawingItems: Array<DrawingItem>): void;
589
+ /**
590
+ * Retrieves `DrawingItem` objects from the layer, optionally filtered by a custom function.
591
+ * @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.
592
+ *
593
+ */
594
+ getDrawingItems(filter?: (item: DrawingItem) => boolean): Array<DrawingItem>;
595
+ /**
596
+ * Returns an array of all selected DrawingItem instances.
597
+ *
598
+ * @returns An array of `DrawingItem` objects.
599
+ */
600
+ getSelectedDrawingItems(): Array<DrawingItem>;
601
+ /**
602
+ * Checks if a specific `DrawingItem` exists within the layer.
603
+ * @param drawingItem Specifies the `DrawingItem`.
604
+ *
605
+ * @returns Boolean indicating whether the specific `DrawingItem` exists.
606
+ */
607
+ hasDrawingItem(drawingItem: DrawingItem): boolean;
608
+ /**
609
+ * Clears all `DrawingItem` objects from the layer.
610
+ */
611
+ clearDrawingItems(): void;
612
+ private _setDefaultStyle;
613
+ /**
614
+ * Establishes the baseline styling preferences for `DrawingItem` objects on the layer.
615
+ * This method offers flexible styling options tailored to the diverse requirements of `DrawingItem` objects based on their state and type:
616
+ * - 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.
617
+ * - 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.
618
+ * - 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.
619
+ *
620
+ * This precision is particularly useful for creating visually distinct interactions or highlighting specific elements based on their content and interaction state.
621
+ * @param drawingStyleId The unique ID of the `DrawingStyle` to be applied.
622
+ * @param state [Optional] Allows the styling to be conditional based on the `DrawingItem`'s current state.
623
+ * @param mediaType [Optional] Further refines the application of the style based on the the `DrawingItem`'s type.
624
+ */
625
+ setDefaultStyle(drawingStyleId: number, state?: EnumDrawingItemState, mediaType?: EnumDrawingItemMediaType): void;
626
+ /**
627
+ * Change drawing layer mode, "viewer" or "editor".
628
+ * @param newMode
629
+ * @ignore
630
+ */
631
+ setMode(newMode: string): void;
632
+ /**
633
+ *
634
+ * @returns
635
+ * @ignore
636
+ */
637
+ getMode(): string;
638
+ /**
639
+ * Update the dimensions of drawing layer.
640
+ * @param dimensions
641
+ * @param options
642
+ * @ignore
643
+ */
644
+ _setDimensions(dimensions: {
645
+ width: number | string;
646
+ height: number | string;
647
+ }, options?: {
648
+ backstoreOnly?: boolean;
649
+ cssOnly?: boolean;
650
+ }): void;
651
+ /**
652
+ * Update the object-fit of drawing layer.
653
+ * @param value
654
+ * @ignore
655
+ */
656
+ _setObjectFit(value: string): void;
657
+ /**
658
+ *
659
+ * @returns
660
+ * @ignore
661
+ */
662
+ _getObjectFit(): string;
663
+ /**
664
+ * Forces a re-render of all `DrawingItem` objects on the layer.
665
+ * Invoke this method to ensure any modifications made to existing `DrawingItem` objects are visually reflected on the layer.
666
+ */
667
+ renderAll(): void;
668
+ /**
669
+ * @ignore
670
+ */
671
+ dispose(): void;
672
+ }
673
+
674
+ declare class DrawingLayerManager {
675
+ _arrDrawingLayer: DrawingLayer[];
676
+ createDrawingLayer(baseCvs: HTMLCanvasElement, drawingLayerId: number): DrawingLayer;
677
+ deleteDrawingLayer(drawingLayerId: number): void;
678
+ clearDrawingLayers(): void;
679
+ getDrawingLayer(drawingLayerId: number): DrawingLayer;
680
+ getAllDrawingLayers(): Array<DrawingLayer>;
681
+ getSelectedDrawingItems(): Array<DrawingItem>;
682
+ setDimensions(dimensions: {
683
+ width: number | string;
684
+ height: number | string;
685
+ }, options?: {
686
+ backstoreOnly?: boolean;
687
+ cssOnly?: boolean;
688
+ }): void;
689
+ setObjectFit(value: string): void;
690
+ getObjectFit(): string;
691
+ setVisible(visible: boolean): void;
692
+ _getFabricCanvas(): any;
693
+ _switchPointerEvent(): void;
694
+ }
695
+
696
+ declare class InnerComponent extends HTMLElement {
697
+ #private;
698
+ constructor();
699
+ getWrapper(): HTMLDivElement;
700
+ setElement(slot: "content" | "single-frame-input-container" | "drawing-layer", el: HTMLElement): void;
701
+ getElement(slot: "content" | "single-frame-input-container" | "drawing-layer"): HTMLElement;
702
+ removeElement(slot: "content" | "single-frame-input-container" | "drawing-layer"): void;
703
+ }
704
+
705
+ declare class DT_Tip extends DT_Text {
706
+ #private;
707
+ constructor(text: string, x: number, y: number, width: number, styleId?: number);
708
+ /**
709
+ * Make the tip hidden after a period of time.
710
+ * @param duration if less then 0, it clears the timer.
711
+ */
712
+ setDuration(duration: number): void;
713
+ getDuration(): number;
714
+ }
715
+ declare abstract class View {
716
+ #private;
717
+ /**
718
+ * @ignore
719
+ */
720
+ _innerComponent: InnerComponent;
721
+ /** @ignore */
722
+ _drawingLayerManager: DrawingLayerManager;
723
+ /** @ignore */
724
+ _layerBaseCvs: HTMLCanvasElement;
725
+ /** @ignore */
726
+ _drawingLayerOfTip: DrawingLayer;
727
+ private _tipStyleId;
728
+ /** @ignore */
729
+ _tip: DT_Tip;
730
+ constructor();
731
+ /**
732
+ * 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.
733
+ */
734
+ protected abstract getContentDimensions(): {
735
+ width: number;
736
+ height: number;
737
+ objectFit: string;
738
+ };
739
+ /**
740
+ * Create a native 'canvas' element, which will be passed to 'fabric' to create a 'fabric.Canvas'.
741
+ * In fact, all drawing layers are in one canvas.
742
+ * @ignore
743
+ */
744
+ protected createDrawingLayerBaseCvs(width: number, height: number, objectFit?: string): HTMLCanvasElement;
745
+ /**
746
+ * Create drawing layer with specified id and size.
747
+ * Differ from 'createDrawingLayer()', the drawing layers created'createDrawingLayer()' can not Specified id, and their size is the same as video.
748
+ * @ignore
749
+ */
750
+ _createDrawingLayer(drawingLayerId: number, width?: number, height?: number, objectFit?: string): DrawingLayer;
751
+ /**
752
+ * Creates a new `DrawingLayer` object and returns it.
753
+ *
754
+ * @returns The created `DrawingLayer` object.
755
+ */
756
+ createDrawingLayer(): DrawingLayer;
757
+ /**
758
+ * Differ from 'deleteUserDefinedDrawingLayer()', 'deleteDrawingLayer()' can delete any layer, while 'deleteUserDefinedDrawingLayer()' can only delete user defined layer.
759
+ */
760
+ protected deleteDrawingLayer(drawingLayerId: number): void;
761
+ /**
762
+ * Deletes a user-defined `DrawingLayer` object specified by its unique identifier (ID).
763
+ * @param id The unique identifier (ID) of the `DrawingLayer` object.
764
+ */
765
+ deleteUserDefinedDrawingLayer(id: number): void;
766
+ /**
767
+ * Not used yet.
768
+ * @ignore
769
+ */
770
+ _clearDrawingLayers(): void;
771
+ /**
772
+ * Clears all user-defined `DrawingLayer` objects, resetting the drawing space without affecting default built-in `DrawingLayer` objects.
773
+ */
774
+ clearUserDefinedDrawingLayers(): void;
775
+ /**
776
+ * Retrieves a `DrawingLayer` object by its unique identifier (ID).
777
+ * @param id The unique identifier (ID) of the `DrawingLayer` object.
778
+ *
779
+ * @returns The `DrawingLayer` object specified by its unique identifier (ID) or `null`.
780
+ */
781
+ getDrawingLayer(drawingLayerId: number): DrawingLayer;
782
+ /**
783
+ * Returns an array of all `DrawingLayer` objects .
784
+ *
785
+ * @returns An array of all `DrawingLayer` objects.
786
+ */
787
+ getAllDrawingLayers(): Array<DrawingLayer>;
788
+ /**
789
+ * update drawing layers according to content(video/image) dimensions.
790
+ */
791
+ protected updateDrawingLayers(contentDimensions: {
792
+ width: number;
793
+ height: number;
794
+ objectFit: string;
795
+ }): void;
796
+ /**
797
+ * Returns an array of all selected DrawingItem instances across different layers, supporting complex selection scenarios.
798
+ *
799
+ * @returns An array of `DrawingItem` objects.
800
+ */
801
+ getSelectedDrawingItems(): Array<DrawingItem>;
802
+ /**
803
+ * Applies configuration settings to the tip message box.
804
+ * This includes its position, size, display duration, and the coordinate system basis.
805
+ * @param tipConfig Configuration object for the tip message box, including top-left position, width, display duration, and coordinate system basis.
806
+ */
807
+ setTipConfig(tipConfig: TipConfig): void;
808
+ /**
809
+ * Retrieves the current configuration of the tip message box, reflecting its position, size, display duration, and the coordinate system basis.
810
+ *
811
+ * @returns The current configuration settings of the tip message box.
812
+ */
813
+ getTipConfig(): TipConfig;
814
+ /**
815
+ * Controls the visibility of the tip message box on the screen.
816
+ * This can be used to show or hide the tip based on user interaction or other criteria.
817
+ * @param visible Boolean flag indicating whether the tip message box should be visible (`true`) or hidden (`false`).
818
+ */
819
+ setTipVisible(visible: boolean): void;
820
+ /**
821
+ * Checks whether the tip message box is currently visible to the user.
822
+ *
823
+ * @returns Boolean indicating the visibility of the tip message box (`true` for visible, `false` for hidden).
824
+ */
825
+ isTipVisible(): boolean;
826
+ /**
827
+ * Updates the message displayed in the tip message box.
828
+ * This can be used to provide dynamic feedback or information to the user.
829
+ * @param message The new message to be displayed in the tip message box.
830
+ */
831
+ updateTipMessage(message: string): void;
832
+ }
833
+
834
+ declare class EventHandler {
835
+ #private;
836
+ get disposed(): boolean;
837
+ on(event: string, listener: Function): void;
838
+ off(event: string, listener: Function): void;
839
+ offAll(event: string): void;
840
+ fire(event: string, params?: Array<any>, options?: {
841
+ target?: object;
842
+ async?: boolean;
843
+ copy?: boolean;
844
+ }): void;
845
+ dispose(): void;
846
+ }
847
+
848
+ declare class CameraEnhancer extends ImageSourceAdapter {
849
+ #private;
850
+ /** @ignore */
851
+ static _debug: boolean;
852
+ static set _onLog(value: (message: any) => void);
853
+ static get _onLog(): (message: any) => void;
854
+ /**
855
+ * @ignore
856
+ */
857
+ static browserInfo: {
858
+ browser: string;
859
+ version: number;
860
+ OS: string;
861
+ };
862
+ /**
863
+ * Event triggered when the running environment is not ideal.
864
+ * @param warning The warning message.
865
+ */
866
+ static onWarning: (warning: Warning) => void;
867
+ /**
868
+ * Detect environment and get a report.
869
+ * ```js
870
+ * console.log(Dynamsoft.DCE.CameraEnhancer.detectEnvironment());
871
+ * // {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"}
872
+ * ```
873
+ */
874
+ static detectEnvironment(): Promise<any>;
875
+ /**
876
+ * Tests whether the application has access to the camera.
877
+ * 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.
878
+ * This method offers the additional advantage of accelerating the camera opening process for the first time.
879
+ *
880
+ * @returns A promise that resolves with an object containing:
881
+ * - `ok`: Boolean indicating whether camera access is available.
882
+ * - `message`: A string providing additional information or the reason why camera access is not available, if applicable.
883
+ */
884
+ static testCameraAccess(): Promise<{
885
+ ok: boolean;
886
+ message: string;
887
+ }>;
888
+ /**
889
+ * Initializes a new instance of the `CameraEnhancer` class.
890
+ * @param view [Optional] Specifies a `CameraView` instance to provide the user interface element to display the live feed from the camera.
891
+ *
892
+ * @returns A promise that resolves with the initialized `CameraEnhancer` instance.
893
+ */
894
+ static createInstance(view?: CameraView): Promise<CameraEnhancer>;
895
+ private cameraManager;
896
+ private cameraView;
897
+ /**
898
+ * @ignore
899
+ */
900
+ private _imageDataGetter;
901
+ /**
902
+ * @ignore
903
+ */
904
+ get video(): HTMLVideoElement;
905
+ /**
906
+ * Sets or returns the source URL for the video stream to be used by the `CameraEnhancer`.
907
+ * 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.
908
+ * 2. When playing an existing video, the camera selection and video selection boxes will be hidden.
909
+ *
910
+ * It is particularly useful for applications that need to process or display video from a specific source rather than the device's default camera.
911
+ */
912
+ set videoSrc(src: string);
913
+ get videoSrc(): string;
914
+ /**
915
+ * Determines whether the last used camera settings should be saved and reused the next time the `CameraEnhancer` is initialized.
916
+ *
917
+ * The default is `false`.
918
+ *
919
+ * When set to `true`, the enhancer attempts to restore the previously used camera settings, offering a more seamless user experience across sessions.
920
+ *
921
+ * - This feature makes use of the [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) of the browser.
922
+ * - 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.
923
+ */
924
+ set ifSaveLastUsedCamera(value: boolean);
925
+ get ifSaveLastUsedCamera(): boolean;
926
+ /**
927
+ * Determines whether to skip the initial camera inspection process.
928
+ *
929
+ * The default is `false`, which means to opt for an optimal rear camera at the first `open()`.
930
+ *
931
+ * Setting this property to `true` bypasses the automatic inspection and configuration that typically occurs when a camera connection is established.
932
+ * This can be useful for scenarios where the default inspection process may not be desirable or necessary.
933
+ *
934
+ * 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`.
935
+ */
936
+ set ifSkipCameraInspection(value: boolean);
937
+ get ifSkipCameraInspection(): boolean;
938
+ /**
939
+ * Specifies the timeout in milliseconds for opening the camera. The default value is 15000 ms.
940
+ *
941
+ * Setting 0 means canceling the timeout or waiting indefinitely.
942
+ *
943
+ * This property sets a limit on how long the `CameraEnhancer` will attempt to open the camera before timing out.
944
+ * It can be adjusted to accommodate different devices and scenarios, ensuring that the application does not hang indefinitely while trying to access the camera.
945
+ */
946
+ set cameraOpenTimeout(value: number);
947
+ get cameraOpenTimeout(): number;
948
+ isTorchOn: undefined | boolean;
949
+ set singleFrameMode(value: "disabled" | "camera" | "image");
950
+ get singleFrameMode(): "disabled" | "camera" | "image";
951
+ /**
952
+ * Event handler in camera selection in default UI.
953
+ * @ignore
954
+ */
955
+ private _onCameraSelChange;
956
+ /**
957
+ * Event handler in resolution selection in default UI.
958
+ * @ignore
959
+ */
960
+ private _onResolutionSelChange;
961
+ /**
962
+ * Event handler in close button in default UI.
963
+ *
964
+ * Now the close button is removed, so it is useless.
965
+ * @ignore
966
+ */
967
+ private _onCloseBtnClick;
968
+ /**
969
+ * Event handler for single frame mode.
970
+ * @ignore
971
+ */
972
+ private _onSingleFrameAcquired;
973
+ _intermediateResultReceiver: any;
974
+ /**
975
+ * @ignore
976
+ */
977
+ get _isFetchingStarted(): boolean;
978
+ /**
979
+ * Set the size limit of the gotten images.
980
+ *
981
+ * By default, there is no limit.
982
+ * @ignore
983
+ */
984
+ canvasSizeLimit: number;
985
+ /**
986
+ * It is used in `DCEFrame.tag.imageId`.
987
+ * @ignore
988
+ */
989
+ _imageId: number;
990
+ private fetchInterval;
991
+ /**
992
+ * Returns whether the `CameraEnhancer` instance has been disposed of.
993
+ *
994
+ * @returns Boolean indicating whether the `CameraEnhancer` instance has been disposed of.
995
+ */
996
+ get disposed(): boolean;
997
+ readonly isCameraEnhancer = true;
998
+ private constructor();
999
+ /**
1000
+ * Sets the `CameraView` instance to be used with the `CameraEnhancer`.
1001
+ * This method allows for specifying a custom camera view, which can be used to display the camera feed and interface elements.
1002
+ *
1003
+ * @param view A `CameraView` instance that will be used to display the camera's video feed and any associated UI components.
1004
+ */
1005
+ setCameraView(view: CameraView): void;
1006
+ /**
1007
+ * Retrieves the current `CameraView` instance associated with the `CameraEnhancer`.
1008
+ * This method allows for accessing the camera view, which can be useful for manipulating the view or accessing its properties and methods.
1009
+ *
1010
+ * @returns The current `CameraView` instance used by the `CameraEnhancer`.
1011
+ */
1012
+ getCameraView(): CameraView;
1013
+ /**
1014
+ *
1015
+ * @returns
1016
+ * @ignore
1017
+ */
1018
+ private releaseCameraView;
1019
+ /**
1020
+ * Add some event listeners to UI element in camera view.
1021
+ * @returns
1022
+ * @ignore
1023
+ */
1024
+ private addListenerToView;
1025
+ /**
1026
+ * Remove event listeners from UI element in camera view.
1027
+ * @returns
1028
+ */
1029
+ private removeListenerFromView;
1030
+ /**
1031
+ * Retrieves the current state of the camera.
1032
+ *
1033
+ * @returns A string indicating the camera's current state, which can be "opening", "open", or "closed".
1034
+ */
1035
+ getCameraState(): string;
1036
+ /**
1037
+ * Checks if the camera is currently open and streaming video.
1038
+ *
1039
+ * @returns Boolean indicating whether the camera is open (`true`) or not (`false`).
1040
+ */
1041
+ isOpen(): boolean;
1042
+ /**
1043
+ * Retrieves the HTMLVideoElement used by the `CameraEnhancer` for displaying the camera feed.
1044
+ * This method provides direct access to the video element, enabling further customization or interaction with the video stream.
1045
+ *
1046
+ * @returns The `HTMLVideoElement` that is being used to display the camera's video feed.
1047
+ */
1048
+ getVideoEl(): HTMLVideoElement;
1049
+ /**
1050
+ * Opens the currently selected camera and starts the video stream.
1051
+ *
1052
+ * @returns A promise that resolves with a `PlayCallbackInfo` object with details about the operation's outcome.
1053
+ */
1054
+ open(): Promise<PlayCallbackInfo>;
1055
+ /**
1056
+ * Closes the currently active camera and stops the video stream.
1057
+ */
1058
+ close(): void;
1059
+ /**
1060
+ * Pauses the video stream without closing the camera.
1061
+ * This can be useful for temporarily halting video processing while keeping the camera ready.
1062
+ */
1063
+ pause(): void;
1064
+ /**
1065
+ * Checks if the video stream is currently paused.
1066
+ *
1067
+ * @returns Boolean indicating whether the video stream is paused (`true`) or active (`false`).
1068
+ */
1069
+ isPaused(): boolean;
1070
+ /**
1071
+ * Resumes the video stream from a paused state.
1072
+ *
1073
+ * @returns A promise that resolves when the video stream resumes. It does not provide any value upon resolution.
1074
+ */
1075
+ resume(): Promise<void>;
1076
+ /**
1077
+ * Selects a specific camera for use by the `CameraEnhancer`. The camera can be specified by a `VideoDeviceInfo` object or by its device ID.
1078
+ * If called before `open()` or `show()`, the selected camera will be used. Otherwise, the system will decide which one to use.
1079
+ * @param cameraObjectOrDeviceID The `VideoDeviceInfo` object or device ID string of the camera to select.
1080
+ *
1081
+ * @returns A promise that resolves with a `PlayCallbackInfo` object indicating the outcome of the camera selection operation.
1082
+ */
1083
+ selectCamera(videoDeviceInfoOrDeviceId: VideoDeviceInfo | string): Promise<PlayCallbackInfo>;
1084
+ /**
1085
+ * Returns the currently selected camera device.
1086
+ *
1087
+ * @returns The `VideoDeviceInfo` object representing the currently active camera.
1088
+ */
1089
+ getSelectedCamera(): VideoDeviceInfo;
1090
+ /**
1091
+ * Retrieves a list of all available video input devices (cameras) on the current device.
1092
+ *
1093
+ * @returns A promise that resolves with an array of `VideoDeviceInfo` objects representing each available camera.
1094
+ */
1095
+ getAllCameras(): Promise<Array<VideoDeviceInfo>>;
1096
+ /**
1097
+ * Sets the resolution of the video stream to a specified value.
1098
+ * If the specified resolution is not exactly supported, the closest resolution will be applied.
1099
+ * 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.
1100
+ * @param resolution The `Resolution` to which the video stream should be set.
1101
+ *
1102
+ * @returns A promise that resolves with a `PlayCallbackInfo` object with details about the operation's outcome.
1103
+ */
1104
+ setResolution(resolution: Resolution): Promise<PlayCallbackInfo>;
1105
+ /**
1106
+ * Gets the current resolution of the video stream.
1107
+ *
1108
+ * @returns The current `Resolution` of the video stream.
1109
+ */
1110
+ getResolution(): Resolution;
1111
+ /**
1112
+ * Retrieves a list of available resolutions supported by the currently selected camera.
1113
+ *
1114
+ * - 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".
1115
+ * - The SDK tests all these resolutions to find out which ones are supported. As a result, the method may be time-consuming.
1116
+ *
1117
+ * @returns A promise that resolves with an array of `Resolution` objects representing each supported resolution.
1118
+ */
1119
+ getAvailableResolutions(): Promise<Array<Resolution>>;
1120
+ /**
1121
+ * 'on()' is the wrapper of '_on()'.
1122
+ * @param event includes
1123
+ * @param listener
1124
+ * @ignore
1125
+ */
1126
+ private _on;
1127
+ /**
1128
+ * 'off()' is the wrapper of '_off()'.
1129
+ * @param event
1130
+ * @param listener
1131
+ * @ignore
1132
+ */
1133
+ private _off;
1134
+ /**
1135
+ * Registers an event listener for specific camera-related events.
1136
+ * This method allows you to respond to various changes and states in the camera lifecycle.
1137
+ * @param eventName The name of the event to listen for. Possible values include "cameraOpen", "cameraClose", "cameraChange", "resolutionChange", "played", "singleFrameAcquired", and "frameAddedToBuffer".
1138
+ * @param listener The callback function to be invoked when the event occurs.
1139
+ */
1140
+ on(eventName: "cameraOpen" | "cameraClose" | "cameraChange" | "resolutionChange" | "played" | "singleFrameAcquired" | "frameAddedToBuffer", listener: Function): void;
1141
+ /**
1142
+ * Removes an event listener previously registered with the `on` method.
1143
+ * @param eventName The name of the event for which to remove the listener.
1144
+ * @param listener The callback function that was originally registered for the event.
1145
+ */
1146
+ off(eventName: "cameraOpen" | "cameraClose" | "cameraChange" | "resolutionChange" | "played" | "singleFrameAcquired" | "frameAddedToBuffer", listener: Function): void;
1147
+ /**
1148
+ * Retrieves the current video settings applied to the camera stream.
1149
+ *
1150
+ * @returns The current `MediaStreamConstraints` object representing the video stream's settings.
1151
+ */
1152
+ getVideoSettings(): MediaStreamConstraints;
1153
+ /**
1154
+ * Updates the video settings for the camera stream with new constraints.
1155
+ * @param constraints The new `MediaStreamConstraints` to apply to the video stream.
1156
+ *
1157
+ * @returns A promise that resolves when the new `MediaStreamConstraints` is applied. It does not provide any value upon resolution.
1158
+ */
1159
+ updateVideoSettings(mediaStreamConstraints: MediaStreamConstraints): Promise<void>;
1160
+ /**
1161
+ * Gets the capabilities of the current camera.
1162
+ *
1163
+ * 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.
1164
+ * @returns A `MediaTrackCapabilities` object representing the capabilities of the camera's video track.
1165
+ */
1166
+ getCapabilities(): MediaTrackCapabilities;
1167
+ /**
1168
+ * Retrieves the current settings of the camera.
1169
+ *
1170
+ * @returns The `MediaTrackSettings` object representing the current settings of the camera's video track.
1171
+ */
1172
+ getCameraSettings(): MediaTrackSettings;
1173
+ /**
1174
+ * Turns on the camera's torch (flashlight) mode, if supported.
1175
+ * 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.
1176
+ * @returns A promise that resolves when the torch has been successfully turned on. It does not provide any value upon resolution.
1177
+ */
1178
+ turnOnTorch(): Promise<void>;
1179
+ /**
1180
+ * Turns off the camera's torch (flashlight) mode.
1181
+ * 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.
1182
+ *
1183
+ * @returns A promise that resolves when the torch has been successfully turned off. It does not provide any value upon resolution.
1184
+ */
1185
+ turnOffTorch(): Promise<void>;
1186
+ _taskid4AutoTorch: any;
1187
+ _delay4AutoTorch: number;
1188
+ grayThreshold4AutoTorch: number;
1189
+ maxDarkCount4AutoTroch: number;
1190
+ turnAutoTorch(delay?: number): Promise<void>;
1191
+ /**
1192
+ * Sets the color temperature of the camera's video feed.
1193
+ * 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.
1194
+ * @param colorTemperature The desired color temperature in Kelvin.
1195
+ *
1196
+ * @returns A promise that resolves when the color temperature has been successfully set. It does not provide any value upon resolution.
1197
+ */
1198
+ setColorTemperature(value: number): Promise<void>;
1199
+ /**
1200
+ * Retrieves the current color temperature setting of the camera's video feed.
1201
+ *
1202
+ * 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.
1203
+ *
1204
+ * @returns The current color temperature in Kelvin.
1205
+ */
1206
+ getColorTemperature(): number;
1207
+ /**
1208
+ * Sets the exposure compensation of the camera's video feed.
1209
+ * 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.
1210
+ * @param exposureCompensation The desired exposure compensation value.
1211
+ *
1212
+ * @returns A promise that resolves when the exposure compensation has been successfully set. It does not provide any value upon resolution.
1213
+ */
1214
+ setExposureCompensation(value: number): Promise<void>;
1215
+ /**
1216
+ * Retrieves the current exposure compensation setting of the camera's video feed.
1217
+ * 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.
1218
+ *
1219
+ * @returns The current exposure compensation value.
1220
+ */
1221
+ getExposureCompensation(): number;
1222
+ /**
1223
+ * '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.
1224
+ * @ignore
1225
+ */
1226
+ private _setZoom;
1227
+ /**
1228
+ * Sets the zoom level of the camera.
1229
+ *
1230
+ * - How it works:
1231
+ * 1. If the camera supports zooming and the zoom factor is within its supported range, zooming is done directly by the camera.
1232
+ * 2. If the camera does not support zooming, software-based magnification is used instead.
1233
+ * 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).
1234
+ * @param settings An object containing the zoom settings.
1235
+ * @param settings.factor: A number specifying the zoom level. At present, it is the only available setting.
1236
+ *
1237
+ * @returns A promise that resolves when the zoom level has been successfully set. It does not provide any value upon resolution.
1238
+ */
1239
+ setZoom(settings: {
1240
+ factor: number;
1241
+ }): Promise<void>;
1242
+ /**
1243
+ * Retrieves the current zoom settings of the camera.
1244
+ *
1245
+ * @returns An object containing the current zoom settings. As present, it contains only the zoom factor.
1246
+ */
1247
+ getZoomSettings(): {
1248
+ factor: number;
1249
+ };
1250
+ /**
1251
+ * Resets the zoom level of the camera to its default value.
1252
+ *
1253
+ * @returns A promise that resolves when the zoom level has been successfully reset. It does not provide any value upon resolution.
1254
+ */
1255
+ resetZoom(): Promise<void>;
1256
+ /**
1257
+ * Sets the frame rate of the camera's video stream.
1258
+ * - 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.
1259
+ * - If you provide a value that exceeds the camera's capabilities, we will automatically adjust it to the maximum value that can be applied.
1260
+ *
1261
+ * @param rate The desired frame rate in frames per second (fps).
1262
+ *
1263
+ * @returns A promise that resolves when the frame rate has been successfully set. It does not provide any value upon resolution.
1264
+ */
1265
+ setFrameRate(value: number): Promise<void>;
1266
+ /**
1267
+ * Retrieves the current frame rate of the camera's video stream.
1268
+ *
1269
+ * @returns The current frame rate in frames per second (fps).
1270
+ */
1271
+ getFrameRate(): number;
1272
+ /**
1273
+ * Sets the focus mode of the camera. This method allows for both manual and continuous focus configurations, as well as specifying a focus area.
1274
+ * - 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.
1275
+ * - 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.
1276
+ * @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`).
1277
+ *
1278
+ * @returns A promise that resolves when the focus settings have been successfully applied. It does not provide any value upon resolution.
1279
+ */
1280
+ setFocus(settings: {
1281
+ mode: string;
1282
+ } | {
1283
+ mode: "manual";
1284
+ distance: number;
1285
+ } | {
1286
+ mode: "manual";
1287
+ area: {
1288
+ centerPoint: {
1289
+ x: string;
1290
+ y: string;
1291
+ };
1292
+ width?: string;
1293
+ height?: string;
1294
+ };
1295
+ }): Promise<void>;
1296
+ /**
1297
+ * Retrieves the current focus settings of the camera.
1298
+ *
1299
+ * @returns An object representing the current focus settings or null.
1300
+ */
1301
+ getFocusSettings(): Object;
1302
+ /**
1303
+ * Sets the auto zoom range for the camera.
1304
+ * `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.
1305
+ * This method allows for specifying the minimum and maximum zoom levels that the camera can automatically adjust to.
1306
+ *
1307
+ * @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}`.
1308
+ */
1309
+ setAutoZoomRange(range: {
1310
+ min: number;
1311
+ max: number;
1312
+ }): void;
1313
+ /**
1314
+ * Retrieves the current auto zoom range settings for the camera.
1315
+ * `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.
1316
+ *
1317
+ * @returns An object representing the current auto zoom range, including the minimum and maximum zoom levels.
1318
+ */
1319
+ getAutoZoomRange(): {
1320
+ min: number;
1321
+ max: number;
1322
+ };
1323
+ /**
1324
+ * Enables one or more enhanced features.
1325
+ * This method allows for activating specific advanced capabilities that may be available.
1326
+ *
1327
+ * - 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.
1328
+ * - `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.
1329
+ * @param enhancedFeatures An enum value or a bitwise combination of `EnumEnhancedFeatures` indicating the features to be enabled.
1330
+ *
1331
+ * @returns A promise that resolves when the specified enhanced features have been successfully enabled. It does not provide any value upon resolution.
1332
+ */
1333
+ enableEnhancedFeatures(enhancedFeatures: EnumEnhancedFeatures): Promise<void>;
1334
+ /**
1335
+ * Disables one or more previously enabled enhanced features.
1336
+ * This method can be used to deactivate specific features that are no longer needed or to revert to default behavior.
1337
+ *
1338
+ * @param enhancedFeatures An enum value or a bitwise combination of `EnumEnhancedFeatures` indicating the features to be disabled.
1339
+ */
1340
+ disableEnhancedFeatures(enhancedFeatures: EnumEnhancedFeatures): void;
1341
+ /**
1342
+ * Differ from 'setScanRegion()', 'setScanRegion()' will update the UI in camera view, while '_setScanRegion()' not.
1343
+ * @param region
1344
+ * @ignore
1345
+ */
1346
+ private _setScanRegion;
1347
+ /**
1348
+ * Sets the scan region within the camera's view which limits the frame acquisition to a specific area of the video feed.
1349
+ *
1350
+ * Note: The region is always specified relative to the original video size, regardless of any transformations or zoom applied to the video display.
1351
+ *
1352
+ * @param region Specifies the scan region.
1353
+ */
1354
+ setScanRegion(region: DSRect | Rect): void;
1355
+ /**
1356
+ * Retrieves the current scan region set within the camera's view.
1357
+ *
1358
+ * 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.
1359
+ *
1360
+ * @returns A `DSRect` or `Rect` object representing the current scan region.
1361
+ *
1362
+ * @throws Error indicating that no scan region has been set, if applicable.
1363
+ */
1364
+ getScanRegion(): DSRect | Rect;
1365
+ /**
1366
+ * Sets an error listener to receive notifications about errors that occur during image source operations.
1367
+ *
1368
+ * @param listener An instance of `ImageSourceErrorListener` or its derived class to handle error notifications.
1369
+ */
1370
+ setErrorListener(listener: ImageSourceErrorListener): void;
1371
+ /**
1372
+ * Determines whether there are more images available to fetch.
1373
+ *
1374
+ * @returns Boolean indicating whether more images can be fetched. `false` means the image source is closed or exhausted.
1375
+ */
1376
+ hasNextImageToFetch(): boolean;
1377
+ /**
1378
+ * Starts the process of fetching images.
1379
+ */
1380
+ startFetching(): void;
1381
+ /**
1382
+ * Stops the process of fetching images.
1383
+ * to false, indicating that image fetching has been halted.
1384
+ */
1385
+ stopFetching(): void;
1386
+ /**
1387
+ * Fetches the current frame from the camera's video feed.
1388
+ * This method is used to obtain the latest image captured by the camera.
1389
+ *
1390
+ * @returns A `DCEFrame` object representing the current frame.
1391
+ * The structure and content of this object will depend on the pixel format set by `setPixelFormat()` and other settings.
1392
+ */
1393
+ fetchImage(): DCEFrame;
1394
+ /**
1395
+ * Sets the interval at which images are continuously fetched from the camera's video feed.
1396
+ * This method allows for controlling how frequently new frames are obtained when `startFetching()` is invoked,
1397
+ * which can be useful for reducing computational load or for pacing the frame processing rate.
1398
+ *
1399
+ * @param interval The desired interval between fetches, specified in milliseconds.
1400
+ */
1401
+ setImageFetchInterval(interval: number): void;
1402
+ /**
1403
+ * Retrieves the current interval at which images are continuously fetched from the camera's video feed.
1404
+ *
1405
+ * @returns The current fetch interval, specified in milliseconds.
1406
+ */
1407
+ getImageFetchInterval(): number;
1408
+ /**
1409
+ * 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.
1410
+ * It can affect both the performance of image processing tasks and the compatibility with certain analysis algorithms.
1411
+ *
1412
+ * @param pixelFormat The desired pixel format for the images. Supported formats include `IPF_GRAYSCALED`, `IPF_ABGR_8888`, and `IPF_ARGB_8888`.
1413
+ */
1414
+ setPixelFormat(format: EnumImagePixelFormat.IPF_GRAYSCALED | EnumImagePixelFormat.IPF_ABGR_8888): void;
1415
+ /**
1416
+ * Retrieves the current pixel format used for images fetched from the camera.
1417
+ *
1418
+ * @returns The current pixel format, which could be one of the following: `IPF_GRAYSCALED`, `IPF_ABGR_8888`, and `IPF_ARGB_8888`.
1419
+ */
1420
+ getPixelFormat(): EnumImagePixelFormat;
1421
+ /**
1422
+ * Initiates a sequence to capture a single frame from the camera, only valid when the camera was open. halting the video stream temporarily.
1423
+ * 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.
1424
+ *
1425
+ * 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.
1426
+ *
1427
+ * Steps performed by `takePhoto`:
1428
+ * 1. Stops the video stream and releases the camera, if it was in use.
1429
+ * 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"]`
1430
+ * 3. Returns the obtained image in a callback function, this differs from `singleFrameMode` which would display the image in the view.
1431
+ * NOTE: user should resume the video stream after the image has been obtained to keep the video stream going.
1432
+ * @param listener A callback function that is invoked with a `DCEFrame` object containing the obtained image.
1433
+ */
1434
+ takePhoto(listener: (dceFrame: DCEFrame) => void): void;
1435
+ /**
1436
+ * Converts coordinates from the video's coordinate system to coordinates relative to the whole page.
1437
+ * This is useful for overlaying HTML elements on top of specific points in the video, aligning with the page's layout.
1438
+ *
1439
+ * @param point A `Point` object representing the x and y coordinates within the video's coordinate system.
1440
+ *
1441
+ * @returns A `Point` object representing the converted x and y coordinates relative to the page.
1442
+ */
1443
+ convertToPageCoordinates(point: Point): Point;
1444
+ /**
1445
+ * Converts coordinates from the video's coordinate system to coordinates relative to the viewport.
1446
+ * This is useful for positioning HTML elements in relation to the video element on the screen, regardless of page scrolling.
1447
+ *
1448
+ * @param point A `Point` object representing the x and y coordinates within the video's coordinate system.
1449
+ *
1450
+ * @returns A `Point` object representing the converted x and y coordinates relative to the viewport.
1451
+ */
1452
+ convertToClientCoordinates(point: Point): Point;
1453
+ /**
1454
+ * Converts coordinates from the video's coordinate system to coordinates relative to the viewport.
1455
+ * This is useful for positioning HTML elements in relation to the video element on the screen, regardless of page scrolling.
1456
+ *
1457
+ * @param point A `Point` object representing the x and y coordinates within the video's coordinate system.
1458
+ *
1459
+ * @returns A `Point` object representing the converted x and y coordinates relative to the viewport.
1460
+ */
1461
+ convertToScanRegionCoordinates(point: Point): Point;
1462
+ /**
1463
+ * Releases all resources used by the `CameraEnhancer` instance.
1464
+ */
1465
+ dispose(): void;
1466
+ }
1467
+
1468
+ declare class CameraView extends View {
1469
+ #private;
1470
+ /**
1471
+ * @ignore
1472
+ */
1473
+ static _onLog: (message: any) => void;
1474
+ private static get engineResourcePath();
1475
+ private static _defaultUIElementURL;
1476
+ /**
1477
+ * Specifies the URL to a default UI definition file.
1478
+ * 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`.
1479
+ * This ensures that `CameraView` has a user interface even when no custom UI is provided.
1480
+ */
1481
+ static set defaultUIElementURL(value: string);
1482
+ static get defaultUIElementURL(): string;
1483
+ /**
1484
+ * Initializes a new instance of the `CameraView` class.
1485
+ * This method allows for optional customization of the user interface (UI) through a specified HTML element or an HTML file.
1486
+ */
1487
+ static createInstance(elementOrUrl?: HTMLElement | string): Promise<CameraView>;
1488
+ /**
1489
+ * Transform the coordinates from related to scan region to related to the whole video/image.
1490
+ * @param coord The coordinates related to scan region.
1491
+ * @param sx The x coordinate of scan region related to the whole video/image.
1492
+ * @param sy The y coordinate of scan region related to the whole video/image.
1493
+ * @param sWidth The width of scan region.
1494
+ * @param sHeight The height of scan region.
1495
+ * @param dWidth The width of cropped image. Its value is different from `sWidth` when the image is compressed.
1496
+ * @param dHeight The height of cropped image. Its value is different from `sHeight` when the image is compressed.
1497
+ * @ignore
1498
+ */
1499
+ static _transformCoordinates(coord: {
1500
+ x: number;
1501
+ y: number;
1502
+ }, sx: number, sy: number, sWidth: number, sHeight: number, dWidth: number, dHeight: number): void;
1503
+ cameraEnhancer: CameraEnhancer;
1504
+ /**
1505
+ * @ignore
1506
+ */
1507
+ eventHandler: EventHandler;
1508
+ private UIElement;
1509
+ /**
1510
+ * @ignore
1511
+ */
1512
+ containerClassName: string;
1513
+ _videoContainer: HTMLDivElement;
1514
+ private videoFit;
1515
+ /** @ignore */
1516
+ _hideDefaultSelection: boolean;
1517
+ /** @ignore */
1518
+ _divScanArea: any;
1519
+ /** @ignore */
1520
+ _divScanLight: any;
1521
+ /** @ignore */
1522
+ _bgLoading: any;
1523
+ /** @ignore */
1524
+ _selCam: any;
1525
+ /** @ignore */
1526
+ _bgCamera: any;
1527
+ /** @ignore */
1528
+ _selRsl: any;
1529
+ /** @ignore */
1530
+ _optGotRsl: any;
1531
+ /** @ignore */
1532
+ _btnClose: any;
1533
+ /** @ignore */
1534
+ _selMinLtr: any;
1535
+ /** @ignore */
1536
+ _optGotMinLtr: any;
1537
+ /** @ignore */
1538
+ _cvsSingleFrameMode: HTMLCanvasElement;
1539
+ private scanRegion;
1540
+ private _drawingLayerOfMask;
1541
+ private _maskBackRectStyleId;
1542
+ private _maskCenterRectStyleId;
1543
+ private regionMaskFillStyle;
1544
+ private regionMaskStrokeStyle;
1545
+ private regionMaskLineWidth;
1546
+ /**
1547
+ * @ignore
1548
+ */
1549
+ _userSetMaskVisible: boolean;
1550
+ /**
1551
+ * @ignore
1552
+ */
1553
+ _userSetLaserVisible: boolean;
1554
+ private _updateLayersTimeoutId;
1555
+ private _updateLayersTimeout;
1556
+ /**
1557
+ * Trigger when the css dimensions of the container of video element changed, or window changed.
1558
+ */
1559
+ private _videoResizeListener;
1560
+ private _windowResizeListener;
1561
+ private _resizeObserver;
1562
+ /**
1563
+ * @ignore
1564
+ */
1565
+ set _singleFrameMode(value: "disabled" | "camera" | "image");
1566
+ get _singleFrameMode(): "disabled" | "camera" | "image";
1567
+ _onSingleFrameAcquired: (canvas: HTMLCanvasElement) => void;
1568
+ private _singleFrameInputContainer;
1569
+ _clickIptSingleFrameMode: () => void;
1570
+ _capturedResultReceiver: any;
1571
+ /**
1572
+ * Returns whether the `CameraView` instance has been disposed of.
1573
+ *
1574
+ * @returns Boolean indicating whether the `CameraView` instance has been disposed of.
1575
+ */
1576
+ get disposed(): boolean;
1577
+ private constructor();
1578
+ /**
1579
+ * Differ from 'setUIElement()', 'setUIElement()' allow parameter of 'string' type, which means a url, '_setUIElement()' only accept parameter of 'HTMLElement' type.
1580
+ * @param element
1581
+ */
1582
+ private _setUIElement;
1583
+ setUIElement(elementOrUrl: HTMLElement | string): Promise<void>;
1584
+ getUIElement(): HTMLElement;
1585
+ private _bindUI;
1586
+ private _unbindUI;
1587
+ /**
1588
+ * Show loading animation.
1589
+ * @ignore
1590
+ */
1591
+ _startLoading(): void;
1592
+ /**
1593
+ * Hide loading animation.
1594
+ * @ignore
1595
+ */
1596
+ _stopLoading(): void;
1597
+ /**
1598
+ * Render cameras info in camera selection in default UI.
1599
+ * @ignore
1600
+ */
1601
+ _renderCamerasInfo(curCamera: {
1602
+ deviceId: string;
1603
+ label: string;
1604
+ }, cameraList: Array<{
1605
+ deviceId: string;
1606
+ label: string;
1607
+ }>): void;
1608
+ /**
1609
+ * Render resolution list in resolution selection in default UI.
1610
+ * @ignore
1611
+ */
1612
+ _renderResolutionInfo(curResolution: {
1613
+ width: number;
1614
+ height: number;
1615
+ }): void;
1616
+ /**
1617
+ * Retrieves the `HTMLVideoElement` that is currently being used for displaying the video in this `CameraView` instance.
1618
+ * This method allows access to the underlying video element, enabling direct interaction or further customization.
1619
+ *
1620
+ * @returns The `HTMLVideoElement` currently used by this `CameraView` instance for video display.
1621
+ */
1622
+ getVideoElement(): HTMLVideoElement;
1623
+ /**
1624
+ * tell if video is loaded.
1625
+ * @ignore
1626
+ */
1627
+ isVideoLoaded(): boolean;
1628
+ /**
1629
+ * Sets the `object-fit` CSS property of the `HTMLVideoElement` used by this `CameraView` instance.
1630
+ * The `object-fit` property specifies how the video content should be resized to fit the container in a way that maintains its aspect ratio.
1631
+ * @param objectFit The value for the `object-fit` property. At present, only "cover" and "contain" are allowed and the default is "contain".
1632
+ * Check out more on [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit).
1633
+ */
1634
+ setVideoFit(value: "contain" | "cover"): void;
1635
+ /**
1636
+ * Retrieves the current value of the `object-fit` CSS property from the `HTMLVideoElement` used by this `CameraView` instance.
1637
+ * The `object-fit` property determines how the video content is resized to fit its container.
1638
+ *
1639
+ * @returns The current value of the `object-fit` property applied to the video element. At present, the value is limited to "cover" and "contain".
1640
+ * Check out more on [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit).
1641
+ */
1642
+ getVideoFit(): "contain" | "cover";
1643
+ /**
1644
+ * Get dimensions of content(video, or image in single frame mode). It decides what dimensions the layers should be created.
1645
+ * @returns
1646
+ */
1647
+ protected getContentDimensions(): {
1648
+ width: number;
1649
+ height: number;
1650
+ objectFit: string;
1651
+ };
1652
+ /**
1653
+ * Update prop '#convertedRegion' and update related UI.
1654
+ * @param contentDimensions
1655
+ * @ignore
1656
+ */
1657
+ private updateConvertedRegion;
1658
+ /**
1659
+ * @ignore
1660
+ */
1661
+ getConvertedRegion(): {
1662
+ x: number;
1663
+ y: number;
1664
+ width: number;
1665
+ height: number;
1666
+ };
1667
+ /**
1668
+ * @ignore
1669
+ */
1670
+ setScanRegion(region: DSRect | Rect): void;
1671
+ /**
1672
+ * @ignore
1673
+ */
1674
+ getScanRegion(): any;
1675
+ /**
1676
+ * Returns the region of the video that is currently visible to the user.
1677
+ * @param options [Optional] Specifies how the visible region should be returned.
1678
+ * @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.
1679
+ *
1680
+ * @returns An object representing the visible region of the video.
1681
+ */
1682
+ getVisibleRegionOfVideo(options: {
1683
+ inPixels?: boolean;
1684
+ }): Rect;
1685
+ private setScanRegionMask;
1686
+ private clearScanRegionMask;
1687
+ /**
1688
+ * Not used yet.
1689
+ * @ignore
1690
+ */
1691
+ private deleteScanRegionMask;
1692
+ /**
1693
+ *
1694
+ * @param visible
1695
+ * @ignore
1696
+ */
1697
+ _setScanRegionMaskVisible(visible: boolean): void;
1698
+ /**
1699
+ * Sets the visibility of the scan region mask. This can be used to show or hide the mask.
1700
+ * @param visible Boolean indicating whether the scan region mask should be visible (`true`) or not (`false`).
1701
+ */
1702
+ setScanRegionMaskVisible(visible: boolean): void;
1703
+ /**
1704
+ * Checks if the scan region mask is currently visible.
1705
+ *
1706
+ * @returns Boolean indicating whether the scan region mask is visible (`true`) or not (`false`).
1707
+ */
1708
+ isScanRegionMaskVisible(): boolean;
1709
+ /**
1710
+ * Sets the style of the scan region mask. This style includes the line width, stroke color, and fill color.
1711
+ * @param style An object containing the new style settings for the scan region mask.
1712
+ * @param style.lineWidth The width of the line used to draw the border of the scan region mask.
1713
+ * @param style.strokeStyle The color of the stroke (border) of the scan region mask.
1714
+ * @param style.fillStyle The fill color of the scan region mask.
1715
+ */
1716
+ setScanRegionMaskStyle(style: {
1717
+ lineWidth: number;
1718
+ strokeStyle: string;
1719
+ fillStyle: string;
1720
+ }): void;
1721
+ /**
1722
+ * Retrieves the current style of the scan region mask. This includes the line width, stroke color, and fill color.
1723
+ */
1724
+ getScanRegionMaskStyle(): {
1725
+ fillStyle: string;
1726
+ strokeStyle: string;
1727
+ lineWidth: number;
1728
+ };
1729
+ /**
1730
+ * @ignore
1731
+ */
1732
+ private _setScanLaserVisible;
1733
+ /**
1734
+ * Sets the visibility of the scan laser effect. This can be used to show or hide the scan laser.
1735
+ * @param visible Boolean indicating whether the scan laser should be visible (`true`) or not (`false`).
1736
+ */
1737
+ setScanLaserVisible(visible: boolean): void;
1738
+ /**
1739
+ * Checks if the scan laser effect is currently visible.
1740
+ *
1741
+ * @returns Boolean indicating whether the scan laser is visible (`true`) or not (`false`).
1742
+ */
1743
+ isScanLaserVisible(): boolean;
1744
+ /**
1745
+ * @ignore
1746
+ */
1747
+ _updateVideoContainer(): void;
1748
+ /**
1749
+ * Update all layers(scan laser, drawing layers, scan region mask). Not used yet.
1750
+ * @ignore
1751
+ */
1752
+ private updateLayers;
1753
+ /**
1754
+ * Clears all system-defined `DrawingItem` objects while keeping user-defined ones.
1755
+ */
1756
+ clearAllInnerDrawingItems(): void;
1757
+ /**
1758
+ * Remove added elements. Remove event listeners.
1759
+ */
1760
+ dispose(): void;
1761
+ }
1762
+
1763
+ declare class ImageEditorView extends View {
1764
+ #private;
1765
+ static createInstance(elementOrUrl?: HTMLElement | string): Promise<ImageEditorView>;
1766
+ private UIElement;
1767
+ /**
1768
+ * @ignore
1769
+ */
1770
+ containerClassName: string;
1771
+ /**
1772
+ * Control if enable magnifier function.
1773
+ * @ignore
1774
+ */
1775
+ private isUseMagnifier;
1776
+ /**
1777
+ * Returns whether the `ImageEditorView` instance has been disposed of.
1778
+ *
1779
+ * @returns Boolean indicating whether the `ImageEditorView` instance has been disposed of.
1780
+ */
1781
+ get disposed(): boolean;
1782
+ private constructor();
1783
+ /**
1784
+ * Differ from 'setUIElement()', 'setUIElement()' allow parameter of 'string' type, which means a url, '_setUIElement()' only accept parameter of 'HTMLElement' type.
1785
+ * @param element
1786
+ */
1787
+ private _setUIElement;
1788
+ setUIElement(elementOrUrl: HTMLElement | string): Promise<void>;
1789
+ getUIElement(): HTMLElement;
1790
+ private _bindUI;
1791
+ private _unbindUI;
1792
+ /**
1793
+ * Draw image in inner canvas.
1794
+ * @ignore
1795
+ */
1796
+ private setImage;
1797
+ /**
1798
+ * Not used yet.
1799
+ * @ignore
1800
+ */
1801
+ private getImage;
1802
+ /**
1803
+ * Not used yet.
1804
+ * @ignore
1805
+ */
1806
+ private clearImage;
1807
+ /**
1808
+ * Not used yet.
1809
+ * @ignore
1810
+ */
1811
+ private removeImage;
1812
+ /**
1813
+ * Sets the image to be drawn on the `ImageEditorView`.
1814
+ * This method allows for the initialization or updating of the image.
1815
+ * @param image The image to be drawn on the `ImageEditorView`.
1816
+ */
1817
+ setOriginalImage(img: DSImageData | HTMLCanvasElement | HTMLImageElement): void;
1818
+ /**
1819
+ * Returns the current image drawn on the `ImageEditorView`.
1820
+ *
1821
+ * @returns The current image drawn on the `ImageEditorView`. The returned type will match the format of the image originally set via `setOriginalImage()`.
1822
+ */
1823
+ getOriginalImage(): DSImageData | HTMLCanvasElement | HTMLImageElement;
1824
+ /**
1825
+ * Get dimensions of content(that is, the image). It decides what dimensions the layers should be created.
1826
+ * @returns
1827
+ */
1828
+ protected getContentDimensions(): {
1829
+ width: number;
1830
+ height: number;
1831
+ objectFit: string;
1832
+ };
1833
+ /**
1834
+ * Create drawing layer with specified id and size.
1835
+ * Differ from 'createDrawingLayer()', the drawing layers created'createDrawingLayer()' can not Specified id, and their size is the same as video.
1836
+ * @ignore
1837
+ */
1838
+ _createDrawingLayer(drawingLayerId: number, width?: number, height?: number, objectFit?: string): DrawingLayer;
1839
+ /**
1840
+ * Releases all resources used by the `ImageEditorView` instance.
1841
+ */
1842
+ dispose(): void;
1843
+ }
1844
+
1845
+ declare class Feedback {
1846
+ #private;
1847
+ static allowBeep: boolean;
1848
+ static beepSoundSource: string;
1849
+ static beep(): void;
1850
+ static allowVibrate: boolean;
1851
+ static vibrateDuration: number;
1852
+ static vibrate(): void;
1853
+ }
1854
+
1855
+ declare class DrawingStyleManager {
1856
+ #private;
1857
+ static STYLE_BLUE_STROKE: number;
1858
+ static STYLE_GREEN_STROKE: number;
1859
+ static STYLE_ORANGE_STROKE: number;
1860
+ static STYLE_YELLOW_STROKE: number;
1861
+ static STYLE_BLUE_STROKE_FILL: number;
1862
+ static STYLE_GREEN_STROKE_FILL: number;
1863
+ static STYLE_ORANGE_STROKE_FILL: number;
1864
+ static STYLE_YELLOW_STROKE_FILL: number;
1865
+ static STYLE_BLUE_STROKE_TRANSPARENT: number;
1866
+ static STYLE_GREEN_STROKE_TRANSPARENT: number;
1867
+ static STYLE_ORANGE_STROKE_TRANSPARENT: number;
1868
+ static USER_START_STYLE_ID: number;
1869
+ static createDrawingStyle(styleDefinition: DrawingStyle): number;
1870
+ private static _getDrawingStyle;
1871
+ static getDrawingStyle(styleId: number): DrawingStyle;
1872
+ static getAllDrawingStyles(): Array<DrawingStyle>;
1873
+ private static _updateDrawingStyle;
1874
+ static updateDrawingStyle(styleId: number, styleDefinition: DrawingStyle): void;
1875
+ }
1876
+
1877
+ export { CameraEnhancer, CameraEnhancerModule, CameraView, DCEFrame, DrawingItem, DrawingItemEvent, DrawingLayer, DrawingStyle, DrawingStyleManager, EnumDrawingItemMediaType, EnumDrawingItemState, EnumEnhancedFeatures, Feedback, DT_Group as GroupDrawingItem, 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 };