@imagowave/vision-ocr 0.0.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.
Files changed (65) hide show
  1. package/NitroVisionOcr.podspec +32 -0
  2. package/README.md +38 -0
  3. package/android/CMakeLists.txt +31 -0
  4. package/android/build.gradle +143 -0
  5. package/android/fix-prefab.gradle +51 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +2 -0
  8. package/android/src/main/cpp/cpp-adapter.cpp +9 -0
  9. package/android/src/main/java/com/margelo/nitro/visionocr/NitroVisionOcrPackage.kt +18 -0
  10. package/android/src/main/java/com/margelo/nitro/visionocr/VisionOcr.kt +120 -0
  11. package/ios/Bridge.h +8 -0
  12. package/ios/VisionOCR.swift +137 -0
  13. package/nitro.json +19 -0
  14. package/nitrogen/generated/.gitattributes +1 -0
  15. package/nitrogen/generated/android/NitroVisionOcr+autolinking.cmake +81 -0
  16. package/nitrogen/generated/android/NitroVisionOcr+autolinking.gradle +27 -0
  17. package/nitrogen/generated/android/NitroVisionOcrOnLoad.cpp +41 -0
  18. package/nitrogen/generated/android/NitroVisionOcrOnLoad.hpp +34 -0
  19. package/nitrogen/generated/android/c++/JHybridVisionOCRSpec.cpp +87 -0
  20. package/nitrogen/generated/android/c++/JHybridVisionOCRSpec.hpp +63 -0
  21. package/nitrogen/generated/android/c++/JOcrBlock.hpp +91 -0
  22. package/nitrogen/generated/android/c++/JOcrBox.hpp +69 -0
  23. package/nitrogen/generated/android/c++/JOcrLine.hpp +93 -0
  24. package/nitrogen/generated/android/c++/JOcrOptions.hpp +95 -0
  25. package/nitrogen/generated/android/c++/JOcrResult.hpp +89 -0
  26. package/nitrogen/generated/android/c++/JOcrWord.hpp +68 -0
  27. package/nitrogen/generated/android/c++/JRLevel.hpp +58 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/HybridVisionOCRSpec.kt +55 -0
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/NitroVisionOcrOnLoad.kt +35 -0
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrBlock.kt +61 -0
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrBox.kt +66 -0
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrLine.kt +66 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrOptions.kt +71 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrResult.kt +56 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/OcrWord.kt +61 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/visionocr/RLevel.kt +23 -0
  37. package/nitrogen/generated/ios/NitroVisionOcr+autolinking.rb +62 -0
  38. package/nitrogen/generated/ios/NitroVisionOcr-Swift-Cxx-Bridge.cpp +44 -0
  39. package/nitrogen/generated/ios/NitroVisionOcr-Swift-Cxx-Bridge.hpp +286 -0
  40. package/nitrogen/generated/ios/NitroVisionOcr-Swift-Cxx-Umbrella.hpp +72 -0
  41. package/nitrogen/generated/ios/c++/HybridVisionOCRSpecSwift.cpp +11 -0
  42. package/nitrogen/generated/ios/c++/HybridVisionOCRSpecSwift.hpp +108 -0
  43. package/nitrogen/generated/ios/swift/HybridVisionOCRSpec.swift +56 -0
  44. package/nitrogen/generated/ios/swift/HybridVisionOCRSpec_cxx.swift +149 -0
  45. package/nitrogen/generated/ios/swift/OcrBlock.swift +64 -0
  46. package/nitrogen/generated/ios/swift/OcrBox.swift +44 -0
  47. package/nitrogen/generated/ios/swift/OcrLine.swift +82 -0
  48. package/nitrogen/generated/ios/swift/OcrOptions.swift +113 -0
  49. package/nitrogen/generated/ios/swift/OcrResult.swift +53 -0
  50. package/nitrogen/generated/ios/swift/OcrWord.swift +58 -0
  51. package/nitrogen/generated/ios/swift/RLevel.swift +40 -0
  52. package/nitrogen/generated/shared/c++/HybridVisionOCRSpec.cpp +21 -0
  53. package/nitrogen/generated/shared/c++/HybridVisionOCRSpec.hpp +71 -0
  54. package/nitrogen/generated/shared/c++/OcrBlock.hpp +98 -0
  55. package/nitrogen/generated/shared/c++/OcrBox.hpp +95 -0
  56. package/nitrogen/generated/shared/c++/OcrLine.hpp +102 -0
  57. package/nitrogen/generated/shared/c++/OcrOptions.hpp +103 -0
  58. package/nitrogen/generated/shared/c++/OcrResult.hpp +91 -0
  59. package/nitrogen/generated/shared/c++/OcrWord.hpp +94 -0
  60. package/nitrogen/generated/shared/c++/RLevel.hpp +76 -0
  61. package/package.json +111 -0
  62. package/react-native.config.js +16 -0
  63. package/src/index.ts +21 -0
  64. package/src/specs/VisionOCR.nitro.ts +11 -0
  65. package/src/types.ts +41 -0
