dynamsoft-capture-vision-react-native 2.4.2000-alpha.2 → 2.6.1002

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 (99) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +32 -4
  3. package/android/build.gradle +1 -5
  4. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +73 -64
  5. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewManagerImpl.kt +2 -18
  6. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewModuleImpl.kt +49 -51
  7. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/RNImageEditorView.kt +19 -0
  8. package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +2 -0
  9. package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +6 -0
  10. package/dynamsoft-capture-vision-react-native.podspec +3 -5
  11. package/ios/CPP/RNDynamsoft+JSI.h +19 -0
  12. package/ios/CPP/RNDynamsoft+JSI.mm +145 -0
  13. package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/RNDynamsoft+Json.h +12 -5
  14. package/ios/{RNDynamsoftCaptureVision/CPP/RNDynamsoft+Json.mm → CPP/RNDynamsoft+Json.m} +6 -124
  15. package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCaptureVisionRouter.mm → RNDynamsoftCaptureVisionRouter.mm} +1 -0
  16. package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageEditorViewManager.mm → RNDynamsoftImageEditorViewManager.mm} +5 -1
  17. package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageManager.mm → RNDynamsoftImageManager.mm} +6 -2
  18. package/package.json +2 -2
  19. package/src/core/CapturedResultItem.tsx +18 -2
  20. package/src/core/CompletionListener.tsx +4 -3
  21. package/src/core/CoreModule.tsx +3 -3
  22. package/src/core/DSRect.tsx +28 -21
  23. package/src/core/EnumCaptureResultItemType.tsx +38 -7
  24. package/src/core/EnumColourChannelUsageType.tsx +25 -7
  25. package/src/core/EnumCrossVerificationStatus.tsx +43 -0
  26. package/src/core/EnumGrayscaleEnhancementMode.tsx +40 -7
  27. package/src/core/EnumGrayscaleTransformationMode.tsx +29 -5
  28. package/src/core/EnumPixelFormat.tsx +37 -32
  29. package/src/core/ImageData.tsx +51 -4
  30. package/src/core/ImageSourceAdapter.tsx +132 -72
  31. package/src/core/NativeDynamsoftImageSourceAdapterModule.tsx +24 -13
  32. package/src/core/Point.tsx +12 -9
  33. package/src/core/Quadrilateral.tsx +9 -5
  34. package/src/core/Rect.tsx +19 -16
  35. package/src/cvr/CaptureVisionRouter.tsx +571 -279
  36. package/src/cvr/CapturedResult.tsx +117 -76
  37. package/src/cvr/CapturedResultFilter.tsx +7 -0
  38. package/src/cvr/CapturedResultReceiver.tsx +59 -3
  39. package/src/cvr/EnumPresetTemplate.tsx +66 -1
  40. package/src/cvr/SimplifiedCaptureVisionSettings.tsx +45 -0
  41. package/src/dbr/BarcodeResultItem.tsx +31 -1
  42. package/src/dbr/DecodedBarcodesResult.tsx +18 -0
  43. package/src/dbr/EnumBarcodeFormat.tsx +61 -50
  44. package/src/dbr/EnumDeblurMode.tsx +28 -12
  45. package/src/dbr/EnumLocalizationMode.tsx +15 -1
  46. package/src/dbr/SimplifiedBarcodeReaderSettings.tsx +72 -12
  47. package/src/dce/CameraEnhancer.tsx +211 -89
  48. package/src/dce/CameraView.tsx +18 -1
  49. package/src/dce/DynamsoftCameraViewNativeComponent.ts +43 -0
  50. package/src/dce/EnumCameraPosition.tsx +3 -0
  51. package/src/dce/EnumDrawingLayerId.tsx +11 -0
  52. package/src/dce/EnumEnhancedFeatures.tsx +23 -7
  53. package/src/dce/EnumFocusMode.tsx +2 -0
  54. package/src/dce/FeedBack.tsx +9 -0
  55. package/src/dce/ImageEditorView.tsx +35 -2
  56. package/src/dcp/EnumMappingStatus.tsx +12 -3
  57. package/src/dcp/EnumValidationStatus.tsx +12 -3
  58. package/src/dcp/ParsedResult.tsx +16 -0
  59. package/src/dcp/ParsedResultItem.tsx +35 -0
  60. package/src/ddn/DetectedQuadResultItem.tsx +23 -0
  61. package/src/ddn/DetectedQuadsResult.tsx +20 -1
  62. package/src/ddn/EnumImageColourMode.tsx +9 -0
  63. package/src/ddn/NormalizedImageResultItem.tsx +25 -0
  64. package/src/ddn/NormalizedImagesResult.tsx +17 -1
  65. package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +38 -2
  66. package/src/dlr/CharacterResult.tsx +17 -0
  67. package/src/dlr/RecognizedTextLinesResult.tsx +23 -1
  68. package/src/dlr/SimplifiedLabelRecognizerSettings.tsx +21 -0
  69. package/src/dlr/TextLineResultItem.tsx +26 -0
  70. package/src/license/LicenseManager.tsx +19 -0
  71. package/src/utility/ImageManager.tsx +23 -0
  72. package/src/utility/MultiFrameResultCrossFilter.tsx +99 -6
  73. package/android/.gitignore +0 -4
  74. package/ios/ReactNativeDcv.xcodeproj/project.pbxproj +0 -390
  75. /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/DSImageData+HostObject.h +0 -0
  76. /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/DSImageData+HostObject.mm +0 -0
  77. /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/ImageDataHostObject.cpp +0 -0
  78. /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/ImageDataHostObject.hpp +0 -0
  79. /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/MutableRawBuffer.cpp +0 -0
  80. /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/MutableRawBuffer.hpp +0 -0
  81. /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/YeetJSIUtils.h +0 -0
  82. /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/YeetJSIUtils.mm +0 -0
  83. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCameraView.h → RNDynamsoftCameraView.h} +0 -0
  84. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCameraView.m → RNDynamsoftCameraView.m} +0 -0
  85. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCameraViewManager.h → RNDynamsoftCameraViewManager.h} +0 -0
  86. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCameraViewManager.m → RNDynamsoftCameraViewManager.m} +0 -0
  87. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCaptureVisionRouter.h → RNDynamsoftCaptureVisionRouter.h} +0 -0
  88. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageEditorView.h → RNDynamsoftImageEditorView.h} +0 -0
  89. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageEditorView.m → RNDynamsoftImageEditorView.m} +0 -0
  90. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageEditorViewManager.h → RNDynamsoftImageEditorViewManager.h} +0 -0
  91. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageManager.h → RNDynamsoftImageManager.h} +0 -0
  92. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageSourceAdapter.h → RNDynamsoftImageSourceAdapter.h} +0 -0
  93. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageSourceAdapter.mm → RNDynamsoftImageSourceAdapter.mm} +0 -0
  94. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftLicense.h → RNDynamsoftLicense.h} +0 -0
  95. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftLicense.m → RNDynamsoftLicense.m} +0 -0
  96. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftMultiCrossFilter.h → RNDynamsoftMultiCrossFilter.h} +0 -0
  97. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftMultiCrossFilter.m → RNDynamsoftMultiCrossFilter.m} +0 -0
  98. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftVersions.h → RNDynamsoftVersions.h} +0 -0
  99. /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftVersions.m → RNDynamsoftVersions.m} +0 -0
