dynamsoft-capture-vision-react-native 1.1.16 → 2.4.2000-alpha.1
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/README.md +17 -22
- package/android/.gitignore +4 -0
- package/android/CMakeLists.txt +14 -0
- package/android/README.md +14 -0
- package/android/build.gradle +95 -15
- package/android/gradle.properties +21 -0
- package/android/settings.gradle +6 -0
- package/android/src/main/cpp/MutableRawBuffer.cpp +24 -0
- package/android/src/main/cpp/MutableRawBuffer.h +24 -0
- package/android/src/main/cpp/android_log.h +14 -0
- package/android/src/main/cpp/core/ImageDataHostObject.cpp +95 -0
- package/android/src/main/cpp/core/ImageDataHostObject.h +34 -0
- package/android/src/main/cpp/core/JsiCore.cpp +284 -0
- package/android/src/main/cpp/core/JsiCore.h +51 -0
- package/android/src/main/cpp/cvr/JsiCvr.cpp +263 -0
- package/android/src/main/cpp/cvr/JsiCvr.h +51 -0
- package/android/src/main/cpp/dbr/JsiDbr.cpp +38 -0
- package/android/src/main/cpp/dbr/JsiDbr.h +26 -0
- package/android/src/main/cpp/dce/JsiDce.cpp +59 -0
- package/android/src/main/cpp/dce/JsiDce.h +17 -0
- package/android/src/main/cpp/dcp/JsiDcp.cpp +51 -0
- package/android/src/main/cpp/dcp/JsiDcp.h +31 -0
- package/android/src/main/cpp/ddn/JsiDdn.cpp +34 -0
- package/android/src/main/cpp/ddn/JsiDdn.h +27 -0
- package/android/src/main/cpp/dlr/JsiDlr.cpp +51 -0
- package/android/src/main/cpp/dlr/JsiDlr.h +26 -0
- package/android/src/main/cpp/utility/JsiUtility.cpp +151 -0
- package/android/src/main/cpp/utility/JsiUtility.h +15 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/DynamsoftBaseModule.kt +9 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/ReactNativeDcvPackage.kt +90 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/core/ImageSourceAdapterModuleImpl.kt +120 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/cvr/CaptureVisionRouterModuleImpl.kt +269 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraEnhancerModuleImpl.kt +196 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraLifeCycleOwner.kt +9 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/CameraViewManagerImpl.kt +65 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewManagerImpl.kt +35 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/ImageEditorViewModuleImpl.kt +113 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/dce/RNCameraView.kt +21 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/license/LicenseModuleImpl.kt +29 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utility/ImageManagerModuleImpl.kt +33 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utility/MultiCrossFilterModuleImpl.kt +85 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/Basic.kt +45 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCore.kt +38 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForCvr.kt +128 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDBR.kt +77 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCE.kt +90 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDCP.kt +50 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDDN.kt +78 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ForDLR.kt +69 -0
- package/android/src/main/java/com/dynamsoft/reactnativelib/utils/ImageUtil.kt +58 -0
- package/android/src/main/withNamespace/AndroidManifest.xml +6 -0
- package/android/src/main/{AndroidManifest.xml → withoutNamespace/AndroidManifest.xml} +2 -3
- package/android/src/newarch/com/dynamsoft/reactnativelib/CVRModule.kt +91 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +46 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/DCEModule.kt +91 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/ISAModule.kt +60 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +16 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +24 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +12 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/LicenseModule.kt +14 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +58 -0
- package/android/src/newarch/com/dynamsoft/reactnativelib/VersionsModule.kt +41 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/CVRModule.kt +114 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/CameraViewManager.kt +50 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/DCEModule.kt +112 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/ISAModule.kt +73 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/ImageEditorViewManager.kt +14 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/ImageEditorViewModule.kt +36 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/ImageManagerModule.kt +16 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/LicenseModule.kt +18 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/MultiCrossFilterModule.kt +72 -0
- package/android/src/oldarch/com/dynamsoft/reactnativelib/VersionsModule.kt +41 -0
- package/ios/RNDynamsoftCaptureVision/CPP/DSImageData+HostObject.h +18 -0
- package/ios/RNDynamsoftCaptureVision/CPP/DSImageData+HostObject.mm +33 -0
- package/ios/RNDynamsoftCaptureVision/CPP/ImageDataHostObject.cpp +75 -0
- package/ios/RNDynamsoftCaptureVision/CPP/ImageDataHostObject.hpp +35 -0
- package/ios/RNDynamsoftCaptureVision/CPP/MutableRawBuffer.cpp +23 -0
- package/ios/RNDynamsoftCaptureVision/CPP/MutableRawBuffer.hpp +23 -0
- package/ios/RNDynamsoftCaptureVision/CPP/RNDynamsoft+Json.h +95 -0
- package/ios/RNDynamsoftCaptureVision/CPP/RNDynamsoft+Json.mm +708 -0
- package/ios/RNDynamsoftCaptureVision/CPP/YeetJSIUtils.h +52 -0
- package/ios/RNDynamsoftCaptureVision/CPP/YeetJSIUtils.mm +188 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCameraView.h +27 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCameraView.m +83 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCameraViewManager.h +14 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCameraViewManager.m +167 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCaptureVisionRouter.h +18 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftCaptureVisionRouter.mm +420 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageEditorView.h +17 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageEditorView.m +25 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageEditorViewManager.h +14 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageEditorViewManager.mm +119 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageManager.h +13 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageManager.mm +116 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageSourceAdapter.h +18 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftImageSourceAdapter.mm +214 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftLicense.h +14 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftLicense.m +50 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftMultiCrossFilter.h +14 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftMultiCrossFilter.m +106 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftVersions.h +13 -0
- package/ios/RNDynamsoftCaptureVision/RNDynamsoftVersions.m +39 -0
- package/ios/ReactNativeDcv.xcodeproj/project.pbxproj +390 -0
- package/package.json +48 -20
- package/react-native-dcv.podspec +22 -0
- package/src/NativeDynamsoftVersionsModule.tsx +20 -0
- package/src/VersionsModule.tsx +7 -0
- package/src/core/CapturedResultItem.tsx +7 -0
- package/src/core/CompletionListener.tsx +4 -0
- package/src/core/CoreModule.tsx +8 -0
- package/src/core/DSRect.tsx +23 -0
- package/src/core/EnumCaptureResultItemType.tsx +8 -0
- package/src/core/EnumColourChannelUsageType.tsx +8 -0
- package/src/core/EnumGrayscaleEnhancementMode.tsx +8 -0
- package/src/core/EnumGrayscaleTransformationMode.tsx +6 -0
- package/src/core/EnumPixelFormat.tsx +48 -0
- package/src/core/ImageData.tsx +36 -0
- package/src/core/ImageSourceAdapter.tsx +91 -0
- package/src/core/NativeDynamsoftImageSourceAdapterModule.tsx +18 -0
- package/src/core/Point.tsx +10 -0
- package/src/core/Quadrilateral.tsx +8 -0
- package/src/core/Rect.tsx +18 -0
- package/src/core/index.tsx +17 -0
- package/src/cvr/CaptureVisionRouter.tsx +338 -0
- package/src/cvr/CaptureVisionRouterModule.tsx +8 -0
- package/src/cvr/CapturedResult.tsx +104 -0
- package/src/cvr/CapturedResultFilter.tsx +4 -0
- package/src/cvr/CapturedResultReceiver.tsx +22 -0
- package/src/cvr/EnumPresetTemplate.tsx +16 -0
- package/src/cvr/NativeDynamsoftCaptureVisionRouterModule.tsx +25 -0
- package/src/cvr/SimplifiedCaptureVisionSettings.tsx +16 -0
- package/src/cvr/index.tsx +11 -0
- package/src/dbr/BarcodeReaderModule.tsx +8 -0
- package/src/dbr/BarcodeResultItem.tsx +16 -0
- package/src/dbr/DecodedBarcodesResult.tsx +9 -0
- package/src/dbr/EnumBarcodeFormat.tsx +98 -0
- package/src/dbr/EnumDeblurMode.tsx +12 -0
- package/src/dbr/EnumLocalizationMode.tsx +12 -0
- package/src/dbr/SimplifiedBarcodeReaderSettings.tsx +20 -0
- package/src/dbr/index.tsx +7 -0
- package/src/dce/CameraEnhancer.tsx +104 -0
- package/src/dce/CameraEnhancerModule.tsx +8 -0
- package/src/dce/CameraView.tsx +75 -0
- package/src/dce/DynamsoftCameraViewNativeComponent.ts +25 -0
- package/src/dce/DynamsoftImageEditorViewNativeComponent.ts +9 -0
- package/src/dce/EnumCameraPosition.tsx +10 -0
- package/src/dce/EnumDrawingLayerId.tsx +6 -0
- package/src/dce/EnumEnhancedFeatures.tsx +9 -0
- package/src/dce/EnumFocusMode.tsx +4 -0
- package/src/dce/EnumTorchState.tsx +10 -0
- package/src/dce/FeedBack.tsx +18 -0
- package/src/dce/ImageEditorView.tsx +94 -0
- package/src/dce/NativeDynamsoftCameraViewModule.tsx +43 -0
- package/src/dce/NativeDynamsoftImageEditorViewModule.ts +9 -0
- package/src/dce/TorchButton.tsx +23 -0
- package/src/dce/index.tsx +11 -0
- package/src/dcp/CodeParserDedicatorModule.tsx +8 -0
- package/src/dcp/CodeParserModule.tsx +8 -0
- package/src/dcp/EnumMappingStatus.tsx +5 -0
- package/src/dcp/EnumValidationStatus.tsx +5 -0
- package/src/dcp/ParsedResult.tsx +8 -0
- package/src/dcp/ParsedResultItem.tsx +15 -0
- package/src/dcp/index.tsx +8 -0
- package/src/ddn/DetectedQuadResultItem.tsx +7 -0
- package/src/ddn/DetectedQuadsResult.tsx +9 -0
- package/src/ddn/DocumentNormalizerModule.tsx +8 -0
- package/src/ddn/EnumImageColourMode.tsx +5 -0
- package/src/ddn/NormalizedImageResultItem.tsx +8 -0
- package/src/ddn/NormalizedImagesResult.tsx +8 -0
- package/src/ddn/SimplifiedDocumentNormalizerSettings.tsx +14 -0
- package/src/ddn/index.tsx +11 -0
- package/src/dip/ImageProcessingModule.tsx +8 -0
- package/src/dip/index.tsx +1 -0
- package/src/dlr/CharacterResult.tsx +8 -0
- package/src/dlr/LabelRecognizerModule.tsx +8 -0
- package/src/dlr/RecognizedTextLinesResult.tsx +9 -0
- package/src/dlr/SimplifiedLabelRecognizerSettings.tsx +11 -0
- package/src/dlr/TextLineResultItem.tsx +11 -0
- package/src/dlr/index.tsx +8 -0
- package/src/index.tsx +13 -0
- package/src/license/LicenseManager.tsx +13 -0
- package/src/license/LicenseModule.tsx +8 -0
- package/src/license/NativeDynamsoftLicenseModule.tsx +7 -0
- package/src/license/index.tsx +7 -0
- package/src/utility/ImageManager.tsx +47 -0
- package/src/utility/MultiFrameResultCrossFilter.tsx +67 -0
- package/src/utility/NativeDynamsoftImageManagerModule.tsx +7 -0
- package/src/utility/NativeDynamsoftMultiCrossFilterModule.tsx +18 -0
- package/src/utility/UtilityModule.tsx +8 -0
- package/src/utility/index.tsx +3 -0
- package/.gitattributes +0 -1
- package/LICENSE +0 -5
- package/Legal.txt +0 -551
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/android/src/main/java/com/dynamsoft/reactlibrary/Constants.java +0 -23
- package/android/src/main/java/com/dynamsoft/reactlibrary/DCVFeedbackModule.java +0 -30
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraView.java +0 -131
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraViewManager.java +0 -246
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftBarcodeReaderModule.java +0 -299
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftCaptrueVisionPackage.java +0 -33
- package/dynamsoft-capture-vision-react-native.podspec +0 -22
- package/ios/RNDynamsoftCaptureVision/DYSCameraView.h +0 -34
- package/ios/RNDynamsoftCaptureVision/DYSCameraView.m +0 -148
- package/ios/RNDynamsoftCaptureVision/DYSCameraViewManager.h +0 -17
- package/ios/RNDynamsoftCaptureVision/DYSCameraViewManager.m +0 -78
- package/ios/RNDynamsoftCaptureVision/RCTDynamsoftBarcodeReader.h +0 -14
- package/ios/RNDynamsoftCaptureVision/RCTDynamsoftBarcodeReader.m +0 -303
- package/ios/RNDynamsoftCaptureVision/RCTDynamsoftFeedback.h +0 -16
- package/ios/RNDynamsoftCaptureVision/RCTDynamsoftFeedback.m +0 -23
- package/ios/RNDynamsoftCaptureVision/StaticClass.h +0 -26
- package/ios/RNDynamsoftCaptureVision/StaticClass.m +0 -21
- package/ios/RNDynamsoftCaptureVision.xcodeproj/project.pbxproj +0 -343
- package/js/BarcodeResult.d.ts +0 -29
- package/js/BarcodeResult.js +0 -3
- package/js/BarcodeResult.js.map +0 -1
- package/js/BarcodeResult.tsx +0 -36
- package/js/BarcodeSettings.d.ts +0 -103
- package/js/BarcodeSettings.js +0 -92
- package/js/BarcodeSettings.js.map +0 -1
- package/js/BarcodeSettings.tsx +0 -106
- package/js/BasicStructures.d.ts +0 -57
- package/js/BasicStructures.js +0 -3
- package/js/BasicStructures.js.map +0 -1
- package/js/BasicStructures.tsx +0 -60
- package/js/CameraSettings.d.ts +0 -53
- package/js/CameraSettings.js +0 -38
- package/js/CameraSettings.js.map +0 -1
- package/js/CameraSettings.tsx +0 -58
- package/js/DCVFeedback.d.ts +0 -4
- package/js/DCVFeedback.js +0 -15
- package/js/DCVFeedback.js.map +0 -1
- package/js/DCVFeedback.tsx +0 -14
- package/js/DynamsoftBarcodeReader.d.ts +0 -61
- package/js/DynamsoftBarcodeReader.js +0 -126
- package/js/DynamsoftBarcodeReader.js.map +0 -1
- package/js/DynamsoftBarcodeReader.tsx +0 -130
- package/js/DynamsoftCameraView.d.ts +0 -64
- package/js/DynamsoftCameraView.js +0 -124
- package/js/DynamsoftCameraView.js.map +0 -1
- package/js/DynamsoftCameraView.tsx +0 -163
- package/js/index.d.ts +0 -7
- package/js/index.js +0 -24
- package/js/index.js.map +0 -1
- package/js/index.tsx +0 -7
- package/tsconfig.json +0 -112
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export enum EnumPresetTemplate {
|
|
2
|
+
PT_DEFAULT = "Default",//DBR + DLR + DDN-Normalize
|
|
3
|
+
PT_READ_BARCODES = "ReadBarcodes_Default",
|
|
4
|
+
PT_RECOGNIZE_TEXT_LINES = "RecognizeTextLines_Default",
|
|
5
|
+
PT_DETECT_DOCUMENT_BOUNDARIES = "DetectDocumentBoundaries_Default",
|
|
6
|
+
PT_DETECT_AND_NORMALIZE_DOCUMENT = "DetectAndNormalizeDocument_Default",
|
|
7
|
+
PT_NORMALIZE_DOCUMENT = "NormalizeDocument_Default",
|
|
8
|
+
PT_READ_BARCODES_SPEED_FIRST = "ReadBarcodes_SpeedFirst",
|
|
9
|
+
PT_READ_BARCODES_READ_RATE_FIRST = "ReadBarcodes_ReadRateFirst",
|
|
10
|
+
PT_READ_SINGLE_BARCODE = "ReadSingleBarcode",
|
|
11
|
+
PT_RECOGNIZE_NUMBERS = "RecognizeNumbers",
|
|
12
|
+
PT_RECOGNIZE_LETTERS = "RecognizeLetters",
|
|
13
|
+
PT_RECOGNIZE_NUMBERS_AND_LETTERS = "RecognizeNumbersAndLetters",
|
|
14
|
+
PT_RECOGNIZE_NUMBERS_AND_UPPERCASE_LETTERS = "RecognizeNumbersAndUppercaseLetters",
|
|
15
|
+
PT_RECOGNIZE_UPPERCASE_LETTERS = "RecognizeUppercaseLetters",
|
|
16
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {type TurboModule, TurboModuleRegistry } from "react-native";
|
|
2
|
+
export interface Spec extends TurboModule {
|
|
3
|
+
install():boolean;
|
|
4
|
+
startCapturing(templateName:string) : Promise<void>;
|
|
5
|
+
stopCapturing() : Promise<void>;
|
|
6
|
+
setInput(isaId: string) : void;
|
|
7
|
+
continueCRR() : void;
|
|
8
|
+
removeAllResultListeners(): void;
|
|
9
|
+
addFilter(filterId: string): void;
|
|
10
|
+
removeFilter(filterId: string): void;
|
|
11
|
+
resetSettings(): Promise<void>;
|
|
12
|
+
getSimplifiedSettings(templateName: string): Promise<unknown>;
|
|
13
|
+
updateSettings(settings: unknown, templateName: string): Promise<void>;
|
|
14
|
+
initSettings(content: string): Promise<void>;
|
|
15
|
+
initSettingsFromFile(file: string): Promise<void>;
|
|
16
|
+
outputSettings(templateName: string): Promise<string | null>;
|
|
17
|
+
outputSettingsToFile(file: string, templateName: string): Promise<void>;
|
|
18
|
+
|
|
19
|
+
addListener(type: string): void;
|
|
20
|
+
removeListeners(count: number): void;
|
|
21
|
+
addResultReceiver(type: string): void;
|
|
22
|
+
removeResultReceiver(type: string): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default TurboModuleRegistry.get<Spec>("DynamsoftCaptureVisionRouterModule") as Spec | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type {EnumCapturedResultItemType, Quadrilateral} from "../core";
|
|
2
|
+
import type {SimplifiedBarcodeReaderSettings} from "../dbr";
|
|
3
|
+
import type {SimplifiedLabelRecognizerSettings} from "../dlr";
|
|
4
|
+
import type {SimplifiedDocumentNormalizerSettings} from "../ddn";
|
|
5
|
+
|
|
6
|
+
export interface SimplifiedCaptureVisionSettings {
|
|
7
|
+
capturedResultItemTypes?: EnumCapturedResultItemType | number;
|
|
8
|
+
roi?: Quadrilateral;
|
|
9
|
+
roiMeasuredInPercentage?: boolean;
|
|
10
|
+
maxParallelTasks?:number
|
|
11
|
+
timeout?: number;
|
|
12
|
+
minImageCaptureInterval?: number;
|
|
13
|
+
barcodeSettings?: SimplifiedBarcodeReaderSettings;
|
|
14
|
+
labelSettings?: SimplifiedLabelRecognizerSettings;
|
|
15
|
+
documentSettings?: SimplifiedDocumentNormalizerSettings;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./CapturedResult"
|
|
2
|
+
export * from "./CapturedResultFilter"
|
|
3
|
+
export * from "./CapturedResultReceiver"
|
|
4
|
+
|
|
5
|
+
export * from "./CaptureVisionRouter"
|
|
6
|
+
|
|
7
|
+
export * from "./CaptureVisionRouterModule"
|
|
8
|
+
|
|
9
|
+
export * from "./EnumPresetTemplate"
|
|
10
|
+
|
|
11
|
+
export * from "./SimplifiedCaptureVisionSettings"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type {CapturedResultItem} from "../core/CapturedResultItem";
|
|
2
|
+
import type {Quadrilateral} from "../core/Quadrilateral";
|
|
3
|
+
import type {EnumBarcodeFormat} from "./EnumBarcodeFormat";
|
|
4
|
+
|
|
5
|
+
export interface BarcodeResultItem extends CapturedResultItem{
|
|
6
|
+
format: EnumBarcodeFormat | bigint;
|
|
7
|
+
_formatNumberString: string;
|
|
8
|
+
formatString: string;
|
|
9
|
+
text: string;
|
|
10
|
+
location: Quadrilateral;
|
|
11
|
+
confidence: number;
|
|
12
|
+
angle: number;
|
|
13
|
+
moduleSize: number;
|
|
14
|
+
isMirrored: boolean;
|
|
15
|
+
isDPM: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
const EnumBarcodeFormat = {
|
|
2
|
+
/**No barcode format in BarcodeFormat*/
|
|
3
|
+
BF_NULL:BigInt(0x00n),
|
|
4
|
+
/**All supported formats in BarcodeFormat*/
|
|
5
|
+
BF_ALL:BigInt(0xFFFFFFFEFFFFFFFFn),
|
|
6
|
+
BF_DEFAULT:BigInt(0xFE3BFFFFn),
|
|
7
|
+
/**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),
|
|
9
|
+
/**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),
|
|
11
|
+
/**Code 39 */
|
|
12
|
+
BF_CODE_39:BigInt(0x1n),
|
|
13
|
+
/**Code 128 */
|
|
14
|
+
BF_CODE_128:BigInt(0x2n),
|
|
15
|
+
/**Code 93 */
|
|
16
|
+
BF_CODE_93:BigInt(0x4n),
|
|
17
|
+
/**Codabar */
|
|
18
|
+
BF_CODABAR:BigInt(0x8n),
|
|
19
|
+
/**Interleaved 2 of 5 */
|
|
20
|
+
BF_ITF:BigInt(0x10n),
|
|
21
|
+
/**EAN-13 */
|
|
22
|
+
BF_EAN_13:BigInt(0x20n),
|
|
23
|
+
/**EAN-8 */
|
|
24
|
+
BF_EAN_8:BigInt(0x40n),
|
|
25
|
+
/**UPC-A */
|
|
26
|
+
BF_UPC_A:BigInt(0x80n),
|
|
27
|
+
/**UPC-E */
|
|
28
|
+
BF_UPC_E:BigInt(0x100n),
|
|
29
|
+
/**Industrial 2 of 5 */
|
|
30
|
+
BF_INDUSTRIAL_25:BigInt(0x200n),
|
|
31
|
+
/**CODE39 Extended */
|
|
32
|
+
BF_CODE_39_EXTENDED:BigInt(0x400n),
|
|
33
|
+
/**GS1 Databar Omnidirectional*/
|
|
34
|
+
BF_GS1_DATABAR_OMNIDIRECTIONAL:BigInt(0x800n),
|
|
35
|
+
/**GS1 Databar Truncated*/
|
|
36
|
+
BF_GS1_DATABAR_TRUNCATED:BigInt(0x1000n),
|
|
37
|
+
/**GS1 Databar Stacked*/
|
|
38
|
+
BF_GS1_DATABAR_STACKED:BigInt(0x2000n),
|
|
39
|
+
/**GS1 Databar Stacked Omnidirectional*/
|
|
40
|
+
BF_GS1_DATABAR_STACKED_OMNIDIRECTIONAL:BigInt(0x4000n),
|
|
41
|
+
/**GS1 Databar Expanded*/
|
|
42
|
+
BF_GS1_DATABAR_EXPANDED:BigInt(0x8000n),
|
|
43
|
+
/**GS1 Databar Expaned Stacked*/
|
|
44
|
+
BF_GS1_DATABAR_EXPANDED_STACKED:BigInt(0x10000n),
|
|
45
|
+
/**GS1 Databar Limited*/
|
|
46
|
+
BF_GS1_DATABAR_LIMITED:BigInt(0x20000n),
|
|
47
|
+
/**Patch code. */
|
|
48
|
+
BF_PATCHCODE:BigInt(0x00040000n),
|
|
49
|
+
/**PDF417 */
|
|
50
|
+
BF_CODE_32:BigInt(0x01000000n),
|
|
51
|
+
BF_PDF417:BigInt(0x02000000n),
|
|
52
|
+
/**QRCode */
|
|
53
|
+
BF_QR_CODE:BigInt(0x04000000n),
|
|
54
|
+
/**DataMatrix */
|
|
55
|
+
BF_DATAMATRIX:BigInt(0x08000000n),
|
|
56
|
+
/**AZTEC */
|
|
57
|
+
BF_AZTEC:BigInt(0x10000000n),
|
|
58
|
+
/**MAXICODE */
|
|
59
|
+
BF_MAXICODE:BigInt(0x20000000n),
|
|
60
|
+
/**Micro QR Code*/
|
|
61
|
+
BF_MICRO_QR:BigInt(0x40000000n),
|
|
62
|
+
/**Micro PDF417*/
|
|
63
|
+
BF_MICRO_PDF417:BigInt(0x00080000n),
|
|
64
|
+
/**GS1 Composite Code*/
|
|
65
|
+
BF_GS1_COMPOSITE:BigInt(0x80000000n),
|
|
66
|
+
/**MSI Code*/
|
|
67
|
+
BF_MSI_CODE:BigInt(0x100000n),
|
|
68
|
+
/*Code 11*/
|
|
69
|
+
BF_CODE_11:BigInt(0x200000n),
|
|
70
|
+
BF_TWO_DIGIT_ADD_ON:BigInt(0x400000n),
|
|
71
|
+
BF_FIVE_DIGIT_ADD_ON:BigInt(0x800000n),
|
|
72
|
+
/**Combined value of BF2_USPSINTELLIGENTMAIL, BF2_POSTNET, BF2_PLANET, BF2_AUSTRALIANPOST, BF2_RM4SCC.*/
|
|
73
|
+
BF_MATRIX_25:BigInt(0x1000000000n),
|
|
74
|
+
BF_POSTALCODE:BigInt(0x3F0000000000000n),
|
|
75
|
+
/**Nonstandard barcode */
|
|
76
|
+
BF_NONSTANDARD_BARCODE:BigInt(0x100000000n),
|
|
77
|
+
/**USPS Intelligent Mail.*/
|
|
78
|
+
BF_USPSINTELLIGENTMAIL:BigInt(0x10000000000000n),
|
|
79
|
+
/**Postnet.*/
|
|
80
|
+
BF_POSTNET:BigInt(0x20000000000000n),
|
|
81
|
+
/**Planet.*/
|
|
82
|
+
BF_PLANET:BigInt(0x40000000000000n),
|
|
83
|
+
/**Australian Post.*/
|
|
84
|
+
BF_AUSTRALIANPOST:BigInt(0x80000000000000n),
|
|
85
|
+
/**Royal Mail 4-State Customer Barcode.*/
|
|
86
|
+
BF_RM4SCC:BigInt(0x100000000000000n),
|
|
87
|
+
BF_KIX:BigInt(0x200000000000000n),
|
|
88
|
+
/**DotCode.*/
|
|
89
|
+
BF_DOTCODE:BigInt(0x200000000n),
|
|
90
|
+
/**_PHARMACODE_ONE_TRACK.*/
|
|
91
|
+
BF_PHARMACODE_ONE_TRACK:BigInt(0x400000000n),
|
|
92
|
+
/**PHARMACODE_TWO_TRACK.*/
|
|
93
|
+
BF_PHARMACODE_TWO_TRACK:BigInt(0x800000000n),
|
|
94
|
+
/**PHARMACODE.*/
|
|
95
|
+
BF_PHARMACODE:BigInt(0xC00000000n)
|
|
96
|
+
}
|
|
97
|
+
type EnumBarcodeFormat = bigint;
|
|
98
|
+
export { EnumBarcodeFormat };
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export enum EnumLocalizationMode {
|
|
2
|
+
LM_SKIP = 0x0,
|
|
3
|
+
LM_AUTO = 0x1,
|
|
4
|
+
LM_CONNECTED_BLOCKS = 0x2,
|
|
5
|
+
LM_STATISTICS = 0x4,
|
|
6
|
+
LM_LINES = 0x8,
|
|
7
|
+
LM_SCAN_DIRECTLY = 0x10,
|
|
8
|
+
LM_STATISTICS_MARKS = 0x20,
|
|
9
|
+
LM_STATISTICS_POSTAL_CODE = 0x40,
|
|
10
|
+
LM_CENTRE = 0x80,
|
|
11
|
+
LM_ONED_FAST_SCAN = 0x100,
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type {EnumBarcodeFormat} from "./EnumBarcodeFormat";
|
|
2
|
+
import type {EnumLocalizationMode} from "./EnumLocalizationMode";
|
|
3
|
+
import type {EnumDeblurMode} from "./EnumDeblurMode";
|
|
4
|
+
import type {EnumGrayscaleTransformationMode} from "../core/EnumGrayscaleTransformationMode";
|
|
5
|
+
import type {EnumGrayscaleEnhancementMode} from "../core/EnumGrayscaleEnhancementMode";
|
|
6
|
+
|
|
7
|
+
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;
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./BarcodeReaderModule"
|
|
2
|
+
export * from "./BarcodeResultItem"
|
|
3
|
+
export * from "./DecodedBarcodesResult"
|
|
4
|
+
export * from "./EnumBarcodeFormat"
|
|
5
|
+
export * from "./EnumDeblurMode"
|
|
6
|
+
export * from "./EnumLocalizationMode"
|
|
7
|
+
export type {SimplifiedBarcodeReaderSettings} from "./SimplifiedBarcodeReaderSettings"
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import {ImageSourceAdapter, type DSRect} from "../core";
|
|
2
|
+
import {NativeModules, Platform} from "react-native";
|
|
3
|
+
import {CameraView} from "./CameraView"
|
|
4
|
+
import type {EnumCameraPosition} from "./EnumCameraPosition";
|
|
5
|
+
import type {EnumFocusMode} from "./EnumFocusMode";
|
|
6
|
+
import type {EnumEnhancedFeatures} from "./EnumEnhancedFeatures";
|
|
7
|
+
|
|
8
|
+
// @ts-ignore Check whether __turboModuleProxy exists, it may not
|
|
9
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
10
|
+
|
|
11
|
+
const DynamsoftCameraEnhancerModule = isTurboModuleEnabled ?
|
|
12
|
+
require("./NativeDynamsoftCameraViewModule").default :
|
|
13
|
+
NativeModules.DynamsoftCameraView;
|
|
14
|
+
|
|
15
|
+
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
|
+
|
|
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
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import React, {Component, ComponentProps} from 'react';
|
|
3
|
+
import {
|
|
4
|
+
findNodeHandle,
|
|
5
|
+
type HostComponent,
|
|
6
|
+
type NativeMethods,
|
|
7
|
+
requireNativeComponent,
|
|
8
|
+
StyleSheet,
|
|
9
|
+
View
|
|
10
|
+
} from "react-native";
|
|
11
|
+
import type {CameraViewNativeProps} from "./DynamsoftCameraViewNativeComponent";
|
|
12
|
+
|
|
13
|
+
const transformToNativeCameraViewProps = (props: CameraViewNativeProps | undefined | null): CameraViewNativeProps => {
|
|
14
|
+
return JSON.parse(JSON.stringify(
|
|
15
|
+
{
|
|
16
|
+
visibleLayerIds: props?.visibleLayerIds,
|
|
17
|
+
scanRegionMaskVisible: props?.scanRegionMaskVisible,
|
|
18
|
+
scanLaserVisible: props?.scanLaserVisible,
|
|
19
|
+
torchButton: props?.torchButton,
|
|
20
|
+
torchButtonVisible: props?.torchButtonVisible,
|
|
21
|
+
}
|
|
22
|
+
))
|
|
23
|
+
}
|
|
24
|
+
type RefType = React.Component<CameraViewNativeProps> & Readonly<NativeMethods>;
|
|
25
|
+
|
|
26
|
+
// @ts-ignore Check whether __turboModuleProxy exists, it may not
|
|
27
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
28
|
+
|
|
29
|
+
const ComponentName = 'DynamsoftCameraView';
|
|
30
|
+
const NativeCameraView: HostComponent<CameraViewNativeProps> = isTurboModuleEnabled?
|
|
31
|
+
require("./DynamsoftCameraViewNativeComponent").default :
|
|
32
|
+
requireNativeComponent(ComponentName)
|
|
33
|
+
|
|
34
|
+
export class CameraView extends Component<CameraViewNativeProps, any> {
|
|
35
|
+
private readonly nativeCameraViewRef: React.RefObject<RefType> = React.createRef<RefType>();
|
|
36
|
+
private readonly nativeProps = transformToNativeCameraViewProps(this.props)
|
|
37
|
+
/** @internal */
|
|
38
|
+
public get nativeCameraViewHandle(): number | null {
|
|
39
|
+
return findNodeHandle(this.nativeCameraViewRef.current);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
componentDidUpdate(prevProps: CameraViewNativeProps) {
|
|
43
|
+
let nativePreProps = transformToNativeCameraViewProps(prevProps)
|
|
44
|
+
let nativeProps = transformToNativeCameraViewProps(this.props)
|
|
45
|
+
if(nativePreProps !== nativeProps) {
|
|
46
|
+
this.nativeCameraViewRef.current?.setNativeProps(nativeProps)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public render(): React.ReactNode {
|
|
51
|
+
return(
|
|
52
|
+
<View style={[styles.blackBg, this.props?.style]}>
|
|
53
|
+
<NativeCameraView
|
|
54
|
+
style={StyleSheet.absoluteFill}
|
|
55
|
+
ref={this.nativeCameraViewRef}
|
|
56
|
+
{...this.nativeProps}
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
{this.props?.children}
|
|
60
|
+
</View>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
const styles = StyleSheet.create({
|
|
67
|
+
container: {
|
|
68
|
+
flex: 1,
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
justifyContent: 'center',
|
|
71
|
+
},
|
|
72
|
+
blackBg: {
|
|
73
|
+
backgroundColor: 'black',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type {HostComponent, ViewProps} from "react-native";
|
|
2
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
3
|
+
import type {Int32} from "react-native/Libraries/Types/CodegenTypes";
|
|
4
|
+
|
|
5
|
+
export interface CameraViewNativeProps extends ViewProps {
|
|
6
|
+
visibleLayerIds?: number[]
|
|
7
|
+
scanRegionMaskVisible?: boolean
|
|
8
|
+
scanLaserVisible?: boolean
|
|
9
|
+
torchButton?: {
|
|
10
|
+
location?: {
|
|
11
|
+
x?: Int32;
|
|
12
|
+
y?: Int32;
|
|
13
|
+
width?: Int32;
|
|
14
|
+
height?: Int32;
|
|
15
|
+
}
|
|
16
|
+
visible?: boolean;
|
|
17
|
+
torchOnImageBase64?: string;
|
|
18
|
+
torchOffImageBase64?: string;
|
|
19
|
+
};
|
|
20
|
+
torchButtonVisible?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default codegenNativeComponent<CameraViewNativeProps>(
|
|
24
|
+
"DynamsoftCameraView"
|
|
25
|
+
) as HostComponent<CameraViewNativeProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type {HostComponent, ViewProps} from "react-native";
|
|
2
|
+
import codegenNativeComponent from "react-native/Libraries/Utilities/codegenNativeComponent";
|
|
3
|
+
|
|
4
|
+
export interface ImageEditorViewNativeProps extends ViewProps {
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export default codegenNativeComponent<ImageEditorViewNativeProps>(
|
|
8
|
+
"DynamsoftImageEditorView"
|
|
9
|
+
) as HostComponent<ImageEditorViewNativeProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {NativeModules} from "react-native";
|
|
2
|
+
|
|
3
|
+
// @ts-ignore Check whether __turboModuleProxy exists, it may not
|
|
4
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
5
|
+
|
|
6
|
+
const DynamsoftCameraEnhancerModule = isTurboModuleEnabled ?
|
|
7
|
+
require("./NativeDynamsoftCameraViewModule").default :
|
|
8
|
+
NativeModules.DynamsoftCameraView;
|
|
9
|
+
|
|
10
|
+
export class FeedBack {
|
|
11
|
+
static beep(): void {
|
|
12
|
+
DynamsoftCameraEnhancerModule.beep();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static vibrate(): void {
|
|
16
|
+
DynamsoftCameraEnhancerModule.vibrate();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, {Component} from "react";
|
|
2
|
+
import {
|
|
3
|
+
findNodeHandle,
|
|
4
|
+
type HostComponent,
|
|
5
|
+
type NativeMethods,
|
|
6
|
+
NativeModules,
|
|
7
|
+
requireNativeComponent,
|
|
8
|
+
StyleSheet,
|
|
9
|
+
View
|
|
10
|
+
} from "react-native";
|
|
11
|
+
import type {EnumDrawingLayerId} from "./EnumDrawingLayerId";
|
|
12
|
+
import type {Quadrilateral, ImageData} from "../core";
|
|
13
|
+
import type {ImageEditorViewNativeProps} from "./DynamsoftImageEditorViewNativeComponent";
|
|
14
|
+
import type {CameraViewNativeProps} from "./DynamsoftCameraViewNativeComponent";
|
|
15
|
+
|
|
16
|
+
const ComponentName = "DynamsoftImageEditorView";
|
|
17
|
+
|
|
18
|
+
// @ts-ignore Check whether __turboModuleProxy exists, it may not
|
|
19
|
+
const isTurboModuleEnabled = global.__turboModuleProxy != null;
|
|
20
|
+
|
|
21
|
+
const NativeImageEditorView: HostComponent<CameraViewNativeProps> = isTurboModuleEnabled ?
|
|
22
|
+
require("./DynamsoftImageEditorViewNativeComponent").default :
|
|
23
|
+
requireNativeComponent(ComponentName)
|
|
24
|
+
|
|
25
|
+
const ImageEditorViewModule = isTurboModuleEnabled ?
|
|
26
|
+
require("./NativeDynamsoftImageEditorViewModule").default :
|
|
27
|
+
NativeModules.DynamsoftImageEditorView;
|
|
28
|
+
|
|
29
|
+
let isInstalled = false
|
|
30
|
+
const installMethods = () => {
|
|
31
|
+
if (!isInstalled) {
|
|
32
|
+
ImageEditorViewModule.install()
|
|
33
|
+
isInstalled = true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare var global: {
|
|
38
|
+
editorView_setOriginalImage: (viewTag: number, imageData: ImageData) => void;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type RefType = React.Component<ImageEditorViewNativeProps> & Readonly<NativeMethods>;
|
|
42
|
+
|
|
43
|
+
export class ImageEditorView extends Component<ImageEditorViewNativeProps, any> {
|
|
44
|
+
private readonly nativeImageEditorViewRef: React.RefObject<RefType> = React.createRef<RefType>();
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
public get nativeCameraViewHandle(): number | null {
|
|
48
|
+
return findNodeHandle(this.nativeImageEditorViewRef.current);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public setOriginalImage(imageData: ImageData) {
|
|
52
|
+
installMethods();
|
|
53
|
+
if (this.nativeCameraViewHandle != null) {
|
|
54
|
+
global.editorView_setOriginalImage(this.nativeCameraViewHandle!, imageData);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public async setQuads(quads: Quadrilateral[] | null | undefined, layerId: EnumDrawingLayerId | number): Promise<void> {
|
|
59
|
+
if (this.nativeCameraViewHandle != null) {
|
|
60
|
+
await ImageEditorViewModule.setQuads(this.nativeCameraViewHandle!, quads, layerId);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public async getSelectedQuad(): Promise<Quadrilateral | null> {
|
|
65
|
+
if (this.nativeCameraViewHandle != null) {
|
|
66
|
+
return await ImageEditorViewModule.getSelectedQuad(this.nativeCameraViewHandle!);
|
|
67
|
+
} else {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public render(): React.ReactNode {
|
|
73
|
+
return (
|
|
74
|
+
<View style={[styles.blackBg, this.props?.style]}>
|
|
75
|
+
<NativeImageEditorView
|
|
76
|
+
style={StyleSheet.absoluteFill}
|
|
77
|
+
ref={this.nativeImageEditorViewRef}
|
|
78
|
+
/>
|
|
79
|
+
{this.props?.children}
|
|
80
|
+
</View>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const styles = StyleSheet.create({
|
|
86
|
+
container: {
|
|
87
|
+
flex: 1,
|
|
88
|
+
alignItems: "center",
|
|
89
|
+
justifyContent: "center"
|
|
90
|
+
},
|
|
91
|
+
blackBg: {
|
|
92
|
+
backgroundColor: "black"
|
|
93
|
+
}
|
|
94
|
+
});
|