react-native-spiral-image 0.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/LICENSE +20 -0
- package/README.md +39 -0
- package/SpiralImage.podspec +29 -0
- package/android/CMakeLists.txt +24 -0
- package/android/build.gradle +112 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +11 -0
- package/android/src/main/java/com/margelo/nitro/spiralimage/SpiralImage.kt +10 -0
- package/android/src/main/java/com/margelo/nitro/spiralimage/SpiralImagePackage.kt +22 -0
- package/ios/SpiralImage.swift +5 -0
- package/lib/module/SpiralImage.nitro.js +4 -0
- package/lib/module/SpiralImage.nitro.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/multiply.js +6 -0
- package/lib/module/multiply.js.map +1 -0
- package/lib/module/multiply.native.js +8 -0
- package/lib/module/multiply.native.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/SpiralImage.nitro.d.ts +8 -0
- package/lib/typescript/src/SpiralImage.nitro.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/multiply.d.ts +2 -0
- package/lib/typescript/src/multiply.d.ts.map +1 -0
- package/lib/typescript/src/multiply.native.d.ts +2 -0
- package/lib/typescript/src/multiply.native.d.ts.map +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/android/c++/JHybridSpiralImageSpec.cpp +53 -0
- package/nitrogen/generated/android/c++/JHybridSpiralImageSpec.hpp +63 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/spiralimage/HybridSpiralImageSpec.kt +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/spiralimage/spiralimageOnLoad.kt +35 -0
- package/nitrogen/generated/android/spiralimage+autolinking.cmake +81 -0
- package/nitrogen/generated/android/spiralimage+autolinking.gradle +27 -0
- package/nitrogen/generated/android/spiralimageOnLoad.cpp +54 -0
- package/nitrogen/generated/android/spiralimageOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/SpiralImage+autolinking.rb +62 -0
- package/nitrogen/generated/ios/SpiralImage-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/SpiralImage-Swift-Cxx-Bridge.hpp +51 -0
- package/nitrogen/generated/ios/SpiralImage-Swift-Cxx-Umbrella.hpp +43 -0
- package/nitrogen/generated/ios/SpiralImageAutolinking.mm +33 -0
- package/nitrogen/generated/ios/SpiralImageAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridSpiralImageSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridSpiralImageSpecSwift.hpp +82 -0
- package/nitrogen/generated/ios/swift/HybridSpiralImageSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridSpiralImageSpec_cxx.swift +138 -0
- package/nitrogen/generated/shared/c++/HybridSpiralImageSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridSpiralImageSpec.hpp +62 -0
- package/package.json +184 -0
- package/src/SpiralImage.nitro.ts +8 -0
- package/src/index.tsx +1 -0
- package/src/multiply.native.tsx +9 -0
- package/src/multiply.tsx +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Spiral Team
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# react-native-spiral-image
|
|
2
|
+
|
|
3
|
+
High performance image processing library for React Native
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install react-native-spiral-image react-native-nitro-modules
|
|
10
|
+
|
|
11
|
+
> `react-native-nitro-modules` is required as this library relies on [Nitro Modules](https://nitro.margelo.com/).
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import { multiply } from 'react-native-spiral-image';
|
|
20
|
+
|
|
21
|
+
// ...
|
|
22
|
+
|
|
23
|
+
const result = multiply(3, 7);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Contributing
|
|
28
|
+
|
|
29
|
+
- [Development workflow](CONTRIBUTING.md#development-workflow)
|
|
30
|
+
- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
|
|
31
|
+
- [Code of conduct](CODE_OF_CONDUCT.md)
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
|
|
35
|
+
MIT
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "SpiralImage"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
+
s.source = { :git => "https://github.com/spiral-team-sys/react-native-spiral-image.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = [
|
|
17
|
+
"ios/**/*.{swift}",
|
|
18
|
+
"ios/**/*.{m,mm}",
|
|
19
|
+
"cpp/**/*.{hpp,cpp}",
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
s.dependency 'React-jsi'
|
|
23
|
+
s.dependency 'React-callinvoker'
|
|
24
|
+
|
|
25
|
+
load 'nitrogen/generated/ios/SpiralImage+autolinking.rb'
|
|
26
|
+
add_nitrogen_files(s)
|
|
27
|
+
|
|
28
|
+
install_modules_dependencies(s)
|
|
29
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
project(spiralimage)
|
|
2
|
+
cmake_minimum_required(VERSION 3.9.0)
|
|
3
|
+
|
|
4
|
+
set(PACKAGE_NAME spiralimage)
|
|
5
|
+
set(CMAKE_VERBOSE_MAKEFILE ON)
|
|
6
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
7
|
+
|
|
8
|
+
# Define C++ library and add all sources
|
|
9
|
+
add_library(${PACKAGE_NAME} SHARED src/main/cpp/cpp-adapter.cpp)
|
|
10
|
+
|
|
11
|
+
# Add Nitrogen specs :)
|
|
12
|
+
include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/spiralimage+autolinking.cmake)
|
|
13
|
+
|
|
14
|
+
# Set up local includes
|
|
15
|
+
include_directories("src/main/cpp" "../cpp")
|
|
16
|
+
|
|
17
|
+
find_library(LOG_LIB log)
|
|
18
|
+
|
|
19
|
+
# Link all libraries together
|
|
20
|
+
target_link_libraries(
|
|
21
|
+
${PACKAGE_NAME}
|
|
22
|
+
${LOG_LIB}
|
|
23
|
+
android # <-- Android core
|
|
24
|
+
)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
ext.SpiralImage = [
|
|
3
|
+
kotlinVersion: "2.0.21",
|
|
4
|
+
minSdkVersion: 24,
|
|
5
|
+
compileSdkVersion: 36
|
|
6
|
+
]
|
|
7
|
+
|
|
8
|
+
ext.getExtOrDefault = { prop ->
|
|
9
|
+
if (rootProject.ext.has(prop)) {
|
|
10
|
+
return rootProject.ext.get(prop)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return SpiralImage[prop]
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
repositories {
|
|
17
|
+
google()
|
|
18
|
+
mavenCentral()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
dependencies {
|
|
22
|
+
classpath "com.android.tools.build:gradle:8.7.2"
|
|
23
|
+
// noinspection DifferentKotlinGradleVersion
|
|
24
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
def reactNativeArchitectures() {
|
|
29
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
30
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
apply plugin: "com.android.library"
|
|
34
|
+
apply plugin: "kotlin-android"
|
|
35
|
+
apply from: '../nitrogen/generated/android/spiralimage+autolinking.gradle'
|
|
36
|
+
|
|
37
|
+
apply plugin: "com.facebook.react"
|
|
38
|
+
|
|
39
|
+
android {
|
|
40
|
+
namespace "com.margelo.nitro.spiralimage"
|
|
41
|
+
|
|
42
|
+
compileSdkVersion getExtOrDefault("compileSdkVersion")
|
|
43
|
+
|
|
44
|
+
defaultConfig {
|
|
45
|
+
minSdkVersion getExtOrDefault("minSdkVersion")
|
|
46
|
+
|
|
47
|
+
externalNativeBuild {
|
|
48
|
+
cmake {
|
|
49
|
+
cppFlags "-frtti -fexceptions -Wall -fstack-protector-all"
|
|
50
|
+
arguments "-DANDROID_STL=c++_shared", "-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
|
|
51
|
+
abiFilters (*reactNativeArchitectures())
|
|
52
|
+
|
|
53
|
+
buildTypes {
|
|
54
|
+
debug {
|
|
55
|
+
cppFlags "-O1 -g"
|
|
56
|
+
}
|
|
57
|
+
release {
|
|
58
|
+
cppFlags "-O2"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
externalNativeBuild {
|
|
66
|
+
cmake {
|
|
67
|
+
path "CMakeLists.txt"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
packaging {
|
|
72
|
+
resources {
|
|
73
|
+
excludes += [
|
|
74
|
+
"META-INF",
|
|
75
|
+
"META-INF/**"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
jniLibs {
|
|
80
|
+
excludes += [
|
|
81
|
+
"**/libc++_shared.so",
|
|
82
|
+
"**/libfbjni.so",
|
|
83
|
+
"**/libjsi.so",
|
|
84
|
+
"**/libfolly_json.so",
|
|
85
|
+
"**/libfolly_runtime.so",
|
|
86
|
+
"**/libglog.so",
|
|
87
|
+
"**/libhermes.so",
|
|
88
|
+
"**/libhermes-executor-debug.so",
|
|
89
|
+
"**/libhermes_executor.so",
|
|
90
|
+
"**/libreactnative.so",
|
|
91
|
+
"**/libreactnativejni.so",
|
|
92
|
+
"**/libturbomodulejsijni.so",
|
|
93
|
+
"**/libreact_nativemodule_core.so",
|
|
94
|
+
"**/libjscexecutor.so"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
buildFeatures {
|
|
100
|
+
prefab true
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
compileOptions {
|
|
104
|
+
sourceCompatibility JavaVersion.VERSION_17
|
|
105
|
+
targetCompatibility JavaVersion.VERSION_17
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
dependencies {
|
|
110
|
+
implementation "com.facebook.react:react-android"
|
|
111
|
+
implementation project(":react-native-nitro-modules")
|
|
112
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
package com.margelo.nitro.spiralimage
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
7
|
+
|
|
8
|
+
class SpiralImagePackage : BaseReactPackage() {
|
|
9
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
|
|
10
|
+
return null
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
|
|
14
|
+
return ReactModuleInfoProvider { HashMap() }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
companion object {
|
|
18
|
+
init {
|
|
19
|
+
System.loadLibrary("spiralimage")
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["SpiralImage.nitro.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["multiply"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,YAAY","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["multiply","a","b"],"sourceRoot":"../../src","sources":["multiply.tsx"],"mappings":";;AAAA,OAAO,SAASA,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAU;EACrD,OAAOD,CAAC,GAAGC,CAAC;AACd","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
const SpiralImageHybridObject = NitroModules.createHybridObject('SpiralImage');
|
|
5
|
+
export function multiply(a, b) {
|
|
6
|
+
return SpiralImageHybridObject.multiply(a, b);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=multiply.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NitroModules","SpiralImageHybridObject","createHybridObject","multiply","a","b"],"sourceRoot":"../../src","sources":["multiply.native.tsx"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAA4B;AAGzD,MAAMC,uBAAuB,GAC3BD,YAAY,CAACE,kBAAkB,CAAc,aAAa,CAAC;AAE7D,OAAO,SAASC,QAAQA,CAACC,CAAS,EAAEC,CAAS,EAAU;EACrD,OAAOJ,uBAAuB,CAACE,QAAQ,CAACC,CAAC,EAAEC,CAAC,CAAC;AAC/C","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpiralImage.nitro.d.ts","sourceRoot":"","sources":["../../../src/SpiralImage.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,WAAW,WAAY,SAAQ,YAAY,CAAC;IAChD,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;IACA,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiply.d.ts","sourceRoot":"","sources":["../../../src/multiply.tsx"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multiply.native.d.ts","sourceRoot":"","sources":["../../../src/multiply.native.tsx"],"names":[],"mappings":"AAMA,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAErD"}
|
package/nitro.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cxxNamespace": ["spiralimage"],
|
|
3
|
+
"ios": {
|
|
4
|
+
"iosModuleName": "SpiralImage"
|
|
5
|
+
},
|
|
6
|
+
"android": {
|
|
7
|
+
"androidNamespace": ["spiralimage"],
|
|
8
|
+
"androidCxxLibName": "spiralimage"
|
|
9
|
+
},
|
|
10
|
+
"autolinking": {
|
|
11
|
+
"SpiralImage": {
|
|
12
|
+
"ios": {
|
|
13
|
+
"language": "swift",
|
|
14
|
+
"implementationClassName": "SpiralImage"
|
|
15
|
+
},
|
|
16
|
+
"android": {
|
|
17
|
+
"language": "kotlin",
|
|
18
|
+
"implementationClassName": "SpiralImage"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"ignorePaths": ["node_modules"]
|
|
23
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridSpiralImageSpec.cpp
|
|
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
|
+
#include "JHybridSpiralImageSpec.hpp"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace margelo::nitro::spiralimage {
|
|
15
|
+
|
|
16
|
+
std::shared_ptr<JHybridSpiralImageSpec> JHybridSpiralImageSpec::JavaPart::getJHybridSpiralImageSpec() {
|
|
17
|
+
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
18
|
+
auto castHybridObject = std::dynamic_pointer_cast<JHybridSpiralImageSpec>(hybridObject);
|
|
19
|
+
if (castHybridObject == nullptr) [[unlikely]] {
|
|
20
|
+
throw std::runtime_error("Failed to downcast JHybridObject to JHybridSpiralImageSpec!");
|
|
21
|
+
}
|
|
22
|
+
return castHybridObject;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
jni::local_ref<JHybridSpiralImageSpec::CxxPart::jhybriddata> JHybridSpiralImageSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
26
|
+
return makeCxxInstance(jThis);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
std::shared_ptr<JHybridObject> JHybridSpiralImageSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
30
|
+
auto castJavaPart = jni::dynamic_ref_cast<JHybridSpiralImageSpec::JavaPart>(javaPart);
|
|
31
|
+
if (castJavaPart == nullptr) [[unlikely]] {
|
|
32
|
+
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridSpiralImageSpec::JavaPart!");
|
|
33
|
+
}
|
|
34
|
+
return std::make_shared<JHybridSpiralImageSpec>(castJavaPart);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
void JHybridSpiralImageSpec::CxxPart::registerNatives() {
|
|
38
|
+
registerHybrid({
|
|
39
|
+
makeNativeMethod("initHybrid", JHybridSpiralImageSpec::CxxPart::initHybrid),
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Properties
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
// Methods
|
|
47
|
+
double JHybridSpiralImageSpec::multiply(double a, double b) {
|
|
48
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<double(double /* a */, double /* b */)>("multiply");
|
|
49
|
+
auto __result = method(_javaPart, a, b);
|
|
50
|
+
return __result;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::spiralimage
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpiralImageSpec.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 <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridSpiralImageSpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::spiralimage {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridSpiralImageSpec: public virtual HybridSpiralImageSpec, public virtual JHybridObject {
|
|
22
|
+
public:
|
|
23
|
+
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/spiralimage/HybridSpiralImageSpec;";
|
|
25
|
+
std::shared_ptr<JHybridSpiralImageSpec> getJHybridSpiralImageSpec();
|
|
26
|
+
};
|
|
27
|
+
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
28
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/spiralimage/HybridSpiralImageSpec$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
|
+
};
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
explicit JHybridSpiralImageSpec(const jni::local_ref<JHybridSpiralImageSpec::JavaPart>& javaPart):
|
|
38
|
+
HybridObject(HybridSpiralImageSpec::TAG),
|
|
39
|
+
JHybridObject(javaPart),
|
|
40
|
+
_javaPart(jni::make_global(javaPart)) {}
|
|
41
|
+
~JHybridSpiralImageSpec() override {
|
|
42
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
43
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline const jni::global_ref<JHybridSpiralImageSpec::JavaPart>& getJavaPart() const noexcept {
|
|
48
|
+
return _javaPart;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
// Methods
|
|
57
|
+
double multiply(double a, double b) override;
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
jni::global_ref<JHybridSpiralImageSpec::JavaPart> _javaPart;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
} // namespace margelo::nitro::spiralimage
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/spiralimage/HybridSpiralImageSpec.kt
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpiralImageSpec.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.spiralimage
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.HybridObject
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A Kotlin class representing the SpiralImage HybridObject.
|
|
17
|
+
* Implement this abstract class to create Kotlin-based instances of SpiralImage.
|
|
18
|
+
*/
|
|
19
|
+
@DoNotStrip
|
|
20
|
+
@Keep
|
|
21
|
+
@Suppress(
|
|
22
|
+
"KotlinJniMissingFunction", "unused",
|
|
23
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
24
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
|
+
)
|
|
26
|
+
abstract class HybridSpiralImageSpec: HybridObject() {
|
|
27
|
+
// Properties
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
// Methods
|
|
31
|
+
@DoNotStrip
|
|
32
|
+
@Keep
|
|
33
|
+
abstract fun multiply(a: Double, b: Double): Double
|
|
34
|
+
|
|
35
|
+
// Default implementation of `HybridObject.toString()`
|
|
36
|
+
override fun toString(): String {
|
|
37
|
+
return "[HybridObject SpiralImage]"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// C++ backing class
|
|
41
|
+
@DoNotStrip
|
|
42
|
+
@Keep
|
|
43
|
+
protected open class CxxPart(javaPart: HybridSpiralImageSpec): HybridObject.CxxPart(javaPart) {
|
|
44
|
+
// C++ JHybridSpiralImageSpec::CxxPart::initHybrid(...)
|
|
45
|
+
external override fun initHybrid(): HybridData
|
|
46
|
+
}
|
|
47
|
+
override fun createCxxPart(): CxxPart {
|
|
48
|
+
return CxxPart(this)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
companion object {
|
|
52
|
+
protected const val TAG = "HybridSpiralImageSpec"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// spiralimageOnLoad.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.spiralimage
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class spiralimageOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "spiralimageOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "spiralimage".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading spiralimage C++ library...")
|
|
25
|
+
System.loadLibrary("spiralimage")
|
|
26
|
+
Log.i(TAG, "Successfully loaded spiralimage C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load spiralimage C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|