react-native-nitro-image-pipeline 1.1.0 → 1.2.1
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 +84 -8
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/HybridNitroImagePipeline.kt +36 -15
- package/android/src/main/java/com/margelo/nitro/nitroimagepipeline/transform/ResizeTransformation.kt +58 -0
- package/ios/HybridNitroImagePipeline.swift +54 -27
- package/ios/RoundedCornersProcessor.swift +6 -3
- package/lib/commonjs/NitroImagePipeline.js +9 -0
- package/lib/commonjs/NitroImagePipeline.js.map +1 -0
- package/lib/commonjs/PipelineImage.js +111 -0
- package/lib/commonjs/PipelineImage.js.map +1 -0
- package/lib/commonjs/index.js +40 -81
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/resizeForStyle.js +68 -0
- package/lib/commonjs/resizeForStyle.js.map +1 -0
- package/lib/commonjs/useImage.js +95 -0
- package/lib/commonjs/useImage.js.map +1 -0
- package/lib/module/NitroImagePipeline.js +5 -0
- package/lib/module/NitroImagePipeline.js.map +1 -0
- package/lib/module/PipelineImage.js +107 -0
- package/lib/module/PipelineImage.js.map +1 -0
- package/lib/module/index.js +4 -79
- package/lib/module/index.js.map +1 -1
- package/lib/module/resizeForStyle.js +62 -0
- package/lib/module/resizeForStyle.js.map +1 -0
- package/lib/module/useImage.js +91 -0
- package/lib/module/useImage.js.map +1 -0
- package/lib/typescript/src/NitroImagePipeline.d.ts +3 -0
- package/lib/typescript/src/NitroImagePipeline.d.ts.map +1 -0
- package/lib/typescript/src/PipelineImage.d.ts +57 -0
- package/lib/typescript/src/PipelineImage.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +5 -38
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/resizeForStyle.d.ts +30 -0
- package/lib/typescript/src/resizeForStyle.d.ts.map +1 -0
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts +33 -5
- package/lib/typescript/src/specs/nitro-image-toolkit.nitro.d.ts.map +1 -1
- package/lib/typescript/src/useImage.d.ts +53 -0
- package/lib/typescript/src/useImage.d.ts.map +1 -0
- package/nitrogen/generated/android/c++/JHybridNitroImagePipelineSpec.cpp +4 -0
- package/nitrogen/generated/android/c++/JOptions.hpp +9 -3
- package/nitrogen/generated/android/c++/JResizeOptions.hpp +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/Options.kt +9 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/ResizeOptions.kt +56 -0
- package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Bridge.hpp +18 -0
- package/nitrogen/generated/ios/NitroImagePipeline-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridNitroImagePipelineSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/swift/Options.swift +12 -1
- package/nitrogen/generated/ios/swift/ResizeOptions.swift +34 -0
- package/nitrogen/generated/shared/c++/Options.hpp +9 -2
- package/nitrogen/generated/shared/c++/ResizeOptions.hpp +87 -0
- package/package.json +1 -1
- package/src/NitroImagePipeline.ts +6 -0
- package/src/PipelineImage.tsx +156 -0
- package/src/index.ts +10 -123
- package/src/resizeForStyle.ts +96 -0
- package/src/specs/nitro-image-toolkit.nitro.ts +34 -5
- package/src/useImage.ts +149 -0
|
@@ -1,39 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
image: undefined;
|
|
7
|
-
error: undefined;
|
|
8
|
-
} | {
|
|
9
|
-
image: Image;
|
|
10
|
-
error: undefined;
|
|
11
|
-
} | {
|
|
12
|
-
image: undefined;
|
|
13
|
-
error: Error;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* A hook to asynchronously load an image from the
|
|
17
|
-
* given {@linkcode AsyncImageSource} into memory.
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* const { image, error } = useImage({ filePath: '/tmp/image.jpg' })
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare function useImage({ url, blur, cornerRadius, cache, }: {
|
|
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
|
-
*/
|
|
30
|
-
blur?: number;
|
|
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;
|
|
37
|
-
cache?: CacheOption;
|
|
38
|
-
}): Result;
|
|
1
|
+
export { NitroImagePipeline } from './NitroImagePipeline';
|
|
2
|
+
export { PipelineImage, type PipelineImageProps } from './PipelineImage';
|
|
3
|
+
export { cornerRadiusForStyle, resizeForLayout, resizeForStyle, } from './resizeForStyle';
|
|
4
|
+
export type { CacheOption, CornerRadii, Options, ResizeOptions, } from './specs/nitro-image-toolkit.nitro';
|
|
5
|
+
export { useImage } from './useImage';
|
|
39
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,WAAW,EACX,WAAW,EACX,OAAO,EACP,aAAa,GACd,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import type { CornerRadii, ResizeOptions } from './specs/nitro-image-toolkit.nitro';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a layout size in points (dp) to the pipeline's `resize` option in
|
|
5
|
+
* whole bitmap pixels using `PixelRatio.getPixelSizeForLayoutSize`. Returns
|
|
6
|
+
* `undefined` unless both values are positive numbers.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resizeForLayout(width: unknown, height: unknown): ResizeOptions | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Derives the pipeline's `resize` option from a view style whose `width` and
|
|
11
|
+
* `height` are numeric points, so the bitmap matches the display size on
|
|
12
|
+
* every screen density:
|
|
13
|
+
* ```ts
|
|
14
|
+
* useImage({ url, resize: resizeForStyle(styles.image) });
|
|
15
|
+
* ```
|
|
16
|
+
* Arrays and registered styles are flattened. Returns `undefined` when either
|
|
17
|
+
* dimension is missing or not a number (`'50%'`, `'auto'`, flex-driven) —
|
|
18
|
+
* use `<PipelineImage>` for those, which measures the view instead.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resizeForStyle(style: StyleProp<ViewStyle>): ResizeOptions | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Derives a `cornerRadius` option from a view style's `borderRadius` /
|
|
23
|
+
* `borderTopLeftRadius` / `borderTopRightRadius` / `borderBottomLeftRadius` /
|
|
24
|
+
* `borderBottomRightRadius`, in points. Per-corner properties override
|
|
25
|
+
* `borderRadius` for that corner; a corner with neither set stays square.
|
|
26
|
+
* Non-numeric values (percentages, animated values) are ignored, like
|
|
27
|
+
* {@linkcode resizeForStyle}. Returns `undefined` when none are set.
|
|
28
|
+
*/
|
|
29
|
+
export declare function cornerRadiusForStyle(style: StyleProp<ViewStyle>): number | CornerRadii | undefined;
|
|
30
|
+
//# sourceMappingURL=resizeForStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resizeForStyle.d.ts","sourceRoot":"","sources":["../../../src/resizeForStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAEd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACd,MAAM,mCAAmC,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,OAAO,GACd,aAAa,GAAG,SAAS,CAS3B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAC1B,aAAa,GAAG,SAAS,CAG3B;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,GAC1B,MAAM,GAAG,WAAW,GAAG,SAAS,CAoClC"}
|
|
@@ -2,7 +2,8 @@ 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
4
|
/**
|
|
5
|
-
* Independent corner radii in
|
|
5
|
+
* Independent corner radii, in pixels of the loaded bitmap (see
|
|
6
|
+
* {@linkcode Options.cornerRadius}). Omitted corners stay square.
|
|
6
7
|
*/
|
|
7
8
|
export interface CornerRadii {
|
|
8
9
|
topLeft?: number;
|
|
@@ -10,12 +11,24 @@ export interface CornerRadii {
|
|
|
10
11
|
bottomLeft?: number;
|
|
11
12
|
bottomRight?: number;
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Target bitmap size in pixels. The image is scaled to fill this size and
|
|
16
|
+
* center-cropped (like CSS `object-fit: cover`), upscaling if needed, so the
|
|
17
|
+
* result is exactly `width` × `height` pixels.
|
|
18
|
+
*/
|
|
19
|
+
export interface ResizeOptions {
|
|
20
|
+
width: number;
|
|
21
|
+
height: number;
|
|
22
|
+
}
|
|
13
23
|
export type Options = {
|
|
14
24
|
/**
|
|
15
25
|
* Gaussian blur strength, given as the standard deviation (sigma) of the
|
|
16
26
|
* blur in **source-image pixels**. The same value on the same source image
|
|
17
27
|
* produces the same result on iOS and Android.
|
|
18
28
|
*
|
|
29
|
+
* When {@linkcode resize} is set, the blur runs after resizing, so sigma is
|
|
30
|
+
* in pixels of the resized bitmap instead.
|
|
31
|
+
*
|
|
19
32
|
* React Native's `<Image blurRadius={n} />` is roughly `blur: n / 2`.
|
|
20
33
|
*
|
|
21
34
|
* @default 0 (no blur)
|
|
@@ -23,14 +36,29 @@ export type Options = {
|
|
|
23
36
|
blur?: number;
|
|
24
37
|
cache?: CacheOption;
|
|
25
38
|
/**
|
|
26
|
-
* Corner radius
|
|
27
|
-
* number to round all four corners uniformly, or a
|
|
28
|
-
* object to round each corner independently (e.g. a
|
|
29
|
-
* larger bottom corners).
|
|
39
|
+
* Corner radius baked into the loaded bitmap, in **pixels of that bitmap**.
|
|
40
|
+
* Pass a single number to round all four corners uniformly, or a
|
|
41
|
+
* {@linkcode CornerRadii} object to round each corner independently (e.g. a
|
|
42
|
+
* "ticket" shape with larger bottom corners).
|
|
43
|
+
*
|
|
44
|
+
* Without {@linkcode resize} the radius applies to the full-resolution
|
|
45
|
+
* source image, so on a large photo displayed small the rounding shrinks
|
|
46
|
+
* along with it. To get corners sized for your layout, pass `resize` with
|
|
47
|
+
* your display size in pixels (points × screen scale) — the radii then
|
|
48
|
+
* apply to that final bitmap, 1:1 with what you see.
|
|
30
49
|
*
|
|
31
50
|
* @default 0 (square corners)
|
|
32
51
|
*/
|
|
33
52
|
cornerRadius?: number | CornerRadii;
|
|
53
|
+
/**
|
|
54
|
+
* Resize the image to exactly this size in pixels (aspect-fill,
|
|
55
|
+
* center-crop) before `blur` and `cornerRadius` are applied. Besides making
|
|
56
|
+
* `cornerRadius` predictable, this avoids decoding and processing
|
|
57
|
+
* full-resolution bitmaps you only display small.
|
|
58
|
+
*
|
|
59
|
+
* @default undefined (keep the source size)
|
|
60
|
+
*/
|
|
61
|
+
resize?: ResizeOptions;
|
|
34
62
|
};
|
|
35
63
|
export interface NitroImagePipeline extends HybridObject<{
|
|
36
64
|
ios: 'swift';
|
|
@@ -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;AAErD
|
|
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;;;GAGG;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;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,OAAO,GAAG;IACpB;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACpC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB,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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Image } from 'react-native-nitro-image';
|
|
2
|
+
import type { CacheOption, CornerRadii, ResizeOptions } from './specs/nitro-image-toolkit.nitro';
|
|
3
|
+
type Result = {
|
|
4
|
+
image: undefined;
|
|
5
|
+
error: undefined;
|
|
6
|
+
} | {
|
|
7
|
+
image: Image;
|
|
8
|
+
error: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
image: undefined;
|
|
11
|
+
error: Error;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* A hook to asynchronously load an image from the
|
|
15
|
+
* given {@linkcode AsyncImageSource} into memory.
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const { image, error } = useImage({ filePath: '/tmp/image.jpg' })
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function useImage({ url, blur, cornerRadius, resize, cache, enabled, }: {
|
|
22
|
+
url: string;
|
|
23
|
+
/**
|
|
24
|
+
* Gaussian blur strength, as the standard deviation (sigma) of the blur in
|
|
25
|
+
* source-image pixels (of the resized bitmap when `resize` is set). Matches
|
|
26
|
+
* across iOS and Android; roughly half of React Native's `blurRadius`.
|
|
27
|
+
*/
|
|
28
|
+
blur?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Corner radius in pixels of the loaded bitmap. Pass a single number for
|
|
31
|
+
* uniform rounding, or per-corner radii (inline object literals are fine —
|
|
32
|
+
* the hook compares the radii by value, not identity). Pair with `resize`
|
|
33
|
+
* so the radii apply at the size you display instead of the source size.
|
|
34
|
+
*/
|
|
35
|
+
cornerRadius?: number | CornerRadii;
|
|
36
|
+
/**
|
|
37
|
+
* Resize the bitmap to exactly this size in pixels (aspect-fill,
|
|
38
|
+
* center-crop) before blur/rounding. Typically your display size in points
|
|
39
|
+
* multiplied by `PixelRatio.get()`. Inline object literals are fine.
|
|
40
|
+
*/
|
|
41
|
+
resize?: ResizeOptions;
|
|
42
|
+
cache?: CacheOption;
|
|
43
|
+
/**
|
|
44
|
+
* When `false`, no request is made and the result stays in the loading
|
|
45
|
+
* state (or keeps the current image if `url` is unchanged) until it becomes
|
|
46
|
+
* `true`. Use it to defer loading until inputs such as a layout size are
|
|
47
|
+
* known.
|
|
48
|
+
* @default true
|
|
49
|
+
*/
|
|
50
|
+
enabled?: boolean;
|
|
51
|
+
}): Result;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=useImage.d.ts.map
|
|
@@ -0,0 +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;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,EACvB,GAAG,EACH,IAAQ,EACR,YAAgB,EAChB,MAAM,EACN,KAAK,EACL,OAAc,GACf,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACpC;;;;OAIG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,MAAM,CA4ET"}
|
|
@@ -15,6 +15,8 @@ namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
|
15
15
|
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
16
16
|
// Forward declaration of `CornerRadii` to properly resolve imports.
|
|
17
17
|
namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
18
|
+
// Forward declaration of `ResizeOptions` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitroimagepipeline { struct ResizeOptions; }
|
|
18
20
|
|
|
19
21
|
#include <memory>
|
|
20
22
|
#include <NitroImage/HybridImageSpec.hpp>
|
|
@@ -32,6 +34,8 @@ namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
|
32
34
|
#include <variant>
|
|
33
35
|
#include "JVariant_Double_CornerRadii.hpp"
|
|
34
36
|
#include "JCornerRadii.hpp"
|
|
37
|
+
#include "ResizeOptions.hpp"
|
|
38
|
+
#include "JResizeOptions.hpp"
|
|
35
39
|
#include <vector>
|
|
36
40
|
|
|
37
41
|
namespace margelo::nitro::nitroimagepipeline {
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
#include "CornerRadii.hpp"
|
|
15
15
|
#include "JCacheOption.hpp"
|
|
16
16
|
#include "JCornerRadii.hpp"
|
|
17
|
+
#include "JResizeOptions.hpp"
|
|
17
18
|
#include "JVariant_Double_CornerRadii.hpp"
|
|
19
|
+
#include "ResizeOptions.hpp"
|
|
18
20
|
#include <optional>
|
|
19
21
|
#include <variant>
|
|
20
22
|
|
|
@@ -43,10 +45,13 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
43
45
|
jni::local_ref<JCacheOption> cache = this->getFieldValue(fieldCache);
|
|
44
46
|
static const auto fieldCornerRadius = clazz->getField<JVariant_Double_CornerRadii>("cornerRadius");
|
|
45
47
|
jni::local_ref<JVariant_Double_CornerRadii> cornerRadius = this->getFieldValue(fieldCornerRadius);
|
|
48
|
+
static const auto fieldResize = clazz->getField<JResizeOptions>("resize");
|
|
49
|
+
jni::local_ref<JResizeOptions> resize = this->getFieldValue(fieldResize);
|
|
46
50
|
return Options(
|
|
47
51
|
blur != nullptr ? std::make_optional(blur->value()) : std::nullopt,
|
|
48
52
|
cache != nullptr ? std::make_optional(cache->toCpp()) : std::nullopt,
|
|
49
|
-
cornerRadius != nullptr ? std::make_optional(cornerRadius->toCpp()) : std::nullopt
|
|
53
|
+
cornerRadius != nullptr ? std::make_optional(cornerRadius->toCpp()) : std::nullopt,
|
|
54
|
+
resize != nullptr ? std::make_optional(resize->toCpp()) : std::nullopt
|
|
50
55
|
);
|
|
51
56
|
}
|
|
52
57
|
|
|
@@ -56,14 +61,15 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
56
61
|
*/
|
|
57
62
|
[[maybe_unused]]
|
|
58
63
|
static jni::local_ref<JOptions::javaobject> fromCpp(const Options& value) {
|
|
59
|
-
using JSignature = JOptions(jni::alias_ref<jni::JDouble>, jni::alias_ref<JCacheOption>, jni::alias_ref<JVariant_Double_CornerRadii>);
|
|
64
|
+
using JSignature = JOptions(jni::alias_ref<jni::JDouble>, jni::alias_ref<JCacheOption>, jni::alias_ref<JVariant_Double_CornerRadii>, jni::alias_ref<JResizeOptions>);
|
|
60
65
|
static const auto clazz = javaClassStatic();
|
|
61
66
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
62
67
|
return create(
|
|
63
68
|
clazz,
|
|
64
69
|
value.blur.has_value() ? jni::JDouble::valueOf(value.blur.value()) : nullptr,
|
|
65
70
|
value.cache.has_value() ? JCacheOption::fromCpp(value.cache.value()) : nullptr,
|
|
66
|
-
value.cornerRadius.has_value() ? JVariant_Double_CornerRadii::fromCpp(value.cornerRadius.value()) : nullptr
|
|
71
|
+
value.cornerRadius.has_value() ? JVariant_Double_CornerRadii::fromCpp(value.cornerRadius.value()) : nullptr,
|
|
72
|
+
value.resize.has_value() ? JResizeOptions::fromCpp(value.resize.value()) : nullptr
|
|
67
73
|
);
|
|
68
74
|
}
|
|
69
75
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JResizeOptions.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 "ResizeOptions.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::nitroimagepipeline {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "ResizeOptions" and the Kotlin data class "ResizeOptions".
|
|
21
|
+
*/
|
|
22
|
+
struct JResizeOptions final: public jni::JavaClass<JResizeOptions> {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroimagepipeline/ResizeOptions;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct ResizeOptions by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
ResizeOptions toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldWidth = clazz->getField<double>("width");
|
|
35
|
+
double width = this->getFieldValue(fieldWidth);
|
|
36
|
+
static const auto fieldHeight = clazz->getField<double>("height");
|
|
37
|
+
double height = this->getFieldValue(fieldHeight);
|
|
38
|
+
return ResizeOptions(
|
|
39
|
+
width,
|
|
40
|
+
height
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JResizeOptions::javaobject> fromCpp(const ResizeOptions& value) {
|
|
50
|
+
using JSignature = JResizeOptions(double, double);
|
|
51
|
+
static const auto clazz = javaClassStatic();
|
|
52
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
53
|
+
return create(
|
|
54
|
+
clazz,
|
|
55
|
+
value.width,
|
|
56
|
+
value.height
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::nitroimagepipeline
|
|
@@ -26,7 +26,10 @@ data class Options(
|
|
|
26
26
|
val cache: CacheOption?,
|
|
27
27
|
@DoNotStrip
|
|
28
28
|
@Keep
|
|
29
|
-
val cornerRadius: Variant_Double_CornerRadii
|
|
29
|
+
val cornerRadius: Variant_Double_CornerRadii?,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val resize: ResizeOptions?
|
|
30
33
|
) {
|
|
31
34
|
/* primary constructor */
|
|
32
35
|
|
|
@@ -36,13 +39,15 @@ data class Options(
|
|
|
36
39
|
return Objects.deepEquals(this.blur, other.blur)
|
|
37
40
|
&& Objects.deepEquals(this.cache, other.cache)
|
|
38
41
|
&& Objects.deepEquals(this.cornerRadius, other.cornerRadius)
|
|
42
|
+
&& Objects.deepEquals(this.resize, other.resize)
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
override fun hashCode(): Int {
|
|
42
46
|
return arrayOf<Any?>(
|
|
43
47
|
blur,
|
|
44
48
|
cache,
|
|
45
|
-
cornerRadius
|
|
49
|
+
cornerRadius,
|
|
50
|
+
resize
|
|
46
51
|
).contentDeepHashCode()
|
|
47
52
|
}
|
|
48
53
|
|
|
@@ -54,8 +59,8 @@ data class Options(
|
|
|
54
59
|
@Keep
|
|
55
60
|
@Suppress("unused")
|
|
56
61
|
@JvmStatic
|
|
57
|
-
private fun fromCpp(blur: Double?, cache: CacheOption?, cornerRadius: Variant_Double_CornerRadii?): Options {
|
|
58
|
-
return Options(blur, cache, cornerRadius)
|
|
62
|
+
private fun fromCpp(blur: Double?, cache: CacheOption?, cornerRadius: Variant_Double_CornerRadii?, resize: ResizeOptions?): Options {
|
|
63
|
+
return Options(blur, cache, cornerRadius, resize)
|
|
59
64
|
}
|
|
60
65
|
}
|
|
61
66
|
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroimagepipeline/ResizeOptions.kt
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ResizeOptions.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 "ResizeOptions".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class ResizeOptions(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val width: Double,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val height: Double
|
|
27
|
+
) {
|
|
28
|
+
/* primary constructor */
|
|
29
|
+
|
|
30
|
+
override fun equals(other: Any?): Boolean {
|
|
31
|
+
if (this === other) return true
|
|
32
|
+
if (other !is ResizeOptions) return false
|
|
33
|
+
return Objects.deepEquals(this.width, other.width)
|
|
34
|
+
&& Objects.deepEquals(this.height, other.height)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun hashCode(): Int {
|
|
38
|
+
return arrayOf<Any?>(
|
|
39
|
+
width,
|
|
40
|
+
height
|
|
41
|
+
).contentDeepHashCode()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
companion object {
|
|
45
|
+
/**
|
|
46
|
+
* Constructor called from C++
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
@Suppress("unused")
|
|
51
|
+
@JvmStatic
|
|
52
|
+
private fun fromCpp(width: Double, height: Double): ResizeOptions {
|
|
53
|
+
return ResizeOptions(width, height)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -18,6 +18,8 @@ namespace margelo::nitro::image { class HybridImageSpec; }
|
|
|
18
18
|
namespace margelo::nitro::nitroimagepipeline { class HybridNitroImagePipelineSpec; }
|
|
19
19
|
// Forward declaration of `Options` to properly resolve imports.
|
|
20
20
|
namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
21
|
+
// Forward declaration of `ResizeOptions` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitroimagepipeline { struct ResizeOptions; }
|
|
21
23
|
|
|
22
24
|
// Forward declarations of Swift defined types
|
|
23
25
|
// Forward declaration of `HybridImageSpec_cxx` to properly resolve imports.
|
|
@@ -30,6 +32,7 @@ namespace NitroImagePipeline { class HybridNitroImagePipelineSpec_cxx; }
|
|
|
30
32
|
#include "CornerRadii.hpp"
|
|
31
33
|
#include "HybridNitroImagePipelineSpec.hpp"
|
|
32
34
|
#include "Options.hpp"
|
|
35
|
+
#include "ResizeOptions.hpp"
|
|
33
36
|
#include <NitroImage/HybridImageSpec.hpp>
|
|
34
37
|
#include <NitroModules/Promise.hpp>
|
|
35
38
|
#include <NitroModules/PromiseHolder.hpp>
|
|
@@ -190,6 +193,21 @@ namespace margelo::nitro::nitroimagepipeline::bridge::swift {
|
|
|
190
193
|
return optional.value();
|
|
191
194
|
}
|
|
192
195
|
|
|
196
|
+
// pragma MARK: std::optional<ResizeOptions>
|
|
197
|
+
/**
|
|
198
|
+
* Specialized version of `std::optional<ResizeOptions>`.
|
|
199
|
+
*/
|
|
200
|
+
using std__optional_ResizeOptions_ = std::optional<ResizeOptions>;
|
|
201
|
+
inline std::optional<ResizeOptions> create_std__optional_ResizeOptions_(const ResizeOptions& value) noexcept {
|
|
202
|
+
return std::optional<ResizeOptions>(value);
|
|
203
|
+
}
|
|
204
|
+
inline bool has_value_std__optional_ResizeOptions_(const std::optional<ResizeOptions>& optional) noexcept {
|
|
205
|
+
return optional.has_value();
|
|
206
|
+
}
|
|
207
|
+
inline ResizeOptions get_std__optional_ResizeOptions_(const std::optional<ResizeOptions>& optional) noexcept {
|
|
208
|
+
return optional.value();
|
|
209
|
+
}
|
|
210
|
+
|
|
193
211
|
// pragma MARK: std::optional<Options>
|
|
194
212
|
/**
|
|
195
213
|
* Specialized version of `std::optional<Options>`.
|
|
@@ -18,12 +18,15 @@ namespace margelo::nitro::image { class HybridImageSpec; }
|
|
|
18
18
|
namespace margelo::nitro::nitroimagepipeline { class HybridNitroImagePipelineSpec; }
|
|
19
19
|
// Forward declaration of `Options` to properly resolve imports.
|
|
20
20
|
namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
21
|
+
// Forward declaration of `ResizeOptions` to properly resolve imports.
|
|
22
|
+
namespace margelo::nitro::nitroimagepipeline { struct ResizeOptions; }
|
|
21
23
|
|
|
22
24
|
// Include C++ defined types
|
|
23
25
|
#include "CacheOption.hpp"
|
|
24
26
|
#include "CornerRadii.hpp"
|
|
25
27
|
#include "HybridNitroImagePipelineSpec.hpp"
|
|
26
28
|
#include "Options.hpp"
|
|
29
|
+
#include "ResizeOptions.hpp"
|
|
27
30
|
#include <NitroImage/HybridImageSpec.hpp>
|
|
28
31
|
#include <NitroModules/Promise.hpp>
|
|
29
32
|
#include <NitroModules/Result.hpp>
|
|
@@ -20,6 +20,8 @@ namespace margelo::nitro::nitroimagepipeline { struct Options; }
|
|
|
20
20
|
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
21
21
|
// Forward declaration of `CornerRadii` to properly resolve imports.
|
|
22
22
|
namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
23
|
+
// Forward declaration of `ResizeOptions` to properly resolve imports.
|
|
24
|
+
namespace margelo::nitro::nitroimagepipeline { struct ResizeOptions; }
|
|
23
25
|
|
|
24
26
|
#include <memory>
|
|
25
27
|
#include <NitroImage/HybridImageSpec.hpp>
|
|
@@ -30,6 +32,7 @@ namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
|
30
32
|
#include "CacheOption.hpp"
|
|
31
33
|
#include "CornerRadii.hpp"
|
|
32
34
|
#include <variant>
|
|
35
|
+
#include "ResizeOptions.hpp"
|
|
33
36
|
#include <vector>
|
|
34
37
|
|
|
35
38
|
#include "NitroImagePipeline-Swift-Cxx-Umbrella.hpp"
|
|
@@ -18,7 +18,7 @@ public extension Options {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `Options`.
|
|
20
20
|
*/
|
|
21
|
-
init(blur: Double?, cache: CacheOption?, cornerRadius: Variant_Double_CornerRadii?) {
|
|
21
|
+
init(blur: Double?, cache: CacheOption?, cornerRadius: Variant_Double_CornerRadii?, resize: ResizeOptions?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_double_ in
|
|
23
23
|
if let __unwrappedValue = blur {
|
|
24
24
|
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
@@ -44,6 +44,12 @@ public extension Options {
|
|
|
44
44
|
} else {
|
|
45
45
|
return .init()
|
|
46
46
|
}
|
|
47
|
+
}(), { () -> bridge.std__optional_ResizeOptions_ in
|
|
48
|
+
if let __unwrappedValue = resize {
|
|
49
|
+
return bridge.create_std__optional_ResizeOptions_(__unwrappedValue)
|
|
50
|
+
} else {
|
|
51
|
+
return .init()
|
|
52
|
+
}
|
|
47
53
|
}())
|
|
48
54
|
}
|
|
49
55
|
|
|
@@ -87,4 +93,9 @@ public extension Options {
|
|
|
87
93
|
}
|
|
88
94
|
}()
|
|
89
95
|
}
|
|
96
|
+
|
|
97
|
+
@inline(__always)
|
|
98
|
+
var resize: ResizeOptions? {
|
|
99
|
+
return self.__resize.value
|
|
100
|
+
}
|
|
90
101
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ResizeOptions.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `ResizeOptions`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias ResizeOptions = margelo.nitro.nitroimagepipeline.ResizeOptions
|
|
14
|
+
|
|
15
|
+
public extension ResizeOptions {
|
|
16
|
+
private typealias bridge = margelo.nitro.nitroimagepipeline.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `ResizeOptions`.
|
|
20
|
+
*/
|
|
21
|
+
init(width: Double, height: Double) {
|
|
22
|
+
self.init(width, height)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var width: Double {
|
|
27
|
+
return self.__width
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var height: Double {
|
|
32
|
+
return self.__height
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -32,11 +32,14 @@
|
|
|
32
32
|
namespace margelo::nitro::nitroimagepipeline { enum class CacheOption; }
|
|
33
33
|
// Forward declaration of `CornerRadii` to properly resolve imports.
|
|
34
34
|
namespace margelo::nitro::nitroimagepipeline { struct CornerRadii; }
|
|
35
|
+
// Forward declaration of `ResizeOptions` to properly resolve imports.
|
|
36
|
+
namespace margelo::nitro::nitroimagepipeline { struct ResizeOptions; }
|
|
35
37
|
|
|
36
38
|
#include <optional>
|
|
37
39
|
#include "CacheOption.hpp"
|
|
38
40
|
#include "CornerRadii.hpp"
|
|
39
41
|
#include <variant>
|
|
42
|
+
#include "ResizeOptions.hpp"
|
|
40
43
|
|
|
41
44
|
namespace margelo::nitro::nitroimagepipeline {
|
|
42
45
|
|
|
@@ -48,10 +51,11 @@ namespace margelo::nitro::nitroimagepipeline {
|
|
|
48
51
|
std::optional<double> blur SWIFT_PRIVATE;
|
|
49
52
|
std::optional<CacheOption> cache SWIFT_PRIVATE;
|
|
50
53
|
std::optional<std::variant<double, CornerRadii>> cornerRadius SWIFT_PRIVATE;
|
|
54
|
+
std::optional<ResizeOptions> resize SWIFT_PRIVATE;
|
|
51
55
|
|
|
52
56
|
public:
|
|
53
57
|
Options() = default;
|
|
54
|
-
explicit Options(std::optional<double> blur, std::optional<CacheOption> cache, std::optional<std::variant<double, CornerRadii>> cornerRadius): blur(blur), cache(cache), cornerRadius(cornerRadius) {}
|
|
58
|
+
explicit Options(std::optional<double> blur, std::optional<CacheOption> cache, std::optional<std::variant<double, CornerRadii>> cornerRadius, std::optional<ResizeOptions> resize): blur(blur), cache(cache), cornerRadius(cornerRadius), resize(resize) {}
|
|
55
59
|
|
|
56
60
|
public:
|
|
57
61
|
friend bool operator==(const Options& lhs, const Options& rhs) = default;
|
|
@@ -69,7 +73,8 @@ namespace margelo::nitro {
|
|
|
69
73
|
return margelo::nitro::nitroimagepipeline::Options(
|
|
70
74
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "blur"))),
|
|
71
75
|
JSIConverter<std::optional<margelo::nitro::nitroimagepipeline::CacheOption>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cache"))),
|
|
72
|
-
JSIConverter<std::optional<std::variant<double, margelo::nitro::nitroimagepipeline::CornerRadii>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cornerRadius")))
|
|
76
|
+
JSIConverter<std::optional<std::variant<double, margelo::nitro::nitroimagepipeline::CornerRadii>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cornerRadius"))),
|
|
77
|
+
JSIConverter<std::optional<margelo::nitro::nitroimagepipeline::ResizeOptions>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resize")))
|
|
73
78
|
);
|
|
74
79
|
}
|
|
75
80
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitroimagepipeline::Options& arg) {
|
|
@@ -77,6 +82,7 @@ namespace margelo::nitro {
|
|
|
77
82
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "blur"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.blur));
|
|
78
83
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cache"), JSIConverter<std::optional<margelo::nitro::nitroimagepipeline::CacheOption>>::toJSI(runtime, arg.cache));
|
|
79
84
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cornerRadius"), JSIConverter<std::optional<std::variant<double, margelo::nitro::nitroimagepipeline::CornerRadii>>>::toJSI(runtime, arg.cornerRadius));
|
|
85
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "resize"), JSIConverter<std::optional<margelo::nitro::nitroimagepipeline::ResizeOptions>>::toJSI(runtime, arg.resize));
|
|
80
86
|
return obj;
|
|
81
87
|
}
|
|
82
88
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -90,6 +96,7 @@ namespace margelo::nitro {
|
|
|
90
96
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "blur")))) return false;
|
|
91
97
|
if (!JSIConverter<std::optional<margelo::nitro::nitroimagepipeline::CacheOption>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cache")))) return false;
|
|
92
98
|
if (!JSIConverter<std::optional<std::variant<double, margelo::nitro::nitroimagepipeline::CornerRadii>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cornerRadius")))) return false;
|
|
99
|
+
if (!JSIConverter<std::optional<margelo::nitro::nitroimagepipeline::ResizeOptions>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "resize")))) return false;
|
|
93
100
|
return true;
|
|
94
101
|
}
|
|
95
102
|
};
|