@@ -1,98 +1,109 @@
1
+ /**
2
+ * EnumBarcodeFormat defines the supported barcode formats.
3
+ * Using or operator can enable multiple Formats.
4
+ * <p>
5
+ * Code snippet:
6
+ * ```
7
+ * let settings: SimplifiedCaptureVisionSettings = ...;
8
+ * settings.barcodeSettings.barcodeFormatIds = EnumBarcodeFormat.BF_ONED | EnumBarcodeFormat.BF_QR_CODE; //Means decode OneD and QRCode
9
+ * ```
10
+ * @see SimplifiedBarcodeReaderSettings.barcodeFormatIds
11
+ * */
1
12
  const EnumBarcodeFormat = {
2
13
  /**No barcode format in BarcodeFormat*/
3
- BF_NULL:BigInt(0x00n),
14
+ BF_NULL:BigInt(0x00),
4
15
  /**All supported formats in BarcodeFormat*/
5
- BF_ALL:BigInt(0xFFFFFFFEFFFFFFFFn),
6
- BF_DEFAULT:BigInt(0xFE3BFFFFn),
16
+ BF_ALL:BigInt(0xFFFFFFFEFFFFFFFF),
17
+ BF_DEFAULT:BigInt(0xFE3BFFFF),
7
18
  /**Combined value of BF_CODABAR, BF_CODE_128, BF_CODE_39, BF_CODE_39_Extended, BF_CODE_93, BF_EAN_13, BF_EAN_8, INDUSTRIAL_25, BF_ITF, BF_UPC_A, BF_UPC_E, BF_MSI_CODE; */
8
- BF_ONED:BigInt(0x003007FFn),
19
+ BF_ONED:BigInt(0x003007FF),
9
20
  /**Combined value of BF_GS1_DATABAR_OMNIDIRECTIONAL, BF_GS1_DATABAR_TRUNCATED, BF_GS1_DATABAR_STACKED, BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL, BF_GS1_DATABAR_EXPANDED, BF_GS1_DATABAR_EXPANDED_STACKED, BF_GS1_DATABAR_LIMITED*/
10
- BF_GS1_DATABAR:BigInt(0x0003F800n),
21
+ BF_GS1_DATABAR:BigInt(0x0003F800),
11
22
  /**Code 39 */
12
- BF_CODE_39:BigInt(0x1n),
23
+ BF_CODE_39:BigInt(0x1),
13
24
  /**Code 128 */
14
- BF_CODE_128:BigInt(0x2n),
25
+ BF_CODE_128:BigInt(0x2),
15
26
  /**Code 93 */
16
- BF_CODE_93:BigInt(0x4n),
27
+ BF_CODE_93:BigInt(0x4),
17
28
  /**Codabar */
18
- BF_CODABAR:BigInt(0x8n),
29
+ BF_CODABAR:BigInt(0x8),
19
30
  /**Interleaved 2 of 5 */
20
- BF_ITF:BigInt(0x10n),
31
+ BF_ITF:BigInt(0x10),
21
32
  /**EAN-13 */
22
- BF_EAN_13:BigInt(0x20n),
33
+ BF_EAN_13:BigInt(0x20),
23
34
  /**EAN-8 */
24
- BF_EAN_8:BigInt(0x40n),
35
+ BF_EAN_8:BigInt(0x40),
25
36
  /**UPC-A */
26
- BF_UPC_A:BigInt(0x80n),
37
+ BF_UPC_A:BigInt(0x80),
27
38
  /**UPC-E */
28
- BF_UPC_E:BigInt(0x100n),
39
+ BF_UPC_E:BigInt(0x100),
29
40
  /**Industrial 2 of 5 */
30
- BF_INDUSTRIAL_25:BigInt(0x200n),
41
+ BF_INDUSTRIAL_25:BigInt(0x200),
31
42
  /**CODE39 Extended */
32
- BF_CODE_39_EXTENDED:BigInt(0x400n),
43
+ BF_CODE_39_EXTENDED:BigInt(0x400),
33
44
  /**GS1 Databar Omnidirectional*/
34
- BF_GS1_DATABAR_OMNIDIRECTIONAL:BigInt(0x800n),
45
+ BF_GS1_DATABAR_OMNIDIRECTIONAL:BigInt(0x800),
35
46
  /**GS1 Databar Truncated*/
36
- BF_GS1_DATABAR_TRUNCATED:BigInt(0x1000n),
47
+ BF_GS1_DATABAR_TRUNCATED:BigInt(0x1000),
37
48
  /**GS1 Databar Stacked*/
38
- BF_GS1_DATABAR_STACKED:BigInt(0x2000n),
49
+ BF_GS1_DATABAR_STACKED:BigInt(0x2000),
39
50
  /**GS1 Databar Stacked Omnidirectional*/
40
- BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL:BigInt(0x4000n),
51
+ BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL:BigInt(0x4000),
41
52
  /**GS1 Databar Expanded*/
42
- BF_GS1_DATABAR_EXPANDED:BigInt(0x8000n),
53
+ BF_GS1_DATABAR_EXPANDED:BigInt(0x8000),
43
54
  /**GS1 Databar Expaned Stacked*/
44
- BF_GS1_DATABAR_EXPANDED_STACKED:BigInt(0x10000n),
55
+ BF_GS1_DATABAR_EXPANDED_STACKED:BigInt(0x10000),
45
56
  /**GS1 Databar Limited*/
46
- BF_GS1_DATABAR_LIMITED:BigInt(0x20000n),
57
+ BF_GS1_DATABAR_LIMITED:BigInt(0x20000),
47
58
  /**Patch code. */
48
- BF_PATCHCODE:BigInt(0x00040000n),
59
+ BF_PATCHCODE:BigInt(0x00040000),
49
60
  /**PDF417 */
50
- BF_CODE_32:BigInt(0x01000000n),
51
- BF_PDF417:BigInt(0x02000000n),
61
+ BF_CODE_32:BigInt(0x01000000),
62
+ BF_PDF417:BigInt(0x02000000),
52
63
  /**QRCode */
53
- BF_QR_CODE:BigInt(0x04000000n),
64
+ BF_QR_CODE:BigInt(0x04000000),
54
65
  /**DataMatrix */
55
- BF_DATAMATRIX:BigInt(0x08000000n),
66
+ BF_DATAMATRIX:BigInt(0x08000000),
56
67
  /**AZTEC */
57
- BF_AZTEC:BigInt(0x10000000n),
68
+ BF_AZTEC:BigInt(0x10000000),
58
69
  /**MAXICODE */
59
- BF_MAXICODE:BigInt(0x20000000n),
70
+ BF_MAXICODE:BigInt(0x20000000),
60
71
  /**Micro QR Code*/
61
- BF_MICRO_QR:BigInt(0x40000000n),
72
+ BF_MICRO_QR:BigInt(0x40000000),
62
73
  /**Micro PDF417*/
63
- BF_MICRO_PDF417:BigInt(0x00080000n),
74
+ BF_MICRO_PDF417:BigInt(0x00080000),
64
75
  /**GS1 Composite Code*/
65
- BF_GS1_COMPOSITE:BigInt(0x80000000n),
76
+ BF_GS1_COMPOSITE:BigInt(0x80000000),
66
77
  /**MSI Code*/
67
- BF_MSI_CODE:BigInt(0x100000n),
78
+ BF_MSI_CODE:BigInt(0x100000),
68
79
  /*Code 11*/
69
- BF_CODE_11:BigInt(0x200000n),
70
- BF_TWO_DIGIT_ADD_ON:BigInt(0x400000n),
71
- BF_FIVE_DIGIT_ADD_ON:BigInt(0x800000n),
80
+ BF_CODE_11:BigInt(0x200000),
81
+ BF_TWO_DIGIT_ADD_ON:BigInt(0x400000),
82
+ BF_FIVE_DIGIT_ADD_ON:BigInt(0x800000),
72
83
  /**Combined value of BF2_USPSINTELLIGENTMAIL, BF2_POSTNET, BF2_PLANET, BF2_AUSTRALIANPOST, BF2_RM4SCC.*/
73
- BF_MATRIX_25:BigInt(0x1000000000n),
74
- BF_POSTALCODE:BigInt(0x3F0000000000000n),
84
+ BF_MATRIX_25:BigInt(0x1000000000),
85
+ BF_POSTALCODE:BigInt(0x3F0000000000000),
75
86
  /**Nonstandard barcode */
76
- BF_NONSTANDARD_BARCODE:BigInt(0x100000000n),
87
+ BF_NONSTANDARD_BARCODE:BigInt(0x100000000),
77
88
  /**USPS Intelligent Mail.*/
78
- BF_USPSINTELLIGENTMAIL:BigInt(0x10000000000000n),
89
+ BF_USPSINTELLIGENTMAIL:BigInt(0x10000000000000),
79
90
  /**Postnet.*/
80
- BF_POSTNET:BigInt(0x20000000000000n),
91
+ BF_POSTNET:BigInt(0x20000000000000),
81
92
  /**Planet.*/
82
- BF_PLANET:BigInt(0x40000000000000n),
93
+ BF_PLANET:BigInt(0x40000000000000),
83
94
  /**Australian Post.*/
84
- BF_AUSTRALIANPOST:BigInt(0x80000000000000n),
95
+ BF_AUSTRALIANPOST:BigInt(0x80000000000000),
85
96
  /**Royal Mail 4-State Customer Barcode.*/
86
- BF_RM4SCC:BigInt(0x100000000000000n),
87
- BF_KIX:BigInt(0x200000000000000n),
97
+ BF_RM4SCC:BigInt(0x100000000000000),
98
+ BF_KIX:BigInt(0x200000000000000),
88
99
  /**DotCode.*/
89
- BF_DOTCODE:BigInt(0x200000000n),
100
+ BF_DOTCODE:BigInt(0x200000000),
90
101
  /**_PHARMACODE_ONE_TRACK.*/
91
- BF_PHARMACODE_ONE_TRACK:BigInt(0x400000000n),
102
+ BF_PHARMACODE_ONE_TRACK:BigInt(0x400000000),
92
103
  /**PHARMACODE_TWO_TRACK.*/
93
- BF_PHARMACODE_TWO_TRACK:BigInt(0x800000000n),
104
+ BF_PHARMACODE_TWO_TRACK:BigInt(0x800000000),
94
105
  /**PHARMACODE.*/
95
- BF_PHARMACODE:BigInt(0xC00000000n)
106
+ BF_PHARMACODE:BigInt(0xC00000000)
96
107
  }
