dynamsoft-capture-vision-react-native 3.4.1200 → 3.4.3000

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 (222) hide show
  1. package/LICENSE +5 -5
  2. package/README.md +62 -66
  3. package/android/README.md +14 -14
  4. package/android/build.gradle +167 -163
  5. package/android/gradle.properties +20 -20
  6. package/android/settings.gradle +5 -5
  7. package/android/src/main/AndroidManifest.xml +6 -6
  8. package/android/src/main/AndroidManifest_noPackage.xml +5 -5
  9. package/android/src/main/cpp/CMakeLists.txt +21 -21
  10. package/android/src/main/cpp/ImgHO.cpp +94 -94
  11. package/android/src/main/cpp/ImgHO.h +34 -34
  12. package/android/src/main/cpp/JsiCore.cpp +296 -296
  13. package/android/src/main/cpp/JsiCore.h +51 -51
  14. package/android/src/main/cpp/JsiCvr.cpp +332 -332
  15. package/android/src/main/cpp/JsiCvr.h +54 -54
  16. package/android/src/main/cpp/JsiDbr.cpp +283 -283
  17. package/android/src/main/cpp/JsiDbr.h +26 -26
  18. package/android/src/main/cpp/JsiDce.cpp +59 -59
  19. package/android/src/main/cpp/JsiDce.h +17 -17
  20. package/android/src/main/cpp/JsiDcp.cpp +51 -51
  21. package/android/src/main/cpp/JsiDcp.h +31 -31
  22. package/android/src/main/cpp/JsiDdn.cpp +50 -50
  23. package/android/src/main/cpp/JsiDdn.h +28 -28
  24. package/android/src/main/cpp/JsiDlr.cpp +60 -60
  25. package/android/src/main/cpp/JsiDlr.h +26 -26
  26. package/android/src/main/cpp/JsiUtility.cpp +604 -604
  27. package/android/src/main/cpp/JsiUtility.h +26 -26
  28. package/android/src/main/cpp/RawBuffer.cpp +23 -23
  29. package/android/src/main/cpp/RawBuffer.h +24 -24
  30. package/android/src/main/cpp/android_log.h +14 -14
  31. package/android/src/main/dysJniLibs/debug/arm64-v8a/librn_dys.so +0 -0
  32. package/android/src/main/dysJniLibs/debug/armeabi-v7a/librn_dys.so +0 -0
  33. package/android/src/main/dysJniLibs/debug/x86/librn_dys.so +0 -0
  34. package/android/src/main/dysJniLibs/debug/x86_64/librn_dys.so +0 -0
  35. package/android/src/main/dysJniLibs/release/arm64-v8a/librn_dys.so +0 -0
  36. package/android/src/main/dysJniLibs/release/armeabi-v7a/librn_dys.so +0 -0
  37. package/android/src/main/dysJniLibs/release/x86/librn_dys.so +0 -0
  38. package/android/src/main/dysJniLibs/release/x86_64/librn_dys.so +0 -0
  39. package/android/src/main/dysJniLibsFor81/debug/arm64-v8a/librn_dys.so +0 -0
  40. package/android/src/main/dysJniLibsFor81/debug/armeabi-v7a/librn_dys.so +0 -0
  41. package/android/src/main/dysJniLibsFor81/debug/x86/librn_dys.so +0 -0
  42. package/android/src/main/dysJniLibsFor81/debug/x86_64/librn_dys.so +0 -0
  43. package/android/src/main/dysJniLibsFor81/release/arm64-v8a/librn_dys.so +0 -0
  44. package/android/src/main/dysJniLibsFor81/release/armeabi-v7a/librn_dys.so +0 -0
  45. package/android/src/main/dysJniLibsFor81/release/x86/librn_dys.so +0 -0
  46. package/android/src/main/dysJniLibsFor81/release/x86_64/librn_dys.so +0 -0
  47. package/android/src/main/dysJniLibsFor82/debug/arm64-v8a/librn_dys.so +0 -0
  48. package/android/src/main/dysJniLibsFor82/debug/armeabi-v7a/librn_dys.so +0 -0
  49. package/android/src/main/dysJniLibsFor82/debug/x86/librn_dys.so +0 -0
  50. package/android/src/main/dysJniLibsFor82/debug/x86_64/librn_dys.so +0 -0
  51. package/android/src/main/dysJniLibsFor82/release/arm64-v8a/librn_dys.so +0 -0
  52. package/android/src/main/dysJniLibsFor82/release/armeabi-v7a/librn_dys.so +0 -0
  53. package/android/src/main/dysJniLibsFor82/release/x86/librn_dys.so +0 -0
  54. package/android/src/main/dysJniLibsFor82/release/x86_64/librn_dys.so +0 -0
  55. package/android/src/main/dysJniLibsFor86/debug/arm64-v8a/librn_dys.so +3 -0
  56. package/android/src/main/dysJniLibsFor86/debug/armeabi-v7a/librn_dys.so +3 -0
  57. package/android/src/main/dysJniLibsFor86/debug/x86/librn_dys.so +3 -0
  58. package/android/src/main/dysJniLibsFor86/debug/x86_64/librn_dys.so +3 -0
  59. package/android/src/main/dysJniLibsFor86/release/arm64-v8a/librn_dys.so +3 -0
  60. package/android/src/main/dysJniLibsFor86/release/armeabi-v7a/librn_dys.so +3 -0
  61. package/android/src/main/dysJniLibsFor86/release/x86/librn_dys.so +3 -0
  62. package/android/src/main/dysJniLibsFor86/release/x86_64/librn_dys.so +3 -0
  63. package/android/src/main/java/com/dynamsoft/reactnativelib/CVRModule.kt +137 -137
  64. package/android/src/main/java/com/dynamsoft/reactnativelib/CameraViewManager.kt +62 -62
  65. package/android/src/main/java/com/dynamsoft/reactnativelib/DCEModule.kt +125 -125
  66. package/android/src/main/java/com/dynamsoft/reactnativelib/DynamsoftBaseModule.kt +8 -8
  67. package/android/src/main/java/com/dynamsoft/reactnativelib/ISAModule.kt +73 -73
  68. package/android/src/main/java/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +14 -14
  69. package/android/src/main/java/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +35 -35
  70. package/android/src/main/java/com/dynamsoft/reactnativelib/ImageManagerModule.kt +15 -15
  71. package/android/src/main/java/com/dynamsoft/reactnativelib/LicenseModule.kt +29 -29
  72. package/android/src/main/java/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +83 -83
  73. package/android/src/main/java/com/dynamsoft/reactnativelib/ReactNativeDcvPackage.kt +32 -32
  74. package/android/src/main/java/com/dynamsoft/reactnativelib/VersionsModule.kt +41 -41
  75. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/Basic.kt +44 -44
  76. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/ForCore.kt +50 -50
  77. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/ForCvr.kt +129 -129
  78. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/ForDBR.kt +157 -157
  79. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/ForDCE.kt +110 -110
  80. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/ForDCP.kt +49 -49
  81. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/ForDDN.kt +85 -85
  82. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/ForDLR.kt +72 -72
  83. package/android/src/main/java/com/dynamsoft/reactnativelib/basicutils/ImageUtil.kt +58 -58
  84. package/android/src/main/java/com/dynamsoft/reactnativelib/core/ImageSourceAdapterModuleImpl.kt +120 -120
  85. package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +306 -306
  86. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +247 -247
  87. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraLifeCycleOwner.java +14 -14
  88. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraViewManagerImpl.kt +77 -77
  89. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewManagerImpl.kt +15 -15
  90. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewModuleImpl.kt +110 -110
  91. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/RNCameraView.kt +20 -20
  92. package/android/src/main/java/com/dynamsoft/reactnativelib/dce/RNImageEditorView.kt +19 -19
  93. package/android/src/main/java/com/dynamsoft/reactnativelib/license/LicenseModuleImpl.kt +39 -39
  94. package/android/src/main/java/com/dynamsoft/reactnativelib/utility/ImageManagerModuleImpl.kt +120 -120
  95. package/android/src/main/java/com/dynamsoft/reactnativelib/utility/MultiCrossFilterModuleImpl.kt +111 -111
  96. package/app.plugin.js +21 -21
  97. package/dynamsoft-capture-vision-react-native.podspec +24 -24
  98. package/ios/CPP/DSImageData+HostObject.h +18 -18
  99. package/ios/CPP/DSImageData+HostObject.mm +38 -38
  100. package/ios/CPP/ImageDataHostObject.cpp +87 -87
  101. package/ios/CPP/ImageDataHostObject.hpp +35 -35
  102. package/ios/CPP/MutableRawBuffer.cpp +23 -23
  103. package/ios/CPP/MutableRawBuffer.hpp +23 -23
  104. package/ios/CPP/RNDynamsoft+JSI.h +22 -22
  105. package/ios/CPP/RNDynamsoft+JSI.mm +303 -303
  106. package/ios/CPP/RNDynamsoft+Json.h +93 -93
  107. package/ios/CPP/RNDynamsoft+Json.m +733 -733
  108. package/ios/CPP/YeetJSIUtils.h +56 -56
  109. package/ios/CPP/YeetJSIUtils.mm +208 -208
  110. package/ios/RNDynamsoftCameraView.h +31 -31
  111. package/ios/RNDynamsoftCameraView.m +108 -108
  112. package/ios/RNDynamsoftCameraViewManager.h +14 -14
  113. package/ios/RNDynamsoftCameraViewManager.m +195 -195
  114. package/ios/RNDynamsoftCaptureVisionRouter.h +18 -18
  115. package/ios/RNDynamsoftCaptureVisionRouter.mm +532 -532
  116. package/ios/RNDynamsoftImageEditorView.h +17 -17
  117. package/ios/RNDynamsoftImageEditorView.m +25 -25
  118. package/ios/RNDynamsoftImageEditorViewManager.h +14 -14
  119. package/ios/RNDynamsoftImageEditorViewManager.mm +183 -183
  120. package/ios/RNDynamsoftImageManager.h +14 -14
  121. package/ios/RNDynamsoftImageManager.mm +369 -369
  122. package/ios/RNDynamsoftImageSourceAdapter.h +19 -19
  123. package/ios/RNDynamsoftImageSourceAdapter.mm +255 -255
  124. package/ios/RNDynamsoftLicense.h +14 -14
  125. package/ios/RNDynamsoftLicense.m +62 -62
  126. package/ios/RNDynamsoftMultiCrossFilter.h +14 -14
  127. package/ios/RNDynamsoftMultiCrossFilter.m +145 -145
  128. package/ios/RNDynamsoftVersions.h +13 -13
  129. package/ios/RNDynamsoftVersions.m +27 -27
  130. package/package.json +48 -48
  131. package/src/NativeDynamsoftVersionsModule.tsx +20 -20
  132. package/src/VersionsModule.tsx +7 -7
  133. package/src/core/CapturedResultBase.tsx +18 -18
  134. package/src/core/CapturedResultItem.tsx +23 -23
  135. package/src/core/CoreModule.tsx +9 -9
  136. package/src/core/DSRect.tsx +29 -29
  137. package/src/core/EnumCaptureResultItemType.tsx +52 -52
  138. package/src/core/EnumColourChannelUsageType.tsx +26 -26
  139. package/src/core/EnumCrossVerificationStatus.tsx +46 -46
  140. package/src/core/EnumGrayscaleEnhancementMode.tsx +46 -46
  141. package/src/core/EnumGrayscaleTransformationMode.tsx +35 -35
  142. package/src/core/EnumImageFileFormat.tsx +6 -6
  143. package/src/core/EnumPixelFormat.tsx +53 -53
  144. package/src/core/ImageData.tsx +87 -87
  145. package/src/core/ImageSourceAdapter.tsx +160 -160
  146. package/src/core/NativeDynamsoftImageSourceAdapterModule.tsx +29 -29
  147. package/src/core/Point.tsx +13 -13
  148. package/src/core/Quadrilateral.tsx +12 -12
  149. package/src/core/index.tsx +18 -18
  150. package/src/cvr/CaptureVisionRouter.tsx +683 -683
  151. package/src/cvr/CaptureVisionRouterModule.tsx +9 -9
  152. package/src/cvr/CapturedResult.tsx +123 -123
  153. package/src/cvr/CapturedResultFilter.tsx +13 -13
  154. package/src/cvr/CapturedResultReceiver.tsx +71 -71
  155. package/src/cvr/EnumPresetTemplate.tsx +81 -81
  156. package/src/cvr/NativeDynamsoftCaptureVisionRouterModule.tsx +25 -25
  157. package/src/cvr/SimplifiedCaptureVisionSettings.tsx +61 -61
  158. package/src/cvr/index.tsx +11 -11
  159. package/src/dbr/BarcodeDetails.tsx +51 -51
  160. package/src/dbr/BarcodeReaderModule.tsx +9 -9
  161. package/src/dbr/BarcodeResultItem.tsx +65 -65
  162. package/src/dbr/DecodedBarcodesResult.tsx +14 -14
  163. package/src/dbr/ECISegment.tsx +23 -23
  164. package/src/dbr/EnumBarcodeFormat.tsx +112 -112
  165. package/src/dbr/EnumDeblurMode.tsx +29 -29
  166. package/src/dbr/EnumLocalizationMode.tsx +27 -27
  167. package/src/dbr/EnumQRCodeErrorCorrectionLevel.tsx +6 -6
  168. package/src/dbr/SimplifiedBarcodeReaderSettings.tsx +80 -80
  169. package/src/dbr/index.tsx +9 -9
  170. package/src/dce/CameraEnhancer.tsx +254 -254
  171. package/src/dce/CameraEnhancerModule.tsx +9 -9
  172. package/src/dce/CameraView.tsx +100 -100
  173. package/src/dce/DynamsoftCameraViewNativeComponent.ts +96 -96
  174. package/src/dce/DynamsoftImageEditorViewNativeComponent.ts +9 -9
  175. package/src/dce/EnumCameraPosition.tsx +25 -25
  176. package/src/dce/EnumDrawingLayerId.tsx +17 -17
  177. package/src/dce/EnumEnhancedFeatures.tsx +24 -24
  178. package/src/dce/EnumFocusMode.tsx +6 -6
  179. package/src/dce/EnumResolution.tsx +8 -8
  180. package/src/dce/EnumTorchState.tsx +10 -10
  181. package/src/dce/FeedBack.tsx +28 -28
  182. package/src/dce/ImageEditorView.tsx +131 -131
  183. package/src/dce/NativeDynamsoftCameraViewModule.tsx +47 -47
  184. package/src/dce/NativeDynamsoftImageEditorViewModule.ts +9 -9
  185. package/src/dce/index.tsx +13 -13
  186. package/src/dcp/CodeParserDedicatorModule.tsx +9 -9
  187. package/src/dcp/CodeParserModule.tsx +9 -9
  188. package/src/dcp/EnumMappingStatus.tsx +14 -14
  189. package/src/dcp/EnumValidationStatus.tsx +14 -14
  190. package/src/dcp/ParsedResult.tsx +14 -14
  191. package/src/dcp/ParsedResultItem.tsx +50 -50
  192. package/src/dcp/index.tsx +8 -8
  193. package/src/ddn/DeskewedImageResultItem.tsx +40 -40
  194. package/src/ddn/DetectedQuadResultItem.tsx +31 -31
  195. package/src/ddn/DocumentNormalizerModule.tsx +9 -9
  196. package/src/ddn/EnhancedImageResultItem.tsx +20 -20
  197. package/src/ddn/EnumImageColourMode.tsx +14 -14
  198. package/src/ddn/ProcessedDocumentResult.tsx +27 -27
  199. package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +65 -65
  200. package/src/ddn/index.tsx +11 -11
  201. package/src/dip/ImageProcessingModule.tsx +9 -9
  202. package/src/dip/index.tsx +1 -1
  203. package/src/dlr/CharacterResult.tsx +28 -28
  204. package/src/dlr/LabelRecognizerModule.tsx +9 -9
  205. package/src/dlr/RecognizedTextLinesResult.tsx +19 -19
  206. package/src/dlr/SimplifiedLabelRecognizerSettings.tsx +33 -33
  207. package/src/dlr/TextLineResultItem.tsx +41 -41
  208. package/src/dlr/index.tsx +8 -8
  209. package/src/index.tsx +13 -13
  210. package/src/license/LicenseManager.tsx +49 -49
  211. package/src/license/LicenseModule.tsx +9 -9
  212. package/src/license/NativeDynamsoftLicenseModule.tsx +7 -7
  213. package/src/license/index.tsx +7 -7
  214. package/src/utility/CrossVerificationCriteria.tsx +11 -11
  215. package/src/utility/EnumFilterType.tsx +5 -5
  216. package/src/utility/ImageManager.tsx +348 -348
  217. package/src/utility/MultiFrameResultCrossFilter.tsx +183 -183
  218. package/src/utility/NativeDynamsoftImageManagerModule.tsx +7 -7
  219. package/src/utility/NativeDynamsoftMultiCrossFilterModule.tsx +18 -18
  220. package/src/utility/UtilityModule.tsx +9 -9
  221. package/src/utility/index.tsx +4 -4
  222. package/android/.gitignore +0 -4