@@ -0,0 +1,95 @@
1
+ ///
2
+ /// JOcrOptions.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "OcrOptions.hpp"
12
+
13
+ #include "JRLevel.hpp"
14
+ #include "RLevel.hpp"
15
+ #include <optional>
16
+ #include <string>
17
+ #include <vector>
18
+
19
+ namespace margelo::nitro::visionocr {
20
+
21
+ using namespace facebook;
22
+
23
+ /**
24
+ * The C++ JNI bridge between the C++ struct "OcrOptions" and the the Kotlin data class "OcrOptions".
25
+ */
26
+ struct JOcrOptions final: public jni::JavaClass<JOcrOptions> {
27
+ public:
28
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visionocr/OcrOptions;";
29
+
30
+ public:
31
+ /**
32
+ * Convert this Java/Kotlin-based struct to the C++ struct OcrOptions by copying all values to C++.
33
+ */
34
+ [[maybe_unused]]
35
+ [[nodiscard]]
36
+ OcrOptions toCpp() const {
37
+ static const auto clazz = javaClassStatic();
38
+ static const auto fieldIncludeBoxes = clazz->getField<jni::JBoolean>("includeBoxes");
39
+ jni::local_ref<jni::JBoolean> includeBoxes = this->getFieldValue(fieldIncludeBoxes);
40
+ static const auto fieldIncludeConfidence = clazz->getField<jni::JBoolean>("includeConfidence");
41
+ jni::local_ref<jni::JBoolean> includeConfidence = this->getFieldValue(fieldIncludeConfidence);
42
+ static const auto fieldRecognitionLevel = clazz->getField<JRLevel>("recognitionLevel");
43
+ jni::local_ref<JRLevel> recognitionLevel = this->getFieldValue(fieldRecognitionLevel);
44
+ static const auto fieldRecognitionLanguages = clazz->getField<jni::JArrayClass<jni::JString>>("recognitionLanguages");
45
+ jni::local_ref<jni::JArrayClass<jni::JString>> recognitionLanguages = this->getFieldValue(fieldRecognitionLanguages);
46
+ static const auto fieldUsesLanguageCorrection = clazz->getField<jni::JBoolean>("usesLanguageCorrection");
47
+ jni::local_ref<jni::JBoolean> usesLanguageCorrection = this->getFieldValue(fieldUsesLanguageCorrection);
48
+ return OcrOptions(
49
+ includeBoxes != nullptr ? std::make_optional(static_cast<bool>(includeBoxes->value())) : std::nullopt,
50
+ includeConfidence != nullptr ? std::make_optional(static_cast<bool>(includeConfidence->value())) : std::nullopt,
51
+ recognitionLevel != nullptr ? std::make_optional(recognitionLevel->toCpp()) : std::nullopt,
52
+ recognitionLanguages != nullptr ? std::make_optional([&](auto&& __input) {
53
+ size_t __size = __input->size();
54
+ std::vector<std::string> __vector;
55
+ __vector.reserve(__size);
56
+ for (size_t __i = 0; __i < __size; __i++) {
57
+ auto __element = __input->getElement(__i);
58
+ __vector.push_back(__element->toStdString());
59
+ }
60
+ return __vector;
61
+ }(recognitionLanguages)) : std::nullopt,
62
+ usesLanguageCorrection != nullptr ? std::make_optional(static_cast<bool>(usesLanguageCorrection->value())) : std::nullopt
63
+ );
64
+ }
65
+
66
+ public:
67
+ /**
68
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
69
+ */
70
+ [[maybe_unused]]
71
+ static jni::local_ref<JOcrOptions::javaobject> fromCpp(const OcrOptions& value) {
72
+ using JSignature = JOcrOptions(jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<JRLevel>, jni::alias_ref<jni::JArrayClass<jni::JString>>, jni::alias_ref<jni::JBoolean>);
73
+ static const auto clazz = javaClassStatic();
74
+ static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
75
+ return create(
76
+ clazz,
77
+ value.includeBoxes.has_value() ? jni::JBoolean::valueOf(value.includeBoxes.value()) : nullptr,
78
+ value.includeConfidence.has_value() ? jni::JBoolean::valueOf(value.includeConfidence.value()) : nullptr,
79
+ value.recognitionLevel.has_value() ? JRLevel::fromCpp(value.recognitionLevel.value()) : nullptr,
80
+ value.recognitionLanguages.has_value() ? [&](auto&& __input) {
81
+ size_t __size = __input.size();
82
+ jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
83
+ for (size_t __i = 0; __i < __size; __i++) {
84
+ const auto& __element = __input[__i];
85
+ auto __elementJni = jni::make_jstring(__element);
86
+ __array->setElement(__i, *__elementJni);
87
+ }
88
+ return __array;
89
+ }(value.recognitionLanguages.value()) : nullptr,
90
+ value.usesLanguageCorrection.has_value() ? jni::JBoolean::valueOf(value.usesLanguageCorrection.value()) : nullptr
91
+ );
92
+ }
93
+ };
94
+
95
+ } // namespace margelo::nitro::visionocr
@@ -0,0 +1,89 @@
1
+ ///
2
+ /// JOcrResult.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "OcrResult.hpp"
12
+
13
+ #include "JOcrBlock.hpp"
14
+ #include "JOcrBox.hpp"
15
+ #include "JOcrLine.hpp"
16
+ #include "JOcrWord.hpp"
17
+ #include "OcrBlock.hpp"
18
+ #include "OcrBox.hpp"
19
+ #include "OcrLine.hpp"
20
+ #include "OcrWord.hpp"
21
+ #include <optional>
22
+ #include <string>
23
+ #include <vector>
24
+
25
+ namespace margelo::nitro::visionocr {
26
+
27
+ using namespace facebook;
28
+
29
+ /**
30
+ * The C++ JNI bridge between the C++ struct "OcrResult" and the the Kotlin data class "OcrResult".
31
+ */
32
+ struct JOcrResult final: public jni::JavaClass<JOcrResult> {
33
+ public:
34
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visionocr/OcrResult;";
35
+
36
+ public:
37
+ /**
38
+ * Convert this Java/Kotlin-based struct to the C++ struct OcrResult by copying all values to C++.
39
+ */
40
+ [[maybe_unused]]
41
+ [[nodiscard]]
42
+ OcrResult toCpp() const {
43
+ static const auto clazz = javaClassStatic();
44
+ static const auto fieldText = clazz->getField<jni::JString>("text");
45
+ jni::local_ref<jni::JString> text = this->getFieldValue(fieldText);
46
+ static const auto fieldBlocks = clazz->getField<jni::JArrayClass<JOcrBlock>>("blocks");
47
+ jni::local_ref<jni::JArrayClass<JOcrBlock>> blocks = this->getFieldValue(fieldBlocks);
48
+ return OcrResult(
49
+ text->toStdString(),
50
+ blocks != nullptr ? std::make_optional([&](auto&& __input) {
51
+ size_t __size = __input->size();
52
+ std::vector<OcrBlock> __vector;
53
+ __vector.reserve(__size);
54
+ for (size_t __i = 0; __i < __size; __i++) {
55
+ auto __element = __input->getElement(__i);
56
+ __vector.push_back(__element->toCpp());
57
+ }
58
+ return __vector;
59
+ }(blocks)) : std::nullopt
60
+ );
61
+ }
62
+
63
+ public:
64
+ /**
65
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
66
+ */
67
+ [[maybe_unused]]
68
+ static jni::local_ref<JOcrResult::javaobject> fromCpp(const OcrResult& value) {
69
+ using JSignature = JOcrResult(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<JOcrBlock>>);
70
+ static const auto clazz = javaClassStatic();
71
+ static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
72
+ return create(
73
+ clazz,
74
+ jni::make_jstring(value.text),
75
+ value.blocks.has_value() ? [&](auto&& __input) {
76
+ size_t __size = __input.size();
77
+ jni::local_ref<jni::JArrayClass<JOcrBlock>> __array = jni::JArrayClass<JOcrBlock>::newArray(__size);
78
+ for (size_t __i = 0; __i < __size; __i++) {
79
+ const auto& __element = __input[__i];
80
+ auto __elementJni = JOcrBlock::fromCpp(__element);
81
+ __array->setElement(__i, *__elementJni);
82
+ }
83
+ return __array;
84
+ }(value.blocks.value()) : nullptr
85
+ );
86
+ }
87
+ };
88
+
89
+ } // namespace margelo::nitro::visionocr
@@ -0,0 +1,68 @@
1
+ ///
2
+ /// JOcrWord.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "OcrWord.hpp"
12
+
13
+ #include "JOcrBox.hpp"
14
+ #include "OcrBox.hpp"
15
+ #include <optional>
16
+ #include <string>
17
+
18
+ namespace margelo::nitro::visionocr {
19
+
20
+ using namespace facebook;
21
+
22
+ /**
23
+ * The C++ JNI bridge between the C++ struct "OcrWord" and the the Kotlin data class "OcrWord".
24
+ */
25
+ struct JOcrWord final: public jni::JavaClass<JOcrWord> {
26
+ public:
27
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visionocr/OcrWord;";
28
+
29
+ public:
30
+ /**
31
+ * Convert this Java/Kotlin-based struct to the C++ struct OcrWord by copying all values to C++.
32
+ */
33
+ [[maybe_unused]]
34
+ [[nodiscard]]
35
+ OcrWord toCpp() const {
36
+ static const auto clazz = javaClassStatic();
37
+ static const auto fieldText = clazz->getField<jni::JString>("text");
38
+ jni::local_ref<jni::JString> text = this->getFieldValue(fieldText);
39
+ static const auto fieldBox = clazz->getField<JOcrBox>("box");
40
+ jni::local_ref<JOcrBox> box = this->getFieldValue(fieldBox);
41
+ static const auto fieldConfidence = clazz->getField<jni::JDouble>("confidence");
42
+ jni::local_ref<jni::JDouble> confidence = this->getFieldValue(fieldConfidence);
43
+ return OcrWord(
44
+ text->toStdString(),
45
+ box != nullptr ? std::make_optional(box->toCpp()) : std::nullopt,
46
+ confidence != nullptr ? std::make_optional(confidence->value()) : std::nullopt
47
+ );
48
+ }
49
+
50
+ public:
51
+ /**
52
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
53
+ */
54
+ [[maybe_unused]]
55
+ static jni::local_ref<JOcrWord::javaobject> fromCpp(const OcrWord& value) {
56
+ using JSignature = JOcrWord(jni::alias_ref<jni::JString>, jni::alias_ref<JOcrBox>, jni::alias_ref<jni::JDouble>);
57
+ static const auto clazz = javaClassStatic();
58
+ static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
59
+ return create(
60
+ clazz,
61
+ jni::make_jstring(value.text),
62
+ value.box.has_value() ? JOcrBox::fromCpp(value.box.value()) : nullptr,
63
+ value.confidence.has_value() ? jni::JDouble::valueOf(value.confidence.value()) : nullptr
64
+ );
65
+ }
66
+ };
67
+
68
+ } // namespace margelo::nitro::visionocr
@@ -0,0 +1,58 @@
1
+ ///
2
+ /// JRLevel.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "RLevel.hpp"
12
+
13
+ namespace margelo::nitro::visionocr {
14
+
15
+ using namespace facebook;
16
+
17
+ /**
18
+ * The C++ JNI bridge between the C++ enum "RLevel" and the the Kotlin enum "RLevel".
19
+ */
20
+ struct JRLevel final: public jni::JavaClass<JRLevel> {
21
+ public:
22
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/visionocr/RLevel;";
23
+
24
+ public:
25
+ /**
26
+ * Convert this Java/Kotlin-based enum to the C++ enum RLevel.
27
+ */
28
+ [[maybe_unused]]
29
+ [[nodiscard]]
30
+ RLevel toCpp() const {
31
+ static const auto clazz = javaClassStatic();
32
+ static const auto fieldOrdinal = clazz->getField<int>("value");
33
+ int ordinal = this->getFieldValue(fieldOrdinal);
34
+ return static_cast<RLevel>(ordinal);
35
+ }
36
+
37
+ public:
38
+ /**
39
+ * Create a Java/Kotlin-based enum with the given C++ enum's value.
40
+ */
41
+ [[maybe_unused]]
42
+ static jni::alias_ref<JRLevel> fromCpp(RLevel value) {
43
+ static const auto clazz = javaClassStatic();
44
+ switch (value) {
45
+ case RLevel::FAST:
46
+ static const auto fieldFAST = clazz->getStaticField<JRLevel>("FAST");
47
+ return clazz->getStaticFieldValue(fieldFAST);
48
+ case RLevel::ACCURATE:
49
+ static const auto fieldACCURATE = clazz->getStaticField<JRLevel>("ACCURATE");
50
+ return clazz->getStaticFieldValue(fieldACCURATE);
51
+ default:
52
+ std::string stringValue = std::to_string(static_cast<int>(value));
53
+ throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
54
+ }
55
+ }
56
+ };
57
+
58
+ } // namespace margelo::nitro::visionocr
@@ -0,0 +1,55 @@
1
+ ///
2
+ /// HybridVisionOCRSpec.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.visionocr
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.jni.HybridData
12
+ import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.camera.HybridFrameSpec
14
+ import com.margelo.nitro.core.HybridObject
15
+
16
+ /**
17
+ * A Kotlin class representing the VisionOCR HybridObject.
18
+ * Implement this abstract class to create Kotlin-based instances of VisionOCR.
19
+ */
20
+ @DoNotStrip
21
+ @Keep
22
+ @Suppress(
23
+ "KotlinJniMissingFunction", "unused",
24
+ "RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
25
+ "LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
26
+ )
27
+ abstract class HybridVisionOCRSpec: HybridObject() {
28
+ // Properties
29
+
30
+
31
+ // Methods
32
+ @DoNotStrip
33
+ @Keep
34
+ abstract fun call(frame: com.margelo.nitro.camera.HybridFrameSpec, options: OcrOptions?): OcrResult?
35
+
36
+ // Default implementation of `HybridObject.toString()`
37
+ override fun toString(): String {
38
+ return "[HybridObject VisionOCR]"
39
+ }
40
+
41
+ // C++ backing class
42
+ @DoNotStrip
43
+ @Keep
44
+ protected open class CxxPart(javaPart: HybridVisionOCRSpec): HybridObject.CxxPart(javaPart) {
45
+ // C++ JHybridVisionOCRSpec::CxxPart::initHybrid(...)
46
+ external override fun initHybrid(): HybridData
47
+ }
48
+ override fun createCxxPart(): CxxPart {
49
+ return CxxPart(this)
50
+ }
51
+
52
+ companion object {
53
+ protected const val TAG = "HybridVisionOCRSpec"
54
+ }
55
+ }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// NitroVisionOcrOnLoad.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.visionocr
9
+
10
+ import android.util.Log
11
+
12
+ internal class NitroVisionOcrOnLoad {
13
+ companion object {
14
+ private const val TAG = "NitroVisionOcrOnLoad"
15
+ private var didLoad = false
16
+ /**
17
+ * Initializes the native part of "NitroVisionOcr".
18
+ * This method is idempotent and can be called more than once.
19
+ */
20
+ @JvmStatic
21
+ fun initializeNative() {
22
+ if (didLoad) return
23
+ try {
24
+ Log.i(TAG, "Loading NitroVisionOcr C++ library...")
25
+ System.loadLibrary("NitroVisionOcr")
26
+ Log.i(TAG, "Successfully loaded NitroVisionOcr C++ library!")
27
+ didLoad = true
28
+ } catch (e: Error) {
29
+ Log.e(TAG, "Failed to load NitroVisionOcr C++ library! Is it properly installed and linked? " +
30
+ "Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
31
+ throw e
32
+ }
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,61 @@
1
+ ///
2
+ /// OcrBlock.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.visionocr
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "OcrBlock".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class OcrBlock(
21
+ @DoNotStrip
22
+ @Keep
23
+ val text: String,
24
+ @DoNotStrip
25
+ @Keep
26
+ val box: OcrBox?,
27
+ @DoNotStrip
28
+ @Keep
29
+ val lines: Array<OcrLine>?
30
+ ) {
31
+ /* primary constructor */
32
+
33
+ override fun equals(other: Any?): Boolean {
34
+ if (this === other) return true
35
+ if (other !is OcrBlock) return false
36
+ return Objects.deepEquals(this.text, other.text)
37
+ && Objects.deepEquals(this.box, other.box)
38
+ && Objects.deepEquals(this.lines, other.lines)
39
+ }
40
+
41
+ override fun hashCode(): Int {
42
+ return arrayOf<Any?>(
43
+ text,
44
+ box,
45
+ lines
46
+ ).contentDeepHashCode()
47
+ }
48
+
49
+ companion object {
50
+ /**
51
+ * Constructor called from C++
52
+ */
53
+ @DoNotStrip
54
+ @Keep
55
+ @Suppress("unused")
56
+ @JvmStatic
57
+ private fun fromCpp(text: String, box: OcrBox?, lines: Array<OcrLine>?): OcrBlock {
58
+ return OcrBlock(text, box, lines)
59
+ }
60
+ }
61
+ }
@@ -0,0 +1,66 @@
1
+ ///
2
+ /// OcrBox.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.visionocr
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "OcrBox".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class OcrBox(
21
+ @DoNotStrip
22
+ @Keep
23
+ val x: Double,
24
+ @DoNotStrip
25
+ @Keep
26
+ val y: Double,
27
+ @DoNotStrip
28
+ @Keep
29
+ val width: Double,
30
+ @DoNotStrip
31
+ @Keep
32
+ val height: Double
33
+ ) {
34
+ /* primary constructor */
35
+
36
+ override fun equals(other: Any?): Boolean {
37
+ if (this === other) return true
38
+ if (other !is OcrBox) return false
39
+ return Objects.deepEquals(this.x, other.x)
40
+ && Objects.deepEquals(this.y, other.y)
41
+ && Objects.deepEquals(this.width, other.width)
42
+ && Objects.deepEquals(this.height, other.height)
43
+ }
44
+
45
+ override fun hashCode(): Int {
46
+ return arrayOf<Any?>(
47
+ x,
48
+ y,
49
+ width,
50
+ height
51
+ ).contentDeepHashCode()
52
+ }
53
+
54
+ companion object {
55
+ /**
56
+ * Constructor called from C++
57
+ */
58
+ @DoNotStrip
59
+ @Keep
60
+ @Suppress("unused")
61
+ @JvmStatic
62
+ private fun fromCpp(x: Double, y: Double, width: Double, height: Double): OcrBox {
63
+ return OcrBox(x, y, width, height)
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,66 @@
1
+ ///
2
+ /// OcrLine.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.visionocr
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "OcrLine".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class OcrLine(
21
+ @DoNotStrip
22
+ @Keep
23
+ val text: String,
24
+ @DoNotStrip
25
+ @Keep
26
+ val box: OcrBox?,
27
+ @DoNotStrip
28
+ @Keep
29
+ val words: Array<OcrWord>?,
30
+ @DoNotStrip
31
+ @Keep
32
+ val confidence: Double?
33
+ ) {
34
+ /* primary constructor */
35
+
36
+ override fun equals(other: Any?): Boolean {
37
+ if (this === other) return true
38
+ if (other !is OcrLine) return false
39
+ return Objects.deepEquals(this.text, other.text)
40
+ && Objects.deepEquals(this.box, other.box)
41
+ && Objects.deepEquals(this.words, other.words)
42
+ && Objects.deepEquals(this.confidence, other.confidence)
43
+ }
44
+
45
+ override fun hashCode(): Int {
46
+ return arrayOf<Any?>(
47
+ text,
48
+ box,
49
+ words,
50
+ confidence
51
+ ).contentDeepHashCode()
52
+ }
53
+
54
+ companion object {
55
+ /**
56
+ * Constructor called from C++
57
+ */
58
+ @DoNotStrip
59
+ @Keep
60
+ @Suppress("unused")
61
+ @JvmStatic
62
+ private fun fromCpp(text: String, box: OcrBox?, words: Array<OcrWord>?, confidence: Double?): OcrLine {
63
+ return OcrLine(text, box, words, confidence)
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,71 @@
1
+ ///
2
+ /// OcrOptions.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.visionocr
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "OcrOptions".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class OcrOptions(
21
+ @DoNotStrip
22
+ @Keep
23
+ val includeBoxes: Boolean?,
24
+ @DoNotStrip
25
+ @Keep
26
+ val includeConfidence: Boolean?,
27
+ @DoNotStrip
28
+ @Keep
29
+ val recognitionLevel: RLevel?,
30
+ @DoNotStrip
31
+ @Keep
32
+ val recognitionLanguages: Array<String>?,
33
+ @DoNotStrip
34
+ @Keep
35
+ val usesLanguageCorrection: Boolean?
36
+ ) {
37
+ /* primary constructor */
38
+
39
+ override fun equals(other: Any?): Boolean {
40
+ if (this === other) return true
41
+ if (other !is OcrOptions) return false
42
+ return Objects.deepEquals(this.includeBoxes, other.includeBoxes)
43
+ && Objects.deepEquals(this.includeConfidence, other.includeConfidence)
44
+ && Objects.deepEquals(this.recognitionLevel, other.recognitionLevel)
45
+ && Objects.deepEquals(this.recognitionLanguages, other.recognitionLanguages)
46
+ && Objects.deepEquals(this.usesLanguageCorrection, other.usesLanguageCorrection)
47
+ }
48
+
49
+ override fun hashCode(): Int {
50
+ return arrayOf<Any?>(
51
+ includeBoxes,
52
+ includeConfidence,
53
+ recognitionLevel,
54
+ recognitionLanguages,
55
+ usesLanguageCorrection
56
+ ).contentDeepHashCode()
57
+ }
58
+
59
+ companion object {
60
+ /**
61
+ * Constructor called from C++
62
+ */
63
+ @DoNotStrip
64
+ @Keep
65
+ @Suppress("unused")
66
+ @JvmStatic
67
+ private fun fromCpp(includeBoxes: Boolean?, includeConfidence: Boolean?, recognitionLevel: RLevel?, recognitionLanguages: Array<String>?, usesLanguageCorrection: Boolean?): OcrOptions {
68
+ return OcrOptions(includeBoxes, includeConfidence, recognitionLevel, recognitionLanguages, usesLanguageCorrection)
69
+ }
70
+ }
71
+ }