react-native-nitro-image-pipeline 1.0.0 → 1.1.0
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 +8 -2
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/HybridNitroImagePipeline.kt +15 -2
- package/ios/HybridNitroImagePipeline.swift +12 -2
- package/ios/RoundedCornersProcessor.swift +118 -0
- package/lib/commonjs/index.js +18 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +18 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +8 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts +18 -1
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroImagePipeline+autolinking.cmake +1 -0
- package/nitrogen/generated/android/c++/JCornerRadii.hpp +69 -0
- package/nitrogen/generated/android/c++/JHybridNitroImagePipelineSpec.cpp +6 -0
- package/nitrogen/generated/android/c++/JOptions.hpp +9 -5
- package/nitrogen/generated/android/c++/JVariant_Double_CornerRadii.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_Double_CornerRadii.hpp +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/CornerRadii.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/Options.kt +2 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/Variant_Double_CornerRadii.kt +62 -0
- package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Bridge.hpp +48 -0
- package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Umbrella.hpp +4 -0
- package/nitrogen/generated/ios/c++/HybridNitroImagePipelineSpecSwift.hpp +4 -0
- package/nitrogen/generated/ios/swift/CornerRadii.swift +96 -0
- package/nitrogen/generated/ios/swift/Options.swift +27 -8
- package/nitrogen/generated/ios/swift/Variant_Double_CornerRadii.swift +30 -0
- package/nitrogen/generated/shared/c++/CornerRadii.hpp +95 -0
- package/nitrogen/generated/shared/c++/Options.hpp +9 -5
- package/package.json +1 -1
- package/src/index.ts +33 -4
- package/src/specs/nitro-image-toolkit.nitro.ts +20 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CornerRadii.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.nitroimagepipeline
|
|
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 "CornerRadii".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class CornerRadii(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val topLeft: Double?,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val topRight: Double?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val bottomLeft: Double?,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val bottomRight: Double?
|
|
33
|
+
) {
|
|
34
|
+
/* primary constructor */
|
|
35
|
+
|
|
36
|
+
override fun equals(other: Any?): Boolean {
|
|
37
|
+
if (this === other) return true
|
|
38
|
+
if (other !is CornerRadii) return false
|
|
39
|
+
return Objects.deepEquals(this.topLeft, other.topLeft)
|
|
40
|
+
&& Objects.deepEquals(this.topRight, other.topRight)
|
|
41
|
+
&& Objects.deepEquals(this.bottomLeft, other.bottomLeft)
|
|
42
|
+
&& Objects.deepEquals(this.bottomRight, other.bottomRight)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
override fun hashCode(): Int {
|
|
46
|
+
return arrayOf<Any?>(
|
|
47
|
+
topLeft,
|
|
48
|
+
topRight,
|
|
49
|
+
bottomLeft,
|
|
50
|
+
bottomRight
|
|
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(topLeft: Double?, topRight: Double?, bottomLeft: Double?, bottomRight: Double?): CornerRadii {
|
|
63
|
+
return CornerRadii(topLeft, topRight, bottomLeft, bottomRight)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -26,7 +26,7 @@ data class Options(
|
|
|
26
26
|
val cache: CacheOption?,
|
|
27
27
|
@DoNotStrip
|
|
28
28
|
@Keep
|
|
29
|
-
val cornerRadius:
|
|
29
|
+
val cornerRadius: Variant_Double_CornerRadii?
|
|
30
30
|
) {
|
|
31
31
|
/* primary constructor */
|
|
32
32
|
|
|
@@ -54,7 +54,7 @@ data class Options(
|
|
|
54
54
|
@Keep
|
|
55
55
|
@Suppress("unused")
|
|
56
56
|
@JvmStatic
|
|
57
|
-
private fun fromCpp(blur: Double?, cache: CacheOption?, cornerRadius:
|
|
57
|
+
private fun fromCpp(blur: Double?, cache: CacheOption?, cornerRadius: Variant_Double_CornerRadii?): Options {
|
|
58
58
|
return Options(blur, cache, cornerRadius)
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_Double_CornerRadii.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.nitroimagepipeline
|
|
9
|
+
|
|
10
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the TypeScript variant "Double | CornerRadii".
|
|
15
|
+
*/
|
|
16
|
+
@Suppress("ClassName")
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
sealed class Variant_Double_CornerRadii {
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
data class First(@DoNotStrip val value: Double): Variant_Double_CornerRadii()
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
data class Second(@DoNotStrip val value: CornerRadii): Variant_Double_CornerRadii()
|
|
23
|
+
|
|
24
|
+
inline fun <reified T> asType(): T? {
|
|
25
|
+
return when (this) {
|
|
26
|
+
is First -> (value) as? T
|
|
27
|
+
is Second -> (value) as? T
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
inline fun <reified T> isType(): Boolean {
|
|
31
|
+
return asType<T>() != null
|
|
32
|
+
}
|
|
33
|
+
inline fun <R> match(first: (Double) -> R, second: (CornerRadii) -> R): R {
|
|
34
|
+
return when (this) {
|
|
35
|
+
is First -> first(value)
|
|
36
|
+
is Second -> second(value)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
val isFirst: Boolean
|
|
41
|
+
get() = this is First
|
|
42
|
+
val isSecond: Boolean
|
|
43
|
+
get() = this is Second
|
|
44
|
+
|
|
45
|
+
fun asFirstOrNull(): Double? {
|
|
46
|
+
val value = (this as? First)?.value ?: return null
|
|
47
|
+
return value
|
|
48
|
+
}
|
|
49
|
+
fun asSecondOrNull(): CornerRadii? {
|
|
50
|
+
val value = (this as? Second)?.value ?: return null
|
|
51
|
+
return value
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
@JvmStatic
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
fun create(value: Double): Variant_Double_CornerRadii = First(value)
|
|
58
|
+
@JvmStatic
|
|
59
|
+
@DoNotStrip
|
|
60
|
+
fun create(value: CornerRadii): Variant_Double_CornerRadii = Second(value)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
11
|
// Forward declaration of `CacheOption` to properly resolve imports.
|
|
12
12
|
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
13
|
+
// Forward declaration of `CornerRadii` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
13
15
|
// Forward declaration of `HybridImageSpec` to properly resolve imports.
|
|
14
16
|
namespace margelo::nitro::image { class HybridImageSpec; }
|
|
15
17
|
// Forward declaration of `HybridNitroImagePipelineSpec` to properly resolve imports.
|
|
@@ -25,6 +27,7 @@ namespace NitroImagePipeline { class HybridNitroImagePipelineSpec_cxx; }
|
|
|
25
27
|
|
|
26
28
|
// Include C++ defined types
|
|
27
29
|
#include "CacheOption.hpp"
|
|
30
|
+
#include "CornerRadii.hpp"
|
|
28
31
|
#include "HybridNitroImagePipelineSpec.hpp"
|
|
29
32
|
#include "Options.hpp"
|
|
30
33
|
#include <NitroImage/HybridImageSpec.hpp>
|
|
@@ -36,6 +39,7 @@ namespace NitroImagePipeline { class HybridNitroImagePipelineSpec_cxx; }
|
|
|
36
39
|
#include <memory>
|
|
37
40
|
#include <optional>
|
|
38
41
|
#include <string>
|
|
42
|
+
#include <variant>
|
|
39
43
|
#include <vector>
|
|
40
44
|
|
|
41
45
|
/**
|
|
@@ -142,6 +146,50 @@ namespace margelo::nitro::nitroimagepipeline::bridge::swift {
|
|
|
142
146
|
return optional.value();
|
|
143
147
|
}
|
|
144
148
|
|
|
149
|
+
// pragma MARK: std::variant<double, CornerRadii>
|
|
150
|
+
/**
|
|
151
|
+
* Wrapper struct for `std::variant<double, CornerRadii>`.
|
|
152
|
+
* std::variant cannot be used in Swift because of a Swift bug.
|
|
153
|
+
* Not even specializing it works. So we create a wrapper struct.
|
|
154
|
+
*/
|
|
155
|
+
struct std__variant_double__CornerRadii_ final {
|
|
156
|
+
std::variant<double, CornerRadii> variant;
|
|
157
|
+
std__variant_double__CornerRadii_(std::variant<double, CornerRadii> variant): variant(variant) { }
|
|
158
|
+
operator std::variant<double, CornerRadii>() const noexcept {
|
|
159
|
+
return variant;
|
|
160
|
+
}
|
|
161
|
+
inline size_t index() const noexcept {
|
|
162
|
+
return variant.index();
|
|
163
|
+
}
|
|
164
|
+
inline double get_0() const noexcept {
|
|
165
|
+
return std::get<0>(variant);
|
|
166
|
+
}
|
|
167
|
+
inline CornerRadii get_1() const noexcept {
|
|
168
|
+
return std::get<1>(variant);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
inline std__variant_double__CornerRadii_ create_std__variant_double__CornerRadii_(double value) noexcept {
|
|
172
|
+
return std__variant_double__CornerRadii_(value);
|
|
173
|
+
}
|
|
174
|
+
inline std__variant_double__CornerRadii_ create_std__variant_double__CornerRadii_(const CornerRadii& value) noexcept {
|
|
175
|
+
return std__variant_double__CornerRadii_(value);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// pragma MARK: std::optional<std::variant<double, CornerRadii>>
|
|
179
|
+
/**
|
|
180
|
+
* Specialized version of `std::optional<std::variant<double, CornerRadii>>`.
|
|
181
|
+
*/
|
|
182
|
+
using std__optional_std__variant_double__CornerRadii__ = std::optional<std::variant<double, CornerRadii>>;
|
|
183
|
+
inline std::optional<std::variant<double, CornerRadii>> create_std__optional_std__variant_double__CornerRadii__(const std::variant<double, CornerRadii>& value) noexcept {
|
|
184
|
+
return std::optional<std::variant<double, CornerRadii>>(value);
|
|
185
|
+
}
|
|
186
|
+
inline bool has_value_std__optional_std__variant_double__CornerRadii__(const std::optional<std::variant<double, CornerRadii>>& optional) noexcept {
|
|
187
|
+
return optional.has_value();
|
|
188
|
+
}
|
|
189
|
+
inline std::variant<double, CornerRadii> get_std__optional_std__variant_double__CornerRadii__(const std::optional<std::variant<double, CornerRadii>>& optional) noexcept {
|
|
190
|
+
return optional.value();
|
|
191
|
+
}
|
|
192
|
+
|
|
145
193
|
// pragma MARK: std::optional<Options>
|
|
146
194
|
/**
|
|
147
195
|
* Specialized version of `std::optional<Options>`.
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
11
|
// Forward declaration of `CacheOption` to properly resolve imports.
|
|
12
12
|
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
13
|
+
// Forward declaration of `CornerRadii` to properly resolve imports.
|
|
14
|
+
namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
13
15
|
// Forward declaration of `HybridImageSpec` to properly resolve imports.
|
|
14
16
|
namespace margelo::nitro::image { class HybridImageSpec; }
|
|
15
17
|
// Forward declaration of `HybridNitroImagePipelineSpec` to properly resolve imports.
|
|
@@ -19,6 +21,7 @@ namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
|
19
21
|
|
|
20
22
|
// Include C++ defined types
|
|
21
23
|
#include "CacheOption.hpp"
|
|
24
|
+
#include "CornerRadii.hpp"
|
|
22
25
|
#include "HybridNitroImagePipelineSpec.hpp"
|
|
23
26
|
#include "Options.hpp"
|
|
24
27
|
#include <NitroImage/HybridImageSpec.hpp>
|
|
@@ -28,6 +31,7 @@ namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
|
28
31
|
#include <memory>
|
|
29
32
|
#include <optional>
|
|
30
33
|
#include <string>
|
|
34
|
+
#include <variant>
|
|
31
35
|
#include <vector>
|
|
32
36
|
|
|
33
37
|
// C++ helpers for Swift
|
|
@@ -18,6 +18,8 @@ namespace margelo::nitro::image { class HybridImageSpec; }
|
|
|
18
18
|
namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
19
19
|
// Forward declaration of `CacheOption` to properly resolve imports.
|
|
20
20
|
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
21
|
+
// Forward declaration of `CornerRadii` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
21
23
|
|
|
22
24
|
#include <memory>
|
|
23
25
|
#include <NitroImage/HybridImageSpec.hpp>
|
|
@@ -26,6 +28,8 @@ namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
|
26
28
|
#include "Options.hpp"
|
|
27
29
|
#include <optional>
|
|
28
30
|
#include "CacheOption.hpp"
|
|
31
|
+
#include "CornerRadii.hpp"
|
|
32
|
+
#include <variant>
|
|
29
33
|
#include <vector>
|
|
30
34
|
|
|
31
35
|
#include "NitroImagePipeline-Swift-Cxx-Umbrella.hpp"
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CornerRadii.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `CornerRadii`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias CornerRadii = margelo.nitro.nitroimagepipeline.CornerRadii
|
|
14
|
+
|
|
15
|
+
public extension CornerRadii {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitroimagepipeline.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `CornerRadii`.
|
|
20
|
+
*/
|
|
21
|
+
init(topLeft: Double?, topRight: Double?, bottomLeft: Double?, bottomRight: Double?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_double_ in
|
|
23
|
+
if let __unwrappedValue = topLeft {
|
|
24
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
29
|
+
if let __unwrappedValue = topRight {
|
|
30
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
35
|
+
if let __unwrappedValue = bottomLeft {
|
|
36
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
41
|
+
if let __unwrappedValue = bottomRight {
|
|
42
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
46
|
+
}())
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@inline(__always)
|
|
50
|
+
var topLeft: Double? {
|
|
51
|
+
return { () -> Double? in
|
|
52
|
+
if bridge.has_value_std__optional_double_(self.__topLeft) {
|
|
53
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__topLeft)
|
|
54
|
+
return __unwrapped
|
|
55
|
+
} else {
|
|
56
|
+
return nil
|
|
57
|
+
}
|
|
58
|
+
}()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@inline(__always)
|
|
62
|
+
var topRight: Double? {
|
|
63
|
+
return { () -> Double? in
|
|
64
|
+
if bridge.has_value_std__optional_double_(self.__topRight) {
|
|
65
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__topRight)
|
|
66
|
+
return __unwrapped
|
|
67
|
+
} else {
|
|
68
|
+
return nil
|
|
69
|
+
}
|
|
70
|
+
}()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@inline(__always)
|
|
74
|
+
var bottomLeft: Double? {
|
|
75
|
+
return { () -> Double? in
|
|
76
|
+
if bridge.has_value_std__optional_double_(self.__bottomLeft) {
|
|
77
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__bottomLeft)
|
|
78
|
+
return __unwrapped
|
|
79
|
+
} else {
|
|
80
|
+
return nil
|
|
81
|
+
}
|
|
82
|
+
}()
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@inline(__always)
|
|
86
|
+
var bottomRight: Double? {
|
|
87
|
+
return { () -> Double? in
|
|
88
|
+
if bridge.has_value_std__optional_double_(self.__bottomRight) {
|
|
89
|
+
let __unwrapped = bridge.get_std__optional_double_(self.__bottomRight)
|
|
90
|
+
return __unwrapped
|
|
91
|
+
} else {
|
|
92
|
+
return nil
|
|
93
|
+
}
|
|
94
|
+
}()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -18,7 +18,7 @@ public extension Options {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `Options`.
|
|
20
20
|
*/
|
|
21
|
-
init(blur: Double?, cache: CacheOption?, cornerRadius:
|
|
21
|
+
init(blur: Double?, cache: CacheOption?, cornerRadius: Variant_Double_CornerRadii?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_double_ in
|
|
23
23
|
if let __unwrappedValue = blur {
|
|
24
24
|
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
@@ -31,9 +31,16 @@ public extension Options {
|
|
|
31
31
|
} else {
|
|
32
32
|
return .init()
|
|
33
33
|
}
|
|
34
|
-
}(), { () -> bridge.
|
|
34
|
+
}(), { () -> bridge.std__optional_std__variant_double__CornerRadii__ in
|
|
35
35
|
if let __unwrappedValue = cornerRadius {
|
|
36
|
-
return bridge.
|
|
36
|
+
return bridge.create_std__optional_std__variant_double__CornerRadii__({ () -> bridge.std__variant_double__CornerRadii_ in
|
|
37
|
+
switch __unwrappedValue {
|
|
38
|
+
case .first(let __value):
|
|
39
|
+
return bridge.create_std__variant_double__CornerRadii_(__value)
|
|
40
|
+
case .second(let __value):
|
|
41
|
+
return bridge.create_std__variant_double__CornerRadii_(__value)
|
|
42
|
+
}
|
|
43
|
+
}().variant)
|
|
37
44
|
} else {
|
|
38
45
|
return .init()
|
|
39
46
|
}
|
|
@@ -58,11 +65,23 @@ public extension Options {
|
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
@inline(__always)
|
|
61
|
-
var cornerRadius:
|
|
62
|
-
return { () ->
|
|
63
|
-
if bridge.
|
|
64
|
-
let __unwrapped = bridge.
|
|
65
|
-
return
|
|
68
|
+
var cornerRadius: Variant_Double_CornerRadii? {
|
|
69
|
+
return { () -> Variant_Double_CornerRadii? in
|
|
70
|
+
if bridge.has_value_std__optional_std__variant_double__CornerRadii__(self.__cornerRadius) {
|
|
71
|
+
let __unwrapped = bridge.get_std__optional_std__variant_double__CornerRadii__(self.__cornerRadius)
|
|
72
|
+
return { () -> Variant_Double_CornerRadii in
|
|
73
|
+
let __variant = bridge.std__variant_double__CornerRadii_(__unwrapped)
|
|
74
|
+
switch __variant.index() {
|
|
75
|
+
case 0:
|
|
76
|
+
let __actual = __variant.get_0()
|
|
77
|
+
return .first(__actual)
|
|
78
|
+
case 1:
|
|
79
|
+
let __actual = __variant.get_1()
|
|
80
|
+
return .second(__actual)
|
|
81
|
+
default:
|
|
82
|
+
fatalError("Variant can never have index \(__variant.index())!")
|
|
83
|
+
}
|
|
84
|
+
}()
|
|
66
85
|
} else {
|
|
67
86
|
return nil
|
|
68
87
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_Double_CornerRadii.swift
|
|
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
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `number | struct`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public indirect enum Variant_Double_CornerRadii {
|
|
16
|
+
case first(Double)
|
|
17
|
+
case second(CornerRadii)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public extension Variant_Double_CornerRadii {
|
|
21
|
+
func asType<T>(_ type: T.Type = T.self) -> T? {
|
|
22
|
+
switch self {
|
|
23
|
+
case .first(let value): return value as? T
|
|
24
|
+
case .second(let value): return value as? T
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
func isType<T>(_ type: T.Type = T.self) -> Bool {
|
|
28
|
+
return self.asType(type) != nil
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CornerRadii.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <optional>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (CornerRadii).
|
|
39
|
+
*/
|
|
40
|
+
struct CornerRadii final {
|
|
41
|
+
public:
|
|
42
|
+
std::optional<double> topLeft SWIFT_PRIVATE;
|
|
43
|
+
std::optional<double> topRight SWIFT_PRIVATE;
|
|
44
|
+
std::optional<double> bottomLeft SWIFT_PRIVATE;
|
|
45
|
+
std::optional<double> bottomRight SWIFT_PRIVATE;
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
CornerRadii() = default;
|
|
49
|
+
explicit CornerRadii(std::optional<double> topLeft, std::optional<double> topRight, std::optional<double> bottomLeft, std::optional<double> bottomRight): topLeft(topLeft), topRight(topRight), bottomLeft(bottomLeft), bottomRight(bottomRight) {}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
friend bool operator==(const CornerRadii& lhs, const CornerRadii& rhs) = default;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
56
|
+
|
|
57
|
+
namespace margelo::nitro {
|
|
58
|
+
|
|
59
|
+
// C++ CornerRadii <> JS CornerRadii (object)
|
|
60
|
+
template <>
|
|
61
|
+
struct JSIConverter<margelo::nitro::nitroimagepipeline::CornerRadii> final {
|
|
62
|
+
static inline margelo::nitro::nitroimagepipeline::CornerRadii fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
63
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
64
|
+
return margelo::nitro::nitroimagepipeline::CornerRadii(
|
|
65
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topLeft"))),
|
|
66
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topRight"))),
|
|
67
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottomLeft"))),
|
|
68
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottomRight")))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroimagepipeline::CornerRadii& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "topLeft"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.topLeft));
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "topRight"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.topRight));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "bottomLeft"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.bottomLeft));
|
|
76
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "bottomRight"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.bottomRight));
|
|
77
|
+
return obj;
|
|
78
|
+
}
|
|
79
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
80
|
+
if (!value.isObject()) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
jsi::Object obj = value.getObject(runtime);
|
|
84
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topLeft")))) return false;
|
|
88
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "topRight")))) return false;
|
|
89
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottomLeft")))) return false;
|
|
90
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "bottomRight")))) return false;
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
} // namespace margelo::nitro
|
|
@@ -30,9 +30,13 @@
|
|
|
30
30
|
|
|
31
31
|
// Forward declaration of `CacheOption` to properly resolve imports.
|
|
32
32
|
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
33
|
+
// Forward declaration of `CornerRadii` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
33
35
|
|
|
34
36
|
#include <optional>
|
|
35
37
|
#include "CacheOption.hpp"
|
|
38
|
+
#include "CornerRadii.hpp"
|
|
39
|
+
#include <variant>
|
|
36
40
|
|
|
37
41
|
namespace margelo::nitro::nitroimagepipeline {
|
|
38
42
|
|
|
@@ -43,11 +47,11 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
43
47
|
public:
|
|
44
48
|
std::optional<double> blur SWIFT_PRIVATE;
|
|
45
49
|
std::optional<CacheOption> cache SWIFT_PRIVATE;
|
|
46
|
-
std::optional<double
|
|
50
|
+
std::optional<std::variant<double, CornerRadii>> cornerRadius SWIFT_PRIVATE;
|
|
47
51
|
|
|
48
52
|
public:
|
|
49
53
|
Options() = default;
|
|
50
|
-
explicit Options(std::optional<double> blur, std::optional<CacheOption> cache, std::optional<double
|
|
54
|
+
explicit Options(std::optional<double> blur, std::optional<CacheOption> cache, std::optional<std::variant<double, CornerRadii>> cornerRadius): blur(blur), cache(cache), cornerRadius(cornerRadius) {}
|
|
51
55
|
|
|
52
56
|
public:
|
|
53
57
|
friend bool operator==(const Options& lhs, const Options& rhs) = default;
|
|
@@ -65,14 +69,14 @@ namespace margelo::nitro {
|
|
|
65
69
|
return margelo::nitro::nitroimagepipeline::Options(
|
|
66
70
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "blur"))),
|
|
67
71
|
JSIConverter<std::optional<margelo::nitro::nitroimagepipeline::CacheOption>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cache"))),
|
|
68
|
-
JSIConverter<std::optional<double
|
|
72
|
+
JSIConverter<std::optional<std::variant<double, margelo::nitro::nitroimagepipeline::CornerRadii>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cornerRadius")))
|
|
69
73
|
);
|
|
70
74
|
}
|
|
71
75
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroimagepipeline::Options& arg) {
|
|
72
76
|
jsi::Object obj(runtime);
|
|
73
77
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "blur"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.blur));
|
|
74
78
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cache"), JSIConverter<std::optional<margelo::nitro::nitroimagepipeline::CacheOption>>::toJSI(runtime, arg.cache));
|
|
75
|
-
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cornerRadius"), JSIConverter<std::optional<double
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cornerRadius"), JSIConverter<std::optional<std::variant<double, margelo::nitro::nitroimagepipeline::CornerRadii>>>::toJSI(runtime, arg.cornerRadius));
|
|
76
80
|
return obj;
|
|
77
81
|
}
|
|
78
82
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -85,7 +89,7 @@ namespace margelo::nitro {
|
|
|
85
89
|
}
|
|
86
90
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "blur")))) return false;
|
|
87
91
|
if (!JSIConverter<std::optional<margelo::nitro::nitroimagepipeline::CacheOption>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cache")))) return false;
|
|
88
|
-
if (!JSIConverter<std::optional<double
|
|
92
|
+
if (!JSIConverter<std::optional<std::variant<double, margelo::nitro::nitroimagepipeline::CornerRadii>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cornerRadius")))) return false;
|
|
89
93
|
return true;
|
|
90
94
|
}
|
|
91
95
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nitro-image-pipeline",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "High-performance image loading, caching, and processing for React Native, built with Nitro Modules",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|