@@ -1,53 +1,53 @@
1
- /**
2
- * Defines the range of pixel formats that an image can have, specifying how color and transparency data are represented in each pixel of the image.
3
- * @see {@link ImageData.format}
4
- * */
5
- export enum EnumPixelFormat {
6
- /** 0:Black, 1:White. */
7
- IPF_BINARY = 0,
8
-
9
- /** 0:White, 1:Black. */
10
- IPF_BINARYINVERTED = 1,
11
-
12
- /** 8bit gray. */
13
- IPF_GRAYSCALED = 2,
14
-
15
- /** NV21 */
16
- IPF_NV21 = 3,
17
-
18
- /** 16bit with RGB channel order stored in memory from high to low address. */
19
- IPF_RGB_565 = 4,
20
-
21
- /** 16bit with RGB channel order stored in memory from high to low address. */
22
- IPF_RGB_555 = 5,
23
-
24
- /** 24bit with RGB channel order stored in memory from high to low address. */
25
- IPF_RGB_888 = 6,
26
-
27
- /** 32bit with ARGB channel order stored in memory from high to low address. */
28
- IPF_ARGB_8888 = 7,
29
-
30
- /** 48bit with RGB channel order stored in memory from high to low address. */
31
- IPF_RGB_161616 = 8,
32
-
33
- /** 64bit with ARGB channel order stored in memory from high to low address. */
34
- IPF_ARGB_16161616 = 9,
35
-
36
- /** 32bit with ABGR channel order stored in memory from high to low address. */
37
- IPF_ABGR_8888 = 10,
38
-
39
- /** 64bit with ABGR channel order stored in memory from high to low address. */
40
- IPF_ABGR_16161616 = 11,
41
-
42
- /** 24bit with BGR channel order stored in memory from high to low address. */
43
- IPF_BGR_888 = 12,
44
-
45
- /** 0:Black, 255:White. */
46
- IPF_BINARY_8 = 13,
47
-
48
- /** NV12. */
49
- IPF_NV12 = 14,
50
-
51
- /** 0:white, 255:black. */
52
- IPF_BINARY_8_INVERTED = 15,
53
- }
1
+ /**
2
+ * Defines the range of pixel formats that an image can have, specifying how color and transparency data are represented in each pixel of the image.
3
+ * @see {@link ImageData.format}
4
+ * */
5
+ export enum EnumPixelFormat {
6
+ /** 0:Black, 1:White. */
7
+ IPF_BINARY = 0,
8
+
9
+ /** 0:White, 1:Black. */
10
+ IPF_BINARYINVERTED = 1,
11
+
12
+ /** 8bit gray. */
13
+ IPF_GRAYSCALED = 2,
14
+
15
+ /** NV21 */
16
+ IPF_NV21 = 3,
17
+
18
+ /** 16bit with RGB channel order stored in memory from high to low address. */
19
+ IPF_RGB_565 = 4,
20
+
21
+ /** 16bit with RGB channel order stored in memory from high to low address. */
22
+ IPF_RGB_555 = 5,
23
+
24
+ /** 24bit with RGB channel order stored in memory from high to low address. */
25
+ IPF_RGB_888 = 6,
26
+
27
+ /** 32bit with ARGB channel order stored in memory from high to low address. */
28
+ IPF_ARGB_8888 = 7,
29
+
30
+ /** 48bit with RGB channel order stored in memory from high to low address. */
31
+ IPF_RGB_161616 = 8,
32
+
33
+ /** 64bit with ARGB channel order stored in memory from high to low address. */
34
+ IPF_ARGB_16161616 = 9,
35
+
36
+ /** 32bit with ABGR channel order stored in memory from high to low address. */
37
+ IPF_ABGR_8888 = 10,
38
+
39
+ /** 64bit with ABGR channel order stored in memory from high to low address. */
40
+ IPF_ABGR_16161616 = 11,
41
+
42
+ /** 24bit with BGR channel order stored in memory from high to low address. */
43
+ IPF_BGR_888 = 12,
44
+
45
+ /** 0:Black, 255:White. */
46
+ IPF_BINARY_8 = 13,
47
+
48
+ /** NV12. */
49
+ IPF_NV12 = 14,
50
+
51
+ /** 0:white, 255:black. */
52
+ IPF_BINARY_8_INVERTED = 15,
53
+ }
@@ -1,87 +1,87 @@
1
- import {EnumPixelFormat} from "./EnumPixelFormat";
2
- import {NativeModules} from "react-native";
3
- import {ImageEditorView} from "../dce";
4
- import {ImageManager} from "../utility";
5
- import {IntermediateResultManager} from "../cvr";
6
-
7
- declare global {
8
- function imageDataToBase64(imageData: ImageData): string; //Installed in ImageSourceAdapterModule
9
- }
10
-
11
- /**
12
- * The ImageData interface represents image data, which contains the image bytes, width, height, stride, pixel format, orientation and a tag.
13
- * <p>
14
- * `Please release the imageData object when it is no longer needed. see` {@link ImageData.release}.
15
- *
16
- * If you want to display imagedata on react UI Element, you can use {@link imageDataToBase64}
17
- * @see {@link imageDataToBase64}
18
- * @see {@link ImageEditorView.setOriginalImage}
19
- * @see {@link ImageManager.saveToFile}
20
- * */
21
- export interface ImageData {
22
- /**
23
- * The raw bytes of the image, of type {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer}.
24
- * */
25
- buffer: ArrayBuffer;
26
-
27
- /**
28
- * The width of the image in pixels.
29
- * */
30
- width: number;
31
-
32
- /**
33
- * The height of the image in pixels.
34
- * */
35
- height: number;
36
-
37
- /**
38
- * The stride (or row width) of the image in bytes.
39
- * */
40
- stride: number;
41
-
42
- /**
43
- * The pixel format of the image, of type {@link EnumPixelFormat}
44
- * */
45
- format: EnumPixelFormat | number;
46
-
47
- /**
48
- * The orientation information of the image.
49
- * */
50
- orientation: number;
51
-
52
- /**
53
- * Release the native memory. Data cannot be used after release.
54
- * */
55
- release(): void;
56
- }
57
-
58
- // @ts-ignore Check whether __turboModuleProxy exists, it may not
59
- const isTurboModuleEnabled = global.__turboModuleProxy != null;
60
-
61
- const ISAModule = isTurboModuleEnabled ?
62
- require("./NativeDynamsoftImageSourceAdapterModule").default :
63
- NativeModules.DynamsoftImageSourceAdapterModule
64
-
65
- let isInstalled = false
66
- const installMethods = () => {
67
- if (!isInstalled) {
68
- ISAModule.install()
69
- isInstalled = true
70
- }
71
- }
72
-
73
-
74
- /**
75
- * Converts an ImageData object to a Base64-encoded string.
76
- *
77
- * @param {ImageData} imageData - The ImageData object to convert.
78
- * @returns {string} - The Base64-encoded string representation of the image data.
79
- * @see {@link IntermediateResultManager.getOriginalImage}
80
- */
81
- export function imageDataToBase64(imageData: ImageData): string | undefined | null {
82
- installMethods();
83
- if (typeof global.imageDataToBase64 !== 'function') {
84
- return null;
85
- }
86
- return global.imageDataToBase64(imageData);
87
- }
1
+ import {EnumPixelFormat} from "./EnumPixelFormat";
2
+ import {NativeModules} from "react-native";
3
+ import {ImageEditorView} from "../dce";
4
+ import {ImageManager} from "../utility";
5
+ import {IntermediateResultManager} from "../cvr";
6
+
7
+ declare global {
8
+ function imageDataToBase64(imageData: ImageData): string; //Installed in ImageSourceAdapterModule
9
+ }
10
+
11
+ /**
12
+ * The ImageData interface represents image data, which contains the image bytes, width, height, stride, pixel format, orientation and a tag.
13
+ * <p>
14
+ * `Please release the imageData object when it is no longer needed. see` {@link ImageData.release}.
15
+ *
16
+ * If you want to display imagedata on react UI Element, you can use {@link imageDataToBase64}
17
+ * @see {@link imageDataToBase64}
18
+ * @see {@link ImageEditorView.setOriginalImage}
19
+ * @see {@link ImageManager.saveToFile}
20
+ * */
21
+ export interface ImageData {
22
+ /**
23
+ * The raw bytes of the image, of type {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer}.
24
+ * */
25
+ buffer: ArrayBuffer;
26
+
27
+ /**
28
+ * The width of the image in pixels.
29
+ * */
30
+ width: number;
31
+
32
+ /**
33
+ * The height of the image in pixels.
34
+ * */
35
+ height: number;
36
+
37
+ /**
38
+ * The stride (or row width) of the image in bytes.
39
+ * */
40
+ stride: number;
41
+
42
+ /**
43
+ * The pixel format of the image, of type {@link EnumPixelFormat}
44
+ * */
45
+ format: EnumPixelFormat | number;
46
+
47
+ /**
48
+ * The orientation information of the image.
49
+ * */
50
+ orientation: number;
51
+
52
+ /**
53
+ * Release the native memory. Data cannot be used after release.
54
+ * */
55
+ release(): void;
56
+ }
57
+
58
+ // @ts-ignore Check whether __turboModuleProxy exists, it may not
59
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
60
+
61
+ const ISAModule = isTurboModuleEnabled ?
62
+ require("./NativeDynamsoftImageSourceAdapterModule").default :
63
+ NativeModules.DynamsoftImageSourceAdapterModule
64
+
65
+ let isInstalled = false
66
+ const installMethods = () => {
67
+ if (!isInstalled) {
68
+ ISAModule.install()
69
+ isInstalled = true
70
+ }
71
+ }
72
+
73
+
74
+ /**
75
+ * Converts an ImageData object to a Base64-encoded string.
76
+ *
77
+ * @param {ImageData} imageData - The ImageData object to convert.
78
+ * @returns {string} - The Base64-encoded string representation of the image data.
79
+ * @see {@link IntermediateResultManager.getOriginalImage}
80
+ */
81
+ export function imageDataToBase64(imageData: ImageData): string | undefined | null {
82
+ installMethods();
83
+ if (typeof global.imageDataToBase64 !== 'function') {
84
+ return null;
85
+ }
86
+ return global.imageDataToBase64(imageData);
87
+ }
@@ -1,160 +1,160 @@
1
- import type {ImageData} from "./ImageData";
2
- import {NativeModules} from "react-native";
3
- import type {EnumColourChannelUsageType} from "./EnumColourChannelUsageType";
4
- import {CameraEnhancer} from "../dce";
5
- import {CaptureVisionRouter} from "../cvr";
6
-
7
- // @ts-ignore Check whether __turboModuleProxy exists, it may not
8
- const isTurboModuleEnabled = global.__turboModuleProxy != null;
9
-
10
- const ISAModule = isTurboModuleEnabled ?
11
- require("./NativeDynamsoftImageSourceAdapterModule").default :
12
- NativeModules.DynamsoftImageSourceAdapterModule
13
-
14
- let isInstalled = false
15
- const installMethods = () => {
16
- if (!isInstalled) {
17
- ISAModule.install()
18
- isInstalled = true
19
- }
20
- }
21
-
22
- declare global {
23
- function isaAddImageToBuffer(nativeIsaId: string, imageData: ImageData): void;
24
-
25
- function isaGetImageData(nativeIsaId: string): ImageData | null | undefined;
26
- }
27
-
28
-
29
- /**
30
- * The ImageSourceAdapter class provides an interface for fetching and buffering images.
31
- * It is an abstract class that needs to be implemented by a concrete class to provide actual functionality.
32
- * `Each ImageSourceAdapter instance object will correspond to a native instance object.`
33
- *
34
- * @see {@link CameraEnhancer}
35
- * @see {@link CaptureVisionRouter.setInput}
36
- * @hideconstructor
37
- * */
38
- export abstract class ImageSourceAdapter {
39
- protected isaId: string = "";
40
-
41
- protected constructor() {
42
- this.init();
43
- }
44
-
45
- protected init() {
46
- this.isaId = ISAModule.createDefaultNativeISA();
47
- }
48
-
49
- /**@internal*/
50
- public _getIsaId(): string {
51
- return this.isaId;
52
- }
53
-
54
- /**
55
- * Destroy native instance. This object is no longer available after destroy().
56
- * */
57
- public destroy(): void {
58
- ISAModule.destroy(this.isaId);
59
- }
60
-
61
- /**
62
- * Adds an image to the buffer of the adapter.
63
- *
64
- * @param imageData The {@link ImageData} object to be added to the buffer.
65
- * */
66
- public addImageToBuffer(imageData: ImageData): void {
67
- installMethods()
68
- if (typeof global.isaAddImageToBuffer !== 'function') {
69
- return;
70
- }
71
- global.isaAddImageToBuffer(this.isaId, imageData)
72
- }
73
-
74
- /**
75
- * Get a buffered image.
76
- *
77
- * @returns {ImageData|null|undefined} - The {@link ImageData} object if available, otherwise`null` or `undefined` if no image is found in the buffer.
78
- * */
79
- public getImageData(): ImageData | null | undefined {
80
- installMethods()
81
- if (typeof global.isaGetImageData !== 'function') {
82
- return null;
83
- }
84
- return global.isaGetImageData(this.isaId)
85
- }
86
-
87
- /**
88
- * Get the current number of images in the buffer.
89
- *
90
- * @returns {Promise<number>} - A promise that resolves to the number of images in the buffer.
91
- * */
92
- public getImageCount(): Promise<number> {
93
- return ISAModule.getImageCount(this.isaId);
94
- }
95
-
96
- /**
97
- * Determines whether the buffer is empty.
98
- * */
99
- public isBufferEmpty(): Promise<boolean> {
100
- return ISAModule.isBufferEmpty(this.isaId);
101
- }
102
-
103
- /**
104
- * Clear the image buffer.
105
- * */
106
- public clearBuffer(): Promise<void> {
107
- return ISAModule.clearBuffer(this.isaId);
108
- }
109
-
110
-
111
- /**
112
- * Get the current usage type for color channels in images.
113
- *
114
- * @returns {Promise<EnumColourChannelUsageType>} - A promise that resolves to an enum representing the color channel usage type.
115
- * */
116
- public getColourChannelUsageType(): Promise<EnumColourChannelUsageType> {
117
- return ISAModule.getColourChannelUsageType(this.isaId);
118
- }
119
-
120
- /**
121
- * Set the usage type of a color channel in images.
122
- *
123
- * @param type The usage type({@link EnumColourChannelUsageType}) to be set for the color channel.
124
- * */
125
- public setColourChannelUsageType(type: EnumColourChannelUsageType): Promise<void> {
126
- return ISAModule.setColourChannelUsageType(this.isaId, type);
127
- }
128
-
129
- /**
130
- * Get the maximum number of images that can be buffered.
131
- *
132
- * @return {Promise<number>} - A promise that resolves to the maximum capability of the Buffer.
133
- * */
134
- public getMaximumImageCount(): Promise<number> {
135
- return ISAModule.getMaximumImageCount(this.isaId);
136
- }
137
-
138
- /**
139
- * Set the maximum number of images that can be buffered at any time.
140
- *
141
- * @param count - The maximum capability of the Buffer.
142
- * */
143
- public setMaximumImageCount(count: number): Promise<void> {
144
- return ISAModule.setNextImageToReturn(this.isaId, count);
145
- }
146
-
147
- /**
148
- * Start fetching images from the source to the Buffer of ImageSourceAdapter.
149
- * */
150
- public startFetching(): void {
151
- ISAModule.startFetching(this.isaId);
152
- }
153
-
154
- /**
155
- * Stop fetching images from the source to the Buffer of ImageSourceAdapter.
156
- * */
157
- public stopFetching(): void {
158
- ISAModule.stopFetching(this.isaId);
159
- }
160
- }
1
+ import type {ImageData} from "./ImageData";
2
+ import {NativeModules} from "react-native";
3
+ import type {EnumColourChannelUsageType} from "./EnumColourChannelUsageType";
4
+ import {CameraEnhancer} from "../dce";
5
+ import {CaptureVisionRouter} from "../cvr";
6
+
7
+ // @ts-ignore Check whether __turboModuleProxy exists, it may not
8
+ const isTurboModuleEnabled = global.__turboModuleProxy != null;
9
+
10
+ const ISAModule = isTurboModuleEnabled ?
11
+ require("./NativeDynamsoftImageSourceAdapterModule").default :
12
+ NativeModules.DynamsoftImageSourceAdapterModule
13
+
14
+ let isInstalled = false
15
+ const installMethods = () => {
16
+ if (!isInstalled) {
17
+ ISAModule.install()
18
+ isInstalled = true
19
+ }
20
+ }
21
+
22
+ declare global {
23
+ function isaAddImageToBuffer(nativeIsaId: string, imageData: ImageData): void;
24
+
25
+ function isaGetImageData(nativeIsaId: string): ImageData | null | undefined;
26
+ }
27
+
28
+
29
+ /**
30
+ * The ImageSourceAdapter class provides an interface for fetching and buffering images.
31
+ * It is an abstract class that needs to be implemented by a concrete class to provide actual functionality.
32
+ * `Each ImageSourceAdapter instance object will correspond to a native instance object.`
33
+ *
34
+ * @see {@link CameraEnhancer}
35
+ * @see {@link CaptureVisionRouter.setInput}
36
+ * @hideconstructor
37
+ * */
38
+ export abstract class ImageSourceAdapter {
39
+ protected isaId: string = "";
40
+
41
+ protected constructor() {
42
+ this.init();
43
+ }
44
+
45
+ protected init() {
46
+ this.isaId = ISAModule.createDefaultNativeISA();
47
+ }
48
+
49
+ /**@internal*/
50
+ public _getIsaId(): string {
51
+ return this.isaId;
52
+ }
53
+
54
+ /**
55
+ * Destroy native instance. This object is no longer available after destroy().
56
+ * */
57
+ public destroy(): void {
58
+ ISAModule.destroy(this.isaId);
59
+ }
60
+
61
+ /**
62
+ * Adds an image to the buffer of the adapter.
63
+ *
64
+ * @param imageData The {@link ImageData} object to be added to the buffer.
65
+ * */
66
+ public addImageToBuffer(imageData: ImageData): void {
67
+ installMethods()
68
+ if (typeof global.isaAddImageToBuffer !== 'function') {
69
+ return;
70
+ }
71
+ global.isaAddImageToBuffer(this.isaId, imageData)
72
+ }
73
+
74
+ /**
75
+ * Get a buffered image.
76
+ *
77
+ * @returns {ImageData|null|undefined} - The {@link ImageData} object if available, otherwise`null` or `undefined` if no image is found in the buffer.
78
+ * */
79
+ public getImageData(): ImageData | null | undefined {
80
+ installMethods()
81
+ if (typeof global.isaGetImageData !== 'function') {
82
+ return null;
83
+ }
84
+ return global.isaGetImageData(this.isaId)
85
+ }
86
+
87
+ /**
88
+ * Get the current number of images in the buffer.
89
+ *
90
+ * @returns {Promise<number>} - A promise that resolves to the number of images in the buffer.
91
+ * */
92
+ public getImageCount(): Promise<number> {
93
+ return ISAModule.getImageCount(this.isaId);
94
+ }
95
+
96
+ /**
97
+ * Determines whether the buffer is empty.
98
+ * */
99
+ public isBufferEmpty(): Promise<boolean> {
100
+ return ISAModule.isBufferEmpty(this.isaId);
101
+ }
102
+
103
+ /**
104
+ * Clear the image buffer.
105
+ * */
106
+ public clearBuffer(): Promise<void> {
107
+ return ISAModule.clearBuffer(this.isaId);
108
+ }
109
+
110
+
111
+ /**
112
+ * Get the current usage type for color channels in images.
113
+ *
114
+ * @returns {Promise<EnumColourChannelUsageType>} - A promise that resolves to an enum representing the color channel usage type.
115
+ * */
116
+ public getColourChannelUsageType(): Promise<EnumColourChannelUsageType> {
117
+ return ISAModule.getColourChannelUsageType(this.isaId);
118
+ }
119
+
120
+ /**
121
+ * Set the usage type of a color channel in images.
122
+ *
123
+ * @param type The usage type({@link EnumColourChannelUsageType}) to be set for the color channel.
124
+ * */
125
+ public setColourChannelUsageType(type: EnumColourChannelUsageType): Promise<void> {
126
+ return ISAModule.setColourChannelUsageType(this.isaId, type);
127
+ }
128
+
129
+ /**
130
+ * Get the maximum number of images that can be buffered.
131
+ *
132
+ * @return {Promise<number>} - A promise that resolves to the maximum capability of the Buffer.
133
+ * */
134
+ public getMaximumImageCount(): Promise<number> {
135
+ return ISAModule.getMaximumImageCount(this.isaId);
136
+ }
137
+
138
+ /**
139
+ * Set the maximum number of images that can be buffered at any time.
140
+ *
141
+ * @param count - The maximum capability of the Buffer.
142
+ * */
143
+ public setMaximumImageCount(count: number): Promise<void> {
144
+ return ISAModule.setNextImageToReturn(this.isaId, count);
145
+ }
146
+
147
+ /**
148
+ * Start fetching images from the source to the Buffer of ImageSourceAdapter.
149
+ * */
150
+ public startFetching(): void {
151
+ ISAModule.startFetching(this.isaId);
152
+ }
153
+
154
+ /**
155
+ * Stop fetching images from the source to the Buffer of ImageSourceAdapter.
156
+ * */
157
+ public stopFetching(): void {
158
+ ISAModule.stopFetching(this.isaId);
159
+ }
160
+ }
@@ -1,29 +1,29 @@
1
- import {type TurboModule, TurboModuleRegistry} from "react-native";
2
-
3
- export interface Spec extends TurboModule {
4
- install(): boolean;
5
-
6
- createDefaultNativeISA(): string;
7
-
8
- destroy(isaId: string): void;
9
-
10
- getImageCount(isaId: string): Promise<number>;
11
-
12
- isBufferEmpty(isaId: string): Promise<boolean>;
13
-
14
- clearBuffer(isaId: string): Promise<void>;
15
-
16
- getColourChannelUsageType(isaId: string): Promise<number>;
17
-
18
- setColourChannelUsageType(isaId: string, type: number): Promise<void>;
19
-
20
- getMaximumImageCount(isaId: string): Promise<number>;
21
-
22
- setMaximumImageCount(isaId: string, maxCount: number): Promise<void>;
23
-
24
- startFetching(isaId: string): void;
25
-
26
- stopFetching(isaId: string): void;
27
- }
28
-
29
- export default TurboModuleRegistry.get<Spec>("DynamsoftImageSourceAdapterModule") as Spec | null;
1
+ import {type TurboModule, TurboModuleRegistry} from "react-native";
2
+
3
+ export interface Spec extends TurboModule {
4
+ install(): boolean;
5
+
6
+ createDefaultNativeISA(): string;
7
+
8
+ destroy(isaId: string): void;
9
+
10
+ getImageCount(isaId: string): Promise<number>;
11
+
12
+ isBufferEmpty(isaId: string): Promise<boolean>;
13
+
14
+ clearBuffer(isaId: string): Promise<void>;
15
+
16
+ getColourChannelUsageType(isaId: string): Promise<number>;
17
+
18
+ setColourChannelUsageType(isaId: string, type: number): Promise<void>;
19
+
20
+ getMaximumImageCount(isaId: string): Promise<number>;
21
+
22
+ setMaximumImageCount(isaId: string, maxCount: number): Promise<void>;
23
+
24
+ startFetching(isaId: string): void;
25
+
26
+ stopFetching(isaId: string): void;
27
+ }
28
+
29
+ export default TurboModuleRegistry.get<Spec>("DynamsoftImageSourceAdapterModule") as Spec | null;