97
108
  type EnumBarcodeFormat = bigint;
98
109
  export { EnumBarcodeFormat };
@@ -1,12 +1,28 @@
1
- export enum EnumDeblurMode {
2
- DM_SKIP= 0x0,
3
- DM_DIRECT_BINARIZATION= 0x1,
4
- DM_THRESHOLD_BINARIZATION= 0x2,
5
- DM_GRAY_EQUALIZATION= 0x4,
6
- DM_SMOOTHING= 0x8,
7
- DM_MORPHING= 0x10,
8
- DM_DEEP_ANALYSIS= 0x20,
9
- DM_SHARPENING= 0x40,
10
- DM_BASED_ON_LOC_BIN= 0x80,
11
- DM_SHARPENING_SMOOTHING= 0x100,
12
- }
1
+ /**
2
+ * DeblurMode specifies the image processing algorithms applied to the localized zones containing barcodes,
3
+ * aimed at generating a binary image for extracting barcode data during the final phase of the barcode decoding process.
4
+ * <p>
5
+ * @see SimplifiedBarcodeReaderSettings.deblurModes
6
+ * */
7
+ export enum EnumDeblurMode {
8
+ /** Skips the process, no deblurring is applied. */
9
+ DM_SKIP = 0x0,
10
+ /** Applies a direct binarization algorithm for generating the binary image. */
11
+ DM_DIRECT_BINARIZATION = 0x1,
12
+ /** Utilizes a threshold binarization algorithm for generating the binary image, dynamically determining the threshold based on the image content. */
13
+ DM_THRESHOLD_BINARIZATION = 0x2,
14
+ /** Employs a gray equalization algorithm to adjust the contrast and brightness, improving the clarity of the gray-scale image before binarization. */
15
+ DM_GRAY_EQUALIZATION = 0x4,
16
+ /** Implements a smoothing algorithm to reduce noise and artifacts, smoothing out the gray-scale image before binarization. */
17
+ DM_SMOOTHING = 0x8,
18
+ /** Uses a morphing algorithm to enhance the gray-scale image before binarization. */
19
+ DM_MORPHING = 0x10,
20
+ /** Engages in a deep analysis of the grayscale image based on the barcode format to intelligently generate the optimized binary image, tailored to complex or severely blurred images. */
21
+ DM_DEEP_ANALYSIS = 0x20,
22
+ /** Applies a sharpening algorithm to enhance the edges and details of the barcode, making it more distinguishable on the gray-scale image before binarization. */
23
+ DM_SHARPENING = 0x40,
24
+ /** Decodes the barcodes based on the binary image obtained during the localization process. */
25
+ DM_BASED_ON_LOC_BIN = 0x80,
26
+ /** Combines sharpening and smoothing algorithms for a comprehensive deblurring effect, targeting both clarity and smoothness of the gray-scale image before binarization. */
27
+ DM_SHARPENING_SMOOTHING = 0x100,
28
+ }
@@ -1,12 +1,26 @@
1
+ /**
2
+ * LocalizationMode specifies the strategies used to identify the locations of barcodes within an image.
3
+ * @see SimplifiedBarcodeReaderSettings.localizationModes
4
+ * */
1
5
  export enum EnumLocalizationMode {
6
+ /** Omits the localization process entirely. */
2
7
  LM_SKIP = 0x0,
8
+ /** Automatic localization mode selection; not yet implemented. */
3
9
  LM_AUTO = 0x1,
10
+ /** Identifies barcodes by finding connected blocks, offering optimal results, especially recommended for highest priority in most scenarios. */
4
11
  LM_CONNECTED_BLOCKS = 0x2,
12
+ /** Detects barcodes through analysis of patterns of contiguous black and white regions, tailored for QR Codes and DataMatrix codes. */
5
13
  LM_STATISTICS = 0x4,
14
+ /** Locates barcodes by identifying linear patterns, designed primarily for 1D barcodes and PDF417 codes. */
6
15
  LM_LINES = 0x8,
16
+ /** Provides rapid barcode localization, suited for interactive applications where speed is crucial. */
7
17
  LM_SCAN_DIRECTLY = 0x10,
18
+ /** Targets barcode localization through detection of specific mark groups, optimized for Direct Part Marking (DPM) codes. */
8
19
  LM_STATISTICS_MARKS = 0x20,
20
+ /** Combines methods of locating connected blocks and linear patterns to efficiently localize postal codes. */
9
21
  LM_STATISTICS_POSTAL_CODE = 0x40,
22
+ /** Initiates barcode localization from the image center, facilitating faster detection in certain layouts. */
10
23
  LM_CENTRE = 0x80,
24
+ /** Specialized for quick localization of 1D barcodes, enhancing performance in fast-scan scenarios. */
11
25
  LM_ONED_FAST_SCAN = 0x100,
12
- }
26
+ }
@@ -4,17 +4,77 @@ import type {EnumDeblurMode} from "./EnumDeblurMode";
4
4
  import type {EnumGrayscaleTransformationMode} from "../core/EnumGrayscaleTransformationMode";
