react-native-nitro-image-pipeline 1.5.0 → 1.7.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 +142 -18
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/HybridNitroImagePipeline.kt +72 -16
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/PipelineImageLoader.kt +47 -8
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/transform/FitGeometry.kt +104 -0
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/transform/PipelineRoundedCornersTransformation.kt +103 -0
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/transform/ResizeTransformation.kt +69 -16
- package/ios/FitResizeProcessor.swift +127 -0
- package/ios/HybridNitroImagePipeline.swift +88 -24
- package/ios/PipelineImageLoader.swift +108 -18
- package/lib/commonjs/NativePipelineImage.js +20 -4
- package/lib/commonjs/NativePipelineImage.js.map +1 -1
- package/lib/commonjs/PipelineImage.js +13 -1
- package/lib/commonjs/PipelineImage.js.map +1 -1
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/resizeForStyle.js +3 -1
- package/lib/commonjs/resizeForStyle.js.map +1 -1
- package/lib/commonjs/resolveImageSource.js +89 -0
- package/lib/commonjs/resolveImageSource.js.map +1 -0
- package/lib/commonjs/useImage.js +14 -6
- package/lib/commonjs/useImage.js.map +1 -1
- package/lib/commonjs/usePipelineImageLoader.js +114 -11
- package/lib/commonjs/usePipelineImageLoader.js.map +1 -1
- package/lib/module/NativePipelineImage.js +20 -4
- package/lib/module/NativePipelineImage.js.map +1 -1
- package/lib/module/PipelineImage.js +13 -1
- package/lib/module/PipelineImage.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/resizeForStyle.js +3 -1
- package/lib/module/resizeForStyle.js.map +1 -1
- package/lib/module/resolveImageSource.js +83 -0
- package/lib/module/resolveImageSource.js.map +1 -0
- package/lib/module/useImage.js +14 -6
- package/lib/module/useImage.js.map +1 -1
- package/lib/module/usePipelineImageLoader.js +115 -12
- package/lib/module/usePipelineImageLoader.js.map +1 -1
- package/lib/typescript/src/NativePipelineImage.d.ts +51 -5
- package/lib/typescript/src/NativePipelineImage.d.ts.map +1 -1
- package/lib/typescript/src/PipelineImage.d.ts +35 -3
- package/lib/typescript/src/PipelineImage.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/resizeForStyle.d.ts +3 -1
- package/lib/typescript/src/resizeForStyle.d.ts.map +1 -1
- package/lib/typescript/src/resolveImageSource.d.ts +56 -0
- package/lib/typescript/src/resolveImageSource.d.ts.map +1 -0
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts +95 -8
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts.map +1 -1
- package/lib/typescript/src/useImage.d.ts +13 -6
- package/lib/typescript/src/useImage.d.ts.map +1 -1
- package/lib/typescript/src/usePipelineImageLoader.d.ts +7 -3
- package/lib/typescript/src/usePipelineImageLoader.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroImagePipelineOnLoad.cpp +4 -0
- package/nitrogen/generated/android/c++/JFunc_void_double_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridNitroImagePipelineSpec.cpp +8 -0
- package/nitrogen/generated/android/c++/JOptions.hpp +2 -0
- package/nitrogen/generated/android/c++/JResizeFit.hpp +64 -0
- package/nitrogen/generated/android/c++/JResizeOptions.hpp +14 -4
- package/nitrogen/generated/android/c++/JViewOptions.hpp +42 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/Func_void_double_double.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/Func_void_std__string.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/ResizeFit.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/ResizeOptions.kt +14 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/ViewOptions.kt +29 -5
- package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Bridge.hpp +107 -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/Func_void_double_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/ResizeFit.swift +48 -0
- package/nitrogen/generated/ios/swift/ResizeOptions.swift +31 -2
- package/nitrogen/generated/ios/swift/ViewOptions.swift +82 -1
- package/nitrogen/generated/shared/c++/ResizeFit.hpp +84 -0
- package/nitrogen/generated/shared/c++/ResizeOptions.hpp +14 -4
- package/nitrogen/generated/shared/c++/ViewOptions.hpp +24 -3
- package/package.json +1 -1
- package/src/NativePipelineImage.tsx +75 -6
- package/src/PipelineImage.tsx +46 -3
- package/src/index.ts +6 -0
- package/src/resizeForStyle.ts +3 -1
- package/src/resolveImageSource.ts +83 -0
- package/src/specs/nitro-image-toolkit.nitro.ts +96 -8
- package/src/useImage.ts +38 -17
- package/src/usePipelineImageLoader.ts +126 -11
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Image } from 'react-native-nitro-image';
|
|
2
|
+
import { type ImageSource } from './resolveImageSource';
|
|
2
3
|
import type { CacheOption, CornerRadii, ResizeOptions } from './specs/nitro-image-toolkit.nitro';
|
|
3
4
|
type Result = {
|
|
4
5
|
image: undefined;
|
|
@@ -11,15 +12,20 @@ type Result = {
|
|
|
11
12
|
error: Error;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
|
-
* A hook to asynchronously load an image from the
|
|
15
|
-
*
|
|
15
|
+
* A hook to asynchronously load an image from `url` through the pipeline
|
|
16
|
+
* into memory.
|
|
16
17
|
* @example
|
|
17
18
|
* ```ts
|
|
18
|
-
* const { image, error } = useImage({
|
|
19
|
+
* const { image, error } = useImage({ url: 'https://example.com/photo.jpg' });
|
|
20
|
+
* const { image: logo } = useImage({ url: require('./logo.png') });
|
|
19
21
|
* ```
|
|
20
22
|
*/
|
|
21
23
|
export declare function useImage({ url, blur, cornerRadius, resize, cache, enabled, }: {
|
|
22
|
-
|
|
24
|
+
/**
|
|
25
|
+
* The image to load: a URL string (`https://`, `file://`, an absolute path)
|
|
26
|
+
* or a `require()`d asset — see {@linkcode ImageSource}.
|
|
27
|
+
*/
|
|
28
|
+
url: ImageSource;
|
|
23
29
|
/**
|
|
24
30
|
* Gaussian blur strength, as the standard deviation (sigma) of the blur in
|
|
25
31
|
* source-image pixels (of the resized bitmap when `resize` is set). Matches
|
|
@@ -34,8 +40,9 @@ export declare function useImage({ url, blur, cornerRadius, resize, cache, enabl
|
|
|
34
40
|
*/
|
|
35
41
|
cornerRadius?: number | CornerRadii;
|
|
36
42
|
/**
|
|
37
|
-
* Resize the bitmap
|
|
38
|
-
* center-crop
|
|
43
|
+
* Resize the bitmap into this box in pixels before blur/rounding —
|
|
44
|
+
* aspect-fill + center-crop by default, or another `fit` (see
|
|
45
|
+
* {@linkcode ResizeOptions}). Typically your display size in points
|
|
39
46
|
* multiplied by `PixelRatio.get()`. Inline object literals are fine.
|
|
40
47
|
*/
|
|
41
48
|
resize?: ResizeOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useImage.d.ts","sourceRoot":"","sources":["../../../src/useImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACd,MAAM,mCAAmC,CAAC;AAE3C,KAAK,MAAM,GAEP;IACE,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;CAClB,GAED;IACE,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;CAClB,GAED;IACE,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEN
|
|
1
|
+
{"version":3,"file":"useImage.d.ts","sourceRoot":"","sources":["../../../src/useImage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,sBAAsB,CAAC;AACzE,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,aAAa,EACd,MAAM,mCAAmC,CAAC;AAE3C,KAAK,MAAM,GAEP;IACE,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;CAClB,GAED;IACE,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;CAClB,GAED;IACE,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEN;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,IAAQ,EACR,YAAgB,EAChB,MAAM,EACN,KAAK,EACL,OAAc,GACf,EAAE;IACD;;;OAGG;IACH,GAAG,EAAE,WAAW,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACpC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,MAAM,CA0FT"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ImageLoader } from 'react-native-nitro-image';
|
|
2
|
+
import { type ImageSource } from './resolveImageSource';
|
|
2
3
|
import type { ViewOptions } from './specs/nitro-image-toolkit.nitro';
|
|
3
4
|
/**
|
|
4
|
-
* Creates (and memoizes) an {@linkcode ImageLoader} for `
|
|
5
|
+
* Creates (and memoizes) an {@linkcode ImageLoader} for `source` — a URL
|
|
6
|
+
* string or a `require()`d asset, see {@linkcode ImageSource} — to pass to
|
|
5
7
|
* `<NativeNitroImage image={...} />`. The view drives it entirely natively:
|
|
6
8
|
* the request starts when the view attaches — at the view's laid-out size,
|
|
7
9
|
* with no JS round trips — and is cancelled when it detaches. See
|
|
@@ -9,7 +11,9 @@ import type { ViewOptions } from './specs/nitro-image-toolkit.nitro';
|
|
|
9
11
|
*
|
|
10
12
|
* `blur`/`cornerRadius` are in **points** (unlike `useImage`, where they are
|
|
11
13
|
* bitmap pixels); the screen scale is applied natively. Inline object
|
|
12
|
-
* literals are fine — options are compared by value, not identity
|
|
14
|
+
* literals are fine — options are compared by value, not identity, and the
|
|
15
|
+
* `onLoad`/`onError` callbacks are read through a ref, so inline arrows don't
|
|
16
|
+
* recreate the loader either.
|
|
13
17
|
*/
|
|
14
|
-
export declare function usePipelineImageLoader(
|
|
18
|
+
export declare function usePipelineImageLoader(source: ImageSource, options?: ViewOptions): ImageLoader;
|
|
15
19
|
//# sourceMappingURL=usePipelineImageLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePipelineImageLoader.d.ts","sourceRoot":"","sources":["../../../src/usePipelineImageLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,KAAK,EAEV,WAAW,EACZ,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"usePipelineImageLoader.d.ts","sourceRoot":"","sources":["../../../src/usePipelineImageLoader.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EACL,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAEV,WAAW,EACZ,MAAM,mCAAmC,CAAC;AAkC3C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,WAAW,EACnB,OAAO,CAAC,EAAE,WAAW,GACpB,WAAW,CAsIb"}
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
18
|
#include "JHybridNitroImagePipelineSpec.hpp"
|
|
19
|
+
#include "JFunc_void_double_double.hpp"
|
|
20
|
+
#include "JFunc_void_std__string.hpp"
|
|
19
21
|
#include <NitroModules/DefaultConstructableObject.hpp>
|
|
20
22
|
|
|
21
23
|
namespace margelo::nitro::nitroimagepipeline {
|
|
@@ -41,6 +43,8 @@ void registerAllNatives() {
|
|
|
41
43
|
|
|
42
44
|
// Register native JNI methods
|
|
43
45
|
margelo::nitro::nitroimagepipeline::JHybridNitroImagePipelineSpec::CxxPart::registerNatives();
|
|
46
|
+
margelo::nitro::nitroimagepipeline::JFunc_void_double_double_cxx::registerNatives();
|
|
47
|
+
margelo::nitro::nitroimagepipeline::JFunc_void_std__string_cxx::registerNatives();
|
|
44
48
|
|
|
45
49
|
// Register Nitro Hybrid Objects
|
|
46
50
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_double_double.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 <functional>
|
|
12
|
+
|
|
13
|
+
#include <functional>
|
|
14
|
+
#include <NitroModules/JNICallable.hpp>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Represents the Java/Kotlin callback `(width: Double, height: Double) -> Unit`.
|
|
22
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
23
|
+
*/
|
|
24
|
+
struct JFunc_void_double_double: public jni::JavaClass<JFunc_void_double_double> {
|
|
25
|
+
public:
|
|
26
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/Func_void_double_double;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Invokes the function this `JFunc_void_double_double` instance holds through JNI.
|
|
31
|
+
*/
|
|
32
|
+
void invoke(double width, double height) const {
|
|
33
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* width */, double /* height */)>("invoke");
|
|
34
|
+
method(self(), width, height);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An implementation of Func_void_double_double that is backed by a C++ implementation (using `std::function<...>`)
|
|
40
|
+
*/
|
|
41
|
+
class JFunc_void_double_double_cxx final: public jni::HybridClass<JFunc_void_double_double_cxx, JFunc_void_double_double> {
|
|
42
|
+
public:
|
|
43
|
+
static jni::local_ref<JFunc_void_double_double::javaobject> fromCpp(const std::function<void(double /* width */, double /* height */)>& func) {
|
|
44
|
+
return JFunc_void_double_double_cxx::newObjectCxxArgs(func);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
/**
|
|
49
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_double_double_cxx` instance holds.
|
|
50
|
+
*/
|
|
51
|
+
void invoke_cxx(double width, double height) {
|
|
52
|
+
_func(width, height);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
[[nodiscard]]
|
|
57
|
+
inline const std::function<void(double /* width */, double /* height */)>& getFunction() const {
|
|
58
|
+
return _func;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/Func_void_double_double_cxx;";
|
|
63
|
+
static void registerNatives() {
|
|
64
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_double_double_cxx::invoke_cxx)});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private:
|
|
68
|
+
explicit JFunc_void_double_double_cxx(const std::function<void(double /* width */, double /* height */)>& func): _func(func) { }
|
|
69
|
+
|
|
70
|
+
private:
|
|
71
|
+
friend HybridBase;
|
|
72
|
+
std::function<void(double /* width */, double /* height */)> _func;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__string.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 <functional>
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the Java/Kotlin callback `(message: String) -> Unit`.
|
|
23
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
24
|
+
*/
|
|
25
|
+
struct JFunc_void_std__string: public jni::JavaClass<JFunc_void_std__string> {
|
|
26
|
+
public:
|
|
27
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/Func_void_std__string;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Invokes the function this `JFunc_void_std__string` instance holds through JNI.
|
|
32
|
+
*/
|
|
33
|
+
void invoke(const std::string& message) const {
|
|
34
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* message */)>("invoke");
|
|
35
|
+
method(self(), jni::make_jstring(message));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An implementation of Func_void_std__string that is backed by a C++ implementation (using `std::function<...>`)
|
|
41
|
+
*/
|
|
42
|
+
class JFunc_void_std__string_cxx final: public jni::HybridClass<JFunc_void_std__string_cxx, JFunc_void_std__string> {
|
|
43
|
+
public:
|
|
44
|
+
static jni::local_ref<JFunc_void_std__string::javaobject> fromCpp(const std::function<void(const std::string& /* message */)>& func) {
|
|
45
|
+
return JFunc_void_std__string_cxx::newObjectCxxArgs(func);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__string_cxx` instance holds.
|
|
51
|
+
*/
|
|
52
|
+
void invoke_cxx(jni::alias_ref<jni::JString> message) {
|
|
53
|
+
_func(message->toStdString());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
[[nodiscard]]
|
|
58
|
+
inline const std::function<void(const std::string& /* message */)>& getFunction() const {
|
|
59
|
+
return _func;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/Func_void_std__string_cxx;";
|
|
64
|
+
static void registerNatives() {
|
|
65
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_cxx::invoke_cxx)});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
explicit JFunc_void_std__string_cxx(const std::function<void(const std::string& /* message */)>& func): _func(func) { }
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
friend HybridBase;
|
|
73
|
+
std::function<void(const std::string& /* message */)> _func;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
@@ -19,6 +19,8 @@ namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
|
19
19
|
namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
20
20
|
// Forward declaration of `ResizeOptions` to properly resolve imports.
|
|
21
21
|
namespace margelo::nitro::nitroimagepipeline { struct ResizeOptions; }
|
|
22
|
+
// Forward declaration of `ResizeFit` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::nitroimagepipeline { enum class ResizeFit; }
|
|
22
24
|
// Forward declaration of `ViewOptions` to properly resolve imports.
|
|
23
25
|
namespace margelo::nitro::nitroimagepipeline { struct ViewOptions; }
|
|
24
26
|
|
|
@@ -42,8 +44,14 @@ namespace margelo::nitro::nitroimagepipeline { struct ViewOptions; }
|
|
|
42
44
|
#include "JCornerRadii.hpp"
|
|
43
45
|
#include "ResizeOptions.hpp"
|
|
44
46
|
#include "JResizeOptions.hpp"
|
|
47
|
+
#include "ResizeFit.hpp"
|
|
48
|
+
#include "JResizeFit.hpp"
|
|
45
49
|
#include "ViewOptions.hpp"
|
|
46
50
|
#include "JViewOptions.hpp"
|
|
51
|
+
#include <functional>
|
|
52
|
+
#include "JFunc_void_double_double.hpp"
|
|
53
|
+
#include <NitroModules/JNICallable.hpp>
|
|
54
|
+
#include "JFunc_void_std__string.hpp"
|
|
47
55
|
#include <vector>
|
|
48
56
|
|
|
49
57
|
namespace margelo::nitro::nitroimagepipeline {
|
|
@@ -14,8 +14,10 @@
|
|
|
14
14
|
#include "CornerRadii.hpp"
|
|
15
15
|
#include "JCacheOption.hpp"
|
|
16
16
|
#include "JCornerRadii.hpp"
|
|
17
|
+
#include "JResizeFit.hpp"
|
|
17
18
|
#include "JResizeOptions.hpp"
|
|
18
19
|
#include "JVariant_Double_CornerRadii.hpp"
|
|
20
|
+
#include "ResizeFit.hpp"
|
|
19
21
|
#include "ResizeOptions.hpp"
|
|
20
22
|
#include <optional>
|
|
21
23
|
#include <variant>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JResizeFit.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 "ResizeFit.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "ResizeFit" and the Kotlin enum "ResizeFit".
|
|
19
|
+
*/
|
|
20
|
+
struct JResizeFit final: public jni::JavaClass<JResizeFit> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/ResizeFit;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum ResizeFit.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
ResizeFit 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<ResizeFit>(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<JResizeFit> fromCpp(ResizeFit value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case ResizeFit::COVER:
|
|
46
|
+
static const auto fieldCOVER = clazz->getStaticField<JResizeFit>("COVER");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldCOVER);
|
|
48
|
+
case ResizeFit::CONTAIN:
|
|
49
|
+
static const auto fieldCONTAIN = clazz->getStaticField<JResizeFit>("CONTAIN");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldCONTAIN);
|
|
51
|
+
case ResizeFit::STRETCH:
|
|
52
|
+
static const auto fieldSTRETCH = clazz->getStaticField<JResizeFit>("STRETCH");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldSTRETCH);
|
|
54
|
+
case ResizeFit::CENTER:
|
|
55
|
+
static const auto fieldCENTER = clazz->getStaticField<JResizeFit>("CENTER");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldCENTER);
|
|
57
|
+
default:
|
|
58
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
59
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
#include <fbjni/fbjni.h>
|
|
11
11
|
#include "ResizeOptions.hpp"
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
#include "JResizeFit.hpp"
|
|
14
|
+
#include "ResizeFit.hpp"
|
|
15
|
+
#include <optional>
|
|
14
16
|
|
|
15
17
|
namespace margelo::nitro::nitroimagepipeline {
|
|
16
18
|
|
|
@@ -35,9 +37,15 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
35
37
|
double width = this->getFieldValue(fieldWidth);
|
|
36
38
|
static const auto fieldHeight = clazz->getField<double>("height");
|
|
37
39
|
double height = this->getFieldValue(fieldHeight);
|
|
40
|
+
static const auto fieldFit = clazz->getField<JResizeFit>("fit");
|
|
41
|
+
jni::local_ref<JResizeFit> fit = this->getFieldValue(fieldFit);
|
|
42
|
+
static const auto fieldAllowUpscale = clazz->getField<jni::JBoolean>("allowUpscale");
|
|
43
|
+
jni::local_ref<jni::JBoolean> allowUpscale = this->getFieldValue(fieldAllowUpscale);
|
|
38
44
|
return ResizeOptions(
|
|
39
45
|
width,
|
|
40
|
-
height
|
|
46
|
+
height,
|
|
47
|
+
fit != nullptr ? std::make_optional(fit->toCpp()) : std::nullopt,
|
|
48
|
+
allowUpscale != nullptr ? std::make_optional(static_cast<bool>(allowUpscale->value())) : std::nullopt
|
|
41
49
|
);
|
|
42
50
|
}
|
|
43
51
|
|
|
@@ -47,13 +55,15 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
47
55
|
*/
|
|
48
56
|
[[maybe_unused]]
|
|
49
57
|
static jni::local_ref<JResizeOptions::javaobject> fromCpp(const ResizeOptions& value) {
|
|
50
|
-
using JSignature = JResizeOptions(double, double);
|
|
58
|
+
using JSignature = JResizeOptions(double, double, jni::alias_ref<JResizeFit>, jni::alias_ref<jni::JBoolean>);
|
|
51
59
|
static const auto clazz = javaClassStatic();
|
|
52
60
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
53
61
|
return create(
|
|
54
62
|
clazz,
|
|
55
63
|
value.width,
|
|
56
|
-
value.height
|
|
64
|
+
value.height,
|
|
65
|
+
value.fit.has_value() ? JResizeFit::fromCpp(value.fit.value()) : nullptr,
|
|
66
|
+
value.allowUpscale.has_value() ? jni::JBoolean::valueOf(value.allowUpscale.value()) : nullptr
|
|
57
67
|
);
|
|
58
68
|
}
|
|
59
69
|
};
|
|
@@ -14,10 +14,17 @@
|
|
|
14
14
|
#include "CornerRadii.hpp"
|
|
15
15
|
#include "JCacheOption.hpp"
|
|
16
16
|
#include "JCornerRadii.hpp"
|
|
17
|
+
#include "JFunc_void_double_double.hpp"
|
|
18
|
+
#include "JFunc_void_std__string.hpp"
|
|
19
|
+
#include "JResizeFit.hpp"
|
|
17
20
|
#include "JResizeOptions.hpp"
|
|
18
21
|
#include "JVariant_Double_CornerRadii.hpp"
|
|
22
|
+
#include "ResizeFit.hpp"
|
|
19
23
|
#include "ResizeOptions.hpp"
|
|
24
|
+
#include <NitroModules/JNICallable.hpp>
|
|
25
|
+
#include <functional>
|
|
20
26
|
#include <optional>
|
|
27
|
+
#include <string>
|
|
21
28
|
#include <variant>
|
|
22
29
|
|
|
23
30
|
namespace margelo::nitro::nitroimagepipeline {
|
|
@@ -47,11 +54,39 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
47
54
|
jni::local_ref<JVariant_Double_CornerRadii> cornerRadius = this->getFieldValue(fieldCornerRadius);
|
|
48
55
|
static const auto fieldResize = clazz->getField<JResizeOptions>("resize");
|
|
49
56
|
jni::local_ref<JResizeOptions> resize = this->getFieldValue(fieldResize);
|
|
57
|
+
static const auto fieldFit = clazz->getField<JResizeFit>("fit");
|
|
58
|
+
jni::local_ref<JResizeFit> fit = this->getFieldValue(fieldFit);
|
|
59
|
+
static const auto fieldAllowUpscale = clazz->getField<jni::JBoolean>("allowUpscale");
|
|
60
|
+
jni::local_ref<jni::JBoolean> allowUpscale = this->getFieldValue(fieldAllowUpscale);
|
|
61
|
+
static const auto fieldOnLoad = clazz->getField<JFunc_void_double_double::javaobject>("onLoad");
|
|
62
|
+
jni::local_ref<JFunc_void_double_double::javaobject> onLoad = this->getFieldValue(fieldOnLoad);
|
|
63
|
+
static const auto fieldOnError = clazz->getField<JFunc_void_std__string::javaobject>("onError");
|
|
64
|
+
jni::local_ref<JFunc_void_std__string::javaobject> onError = this->getFieldValue(fieldOnError);
|
|
50
65
|
return ViewOptions(
|
|
51
66
|
blur != nullptr ? std::make_optional(blur->value()) : std::nullopt,
|
|
52
67
|
cache != nullptr ? std::make_optional(cache->toCpp()) : std::nullopt,
|
|
53
68
|
cornerRadius != nullptr ? std::make_optional(cornerRadius->toCpp()) : std::nullopt,
|
|
54
|
-
resize != nullptr ? std::make_optional(resize->toCpp()) : std::nullopt
|
|
69
|
+
resize != nullptr ? std::make_optional(resize->toCpp()) : std::nullopt,
|
|
70
|
+
fit != nullptr ? std::make_optional(fit->toCpp()) : std::nullopt,
|
|
71
|
+
allowUpscale != nullptr ? std::make_optional(static_cast<bool>(allowUpscale->value())) : std::nullopt,
|
|
72
|
+
onLoad != nullptr ? std::make_optional([&]() -> std::function<void(double /* width */, double /* height */)> {
|
|
73
|
+
if (onLoad->isInstanceOf(JFunc_void_double_double_cxx::javaClassStatic())) [[likely]] {
|
|
74
|
+
auto downcast = jni::static_ref_cast<JFunc_void_double_double_cxx::javaobject>(onLoad);
|
|
75
|
+
return downcast->cthis()->getFunction();
|
|
76
|
+
} else {
|
|
77
|
+
auto onLoadRef = jni::make_global(onLoad);
|
|
78
|
+
return JNICallable<JFunc_void_double_double, void(double, double)>(std::move(onLoadRef));
|
|
79
|
+
}
|
|
80
|
+
}()) : std::nullopt,
|
|
81
|
+
onError != nullptr ? std::make_optional([&]() -> std::function<void(const std::string& /* message */)> {
|
|
82
|
+
if (onError->isInstanceOf(JFunc_void_std__string_cxx::javaClassStatic())) [[likely]] {
|
|
83
|
+
auto downcast = jni::static_ref_cast<JFunc_void_std__string_cxx::javaobject>(onError);
|
|
84
|
+
return downcast->cthis()->getFunction();
|
|
85
|
+
} else {
|
|
86
|
+
auto onErrorRef = jni::make_global(onError);
|
|
87
|
+
return JNICallable<JFunc_void_std__string, void(std::string)>(std::move(onErrorRef));
|
|
88
|
+
}
|
|
89
|
+
}()) : std::nullopt
|
|
55
90
|
);
|
|
56
91
|
}
|
|
57
92
|
|
|
@@ -61,7 +96,7 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
61
96
|
*/
|
|
62
97
|
[[maybe_unused]]
|
|
63
98
|
static jni::local_ref<JViewOptions::javaobject> fromCpp(const ViewOptions& value) {
|
|
64
|
-
using JSignature = JViewOptions(jni::alias_ref<jni::JDouble>, jni::alias_ref<JCacheOption>, jni::alias_ref<JVariant_Double_CornerRadii>, jni::alias_ref<JResizeOptions>);
|
|
99
|
+
using JSignature = JViewOptions(jni::alias_ref<jni::JDouble>, jni::alias_ref<JCacheOption>, jni::alias_ref<JVariant_Double_CornerRadii>, jni::alias_ref<JResizeOptions>, jni::alias_ref<JResizeFit>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<JFunc_void_double_double::javaobject>, jni::alias_ref<JFunc_void_std__string::javaobject>);
|
|
65
100
|
static const auto clazz = javaClassStatic();
|
|
66
101
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
67
102
|
return create(
|
|
@@ -69,7 +104,11 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
69
104
|
value.blur.has_value() ? jni::JDouble::valueOf(value.blur.value()) : nullptr,
|
|
70
105
|
value.cache.has_value() ? JCacheOption::fromCpp(value.cache.value()) : nullptr,
|
|
71
106
|
value.cornerRadius.has_value() ? JVariant_Double_CornerRadii::fromCpp(value.cornerRadius.value()) : nullptr,
|
|
72
|
-
value.resize.has_value() ? JResizeOptions::fromCpp(value.resize.value()) : nullptr
|
|
107
|
+
value.resize.has_value() ? JResizeOptions::fromCpp(value.resize.value()) : nullptr,
|
|
108
|
+
value.fit.has_value() ? JResizeFit::fromCpp(value.fit.value()) : nullptr,
|
|
109
|
+
value.allowUpscale.has_value() ? jni::JBoolean::valueOf(value.allowUpscale.value()) : nullptr,
|
|
110
|
+
value.onLoad.has_value() ? JFunc_void_double_double_cxx::fromCpp(value.onLoad.value()) : nullptr,
|
|
111
|
+
value.onError.has_value() ? JFunc_void_std__string_cxx::fromCpp(value.onError.value()) : nullptr
|
|
73
112
|
);
|
|
74
113
|
}
|
|
75
114
|
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double_double.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.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(width: number, height: number) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_double_double: (Double, Double) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(width: Double, height: Double): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(width: number, height: number) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_double_double_cxx: Func_void_double_double {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(width: Double, height: Double): Unit
|
|
59
|
+
= invoke_cxx(width,height)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(width: Double, height: Double): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(width: number, height: number) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(Double, Double) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_double_double_java(private val function: (Double, Double) -> Unit): Func_void_double_double {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(width: Double, height: Double): Unit {
|
|
76
|
+
return this.function(width, height)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string.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.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(message: string) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_std__string: (String) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(message: String): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(message: string) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_std__string_cxx: Func_void_std__string {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(message: String): Unit
|
|
59
|
+
= invoke_cxx(message)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(message: String): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(message: string) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(String) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_std__string_java(private val function: (String) -> Unit): Func_void_std__string {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(message: String): Unit {
|
|
76
|
+
return this.function(message)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ResizeFit.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
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "ResizeFit".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class ResizeFit(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
COVER(0),
|
|
20
|
+
CONTAIN(1),
|
|
21
|
+
STRETCH(2),
|
|
22
|
+
CENTER(3);
|
|
23
|
+
|
|
24
|
+
companion object
|
|
25
|
+
}
|