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.
- package/LICENSE +5 -0
- package/README.md +32 -4
- package/android/build.gradle +1 -5
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +73 -64
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewManagerImpl.kt +2 -18
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewModuleImpl.kt +49 -51
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/RNImageEditorView.kt +19 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +2 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +6 -0
- package/dynamsoft-capture-vision-react-native.podspec +3 -5
- package/ios/CPP/RNDynamsoft+JSI.h +19 -0
- package/ios/CPP/RNDynamsoft+JSI.mm +145 -0
- package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/RNDynamsoft+Json.h +12 -5
- package/ios/{RNDynamsoftCaptureVision/CPP/RNDynamsoft+Json.mm → CPP/RNDynamsoft+Json.m} +6 -124
- package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCaptureVisionRouter.mm → RNDynamsoftCaptureVisionRouter.mm} +1 -0
- package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageEditorViewManager.mm → RNDynamsoftImageEditorViewManager.mm} +5 -1
- package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageManager.mm → RNDynamsoftImageManager.mm} +6 -2
- package/package.json +2 -2
- package/src/core/CapturedResultItem.tsx +18 -2
- package/src/core/CompletionListener.tsx +4 -3
- package/src/core/CoreModule.tsx +3 -3
- package/src/core/DSRect.tsx +28 -21
- package/src/core/EnumCaptureResultItemType.tsx +38 -7
- package/src/core/EnumColourChannelUsageType.tsx +25 -7
- package/src/core/EnumCrossVerificationStatus.tsx +43 -0
- package/src/core/EnumGrayscaleEnhancementMode.tsx +40 -7
- package/src/core/EnumGrayscaleTransformationMode.tsx +29 -5
- package/src/core/EnumPixelFormat.tsx +37 -32
- package/src/core/ImageData.tsx +51 -4
- package/src/core/ImageSourceAdapter.tsx +132 -72
- package/src/core/NativeDynamsoftImageSourceAdapterModule.tsx +24 -13
- package/src/core/Point.tsx +12 -9
- package/src/core/Quadrilateral.tsx +9 -5
- package/src/core/Rect.tsx +19 -16
- package/src/cvr/CaptureVisionRouter.tsx +571 -279
- package/src/cvr/CapturedResult.tsx +117 -76
- package/src/cvr/CapturedResultFilter.tsx +7 -0
- package/src/cvr/CapturedResultReceiver.tsx +59 -3
- package/src/cvr/EnumPresetTemplate.tsx +66 -1
- package/src/cvr/SimplifiedCaptureVisionSettings.tsx +45 -0
- package/src/dbr/BarcodeResultItem.tsx +31 -1
- package/src/dbr/DecodedBarcodesResult.tsx +18 -0
- package/src/dbr/EnumBarcodeFormat.tsx +61 -50
- package/src/dbr/EnumDeblurMode.tsx +28 -12
- package/src/dbr/EnumLocalizationMode.tsx +15 -1
- package/src/dbr/SimplifiedBarcodeReaderSettings.tsx +72 -12
- package/src/dce/CameraEnhancer.tsx +211 -89
- package/src/dce/CameraView.tsx +18 -1
- package/src/dce/DynamsoftCameraViewNativeComponent.ts +43 -0
- package/src/dce/EnumCameraPosition.tsx +3 -0
- package/src/dce/EnumDrawingLayerId.tsx +11 -0
- package/src/dce/EnumEnhancedFeatures.tsx +23 -7
- package/src/dce/EnumFocusMode.tsx +2 -0
- package/src/dce/FeedBack.tsx +9 -0
- package/src/dce/ImageEditorView.tsx +35 -2
- package/src/dcp/EnumMappingStatus.tsx +12 -3
- package/src/dcp/EnumValidationStatus.tsx +12 -3
- package/src/dcp/ParsedResult.tsx +16 -0
- package/src/dcp/ParsedResultItem.tsx +35 -0
- package/src/ddn/DetectedQuadResultItem.tsx +23 -0
- package/src/ddn/DetectedQuadsResult.tsx +20 -1
- package/src/ddn/EnumImageColourMode.tsx +9 -0
- package/src/ddn/NormalizedImageResultItem.tsx +25 -0
- package/src/ddn/NormalizedImagesResult.tsx +17 -1
- package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +38 -2
- package/src/dlr/CharacterResult.tsx +17 -0
- package/src/dlr/RecognizedTextLinesResult.tsx +23 -1
- package/src/dlr/SimplifiedLabelRecognizerSettings.tsx +21 -0
- package/src/dlr/TextLineResultItem.tsx +26 -0
- package/src/license/LicenseManager.tsx +19 -0
- package/src/utility/ImageManager.tsx +23 -0
- package/src/utility/MultiFrameResultCrossFilter.tsx +99 -6
- package/android/.gitignore +0 -4
- package/ios/ReactNativeDcv.xcodeproj/project.pbxproj +0 -390
- /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/DSImageData+HostObject.h +0 -0
- /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/DSImageData+HostObject.mm +0 -0
- /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/ImageDataHostObject.cpp +0 -0
- /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/ImageDataHostObject.hpp +0 -0
- /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/MutableRawBuffer.cpp +0 -0
- /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/MutableRawBuffer.hpp +0 -0
- /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/YeetJSIUtils.h +0 -0
- /package/ios/{RNDynamsoftCaptureVision/CPP → CPP}/YeetJSIUtils.mm +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCameraView.h → RNDynamsoftCameraView.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCameraView.m → RNDynamsoftCameraView.m} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCameraViewManager.h → RNDynamsoftCameraViewManager.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCameraViewManager.m → RNDynamsoftCameraViewManager.m} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftCaptureVisionRouter.h → RNDynamsoftCaptureVisionRouter.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageEditorView.h → RNDynamsoftImageEditorView.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageEditorView.m → RNDynamsoftImageEditorView.m} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageEditorViewManager.h → RNDynamsoftImageEditorViewManager.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageManager.h → RNDynamsoftImageManager.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageSourceAdapter.h → RNDynamsoftImageSourceAdapter.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftImageSourceAdapter.mm → RNDynamsoftImageSourceAdapter.mm} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftLicense.h → RNDynamsoftLicense.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftLicense.m → RNDynamsoftLicense.m} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftMultiCrossFilter.h → RNDynamsoftMultiCrossFilter.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftMultiCrossFilter.m → RNDynamsoftMultiCrossFilter.m} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftVersions.h → RNDynamsoftVersions.h} +0 -0
- /package/ios/{RNDynamsoftCaptureVision/RNDynamsoftVersions.m → RNDynamsoftVersions.m} +0 -0
|
@@ -1,8 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifies the method employed to enhance images in grayscale.
|
|
3
|
+
* @see SimplifiedBarcodeReaderSettings.grayscaleEnhancementModes
|
|
4
|
+
*/
|
|
1
5
|
export enum EnumGrayscaleEnhancementMode {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Disables any grayscale image preprocessing. Selecting this mode skips the preprocessing step,
|
|
8
|
+
* passing the image through to subsequent operations without modification.
|
|
9
|
+
*/
|
|
10
|
+
GEM_SKIP = 0x0,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Automatic selection of grayscale enhancement mode. Currently, not supported.
|
|
14
|
+
* Future implementations may automatically choose the most suitable enhancement based on image analysis.
|
|
15
|
+
*/
|
|
16
|
+
GEM_AUTO = 0x1,
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Uses the original, unprocessed image for subsequent operations. This mode is selected when no specific
|
|
20
|
+
* grayscale enhancement is required, maintaining the image in its natural state.
|
|
21
|
+
*/
|
|
22
|
+
GEM_GENERAL = 0x2,
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Applies a grayscale equalization algorithm to the image, enhancing contrast and detail in gray level.
|
|
26
|
+
* Suitable for images with poor contrast.
|
|
27
|
+
*/
|
|
28
|
+
GEM_GRAY_EQUALIZE = 0x4,
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Implements a grayscale smoothing algorithm to reduce noise and smooth the image.
|
|
32
|
+
* This can be beneficial for images with high levels of grain or noise.
|
|
33
|
+
*/
|
|
34
|
+
GEM_GRAY_SMOOTH = 0x8,
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Enhances the image by applying both sharpening and smoothing algorithms. This mode aims to increase
|
|
38
|
+
* clarity and detail while reducing noise, offering a balanced approach to image preprocessing.
|
|
39
|
+
*/
|
|
40
|
+
GEM_SHARPEN_SMOOTH = 0x10
|
|
41
|
+
}
|
|
@@ -1,6 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifies the method employed to transform images in grayscale.
|
|
3
|
+
* @see SimplifiedBarcodeReaderSettings.grayscaleTransformationModes
|
|
4
|
+
*/
|
|
1
5
|
export enum EnumGrayscaleTransformationMode {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Bypasses grayscale transformation, leaving the image in its current state without any modification to its grayscale values.
|
|
8
|
+
* This mode is selected when no alteration of the grayscale data is desired, passing the image through to subsequent operations without modification.
|
|
9
|
+
*/
|
|
10
|
+
GTM_SKIP = 0x0,
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Applies an inversion to the grayscale values of the image, effectively transforming light elements to dark and vice versa.
|
|
14
|
+
* This mode is particularly useful for images with light text on dark backgrounds, enhancing visibility for further processing.
|
|
15
|
+
*/
|
|
16
|
+
GTM_INVERTED = 0x1,
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Maintains the original grayscale values of the image without any transformation. This mode is suited for images with
|
|
20
|
+
* dark elements on light backgrounds, ensuring the natural contrast and detail are preserved for subsequent analysis.
|
|
21
|
+
*/
|
|
22
|
+
GTM_ORIGINAL = 0x2,
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Delegates the choice of grayscale transformation to the library's algorithm, which automatically determines the most
|
|
26
|
+
* suitable transformation based on the image's characteristics. This mode is beneficial when the optimal transformation
|
|
27
|
+
* is not known in advance or varies across different images.
|
|
28
|
+
*/
|
|
29
|
+
GTM_AUTO = 0x4
|
|
30
|
+
}
|
|
@@ -1,48 +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 ImageData.format
|
|
4
|
+
* */
|
|
1
5
|
export enum EnumPixelFormat {
|
|
2
|
-
|
|
3
|
-
|
|
6
|
+
/** 0:Black, 1:White. */
|
|
7
|
+
IPF_BINARY = 0,
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
/** 0:White, 1:Black. */
|
|
10
|
+
IPF_BINARYINVERTED = 1,
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
/** 8bit gray. */
|
|
13
|
+
IPF_GRAYSCALED = 2,
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
/** NV21 */
|
|
16
|
+
IPF_NV21 = 3,
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
/** 16bit with RGB channel order stored in memory from high to low address. */
|
|
19
|
+
IPF_RGB_565 = 4,
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
/** 16bit with RGB channel order stored in memory from high to low address. */
|
|
22
|
+
IPF_RGB_555 = 5,
|
|
19
23
|
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
/** 24bit with RGB channel order stored in memory from high to low address. */
|
|
25
|
+
IPF_RGB_888 = 6,
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
/** 32bit with ARGB channel order stored in memory from high to low address. */
|
|
28
|
+
IPF_ARGB_8888 = 7,
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
/** 48bit with RGB channel order stored in memory from high to low address. */
|
|
31
|
+
IPF_RGB_161616 = 8,
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
33
|
+
/** 64bit with ARGB channel order stored in memory from high to low address. */
|
|
34
|
+
IPF_ARGB_16161616 = 9,
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
/** 32bit with ABGR channel order stored in memory from high to low address. */
|
|
37
|
+
IPF_ABGR_8888 = 10,
|
|
34
38
|
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
/** 64bit with ABGR channel order stored in memory from high to low address. */
|
|
40
|
+
IPF_ABGR_16161616 = 11,
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
/** 24bit with BGR channel order stored in memory from high to low address. */
|
|
43
|
+
IPF_BGR_888 = 12,
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
/** 0:Black, 255:White. */
|
|
46
|
+
IPF_BINARY_8 = 13,
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
/** NV12. */
|
|
49
|
+
IPF_NV12 = 14,
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
51
|
+
/** 0:white, 255:black. */
|
|
52
|
+
IPF_BINARY_8_INVERTED = 15,
|
|
53
|
+
}
|
package/src/core/ImageData.tsx
CHANGED
|
@@ -1,17 +1,57 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {EnumPixelFormat} from "./EnumPixelFormat";
|
|
2
2
|
import {NativeModules} from "react-native";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
function imageDataToBase64(imageData: ImageData): string; //Installed in ImageSourceAdapterModule
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* The ImageData interface represents image data, which contains the image bytes, width, height, stride, pixel format, orientation and a tag.
|
|
10
|
+
* <p>
|
|
11
|
+
* `Please release the imageData object when it is no longer needed. see` {@link ImageData.release}.
|
|
12
|
+
*
|
|
13
|
+
* If you want to display imagedata on react UI Element, you can use {@link imageDataToBase64}
|
|
14
|
+
* @see ImageData.release
|
|
15
|
+
* @see imageDataToBase64
|
|
16
|
+
* @see EditorView.setOriginalImage
|
|
17
|
+
* @see ImageManager.saveToFile
|
|
18
|
+
* */
|
|
8
19
|
export interface ImageData {
|
|
20
|
+
/**
|
|
21
|
+
* The raw bytes of the image, of type ArrayBuffer.
|
|
22
|
+
* @see ArrayBuffer
|
|
23
|
+
* */
|
|
9
24
|
buffer: ArrayBuffer;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The width of the image in pixels.
|
|
28
|
+
* */
|
|
10
29
|
width: number;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The height of the image in pixels.
|
|
33
|
+
* */
|
|
11
34
|
height: number;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The stride (or row width) of the image in bytes.
|
|
38
|
+
* */
|
|
12
39
|
stride: number;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The pixel format of the image.
|
|
43
|
+
* @see EnumPixelFormat
|
|
44
|
+
* */
|
|
13
45
|
format: EnumPixelFormat | number;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The orientation information of the image.
|
|
49
|
+
* */
|
|
14
50
|
orientation: number;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Release the native memory. Data cannot be used after release.
|
|
54
|
+
* */
|
|
15
55
|
release(): void;
|
|
16
56
|
}
|
|
17
57
|
|
|
@@ -19,17 +59,24 @@ export interface ImageData {
|
|
|
19
59
|
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
20
60
|
|
|
21
61
|
const ISAModule = isTurboModuleEnabled ?
|
|
22
|
-
|
|
23
|
-
|
|
62
|
+
require("./NativeDynamsoftImageSourceAdapterModule").default :
|
|
63
|
+
NativeModules.DynamsoftImageSourceAdapterModule
|
|
24
64
|
|
|
25
65
|
let isInstalled = false
|
|
26
66
|
const installMethods = () => {
|
|
27
|
-
if(!isInstalled) {
|
|
67
|
+
if (!isInstalled) {
|
|
28
68
|
ISAModule.install()
|
|
29
69
|
isInstalled = true
|
|
30
70
|
}
|
|
31
71
|
}
|
|
32
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
|
+
*/
|
|
33
80
|
export function imageDataToBase64(imageData: ImageData): string {
|
|
34
81
|
installMethods();
|
|
35
82
|
return global.imageDataToBase64(imageData);
|
|
@@ -6,86 +6,146 @@ import type {EnumColourChannelUsageType} from "./EnumColourChannelUsageType";
|
|
|
6
6
|
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
7
7
|
|
|
8
8
|
const ISAModule = isTurboModuleEnabled ?
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
require("./NativeDynamsoftImageSourceAdapterModule").default :
|
|
10
|
+
NativeModules.DynamsoftImageSourceAdapterModule
|
|
11
11
|
|
|
12
12
|
let isInstalled = false
|
|
13
13
|
const installMethods = () => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
if (!isInstalled) {
|
|
15
|
+
ISAModule.install()
|
|
16
|
+
isInstalled = true
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
declare global {
|
|
21
|
-
|
|
21
|
+
function isaAddImageToBuffer(nativeIsaId: string, imageData: ImageData): void;
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
function isaGetImageData(nativeIsaId: string): ImageData | null | undefined;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The ImageSourceAdapter class provides an interface for fetching and buffering images.
|
|
29
|
+
* It is an abstract class that needs to be implemented by a concrete class to provide actual functionality.
|
|
30
|
+
* `Each ImageSourceAdapter instance object will correspond to a native instance object.`
|
|
31
|
+
*
|
|
32
|
+
* @see CameraEnhancer
|
|
33
|
+
* @see CaptureVisionRouter.setInput
|
|
34
|
+
* */
|
|
26
35
|
export abstract class ImageSourceAdapter {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
36
|
+
protected isaId: string = "";
|
|
37
|
+
|
|
38
|
+
protected constructor() {
|
|
39
|
+
this.init();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected init() {
|
|
43
|
+
this.isaId = ISAModule.createDefaultNativeISA();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**@internal*/
|
|
47
|
+
public _getIsaId(): string {
|
|
48
|
+
return this.isaId;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Destroy native instance. This object is no longer available after destroy().
|
|
53
|
+
* */
|
|
54
|
+
public destroy(): void {
|
|
55
|
+
ISAModule.destroy(this.isaId);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Adds an image to the buffer of the adapter.
|
|
60
|
+
*
|
|
61
|
+
* @param imageData The {@link ImageData} object to be added to the buffer.
|
|
62
|
+
* */
|
|
63
|
+
public addImageToBuffer(imageData: ImageData): void {
|
|
64
|
+
installMethods()
|
|
65
|
+
global.isaAddImageToBuffer(this.isaId, imageData)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get a buffered image.
|
|
70
|
+
*
|
|
71
|
+
* @returns {ImageData|null|undefined} - The {@link ImageData} object if available, otherwise`null` or `undefined` if no image is found in the buffer.
|
|
72
|
+
* */
|
|
73
|
+
public getImageData(): ImageData | null | undefined {
|
|
74
|
+
installMethods()
|
|
75
|
+
return global.isaGetImageData(this.isaId)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get the current number of images in the buffer.
|
|
80
|
+
*
|
|
81
|
+
* @returns {Promise<number>} - A promise that resolves to the number of images in the buffer.
|
|
82
|
+
* */
|
|
83
|
+
public getImageCount(): Promise<number> {
|
|
84
|
+
return ISAModule.getImageCount(this.isaId);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Determines whether the buffer is empty.
|
|
89
|
+
* */
|
|
90
|
+
public isBufferEmpty(): Promise<boolean> {
|
|
91
|
+
return ISAModule.isBufferEmpty(this.isaId);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Clear the image buffer.
|
|
96
|
+
* */
|
|
97
|
+
public clearBuffer(): Promise<void> {
|
|
98
|
+
return ISAModule.clearBuffer(this.isaId);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get the current usage type for color channels in images.
|
|
104
|
+
*
|
|
105
|
+
* @returns {Promise<EnumColourChannelUsageType>} - A promise that resolves to an enum representing the color channel usage type.
|
|
106
|
+
* */
|
|
107
|
+
public getColourChannelUsageType(): Promise<EnumColourChannelUsageType> {
|
|
108
|
+
return ISAModule.getColourChannelUsageType(this.isaId);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Set the usage type of a color channel in images.
|
|
113
|
+
*
|
|
114
|
+
* @param type The usage type({@link EnumColourChannelUsageType}) to be set for the color channel.
|
|
115
|
+
* */
|
|
116
|
+
public setColourChannelUsageType(type: EnumColourChannelUsageType): Promise<void> {
|
|
117
|
+
return ISAModule.setColourChannelUsageType(this.isaId, type);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Get the maximum number of images that can be buffered.
|
|
122
|
+
*
|
|
123
|
+
* @return {Promise<number>} - A promise that resolves to the maximum capability of the Buffer.
|
|
124
|
+
* */
|
|
125
|
+
public getMaximumImageCount(): Promise<number> {
|
|
126
|
+
return ISAModule.getMaximumImageCount(this.isaId);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Set the maximum number of images that can be buffered at any time.
|
|
131
|
+
*
|
|
132
|
+
* @param count - The maximum capability of the Buffer.
|
|
133
|
+
* */
|
|
134
|
+
public setMaximumImageCount(count: number): Promise<void> {
|
|
135
|
+
return ISAModule.setNextImageToReturn(this.isaId, count);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Start fetching images from the source to the Buffer of ImageSourceAdapter.
|
|
140
|
+
* */
|
|
141
|
+
public startFetching(): void {
|
|
142
|
+
ISAModule.startFetching(this.isaId);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Stop fetching images from the source to the Buffer of ImageSourceAdapter.
|
|
147
|
+
* */
|
|
148
|
+
public stopFetching(): void {
|
|
149
|
+
ISAModule.stopFetching(this.isaId);
|
|
150
|
+
}
|
|
91
151
|
}
|
|
@@ -1,18 +1,29 @@
|
|
|
1
|
-
import {type TurboModule, TurboModuleRegistry
|
|
1
|
+
import {type TurboModule, TurboModuleRegistry} from "react-native";
|
|
2
2
|
|
|
3
3
|
export interface Spec extends TurboModule {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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;
|
|
16
27
|
}
|
|
17
28
|
|
|
18
29
|
export default TurboModuleRegistry.get<Spec>("DynamsoftImageSourceAdapterModule") as Spec | null;
|
package/src/core/Point.tsx
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see Quadrilateral.points
|
|
3
|
+
* */
|
|
1
4
|
export interface Point {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
5
|
+
/**
|
|
6
|
+
* X coordinate of the point.
|
|
7
|
+
*/
|
|
8
|
+
x: number;
|
|
9
|
+
/**
|
|
10
|
+
* Y coordinate of the point.
|
|
11
|
+
*/
|
|
12
|
+
y: number;
|
|
13
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type {Point} from "./Point";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The Quadrilateral class represents a quadrilateral shape in 2D space,
|
|
5
|
+
* which contains an array of four points, representing the vertices of the quadrilateral.
|
|
6
|
+
* */
|
|
3
7
|
export interface Quadrilateral {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
8
|
+
/**
|
|
9
|
+
* Vertex coordinates of the quadrilateral.
|
|
10
|
+
*/
|
|
11
|
+
points: Point[];
|
|
12
|
+
}
|
package/src/core/Rect.tsx
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see TorchButton.location
|
|
3
|
+
* */
|
|
1
4
|
export interface Rect {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
/**
|
|
6
|
+
* X coordinate of the top-left vertex of the rectangle.
|
|
7
|
+
*/
|
|
8
|
+
x: number;
|
|
9
|
+
/**
|
|
10
|
+
* Y coordinate of the top-left vertex of the rectangle.
|
|
11
|
+
*/
|
|
12
|
+
y: number;
|
|
13
|
+
/**
|
|
14
|
+
* The width of the rectangle.
|
|
15
|
+
*/
|
|
16
|
+
width: number;
|
|
17
|
+
/**
|
|
18
|
+
* The height of the rectangle.
|
|
19
|
+
*/
|
|
20
|
+
height: number;
|
|
18
21
|
}
|