5
5
  import type {EnumGrayscaleEnhancementMode} from "../core/EnumGrayscaleEnhancementMode";
6
6
 
7
+ /**
8
+ * This interface defines simplified settings for barcode reading tasks.
9
+ * */
7
10
  export interface SimplifiedBarcodeReaderSettings {
8
- barcodeFormatIds?: EnumBarcodeFormat | bigint;
9
- _barcodeFormatIdsNumberString?: string;
10
- expectedBarcodesCount?: number;
11
- minResultConfidence?: number;
12
- minBarcodeTextLength?: number;
13
- barcodeTextRegExPattern?: string;
14
- maxThreadsInOneTask?: number;
15
- localizationModes?: Array<EnumLocalizationMode> | Int32Array;
16
- deblurModes?: Array<EnumDeblurMode> | Int32Array;
17
- grayscaleTransformationModes?: Array<EnumGrayscaleTransformationMode> | Int32Array;
18
- grayscaleEnhancementModes?: Array<EnumGrayscaleEnhancementMode> | Int32Array;
19
- scaleDownThreshold?: number;
11
+ /**
12
+ * A combined value of enumeration BarcodeFormat to specify the targeting barcode formats.
13
+ * @see EnumBarcodeFormat
14
+ * */
15
+ barcodeFormatIds?: EnumBarcodeFormat | bigint;
16
+
17
+ /**@internal*/
18
+ _barcodeFormatIdsNumberString?: string;
19
+
20
+ /**
21
+ * Set the expected barcode count. The default value is 0.
22
+ * @remarks
23
+ * - Set expectedBarcodesCount to 0 if the barcode count is unknown. The library will try to find at least 1 barcode.
24
+ * - Set expectedBarcodesCount to 1 to reach the highest speed for processing single barcode.
25
+ * - Set expectedBarcodesCount to “n” if there will be “n” barcodes to process from an image.
26
+ * - Set expectedBarcodesCount to the highest expected value if there exists multiple barcodes but the exact count is not confirmed.
27
+ * */
28
+ expectedBarcodesCount?: number;
29
+
30
+ /**
31
+ * Set the minimum result confidence to filter out the low confidence results. The default value is 30.
32
+ * */
33
+ minResultConfidence?: number;
34
+
35
+ /**
36
+ * Set the minimum barcode text length to filter out the unqualified results.
37
+ * */
38
+ minBarcodeTextLength?: number;
39
+
40
+ /**
41
+ * Set the RegEx pattern of the barcode text to filter out the unqualified results.
42
+ * */
43
+ barcodeTextRegExPattern?: string;
44
+ maxThreadsInOneTask?: number;
45
+
46
+ /**
47
+ * Set the location modes with an array of enumeration LocalizationMode.
48
+ * View the reference page of LocalizationModes for more detail about location modes.
49
+ * @see EnumLocalizationMode
50
+ * */
51
+ localizationModes?: Array<EnumLocalizationMode> | Int32Array;
52
+
53
+ /**
54
+ * Set the deblur modes with an array of enumeration DeblurMode.
55
+ * View the reference page of DeblurModes for more detail about deblur modes.
56
+ * @see EnumDeblurMode
57
+ * */
58
+ deblurModes?: Array<EnumDeblurMode> | Int32Array;
59
+
60
+ /**
61
+ * Set the grayscale transformation modes with an array of enumeration GrayscaleTransformationMode.
62
+ * View the reference page of GrayscaleTransformationModes for more detail about grayscale transformation modes.
63
+ * @see EnumGrayscaleTransformationMode
64
+ * */
65
+ grayscaleTransformationModes?: Array<EnumGrayscaleTransformationMode> | Int32Array;
66
+
67
+ /**
68
+ * Set the grayscale enhancement modes with an array of enumeration GrayscaleEnhancementMode.
69
+ * View the reference page of GrayscaleEnhancementModes for more detail about grayscale enhancement modes.
70
+ * @see EnumGrayscaleEnhancementMode
71
+ * */
72
+ grayscaleEnhancementModes?: Array<EnumGrayscaleEnhancementMode> | Int32Array;
73
+
74
+ /**
75
+ * Set the threshold for scaling down the input image during barcode localization.
76
+ * If the shorter edge size of the image is larger than this threshold, the original may be scaled down to reduce processing time.
77
+ * The default value is 2300.
78
+ * */
79
+ scaleDownThreshold?: number;
20
80
  }
