rn-remove-image-bg 0.0.29 → 0.0.31
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/nitrogen/generated/android/NitroRnRemoveImageBg+autolinking.cmake +1 -1
- package/nitrogen/generated/android/NitroRnRemoveImageBg+autolinking.gradle +1 -1
- package/nitrogen/generated/android/NitroRnRemoveImageBgOnLoad.cpp +27 -17
- package/nitrogen/generated/android/NitroRnRemoveImageBgOnLoad.hpp +14 -5
- package/nitrogen/generated/android/c++/JHybridImageBackgroundRemoverSpec.cpp +21 -20
- package/nitrogen/generated/android/c++/JHybridImageBackgroundRemoverSpec.hpp +20 -22
- package/nitrogen/generated/android/c++/JNativeRemoveBackgroundOptions.hpp +1 -1
- package/nitrogen/generated/android/c++/JOutputFormat.hpp +3 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnremoveimagebg/HybridImageBackgroundRemoverSpec.kt +15 -18
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnremoveimagebg/NativeRemoveBackgroundOptions.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnremoveimagebg/NitroRnRemoveImageBgOnLoad.kt +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rnremoveimagebg/OutputFormat.kt +3 -1
- package/nitrogen/generated/ios/NitroRnRemoveImageBg+autolinking.rb +2 -2
- package/nitrogen/generated/ios/NitroRnRemoveImageBg-Swift-Cxx-Bridge.cpp +1 -1
- package/nitrogen/generated/ios/NitroRnRemoveImageBg-Swift-Cxx-Bridge.hpp +1 -1
- package/nitrogen/generated/ios/NitroRnRemoveImageBg-Swift-Cxx-Umbrella.hpp +1 -1
- package/nitrogen/generated/ios/c++/HybridImageBackgroundRemoverSpecSwift.cpp +1 -1
- package/nitrogen/generated/ios/c++/HybridImageBackgroundRemoverSpecSwift.hpp +7 -1
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -2
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +1 -2
- package/nitrogen/generated/ios/swift/HybridImageBackgroundRemoverSpec.swift +3 -4
- package/nitrogen/generated/ios/swift/HybridImageBackgroundRemoverSpec_cxx.swift +9 -2
- package/nitrogen/generated/ios/swift/NativeRemoveBackgroundOptions.swift +7 -26
- package/nitrogen/generated/ios/swift/OutputFormat.swift +1 -1
- package/nitrogen/generated/shared/c++/HybridImageBackgroundRemoverSpec.cpp +1 -1
- package/nitrogen/generated/shared/c++/HybridImageBackgroundRemoverSpec.hpp +1 -1
- package/nitrogen/generated/shared/c++/NativeRemoveBackgroundOptions.hpp +19 -11
- package/nitrogen/generated/shared/c++/OutputFormat.hpp +1 -1
- package/package.json +17 -50
- package/lib/ImageProcessing.d.ts +0 -167
- package/lib/ImageProcessing.js +0 -323
- package/lib/ImageProcessing.web.d.ts +0 -25
- package/lib/ImageProcessing.web.js +0 -89
- package/lib/__tests__/cache.test.d.ts +0 -1
- package/lib/__tests__/cache.test.js +0 -87
- package/lib/__tests__/errors.test.d.ts +0 -1
- package/lib/__tests__/errors.test.js +0 -82
- package/lib/cache.d.ts +0 -72
- package/lib/cache.js +0 -228
- package/lib/errors.d.ts +0 -20
- package/lib/errors.js +0 -64
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -9
- package/lib/specs/Example.nitro.d.ts +0 -0
- package/lib/specs/Example.nitro.js +0 -2
- package/lib/specs/ImageBackgroundRemover.nitro.d.ts +0 -41
- package/lib/specs/ImageBackgroundRemover.nitro.js +0 -1
- package/lib/web/core/BackgroundRemover.d.ts +0 -31
- package/lib/web/core/BackgroundRemover.js +0 -64
- package/lib/web/core/CacheManager.d.ts +0 -16
- package/lib/web/core/CacheManager.js +0 -57
- package/lib/web/core/types.d.ts +0 -47
- package/lib/web/core/types.js +0 -1
- package/lib/web/errors/WebErrorAdapter.d.ts +0 -8
- package/lib/web/errors/WebErrorAdapter.js +0 -29
- package/lib/web/utils/CompressImage.d.ts +0 -2
- package/lib/web/utils/CompressImage.js +0 -34
- package/lib/web/utils/ThumbhashGenerator.d.ts +0 -1
- package/lib/web/utils/ThumbhashGenerator.js +0 -31
- package/lib/web/utils/formatConverter.d.ts +0 -4
- package/lib/web/utils/formatConverter.js +0 -18
- package/lib/web/utils/uriHelper.d.ts +0 -10
- package/lib/web/utils/uriHelper.js +0 -46
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# NitroRnRemoveImageBg+autolinking.cmake
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a CMake file that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// NitroRnRemoveImageBg+autolinking.gradle
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
/// This is a Gradle file that adds all files generated by Nitrogen
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// NitroRnRemoveImageBgOnLoad.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#ifndef BUILDING_NITRORNREMOVEIMAGEBG_WITH_GENERATED_CMAKE_PROJECT
|
|
@@ -21,24 +21,34 @@
|
|
|
21
21
|
namespace margelo::nitro::rnremoveimagebg {
|
|
22
22
|
|
|
23
23
|
int initialize(JavaVM* vm) {
|
|
24
|
+
return facebook::jni::initialize(vm, []() {
|
|
25
|
+
::margelo::nitro::rnremoveimagebg::registerAllNatives();
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
struct JHybridImageBackgroundRemoverSpecImpl: public jni::JavaClass<JHybridImageBackgroundRemoverSpecImpl, JHybridImageBackgroundRemoverSpec::JavaPart> {
|
|
30
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/rnremoveimagebg/HybridImageBackgroundRemover;";
|
|
31
|
+
static std::shared_ptr<JHybridImageBackgroundRemoverSpec> create() {
|
|
32
|
+
static auto constructorFn = javaClassStatic()->getConstructor<JHybridImageBackgroundRemoverSpecImpl::javaobject()>();
|
|
33
|
+
jni::local_ref<JHybridImageBackgroundRemoverSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
34
|
+
return javaPart->getJHybridImageBackgroundRemoverSpec();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
void registerAllNatives() {
|
|
24
39
|
using namespace margelo::nitro;
|
|
25
40
|
using namespace margelo::nitro::rnremoveimagebg;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
auto instance = object.create();
|
|
38
|
-
return instance->cthis()->shared();
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
});
|
|
41
|
+
|
|
42
|
+
// Register native JNI methods
|
|
43
|
+
margelo::nitro::rnremoveimagebg::JHybridImageBackgroundRemoverSpec::CxxPart::registerNatives();
|
|
44
|
+
|
|
45
|
+
// Register Nitro Hybrid Objects
|
|
46
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
47
|
+
"ImageBackgroundRemover",
|
|
48
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
49
|
+
return JHybridImageBackgroundRemoverSpecImpl::create();
|
|
50
|
+
}
|
|
51
|
+
);
|
|
42
52
|
}
|
|
43
53
|
|
|
44
54
|
} // namespace margelo::nitro::rnremoveimagebg
|
|
@@ -2,24 +2,33 @@
|
|
|
2
2
|
/// NitroRnRemoveImageBgOnLoad.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include <jni.h>
|
|
9
|
+
#include <functional>
|
|
9
10
|
#include <NitroModules/NitroDefines.hpp>
|
|
10
11
|
|
|
11
12
|
namespace margelo::nitro::rnremoveimagebg {
|
|
12
13
|
|
|
14
|
+
[[deprecated("Use registerNatives() instead.")]]
|
|
15
|
+
int initialize(JavaVM* vm);
|
|
16
|
+
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
15
|
-
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`)
|
|
18
|
+
* Register the native (C++) part of NitroRnRemoveImageBg, and autolinks all Hybrid Objects.
|
|
19
|
+
* Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`),
|
|
20
|
+
* inside a `facebook::jni::initialize(vm, ...)` call.
|
|
16
21
|
* Example:
|
|
17
22
|
* ```cpp (cpp-adapter.cpp)
|
|
18
23
|
* JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
|
|
19
|
-
* return
|
|
24
|
+
* return facebook::jni::initialize(vm, []() {
|
|
25
|
+
* // register all NitroRnRemoveImageBg HybridObjects
|
|
26
|
+
* margelo::nitro::rnremoveimagebg::registerNatives();
|
|
27
|
+
* // any other custom registrations go here.
|
|
28
|
+
* });
|
|
20
29
|
* }
|
|
21
30
|
* ```
|
|
22
31
|
*/
|
|
23
|
-
|
|
32
|
+
void registerAllNatives();
|
|
24
33
|
|
|
25
34
|
} // namespace margelo::nitro::rnremoveimagebg
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// JHybridImageBackgroundRemoverSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "JHybridImageBackgroundRemoverSpec.hpp"
|
|
@@ -22,30 +22,31 @@ namespace margelo::nitro::rnremoveimagebg { enum class OutputFormat; }
|
|
|
22
22
|
|
|
23
23
|
namespace margelo::nitro::rnremoveimagebg {
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
});
|
|
25
|
+
std::shared_ptr<JHybridImageBackgroundRemoverSpec> JHybridImageBackgroundRemoverSpec::JavaPart::getJHybridImageBackgroundRemoverSpec() {
|
|
26
|
+
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
27
|
+
auto castHybridObject = std::dynamic_pointer_cast<JHybridImageBackgroundRemoverSpec>(hybridObject);
|
|
28
|
+
if (castHybridObject == nullptr) [[unlikely]] {
|
|
29
|
+
throw std::runtime_error("Failed to downcast JHybridObject to JHybridImageBackgroundRemoverSpec!");
|
|
30
|
+
}
|
|
31
|
+
return castHybridObject;
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return method(_javaPart);
|
|
34
|
+
jni::local_ref<JHybridImageBackgroundRemoverSpec::CxxPart::jhybriddata> JHybridImageBackgroundRemoverSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
35
|
+
return makeCxxInstance(jThis);
|
|
38
36
|
}
|
|
39
37
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
std::shared_ptr<JHybridObject> JHybridImageBackgroundRemoverSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
39
|
+
auto castJavaPart = jni::dynamic_ref_cast<JHybridImageBackgroundRemoverSpec::JavaPart>(javaPart);
|
|
40
|
+
if (castJavaPart == nullptr) [[unlikely]] {
|
|
41
|
+
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridImageBackgroundRemoverSpec::JavaPart!");
|
|
42
|
+
}
|
|
43
|
+
return std::make_shared<JHybridImageBackgroundRemoverSpec>(castJavaPart);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
void JHybridImageBackgroundRemoverSpec::CxxPart::registerNatives() {
|
|
47
|
+
registerHybrid({
|
|
48
|
+
makeNativeMethod("initHybrid", JHybridImageBackgroundRemoverSpec::CxxPart::initHybrid),
|
|
49
|
+
});
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
// Properties
|
|
@@ -53,7 +54,7 @@ namespace margelo::nitro::rnremoveimagebg {
|
|
|
53
54
|
|
|
54
55
|
// Methods
|
|
55
56
|
std::shared_ptr<Promise<std::string>> JHybridImageBackgroundRemoverSpec::removeBackground(const std::string& imagePath, const NativeRemoveBackgroundOptions& options) {
|
|
56
|
-
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* imagePath */, jni::alias_ref<JNativeRemoveBackgroundOptions> /* options */)>("removeBackground");
|
|
57
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* imagePath */, jni::alias_ref<JNativeRemoveBackgroundOptions> /* options */)>("removeBackground");
|
|
57
58
|
auto __result = method(_javaPart, jni::make_jstring(imagePath), JNativeRemoveBackgroundOptions::fromCpp(options));
|
|
58
59
|
return [&]() {
|
|
59
60
|
auto __promise = Promise<std::string>::create();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridImageBackgroundRemoverSpec.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -18,33 +18,33 @@ namespace margelo::nitro::rnremoveimagebg {
|
|
|
18
18
|
|
|
19
19
|
using namespace facebook;
|
|
20
20
|
|
|
21
|
-
class JHybridImageBackgroundRemoverSpec: public
|
|
22
|
-
public virtual HybridImageBackgroundRemoverSpec {
|
|
21
|
+
class JHybridImageBackgroundRemoverSpec: public virtual HybridImageBackgroundRemoverSpec, public virtual JHybridObject {
|
|
23
22
|
public:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
HybridBase
|
|
33
|
-
|
|
23
|
+
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
|
24
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/rnremoveimagebg/HybridImageBackgroundRemoverSpec;";
|
|
25
|
+
std::shared_ptr<JHybridImageBackgroundRemoverSpec> getJHybridImageBackgroundRemoverSpec();
|
|
26
|
+
};
|
|
27
|
+
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
28
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/rnremoveimagebg/HybridImageBackgroundRemoverSpec$CxxPart;";
|
|
29
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
30
|
+
static void registerNatives();
|
|
31
|
+
using HybridBase::HybridBase;
|
|
32
|
+
protected:
|
|
33
|
+
std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
|
|
34
|
+
};
|
|
34
35
|
|
|
35
36
|
public:
|
|
37
|
+
explicit JHybridImageBackgroundRemoverSpec(const jni::local_ref<JHybridImageBackgroundRemoverSpec::JavaPart>& javaPart):
|
|
38
|
+
HybridObject(HybridImageBackgroundRemoverSpec::TAG),
|
|
39
|
+
JHybridObject(javaPart),
|
|
40
|
+
_javaPart(jni::make_global(javaPart)) {}
|
|
36
41
|
~JHybridImageBackgroundRemoverSpec() override {
|
|
37
42
|
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
38
43
|
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
public:
|
|
42
|
-
|
|
43
|
-
void dispose() noexcept override;
|
|
44
|
-
std::string toString() override;
|
|
45
|
-
|
|
46
|
-
public:
|
|
47
|
-
inline const jni::global_ref<JHybridImageBackgroundRemoverSpec::javaobject>& getJavaPart() const noexcept {
|
|
47
|
+
inline const jni::global_ref<JHybridImageBackgroundRemoverSpec::JavaPart>& getJavaPart() const noexcept {
|
|
48
48
|
return _javaPart;
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -57,9 +57,7 @@ namespace margelo::nitro::rnremoveimagebg {
|
|
|
57
57
|
std::shared_ptr<Promise<std::string>> removeBackground(const std::string& imagePath, const NativeRemoveBackgroundOptions& options) override;
|
|
58
58
|
|
|
59
59
|
private:
|
|
60
|
-
|
|
61
|
-
using HybridBase::HybridBase;
|
|
62
|
-
jni::global_ref<JHybridImageBackgroundRemoverSpec::javaobject> _javaPart;
|
|
60
|
+
jni::global_ref<JHybridImageBackgroundRemoverSpec::JavaPart> _javaPart;
|
|
63
61
|
};
|
|
64
62
|
|
|
65
63
|
} // namespace margelo::nitro::rnremoveimagebg
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// JOutputFormat.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -41,13 +41,12 @@ namespace margelo::nitro::rnremoveimagebg {
|
|
|
41
41
|
[[maybe_unused]]
|
|
42
42
|
static jni::alias_ref<JOutputFormat> fromCpp(OutputFormat value) {
|
|
43
43
|
static const auto clazz = javaClassStatic();
|
|
44
|
-
static const auto fieldPNG = clazz->getStaticField<JOutputFormat>("PNG");
|
|
45
|
-
static const auto fieldWEBP = clazz->getStaticField<JOutputFormat>("WEBP");
|
|
46
|
-
|
|
47
44
|
switch (value) {
|
|
48
45
|
case OutputFormat::PNG:
|
|
46
|
+
static const auto fieldPNG = clazz->getStaticField<JOutputFormat>("PNG");
|
|
49
47
|
return clazz->getStaticFieldValue(fieldPNG);
|
|
50
48
|
case OutputFormat::WEBP:
|
|
49
|
+
static const auto fieldWEBP = clazz->getStaticField<JOutputFormat>("WEBP");
|
|
51
50
|
return clazz->getStaticFieldValue(fieldWEBP);
|
|
52
51
|
default:
|
|
53
52
|
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridImageBackgroundRemoverSpec.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.rnremoveimagebg
|
|
@@ -25,32 +25,29 @@ import com.margelo.nitro.core.HybridObject
|
|
|
25
25
|
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
26
|
)
|
|
27
27
|
abstract class HybridImageBackgroundRemoverSpec: HybridObject() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
init {
|
|
32
|
-
super.updateNative(mHybridData)
|
|
33
|
-
}
|
|
28
|
+
// Properties
|
|
29
|
+
|
|
34
30
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
// Methods
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
@Keep
|
|
34
|
+
abstract fun removeBackground(imagePath: String, options: NativeRemoveBackgroundOptions): Promise<String>
|
|
39
35
|
|
|
40
36
|
// Default implementation of `HybridObject.toString()`
|
|
41
37
|
override fun toString(): String {
|
|
42
38
|
return "[HybridObject ImageBackgroundRemover]"
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// Methods
|
|
41
|
+
// C++ backing class
|
|
49
42
|
@DoNotStrip
|
|
50
43
|
@Keep
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
protected open class CxxPart(javaPart: HybridImageBackgroundRemoverSpec): HybridObject.CxxPart(javaPart) {
|
|
45
|
+
// C++ JHybridImageBackgroundRemoverSpec::CxxPart::initHybrid(...)
|
|
46
|
+
external override fun initHybrid(): HybridData
|
|
47
|
+
}
|
|
48
|
+
override fun createCxxPart(): CxxPart {
|
|
49
|
+
return CxxPart(this)
|
|
50
|
+
}
|
|
54
51
|
|
|
55
52
|
companion object {
|
|
56
53
|
protected const val TAG = "HybridImageBackgroundRemoverSpec"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// NativeRemoveBackgroundOptions.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.rnremoveimagebg
|
|
@@ -29,7 +29,7 @@ data class NativeRemoveBackgroundOptions(
|
|
|
29
29
|
) {
|
|
30
30
|
/* primary constructor */
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
companion object {
|
|
33
33
|
/**
|
|
34
34
|
* Constructor called from C++
|
|
35
35
|
*/
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// NitroRnRemoveImageBgOnLoad.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.rnremoveimagebg
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// OutputFormat.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
package com.margelo.nitro.rnremoveimagebg
|
|
@@ -18,4 +18,6 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
|
18
18
|
enum class OutputFormat(@DoNotStrip @Keep val value: Int) {
|
|
19
19
|
PNG(0),
|
|
20
20
|
WEBP(1);
|
|
21
|
+
|
|
22
|
+
companion object
|
|
21
23
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# NitroRnRemoveImageBg+autolinking.rb
|
|
3
3
|
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
# https://github.com/mrousavy/nitro
|
|
5
|
-
# Copyright ©
|
|
5
|
+
# Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
#
|
|
7
7
|
|
|
8
8
|
# This is a Ruby script that adds all files generated by Nitrogen
|
|
@@ -52,7 +52,7 @@ def add_nitrogen_files(spec)
|
|
|
52
52
|
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
53
|
# Use C++ 20
|
|
54
54
|
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
-
# Enables C++ <-> Swift interop (by default it's only
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
56
|
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
57
|
# Enables stricter modular headers
|
|
58
58
|
"DEFINES_MODULE" => "YES",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// NitroRnRemoveImageBg-Swift-Cxx-Bridge.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "NitroRnRemoveImageBg-Swift-Cxx-Bridge.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridImageBackgroundRemoverSpecSwift.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridImageBackgroundRemoverSpecSwift.hpp"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridImageBackgroundRemoverSpecSwift.hpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#pragma once
|
|
@@ -53,6 +53,12 @@ namespace margelo::nitro::rnremoveimagebg {
|
|
|
53
53
|
inline size_t getExternalMemorySize() noexcept override {
|
|
54
54
|
return _swiftPart.getMemorySize();
|
|
55
55
|
}
|
|
56
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
57
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridImageBackgroundRemoverSpecSwift>(other)) {
|
|
58
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
56
62
|
void dispose() noexcept override {
|
|
57
63
|
_swiftPart.dispose();
|
|
58
64
|
}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// Func_void_std__exception_ptr.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// Func_void_std__string.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// HybridImageBackgroundRemoverSpec.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/// See ``HybridImageBackgroundRemoverSpec``
|
|
@@ -30,14 +29,14 @@ open class HybridImageBackgroundRemoverSpec_base {
|
|
|
30
29
|
public init() { }
|
|
31
30
|
public func getCxxWrapper() -> HybridImageBackgroundRemoverSpec_cxx {
|
|
32
31
|
#if DEBUG
|
|
33
|
-
guard self is HybridImageBackgroundRemoverSpec else {
|
|
32
|
+
guard self is any HybridImageBackgroundRemoverSpec else {
|
|
34
33
|
fatalError("`self` is not a `HybridImageBackgroundRemoverSpec`! Did you accidentally inherit from `HybridImageBackgroundRemoverSpec_base` instead of `HybridImageBackgroundRemoverSpec`?")
|
|
35
34
|
}
|
|
36
35
|
#endif
|
|
37
36
|
if let cxxWrapper = self.cxxWrapper {
|
|
38
37
|
return cxxWrapper
|
|
39
38
|
} else {
|
|
40
|
-
let cxxWrapper = HybridImageBackgroundRemoverSpec_cxx(self as! HybridImageBackgroundRemoverSpec)
|
|
39
|
+
let cxxWrapper = HybridImageBackgroundRemoverSpec_cxx(self as! any HybridImageBackgroundRemoverSpec)
|
|
41
40
|
self.cxxWrapper = cxxWrapper
|
|
42
41
|
return cxxWrapper
|
|
43
42
|
}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// HybridImageBackgroundRemoverSpec_cxx.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -96,6 +95,14 @@ open class HybridImageBackgroundRemoverSpec_cxx {
|
|
|
96
95
|
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
97
96
|
}
|
|
98
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Compares this object with the given [other] object for reference equality.
|
|
100
|
+
*/
|
|
101
|
+
@inline(__always)
|
|
102
|
+
public func equals(other: HybridImageBackgroundRemoverSpec_cxx) -> Bool {
|
|
103
|
+
return self.__implementation === other.__implementation
|
|
104
|
+
}
|
|
105
|
+
|
|
99
106
|
/**
|
|
100
107
|
* Call dispose() on the Swift class.
|
|
101
108
|
* This _may_ be called manually from JS.
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
/// NativeRemoveBackgroundOptions.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import NitroModules
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -23,36 +22,18 @@ public extension NativeRemoveBackgroundOptions {
|
|
|
23
22
|
self.init(maxDimension, format, quality)
|
|
24
23
|
}
|
|
25
24
|
|
|
25
|
+
@inline(__always)
|
|
26
26
|
var maxDimension: Double {
|
|
27
|
-
|
|
28
|
-
get {
|
|
29
|
-
return self.__maxDimension
|
|
30
|
-
}
|
|
31
|
-
@inline(__always)
|
|
32
|
-
set {
|
|
33
|
-
self.__maxDimension = newValue
|
|
34
|
-
}
|
|
27
|
+
return self.__maxDimension
|
|
35
28
|
}
|
|
36
29
|
|
|
30
|
+
@inline(__always)
|
|
37
31
|
var format: OutputFormat {
|
|
38
|
-
|
|
39
|
-
get {
|
|
40
|
-
return self.__format
|
|
41
|
-
}
|
|
42
|
-
@inline(__always)
|
|
43
|
-
set {
|
|
44
|
-
self.__format = newValue
|
|
45
|
-
}
|
|
32
|
+
return self.__format
|
|
46
33
|
}
|
|
47
34
|
|
|
35
|
+
@inline(__always)
|
|
48
36
|
var quality: Double {
|
|
49
|
-
|
|
50
|
-
get {
|
|
51
|
-
return self.__quality
|
|
52
|
-
}
|
|
53
|
-
@inline(__always)
|
|
54
|
-
set {
|
|
55
|
-
self.__quality = newValue
|
|
56
|
-
}
|
|
37
|
+
return self.__quality
|
|
57
38
|
}
|
|
58
39
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// HybridImageBackgroundRemoverSpec.cpp
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
|
-
/// Copyright ©
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
6
|
///
|
|
7
7
|
|
|
8
8
|
#include "HybridImageBackgroundRemoverSpec.hpp"
|