react-native-nitro-image-pipeline 0.3.5 → 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 +66 -6
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/HybridNitroImagePipeline.kt +24 -6
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/transform/BlurTransformation.kt +50 -24
- package/ios/GaussianBlur.swift +135 -0
- package/ios/GaussianBlurProcessor.swift +41 -0
- package/ios/HybridNitroImagePipeline.swift +15 -20
- 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 +13 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts +32 -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 +21 -13
- package/src/index.ts +38 -4
- package/src/specs/nitro-image-toolkit.nitro.ts +38 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","require","_reactNativeNitroModules","NitroImagePipeline","exports","NitroModules","createHybridObject","useImage","url","blur","cornerRadius","cache","image","setImage","useState","undefined","error","loadedUrlRef","useRef","useEffect","cancelled","current","result","loadImage","e","Error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,wBAAA,GAAAD,OAAA;
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNativeNitroModules","NitroImagePipeline","exports","NitroModules","createHybridObject","useImage","url","blur","cornerRadius","cache","image","setImage","useState","undefined","error","loadedUrlRef","useRef","isUniformRadius","uniformRadius","topLeft","topRight","bottomLeft","bottomRight","useEffect","cancelled","current","result","loadImage","e","Error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAAC,wBAAA,GAAAD,OAAA;AAWO,MAAME,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAC7BE,qCAAY,CAACC,kBAAkB,CAAyB,oBAAoB,CAAC;AAmB/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,QAAQA,CAAC;EACvBC,GAAG;EACHC,IAAI,GAAG,CAAC;EACRC,YAAY,GAAG,CAAC;EAChBC;AAgBF,CAAC,EAAU;EACT,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,EAAS;IACzCF,KAAK,EAAEG,SAAS;IAChBC,KAAK,EAAED;EACT,CAAC,CAAC;EACF,MAAME,YAAY,GAAG,IAAAC,aAAM,EAACV,GAAG,CAAC;;EAEhC;EACA;EACA,MAAMW,eAAe,GAAG,OAAOT,YAAY,KAAK,QAAQ;EACxD,MAAMU,aAAa,GAAGD,eAAe,GAAGT,YAAY,GAAG,CAAC;EACxD,MAAM;IACJW,OAAO,GAAG,CAAC;IACXC,QAAQ,GAAG,CAAC;IACZC,UAAU,GAAG,CAAC;IACdC,WAAW,GAAG;EAChB,CAAC,GAAGL,eAAe,GAAG,CAAC,CAAC,GAAGT,YAAY;EAEvC,IAAAe,gBAAS,EAAC,MAAM;IACd,IAAIC,SAAS,GAAG,KAAK;IACrB;IACA;IACA;IACA,IAAIT,YAAY,CAACU,OAAO,KAAKnB,GAAG,EAAE;MAChCS,YAAY,CAACU,OAAO,GAAGnB,GAAG;MAC1BK,QAAQ,CAAC;QAAED,KAAK,EAAEG,SAAS;QAAEC,KAAK,EAAED;MAAU,CAAC,CAAC;IAClD;IAEA,CAAC,YAAY;MACX,IAAI;QACF,MAAMa,MAAM,GAAG,MAAMzB,kBAAkB,CAAC0B,SAAS,CAACrB,GAAG,EAAE;UACrDC,IAAI;UACJC,YAAY,EAAES,eAAe,GACzBC,aAAa,GACb;YAAEC,OAAO;YAAEC,QAAQ;YAAEC,UAAU;YAAEC;UAAY,CAAC;UAClDb;QACF,CAAC,CAAC;QAEF,IAAI,CAACe,SAAS,EAAE;UACdb,QAAQ,CAAC;YAAED,KAAK,EAAEgB,MAAM;YAAEZ,KAAK,EAAED;UAAU,CAAC,CAAC;QAC/C;MACF,CAAC,CAAC,OAAOe,CAAC,EAAE;QACV,MAAMd,KAAK,GAAGc,CAAC,YAAYC,KAAK,GAAGD,CAAC,GAAG,IAAIC,KAAK,CAAC,GAAGD,CAAC,EAAE,CAAC;QACxD,IAAI,CAACJ,SAAS,EAAE;UACdb,QAAQ,CAAC;YAAED,KAAK,EAAEG,SAAS;YAAEC,KAAK,EAAEA;UAAM,CAAC,CAAC;QAC9C;MACF;IACF,CAAC,EAAE,CAAC;IAEJ,OAAO,MAAM;MACXU,SAAS,GAAG,IAAI;IAClB,CAAC;EACH,CAAC,EAAE,CACDlB,GAAG,EACHC,IAAI,EACJU,eAAe,EACfC,aAAa,EACbC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,WAAW,EACXb,KAAK,CACN,CAAC;EAEF,OAAOC,KAAK;AACd","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -22,6 +22,17 @@ export function useImage({
|
|
|
22
22
|
error: undefined
|
|
23
23
|
});
|
|
24
24
|
const loadedUrlRef = useRef(url);
|
|
25
|
+
|
|
26
|
+
// Split the option into primitives so an inline `{ topLeft: 24, ... }`
|
|
27
|
+
// literal (new identity every render) doesn't re-trigger the effect.
|
|
28
|
+
const isUniformRadius = typeof cornerRadius === 'number';
|
|
29
|
+
const uniformRadius = isUniformRadius ? cornerRadius : 0;
|
|
30
|
+
const {
|
|
31
|
+
topLeft = 0,
|
|
32
|
+
topRight = 0,
|
|
33
|
+
bottomLeft = 0,
|
|
34
|
+
bottomRight = 0
|
|
35
|
+
} = isUniformRadius ? {} : cornerRadius;
|
|
25
36
|
useEffect(() => {
|
|
26
37
|
let cancelled = false;
|
|
27
38
|
// Only reset to the loading state when the URL changes; for same-URL
|
|
@@ -38,7 +49,12 @@ export function useImage({
|
|
|
38
49
|
try {
|
|
39
50
|
const result = await NitroImagePipeline.loadImage(url, {
|
|
40
51
|
blur,
|
|
41
|
-
cornerRadius
|
|
52
|
+
cornerRadius: isUniformRadius ? uniformRadius : {
|
|
53
|
+
topLeft,
|
|
54
|
+
topRight,
|
|
55
|
+
bottomLeft,
|
|
56
|
+
bottomRight
|
|
57
|
+
},
|
|
42
58
|
cache
|
|
43
59
|
});
|
|
44
60
|
if (!cancelled) {
|
|
@@ -60,7 +76,7 @@ export function useImage({
|
|
|
60
76
|
return () => {
|
|
61
77
|
cancelled = true;
|
|
62
78
|
};
|
|
63
|
-
}, [url, blur,
|
|
79
|
+
}, [url, blur, isUniformRadius, uniformRadius, topLeft, topRight, bottomLeft, bottomRight, cache]);
|
|
64
80
|
return image;
|
|
65
81
|
}
|
|
66
82
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useState","NitroModules","NitroImagePipeline","createHybridObject","useImage","url","blur","cornerRadius","cache","image","setImage","undefined","error","loadedUrlRef","cancelled","current","result","loadImage","e","Error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnD,SAASC,YAAY,QAAQ,4BAA4B;
|
|
1
|
+
{"version":3,"names":["useEffect","useRef","useState","NitroModules","NitroImagePipeline","createHybridObject","useImage","url","blur","cornerRadius","cache","image","setImage","undefined","error","loadedUrlRef","isUniformRadius","uniformRadius","topLeft","topRight","bottomLeft","bottomRight","cancelled","current","result","loadImage","e","Error"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEnD,SAASC,YAAY,QAAQ,4BAA4B;AAWzD,OAAO,MAAMC,kBAAkB,GAC7BD,YAAY,CAACE,kBAAkB,CAAyB,oBAAoB,CAAC;AAmB/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,QAAQA,CAAC;EACvBC,GAAG;EACHC,IAAI,GAAG,CAAC;EACRC,YAAY,GAAG,CAAC;EAChBC;AAgBF,CAAC,EAAU;EACT,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAGV,QAAQ,CAAS;IACzCS,KAAK,EAAEE,SAAS;IAChBC,KAAK,EAAED;EACT,CAAC,CAAC;EACF,MAAME,YAAY,GAAGd,MAAM,CAACM,GAAG,CAAC;;EAEhC;EACA;EACA,MAAMS,eAAe,GAAG,OAAOP,YAAY,KAAK,QAAQ;EACxD,MAAMQ,aAAa,GAAGD,eAAe,GAAGP,YAAY,GAAG,CAAC;EACxD,MAAM;IACJS,OAAO,GAAG,CAAC;IACXC,QAAQ,GAAG,CAAC;IACZC,UAAU,GAAG,CAAC;IACdC,WAAW,GAAG;EAChB,CAAC,GAAGL,eAAe,GAAG,CAAC,CAAC,GAAGP,YAAY;EAEvCT,SAAS,CAAC,MAAM;IACd,IAAIsB,SAAS,GAAG,KAAK;IACrB;IACA;IACA;IACA,IAAIP,YAAY,CAACQ,OAAO,KAAKhB,GAAG,EAAE;MAChCQ,YAAY,CAACQ,OAAO,GAAGhB,GAAG;MAC1BK,QAAQ,CAAC;QAAED,KAAK,EAAEE,SAAS;QAAEC,KAAK,EAAED;MAAU,CAAC,CAAC;IAClD;IAEA,CAAC,YAAY;MACX,IAAI;QACF,MAAMW,MAAM,GAAG,MAAMpB,kBAAkB,CAACqB,SAAS,CAAClB,GAAG,EAAE;UACrDC,IAAI;UACJC,YAAY,EAAEO,eAAe,GACzBC,aAAa,GACb;YAAEC,OAAO;YAAEC,QAAQ;YAAEC,UAAU;YAAEC;UAAY,CAAC;UAClDX;QACF,CAAC,CAAC;QAEF,IAAI,CAACY,SAAS,EAAE;UACdV,QAAQ,CAAC;YAAED,KAAK,EAAEa,MAAM;YAAEV,KAAK,EAAED;UAAU,CAAC,CAAC;QAC/C;MACF,CAAC,CAAC,OAAOa,CAAC,EAAE;QACV,MAAMZ,KAAK,GAAGY,CAAC,YAAYC,KAAK,GAAGD,CAAC,GAAG,IAAIC,KAAK,CAAC,GAAGD,CAAC,EAAE,CAAC;QACxD,IAAI,CAACJ,SAAS,EAAE;UACdV,QAAQ,CAAC;YAAED,KAAK,EAAEE,SAAS;YAAEC,KAAK,EAAEA;UAAM,CAAC,CAAC;QAC9C;MACF;IACF,CAAC,EAAE,CAAC;IAEJ,OAAO,MAAM;MACXQ,SAAS,GAAG,IAAI;IAClB,CAAC;EACH,CAAC,EAAE,CACDf,GAAG,EACHC,IAAI,EACJQ,eAAe,EACfC,aAAa,EACbC,OAAO,EACPC,QAAQ,EACRC,UAAU,EACVC,WAAW,EACXX,KAAK,CACN,CAAC;EAEF,OAAOC,KAAK;AACd","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Image } from 'react-native-nitro-image';
|
|
2
|
-
import type { CacheOption, NitroImagePipeline as NitroImagePipelineSpec, Options } from './specs/nitro-image-toolkit.nitro';
|
|
3
|
-
export type { CacheOption, Options };
|
|
2
|
+
import type { CacheOption, CornerRadii, NitroImagePipeline as NitroImagePipelineSpec, Options } from './specs/nitro-image-toolkit.nitro';
|
|
3
|
+
export type { CacheOption, CornerRadii, Options };
|
|
4
4
|
export declare const NitroImagePipeline: NitroImagePipelineSpec;
|
|
5
5
|
type Result = {
|
|
6
6
|
image: undefined;
|
|
@@ -22,8 +22,18 @@ type Result = {
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function useImage({ url, blur, cornerRadius, cache, }: {
|
|
24
24
|
url: string;
|
|
25
|
+
/**
|
|
26
|
+
* Gaussian blur strength, as the standard deviation (sigma) of the blur in
|
|
27
|
+
* source-image pixels. Matches across iOS and Android; roughly half of
|
|
28
|
+
* React Native's `blurRadius`.
|
|
29
|
+
*/
|
|
25
30
|
blur?: number;
|
|
26
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Corner radius in points, baked into the loaded bitmap. Pass a single
|
|
33
|
+
* number for uniform rounding, or per-corner radii (inline object literals
|
|
34
|
+
* are fine — the hook compares the radii by value, not identity).
|
|
35
|
+
*/
|
|
36
|
+
cornerRadius?: number | CornerRadii;
|
|
27
37
|
cache?: CacheOption;
|
|
28
38
|
}): Result;
|
|
29
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,IAAI,sBAAsB,EAC5C,OAAO,EACR,MAAM,mCAAmC,CAAC;AAE3C,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,kBAAkB,IAAI,sBAAsB,EAC5C,OAAO,EACR,MAAM,mCAAmC,CAAC;AAE3C,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAElD,eAAO,MAAM,kBAAkB,wBACgD,CAAC;AAEhF,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;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,IAAQ,EACR,YAAgB,EAChB,KAAK,GACN,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACpC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,MAAM,CAiET"}
|
|
@@ -1,10 +1,36 @@
|
|
|
1
1
|
import type { Image } from 'react-native-nitro-image';
|
|
2
2
|
import type { HybridObject } from 'react-native-nitro-modules';
|
|
3
3
|
export type CacheOption = 'memory' | 'disk' | 'none';
|
|
4
|
+
/**
|
|
5
|
+
* Independent corner radii in points. Omitted corners stay square.
|
|
6
|
+
*/
|
|
7
|
+
export interface CornerRadii {
|
|
8
|
+
topLeft?: number;
|
|
9
|
+
topRight?: number;
|
|
10
|
+
bottomLeft?: number;
|
|
11
|
+
bottomRight?: number;
|
|
12
|
+
}
|
|
4
13
|
export type Options = {
|
|
14
|
+
/**
|
|
15
|
+
* Gaussian blur strength, given as the standard deviation (sigma) of the
|
|
16
|
+
* blur in **source-image pixels**. The same value on the same source image
|
|
17
|
+
* produces the same result on iOS and Android.
|
|
18
|
+
*
|
|
19
|
+
* React Native's `<Image blurRadius={n} />` is roughly `blur: n / 2`.
|
|
20
|
+
*
|
|
21
|
+
* @default 0 (no blur)
|
|
22
|
+
*/
|
|
5
23
|
blur?: number;
|
|
6
24
|
cache?: CacheOption;
|
|
7
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Corner radius in points, baked into the loaded bitmap. Pass a single
|
|
27
|
+
* number to round all four corners uniformly, or a {@linkcode CornerRadii}
|
|
28
|
+
* object to round each corner independently (e.g. a "ticket" shape with
|
|
29
|
+
* larger bottom corners).
|
|
30
|
+
*
|
|
31
|
+
* @default 0 (square corners)
|
|
32
|
+
*/
|
|
33
|
+
cornerRadius?: number | CornerRadii;
|
|
8
34
|
};
|
|
9
35
|
export interface NitroImagePipeline extends HybridObject<{
|
|
10
36
|
ios: 'swift';
|
|
@@ -13,6 +39,11 @@ export interface NitroImagePipeline extends HybridObject<{
|
|
|
13
39
|
loadImage(url: string, options?: Options): Promise<Image>;
|
|
14
40
|
preLoadImage(url: string): Promise<void>;
|
|
15
41
|
preLoadImages(urls: string[]): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Blurs an already-loaded image. `radius` is the standard deviation (sigma)
|
|
44
|
+
* of the Gaussian in **source-image pixels**, the same unit as
|
|
45
|
+
* {@linkcode Options.blur}.
|
|
46
|
+
*/
|
|
16
47
|
gaussianBlur(image: Image, radius: number): Promise<Image>;
|
|
17
48
|
clearCache(): Promise<void>;
|
|
18
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nitro-image-toolkit.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/nitro-image-toolkit.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"nitro-image-toolkit.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/nitro-image-toolkit.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CACrC,CAAC;AAEF,MAAM,WAAW,kBAAmB,SAAQ,YAAY,CAAC;IACvD,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,QAAQ,CAAC;CACnB,CAAC;IACA,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C;;;;OAIG;IACH,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAG3D,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B"}
|
|
@@ -36,6 +36,7 @@ target_sources(
|
|
|
36
36
|
../nitrogen/generated/shared/c++/HybridNitroImagePipelineSpec.cpp
|
|
37
37
|
# Android-specific Nitrogen C++ sources
|
|
38
38
|
../nitrogen/generated/android/c++/JHybridNitroImagePipelineSpec.cpp
|
|
39
|
+
../nitrogen/generated/android/c++/JVariant_Double_CornerRadii.cpp
|
|
39
40
|
)
|
|
40
41
|
|
|
41
42
|
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JCornerRadii.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 "CornerRadii.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "CornerRadii" and the Kotlin data class "CornerRadii".
|
|
21
|
+
*/
|
|
22
|
+
struct JCornerRadii final: public jni::JavaClass<JCornerRadii> {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/CornerRadii;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct CornerRadii by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
CornerRadii toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldTopLeft = clazz->getField<jni::JDouble>("topLeft");
|
|
35
|
+
jni::local_ref<jni::JDouble> topLeft = this->getFieldValue(fieldTopLeft);
|
|
36
|
+
static const auto fieldTopRight = clazz->getField<jni::JDouble>("topRight");
|
|
37
|
+
jni::local_ref<jni::JDouble> topRight = this->getFieldValue(fieldTopRight);
|
|
38
|
+
static const auto fieldBottomLeft = clazz->getField<jni::JDouble>("bottomLeft");
|
|
39
|
+
jni::local_ref<jni::JDouble> bottomLeft = this->getFieldValue(fieldBottomLeft);
|
|
40
|
+
static const auto fieldBottomRight = clazz->getField<jni::JDouble>("bottomRight");
|
|
41
|
+
jni::local_ref<jni::JDouble> bottomRight = this->getFieldValue(fieldBottomRight);
|
|
42
|
+
return CornerRadii(
|
|
43
|
+
topLeft != nullptr ? std::make_optional(topLeft->value()) : std::nullopt,
|
|
44
|
+
topRight != nullptr ? std::make_optional(topRight->value()) : std::nullopt,
|
|
45
|
+
bottomLeft != nullptr ? std::make_optional(bottomLeft->value()) : std::nullopt,
|
|
46
|
+
bottomRight != nullptr ? std::make_optional(bottomRight->value()) : std::nullopt
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
/**
|
|
52
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
53
|
+
*/
|
|
54
|
+
[[maybe_unused]]
|
|
55
|
+
static jni::local_ref<JCornerRadii::javaobject> fromCpp(const CornerRadii& value) {
|
|
56
|
+
using JSignature = JCornerRadii(jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>);
|
|
57
|
+
static const auto clazz = javaClassStatic();
|
|
58
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
59
|
+
return create(
|
|
60
|
+
clazz,
|
|
61
|
+
value.topLeft.has_value() ? jni::JDouble::valueOf(value.topLeft.value()) : nullptr,
|
|
62
|
+
value.topRight.has_value() ? jni::JDouble::valueOf(value.topRight.value()) : nullptr,
|
|
63
|
+
value.bottomLeft.has_value() ? jni::JDouble::valueOf(value.bottomLeft.value()) : nullptr,
|
|
64
|
+
value.bottomRight.has_value() ? jni::JDouble::valueOf(value.bottomRight.value()) : nullptr
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
@@ -13,6 +13,8 @@ namespace margelo::nitro::image { class HybridImageSpec; }
|
|
|
13
13
|
namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
14
14
|
// Forward declaration of `CacheOption` to properly resolve imports.
|
|
15
15
|
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
16
|
+
// Forward declaration of `CornerRadii` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
16
18
|
|
|
17
19
|
#include <memory>
|
|
18
20
|
#include <NitroImage/HybridImageSpec.hpp>
|
|
@@ -26,6 +28,10 @@ namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
|
26
28
|
#include "JOptions.hpp"
|
|
27
29
|
#include "CacheOption.hpp"
|
|
28
30
|
#include "JCacheOption.hpp"
|
|
31
|
+
#include "CornerRadii.hpp"
|
|
32
|
+
#include <variant>
|
|
33
|
+
#include "JVariant_Double_CornerRadii.hpp"
|
|
34
|
+
#include "JCornerRadii.hpp"
|
|
29
35
|
#include <vector>
|
|
30
36
|
|
|
31
37
|
namespace margelo::nitro::nitroimagepipeline {
|
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
#include "Options.hpp"
|
|
12
12
|
|
|
13
13
|
#include "CacheOption.hpp"
|
|
14
|
+
#include "CornerRadii.hpp"
|
|
14
15
|
#include "JCacheOption.hpp"
|
|
16
|
+
#include "JCornerRadii.hpp"
|
|
17
|
+
#include "JVariant_Double_CornerRadii.hpp"
|
|
15
18
|
#include <optional>
|
|
19
|
+
#include <variant>
|
|
16
20
|
|
|
17
21
|
namespace margelo::nitro::nitroimagepipeline {
|
|
18
22
|
|
|
@@ -37,12 +41,12 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
37
41
|
jni::local_ref<jni::JDouble> blur = this->getFieldValue(fieldBlur);
|
|
38
42
|
static const auto fieldCache = clazz->getField<JCacheOption>("cache");
|
|
39
43
|
jni::local_ref<JCacheOption> cache = this->getFieldValue(fieldCache);
|
|
40
|
-
static const auto fieldCornerRadius = clazz->getField<
|
|
41
|
-
jni::local_ref<
|
|
44
|
+
static const auto fieldCornerRadius = clazz->getField<JVariant_Double_CornerRadii>("cornerRadius");
|
|
45
|
+
jni::local_ref<JVariant_Double_CornerRadii> cornerRadius = this->getFieldValue(fieldCornerRadius);
|
|
42
46
|
return Options(
|
|
43
47
|
blur != nullptr ? std::make_optional(blur->value()) : std::nullopt,
|
|
44
48
|
cache != nullptr ? std::make_optional(cache->toCpp()) : std::nullopt,
|
|
45
|
-
cornerRadius != nullptr ? std::make_optional(cornerRadius->
|
|
49
|
+
cornerRadius != nullptr ? std::make_optional(cornerRadius->toCpp()) : std::nullopt
|
|
46
50
|
);
|
|
47
51
|
}
|
|
48
52
|
|
|
@@ -52,14 +56,14 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
52
56
|
*/
|
|
53
57
|
[[maybe_unused]]
|
|
54
58
|
static jni::local_ref<JOptions::javaobject> fromCpp(const Options& value) {
|
|
55
|
-
using JSignature = JOptions(jni::alias_ref<jni::JDouble>, jni::alias_ref<JCacheOption>, jni::alias_ref<
|
|
59
|
+
using JSignature = JOptions(jni::alias_ref<jni::JDouble>, jni::alias_ref<JCacheOption>, jni::alias_ref<JVariant_Double_CornerRadii>);
|
|
56
60
|
static const auto clazz = javaClassStatic();
|
|
57
61
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
58
62
|
return create(
|
|
59
63
|
clazz,
|
|
60
64
|
value.blur.has_value() ? jni::JDouble::valueOf(value.blur.value()) : nullptr,
|
|
61
65
|
value.cache.has_value() ? JCacheOption::fromCpp(value.cache.value()) : nullptr,
|
|
62
|
-
value.cornerRadius.has_value() ?
|
|
66
|
+
value.cornerRadius.has_value() ? JVariant_Double_CornerRadii::fromCpp(value.cornerRadius.value()) : nullptr
|
|
63
67
|
);
|
|
64
68
|
}
|
|
65
69
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_Double_CornerRadii.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 "JVariant_Double_CornerRadii.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
11
|
+
/**
|
|
12
|
+
* Converts JVariant_Double_CornerRadii to std::variant<double, CornerRadii>
|
|
13
|
+
*/
|
|
14
|
+
std::variant<double, CornerRadii> JVariant_Double_CornerRadii::toCpp() const {
|
|
15
|
+
if (isInstanceOf(JVariant_Double_CornerRadii_impl::First::javaClassStatic())) {
|
|
16
|
+
// It's a `double`
|
|
17
|
+
auto jniValue = static_cast<const JVariant_Double_CornerRadii_impl::First*>(this)->getValue();
|
|
18
|
+
return jniValue;
|
|
19
|
+
} else if (isInstanceOf(JVariant_Double_CornerRadii_impl::Second::javaClassStatic())) {
|
|
20
|
+
// It's a `CornerRadii`
|
|
21
|
+
auto jniValue = static_cast<const JVariant_Double_CornerRadii_impl::Second*>(this)->getValue();
|
|
22
|
+
return jniValue->toCpp();
|
|
23
|
+
}
|
|
24
|
+
throw std::invalid_argument("Variant is unknown Kotlin instance!");
|
|
25
|
+
}
|
|
26
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_Double_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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <variant>
|
|
12
|
+
|
|
13
|
+
#include "CornerRadii.hpp"
|
|
14
|
+
#include <variant>
|
|
15
|
+
#include "JCornerRadii.hpp"
|
|
16
|
+
#include <optional>
|
|
17
|
+
|
|
18
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The C++ JNI bridge between the C++ std::variant and the Java class "Variant_Double_CornerRadii".
|
|
24
|
+
*/
|
|
25
|
+
class JVariant_Double_CornerRadii: public jni::JavaClass<JVariant_Double_CornerRadii> {
|
|
26
|
+
public:
|
|
27
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/Variant_Double_CornerRadii;";
|
|
28
|
+
|
|
29
|
+
static jni::local_ref<JVariant_Double_CornerRadii> create_0(double value) {
|
|
30
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_Double_CornerRadii(double)>("create");
|
|
31
|
+
return method(javaClassStatic(), value);
|
|
32
|
+
}
|
|
33
|
+
static jni::local_ref<JVariant_Double_CornerRadii> create_1(jni::alias_ref<JCornerRadii> value) {
|
|
34
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_Double_CornerRadii(jni::alias_ref<JCornerRadii>)>("create");
|
|
35
|
+
return method(javaClassStatic(), value);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static jni::local_ref<JVariant_Double_CornerRadii> fromCpp(const std::variant<double, CornerRadii>& variant) {
|
|
39
|
+
switch (variant.index()) {
|
|
40
|
+
case 0: return create_0(std::get<0>(variant));
|
|
41
|
+
case 1: return create_1(JCornerRadii::fromCpp(std::get<1>(variant)));
|
|
42
|
+
default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[[nodiscard]] std::variant<double, CornerRadii> toCpp() const;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
namespace JVariant_Double_CornerRadii_impl {
|
|
50
|
+
class First final: public jni::JavaClass<First, JVariant_Double_CornerRadii> {
|
|
51
|
+
public:
|
|
52
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/Variant_Double_CornerRadii$First;";
|
|
53
|
+
|
|
54
|
+
[[nodiscard]] double getValue() const {
|
|
55
|
+
static const auto field = javaClassStatic()->getField<double>("value");
|
|
56
|
+
return getFieldValue(field);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
class Second final: public jni::JavaClass<Second, JVariant_Double_CornerRadii> {
|
|
61
|
+
public:
|
|
62
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/Variant_Double_CornerRadii$Second;";
|
|
63
|
+
|
|
64
|
+
[[nodiscard]] jni::local_ref<JCornerRadii> getValue() const {
|
|
65
|
+
static const auto field = javaClassStatic()->getField<JCornerRadii>("value");
|
|
66
|
+
return getFieldValue(field);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
} // namespace JVariant_Double_CornerRadii_impl
|
|
70
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
@@ -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
|