@@ -9,96 +9,218 @@ import type {EnumEnhancedFeatures} from "./EnumEnhancedFeatures";
9
9
  const isTurboModuleEnabled = global.__turboModuleProxy != null;
10
10
 
11
11
  const DynamsoftCameraEnhancerModule = isTurboModuleEnabled ?
12
- require("./NativeDynamsoftCameraViewModule").default :
13
- NativeModules.DynamsoftCameraView;
12
+ require("./NativeDynamsoftCameraViewModule").default :
13
+ NativeModules.DynamsoftCameraView;
14
14
 
15
+ /**
16
+ * The singleton instance of CameraEnhancer.
17
+ * */
15
18
  let dce: CameraEnhancer | null;
16
- export class CameraEnhancer extends ImageSourceAdapter {
17
- private constructor() {
18
- super();
19
- }
20
-
21
- protected init() {
22
- this.isaId = DynamsoftCameraEnhancerModule.createInstance()
23
- }
24
-
25
- static async requestCameraPermission() {
26
- if(Platform.OS === "android") {
27
- DynamsoftCameraEnhancerModule.requestCameraPermission()
28
- }
29
- }
30
-
31
- static getInstance(): CameraEnhancer {
32
- if (dce) {
33
- return dce;
34
- }
35
- return dce = new CameraEnhancer();
36
- }
37
-
38
- open() {
39
- DynamsoftCameraEnhancerModule.open();
40
- }
41
-
42
- close() {
43
- DynamsoftCameraEnhancerModule.close();
44
- }
45
-
46
- setCameraView(view: CameraView) {
47
- if (view) {
48
- DynamsoftCameraEnhancerModule.setCameraView(view.nativeCameraViewHandle);
49
- }
50
- }
51
-
52
- selectCamera(position: EnumCameraPosition | number) {
53
- DynamsoftCameraEnhancerModule.selectCamera(position);
54
- }
55
-
56
- getCameraPosition(): Promise<EnumCameraPosition | number> {
57
- return DynamsoftCameraEnhancerModule.getCameraPosition();
58
- }
59
-
60
- setFocus(floatX: number, floatY: number, focusMode: EnumFocusMode | number) {
61
- DynamsoftCameraEnhancerModule.setFocus(floatX, floatY, focusMode);
62
- }
63
19
 
64
- getFocusMode(): Promise<EnumFocusMode | number> {
65
- return DynamsoftCameraEnhancerModule.getFocusMode();
66
- }
67
-
68
- setZoomFactor(factor: number) {
69
- DynamsoftCameraEnhancerModule.setZoomFactor(factor);
70
- }
71
-
72
- getZoomFactor(): Promise<number> {
73
- return DynamsoftCameraEnhancerModule.getZoomFactor();
74
- }
75
-
76
- enableEnhancedFeatures(features: EnumEnhancedFeatures | number) {
77
- DynamsoftCameraEnhancerModule.enableEnhancedFeatures(features);
78
- }
79
-
80
- disableEnhancedFeatures(features: EnumEnhancedFeatures | number) {
81
- DynamsoftCameraEnhancerModule.disableEnhancedFeatures(features);
82
- }
83
-
84
- setScanRegion(region: DSRect | null | undefined) {
85
- DynamsoftCameraEnhancerModule.setScanRegion(region);
86
- }
87
-
88
- getScanRegion(): Promise<DSRect | null | undefined> {
89
- return DynamsoftCameraEnhancerModule.getScanRegion()
90
- }
91
-
92
- turnOnTorch() {
93
- DynamsoftCameraEnhancerModule.turnOnTorch()
94
- }
95
-
96
- turnOffTorch() {
97
- DynamsoftCameraEnhancerModule.turnOffTorch()
98
- }
99
-
100
- destroy() {
101
- this.close()
102
- super.destroy();
103
- }
20
+ /**
21
+ * The CameraEnhancer class is the primary class of Dynamsoft Camera Enhancer that defines the camera controlling APIs.
22
+ * It is a subclass of {@link ImageSourceAdapter}.
23
+ * <p>
24
+ * In js end of react-native, CameraEnhancer uses singleton mode. You can only get CaptureVisionRouter instance by {@link CameraEnhancer.getInstance}.
25
+ * */
26
+ export class CameraEnhancer extends ImageSourceAdapter {
27
+ private constructor() {
28
+ super();
29
+ }
30
+
31
+ protected init() {
32
+ this.isaId = DynamsoftCameraEnhancerModule.createInstance()
33
+ }
34
+
35
+ /**Trigger to request the camera permission.*/
36
+ static async requestCameraPermission() {
37
+ if (Platform.OS === "android") {
38
+ DynamsoftCameraEnhancerModule.requestCameraPermission()
39
+ }
40
+ }
41
+
42
+ /**
43
+ * Get the singleton instance of CameraEnhancer.
44
+ * <p>
45
+ * This method ensures that only one instance of CameraEnhancer is created
46
+ * and reused throughout the application. If an instance already exists, it will
47
+ * return the existing one. Otherwise, it will create a new instance and return it.
48
+ *
49
+ * @returns {CameraEnhancer} The singleton instance of CameraEnhancer.
50
+ * */
51
+ static getInstance(): CameraEnhancer {
52
+ if (dce) {
53
+ return dce;
54
+ }
55
+ return dce = new CameraEnhancer();
56
+ }
57
+
58
+ /**Opens the currently selected camera and starts the video stream.*/
59
+ open() {
60
+ DynamsoftCameraEnhancerModule.open();
61
+ }
62
+
63
+ /**Closes the currently active camera and stops the video stream.*/
64
+ close() {
65
+ DynamsoftCameraEnhancerModule.close();
66
+ }
67
+
68
+ /**
69
+ * Bind a CameraView instance with this CameraEnhancer instance.
70
+ *
71
+ * <p>
72
+ * Code snippet:
73
+ * ```
74
+ * function App(): React.JSX.Element {
75
+ * const cameraView = useRef<CameraView>(null);
76
+ * const camera = CameraEnhancer.getInstance();
77
+ * useEffect(() => {
78
+ * camera.setCameraView(cameraView.current!!);
79
+ * camera.open();
80
+ * }, [camera, cameraView])
81
+ * return (<CameraView style={{flex:1}} ref={cameraView}/>);
82
+ * }
83
+ * ```
84
+ *
85
+ * @param view - the CameraView element
86
+ * */
87
+ setCameraView(view: CameraView) {
88
+ if (view) {
89
+ DynamsoftCameraEnhancerModule.setCameraView(view.nativeCameraViewHandle);
90
+ }
91
+ }
92
+
93
+ /**
94
+ * Select a camera with a camera position.
95
+ * @param position - One of the {@link EnumCameraPosition}
96
+ * */
97
+ selectCamera(position: EnumCameraPosition | number) {
98
+ DynamsoftCameraEnhancerModule.selectCamera(position);
99
+ }
100
+
101
+ /**
102
+ * Get the camera position.
103
+ * @return {Promise<EnumCameraPosition|number>} - A promise that resolves {@link EnumCameraPosition.CP_BACK} or {@link EnumCameraPosition.CP_FRONT}.
104
+ * */
105
+ getCameraPosition(): Promise<EnumCameraPosition | number> {
106
+ return DynamsoftCameraEnhancerModule.getCameraPosition();
107
+ }
108
+
109
+ /**
110
+ * Set the focus point of interest and trigger an one-off auto-focus.
111
+ * After the focus, you can either lock the focalngth or keep the continuous auto focus enabled by configuring the subsequent focus mode.
112
+ * @param floatX - The x of focus point of interest. The coordinate base of the point is "image".
113
+ * @param floatX - The y of focus point of interest. The coordinate base of the point is "image".
114
+ * @param focusMode The subsequent focus mode.
115
+ * @see EnumFocusMode
116
+ * */
117
+ setFocus(floatX: number, floatY: number, focusMode: EnumFocusMode | number) {
118
+ DynamsoftCameraEnhancerModule.setFocus(floatX, floatY, focusMode);
119
+ }
120
+
121
+ /**
122
+ * Get the currently actived focus mode.
123
+ * @return {Promise<EnumFocusMode|number>} - A promise that resolves one of {@link EnumFocusMode}.
124
+ * */
125
+ getFocusMode(): Promise<EnumFocusMode | number> {
126
+ return DynamsoftCameraEnhancerModule.getFocusMode();
127
+ }
128
+
129
+ /**
130
+ * Set the zoom factor of the camera.
131
+ * @param factor - The zoom factor.
132
+ * */
133
+ setZoomFactor(factor: number) {
134
+ DynamsoftCameraEnhancerModule.setZoomFactor(factor);
135
+ }
136
+
137
+ /**
138
+ * Get the zoom factor of the camera.
139
+ * @return {Promise<number>} - A promise that resolves current zoom factor.
140
+ * */
141
+ getZoomFactor(): Promise<number> {
142
+ return DynamsoftCameraEnhancerModule.getZoomFactor();
143
+ }
144
+
145
+ /**
146
+ * Enable the specified enhanced features. View {@link EnumEnhancedFeatures} to learn about these enhanced features.
147
+ * By default, these enhanced features are all disabled.
148
+ * <p>
149
+ * Code snippet:
150
+ * ```
151
+ * cameraEnhancer.enableEnhancedFeatures(EnumEnhancedFeatures.EF_AUTO_ZOOM | EnumEnhancedFeatures.EF_FRAME_FILTER)
152
+ * ```
153
+ * @param features - An enum value or a bitwise combination of EnumEnhancedFeatures which indicates a series of enhanced features.
154
+ * @see EnumEnhancedFeatures
155
+ * */
156
+ enableEnhancedFeatures(features: EnumEnhancedFeatures | number) {
157
+ DynamsoftCameraEnhancerModule.enableEnhancedFeatures(features);
158
+ }
159
+
160
+ /**
161
+ * Disables one or more previously enabled enhanced features.
162
+ * <p>
163
+ * Code snippet:
164
+ * ```
165
+ * cameraEnhancer.disableEnhancedFeatures(EnumEnhancedFeatures.EF_AUTO_ZOOM | EnumEnhancedFeatures.EF_FRAME_FILTER)
166
+ * ```
167
+ * @param features - An enum value or a bitwise combination of EnumEnhancedFeatures indicating the features to be disabled.
168
+ * @see EnumEnhancedFeatures
169
+ * */
170
+ disableEnhancedFeatures(features: EnumEnhancedFeatures | number) {
171
+ DynamsoftCameraEnhancerModule.disableEnhancedFeatures(features);
172
+ }
173
+
174
+ /**
175
+ * Sets the scan region within the camera's view which limits the frame acquisition to a specific area of the video feed.
176
+ * <p>
177
+ * Code snippet:
178
+ * ```
179
+ * let scanRegion = {
180
+ * top: 25,
181
+ * bottom: 75,
182
+ * left: 25,
183
+ * right: 75,
184
+ * measuredInPercentage: true,
185
+ * }
186
+ * cameraEnhancer.setScanRegion(scanRegion);
187
+ * //...
188
+ * cameraEnhancer.setScanRegion(null); //Cancel the scan region
189
+ * ```
190
+ *
191
+ * @param region - specifies the scan region. If null or undefined, cancel the scan region.
192
+ * @remarks The region is always specified relative to the original video size, regardless of any transformations or zoom applied to the video display.
193
+ * @see DSRect
194
+ * */
195
+ setScanRegion(region: DSRect | null | undefined) {
196
+ DynamsoftCameraEnhancerModule.setScanRegion(region);
197
+ }
198
+
199
+ /**
200
+ * Retrieves the current scan region.
201
+ * @return {Promise<DSRect|null|undefined>} - A promise that resolves current scan region.
202
+ * @see DSRect
203
+ * */
204
+ getScanRegion(): Promise<DSRect | null | undefined> {
205
+ return DynamsoftCameraEnhancerModule.getScanRegion()
206
+ }
207
+
208
+ /**
209
+ * Turn on the torch.
210
+ * */
211
+ turnOnTorch() {
212
+ DynamsoftCameraEnhancerModule.turnOnTorch()
213
+ }
214
+
215
+ /**
216
+ * Turn off the torch.
217
+ * */
218
+ turnOffTorch() {
219
+ DynamsoftCameraEnhancerModule.turnOffTorch()
220
+ }
221
+
222
+ destroy() {
223
+ this.close()
224
+ super.destroy();
225
+ }
104
226
  }
@@ -1,5 +1,5 @@
1
1
  // @ts-ignore
2
- import React, {Component, ComponentProps} from 'react';
2
+ import React, {Component, ComponentProps, createElement} from 'react';
3
3
  import {
4
4
  findNodeHandle,
5
5
  type HostComponent,
@@ -10,6 +10,13 @@ import {
10
10
  } from "react-native";
11
11
  import type {CameraViewNativeProps} from "./DynamsoftCameraViewNativeComponent";
12
12
 
13
+ /**
14
+ * Transforms CameraViewNativeProps to a format compatible with the native CameraView component.
15
+ * This ensures only supported properties are passed to the native layer.
16
+ * @param props - The props for the {@link CameraView} component.
17
+ * @returns The transformed native props.
18
+ * @internal
19
+ */
13
20
  const transformToNativeCameraViewProps = (props: CameraViewNativeProps | undefined | null): CameraViewNativeProps => {
14
21
  return JSON.parse(JSON.stringify(
15
22
  {
@@ -31,9 +38,19 @@ const NativeCameraView: HostComponent<CameraViewNativeProps> = isTurboModuleEnab
31
38
  require("./DynamsoftCameraViewNativeComponent").default :
32
39
  requireNativeComponent(ComponentName)
33
40
 
41
+ /**
42
+ * The CameraView class is a React Component that wraps the native CameraView, which is used to display the camera preview.
43
+ * Users can add interactable UI elements on the view.
44
+ * You can view {@link CameraViewNativeProps} to know what custom properties you can define.
45
+ * Only available when CameraView is bound on CameraEnhancer by {@link CameraEnhancer.setCameraView} .
46
+ * @prop CameraViewNativeProps
47
+ * @see CameraViewNativeProps
48
+ * @see CameraEnhancer.setCameraView
49
+ */
34
50
  export class CameraView extends Component<CameraViewNativeProps, any> {
35
51
  private readonly nativeCameraViewRef: React.RefObject<RefType> = React.createRef<RefType>();
36
52
  private readonly nativeProps = transformToNativeCameraViewProps(this.props)
53
+
37
54
  /** @internal */
38
55
  public get nativeCameraViewHandle(): number | null {
39
56
  return findNodeHandle(this.nativeCameraViewRef.current);