@shopify/react-native-skia 0.1.116 → 0.1.118
Sign up to get free protection for your applications and to get access to all the features.
- package/cpp/api/JsiSkApi.h +13 -9
- package/cpp/api/JsiSkCanvas.h +9 -1
- package/cpp/api/JsiSkPicture.h +71 -0
- package/cpp/api/JsiSkPictureFactory.h +50 -0
- package/cpp/api/JsiSkPictureRecorder.h +53 -0
- package/lib/commonjs/renderer/Canvas.js +22 -36
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +2 -24
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/components/Drawing.js +31 -0
- package/lib/commonjs/renderer/components/Drawing.js.map +1 -0
- package/lib/commonjs/renderer/components/Group.js +1 -1
- package/lib/commonjs/renderer/components/Group.js.map +1 -1
- package/lib/commonjs/renderer/components/Picture.js +35 -0
- package/lib/commonjs/renderer/components/Picture.js.map +1 -0
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +5 -34
- package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
- package/lib/commonjs/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +19 -8
- package/lib/commonjs/renderer/components/imageFilters/Shadow.js.map +1 -0
- package/lib/commonjs/renderer/components/imageFilters/index.js +4 -17
- package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
- package/lib/commonjs/renderer/components/index.js +26 -0
- package/lib/commonjs/renderer/components/index.js.map +1 -1
- package/lib/commonjs/renderer/components/maskFilters/Blur.js +1 -1
- package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
- package/lib/commonjs/renderer/components/shapes/Box.js +126 -0
- package/lib/commonjs/renderer/components/shapes/Box.js.map +1 -0
- package/lib/commonjs/renderer/components/shapes/index.js +13 -0
- package/lib/commonjs/renderer/components/shapes/index.js.map +1 -1
- package/lib/commonjs/renderer/index.js +13 -0
- package/lib/commonjs/renderer/index.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Declaration.js +8 -1
- package/lib/commonjs/renderer/nodes/Declaration.js.map +1 -1
- package/lib/commonjs/renderer/nodes/Drawing.js +5 -8
- package/lib/commonjs/renderer/nodes/Drawing.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Math.js +19 -1
- package/lib/commonjs/renderer/processors/math/Math.js.map +1 -1
- package/lib/commonjs/renderer/processors/math/Matrix3.js +11 -5
- package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
- package/lib/commonjs/renderer/typeddash.js +26 -2
- package/lib/commonjs/renderer/typeddash.js.map +1 -1
- package/lib/commonjs/renderer/useContextBridge.js +35 -0
- package/lib/commonjs/renderer/useContextBridge.js.map +1 -0
- package/lib/commonjs/skia/Canvas.js.map +1 -1
- package/lib/commonjs/skia/Picture/Picture.js +6 -0
- package/lib/commonjs/skia/Picture/Picture.js.map +1 -0
- package/lib/commonjs/skia/Picture/PictureFactory.js +6 -0
- package/lib/commonjs/skia/Picture/PictureFactory.js.map +1 -0
- package/lib/commonjs/skia/Picture/PictureRecorder.js +6 -0
- package/lib/commonjs/skia/Picture/PictureRecorder.js.map +1 -0
- package/lib/commonjs/skia/Picture/index.js +58 -0
- package/lib/commonjs/skia/Picture/index.js.map +1 -0
- package/lib/commonjs/skia/Picture/usePicture.js +30 -0
- package/lib/commonjs/skia/Picture/usePicture.js.map +1 -0
- package/lib/commonjs/skia/Skia.js +2 -0
- package/lib/commonjs/skia/Skia.js.map +1 -1
- package/lib/commonjs/skia/index.js +14 -0
- package/lib/commonjs/skia/index.js.map +1 -1
- package/lib/commonjs/values/hooks/useDerivedValue.js +2 -2
- package/lib/commonjs/values/hooks/useDerivedValue.js.map +1 -1
- package/lib/commonjs/views/SkiaView.js +6 -5
- package/lib/commonjs/views/SkiaView.js.map +1 -1
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/renderer/Canvas.js +20 -32
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +1 -23
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/components/Drawing.js +17 -0
- package/lib/module/renderer/components/Drawing.js.map +1 -0
- package/lib/module/renderer/components/Group.js +1 -1
- package/lib/module/renderer/components/Group.js.map +1 -1
- package/lib/module/renderer/components/Picture.js +21 -0
- package/lib/module/renderer/components/Picture.js.map +1 -0
- package/lib/module/renderer/components/imageFilters/InnerShadow.js +4 -26
- package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
- package/lib/module/renderer/components/imageFilters/{DropShadow.js → Shadow.js} +16 -6
- package/lib/module/renderer/components/imageFilters/Shadow.js.map +1 -0
- package/lib/module/renderer/components/imageFilters/index.js +1 -2
- package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
- package/lib/module/renderer/components/index.js +2 -0
- package/lib/module/renderer/components/index.js.map +1 -1
- package/lib/module/renderer/components/maskFilters/Blur.js +1 -1
- package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
- package/lib/module/renderer/components/shapes/Box.js +102 -0
- package/lib/module/renderer/components/shapes/Box.js.map +1 -0
- package/lib/module/renderer/components/shapes/index.js +1 -0
- package/lib/module/renderer/components/shapes/index.js.map +1 -1
- package/lib/module/renderer/index.js +1 -0
- package/lib/module/renderer/index.js.map +1 -1
- package/lib/module/renderer/nodes/Declaration.js +3 -0
- package/lib/module/renderer/nodes/Declaration.js.map +1 -1
- package/lib/module/renderer/nodes/Drawing.js +3 -4
- package/lib/module/renderer/nodes/Drawing.js.map +1 -1
- package/lib/module/renderer/processors/math/Math.js +15 -0
- package/lib/module/renderer/processors/math/Math.js.map +1 -1
- package/lib/module/renderer/processors/math/Matrix3.js +6 -2
- package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
- package/lib/module/renderer/typeddash.js +21 -0
- package/lib/module/renderer/typeddash.js.map +1 -1
- package/lib/module/renderer/useContextBridge.js +21 -0
- package/lib/module/renderer/useContextBridge.js.map +1 -0
- package/lib/module/skia/Canvas.js.map +1 -1
- package/lib/module/skia/Picture/Picture.js +2 -0
- package/lib/module/skia/Picture/Picture.js.map +1 -0
- package/lib/module/skia/Picture/PictureFactory.js +2 -0
- package/lib/module/skia/Picture/PictureFactory.js.map +1 -0
- package/lib/module/skia/Picture/PictureRecorder.js +2 -0
- package/lib/module/skia/Picture/PictureRecorder.js.map +1 -0
- package/lib/module/skia/Picture/index.js +5 -0
- package/lib/module/skia/Picture/index.js.map +1 -0
- package/lib/module/skia/Picture/usePicture.js +19 -0
- package/lib/module/skia/Picture/usePicture.js.map +1 -0
- package/lib/module/skia/Skia.js +2 -0
- package/lib/module/skia/Skia.js.map +1 -1
- package/lib/module/skia/index.js +1 -0
- package/lib/module/skia/index.js.map +1 -1
- package/lib/module/values/hooks/useDerivedValue.js +1 -1
- package/lib/module/values/hooks/useDerivedValue.js.map +1 -1
- package/lib/module/views/SkiaView.js +6 -5
- package/lib/module/views/SkiaView.js.map +1 -1
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +5 -10
- package/lib/typescript/src/renderer/components/Drawing.d.ts +7 -0
- package/lib/typescript/src/renderer/components/Picture.d.ts +6 -0
- package/lib/typescript/src/renderer/components/imageFilters/InnerShadow.d.ts +3 -12
- package/lib/typescript/src/renderer/components/imageFilters/{DropShadow.d.ts → Shadow.d.ts} +3 -2
- package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -2
- package/lib/typescript/src/renderer/components/index.d.ts +2 -0
- package/lib/typescript/src/renderer/components/shapes/Box.d.ts +23 -0
- package/lib/typescript/src/renderer/components/shapes/index.d.ts +1 -0
- package/lib/typescript/src/renderer/index.d.ts +1 -0
- package/lib/typescript/src/renderer/nodes/Declaration.d.ts +2 -0
- package/lib/typescript/src/renderer/nodes/Drawing.d.ts +2 -2
- package/lib/typescript/src/renderer/processors/math/Math.d.ts +14 -0
- package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -0
- package/lib/typescript/src/renderer/typeddash.d.ts +1 -0
- package/lib/typescript/src/renderer/useContextBridge.d.ts +5 -0
- package/lib/typescript/src/skia/Canvas.d.ts +6 -0
- package/lib/typescript/src/skia/Picture/Picture.d.ts +26 -0
- package/lib/typescript/src/skia/Picture/PictureFactory.d.ts +8 -0
- package/lib/typescript/src/skia/Picture/PictureRecorder.d.ts +15 -0
- package/lib/typescript/src/skia/Picture/index.d.ts +4 -0
- package/lib/typescript/src/skia/Picture/usePicture.d.ts +11 -0
- package/lib/typescript/src/skia/Skia.d.ts +5 -0
- package/lib/typescript/src/skia/index.d.ts +1 -0
- package/lib/typescript/src/views/SkiaView.d.ts +25 -1
- package/lib/typescript/src/views/types.d.ts +0 -24
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/src/renderer/Canvas.tsx +14 -30
- package/src/renderer/HostConfig.ts +1 -19
- package/src/renderer/components/Drawing.tsx +16 -0
- package/src/renderer/components/Group.tsx +1 -1
- package/src/renderer/components/Picture.tsx +17 -0
- package/src/renderer/components/imageFilters/InnerShadow.tsx +33 -47
- package/src/renderer/components/imageFilters/Shadow.tsx +39 -0
- package/src/renderer/components/imageFilters/index.ts +1 -2
- package/src/renderer/components/index.ts +2 -0
- package/src/renderer/components/maskFilters/Blur.tsx +1 -1
- package/src/renderer/components/shapes/Box.tsx +98 -0
- package/src/renderer/components/shapes/index.ts +1 -0
- package/src/renderer/index.ts +1 -0
- package/src/renderer/nodes/Declaration.tsx +10 -0
- package/src/renderer/nodes/Drawing.tsx +6 -6
- package/src/renderer/processors/math/Math.ts +16 -0
- package/src/renderer/processors/math/Matrix3.ts +35 -31
- package/src/renderer/typeddash.ts +18 -0
- package/src/renderer/useContextBridge.tsx +21 -0
- package/src/skia/Canvas.ts +7 -0
- package/src/skia/Picture/Picture.ts +34 -0
- package/src/skia/Picture/PictureFactory.ts +9 -0
- package/src/skia/Picture/PictureRecorder.ts +18 -0
- package/src/skia/Picture/index.ts +4 -0
- package/src/skia/Picture/usePicture.ts +28 -0
- package/src/skia/Skia.ts +5 -0
- package/src/skia/index.ts +1 -0
- package/src/values/hooks/useDerivedValue.ts +1 -1
- package/src/views/SkiaView.tsx +27 -3
- package/src/views/types.ts +0 -25
- package/lib/commonjs/renderer/components/imageFilters/DropShadow.js.map +0 -1
- package/lib/module/renderer/components/imageFilters/DropShadow.js.map +0 -1
- package/src/renderer/components/imageFilters/DropShadow.tsx +0 -31
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { InputColorMatrix } from "../ColorFilter";
|
2
|
+
import type { FilterMode } from "../Image";
|
3
|
+
import type { TileMode } from "../ImageFilter";
|
4
|
+
import type { SkRect } from "../Rect";
|
5
|
+
import type { IShader } from "../Shader";
|
6
|
+
|
7
|
+
export interface SkPicture {
|
8
|
+
/**
|
9
|
+
* Returns a new shader that will draw with this picture.
|
10
|
+
*
|
11
|
+
* @param tmx The tiling mode to use when sampling in the x-direction.
|
12
|
+
* @param tmy The tiling mode to use when sampling in the y-direction.
|
13
|
+
* @param mode How to filter the tiles
|
14
|
+
* @param localMatrix Optional matrix used when sampling
|
15
|
+
* @param tileRect The tile rectangle in picture coordinates: this represents the subset
|
16
|
+
* (or superset) of the picture used when building a tile. It is not
|
17
|
+
* affected by localMatrix and does not imply scaling (only translation
|
18
|
+
* and cropping). If null, the tile rect is considered equal to the picture
|
19
|
+
* bounds.
|
20
|
+
*/
|
21
|
+
makeShader(
|
22
|
+
tmx: TileMode,
|
23
|
+
tmy: TileMode,
|
24
|
+
mode: FilterMode,
|
25
|
+
localMatrix?: InputColorMatrix,
|
26
|
+
tileRect?: SkRect
|
27
|
+
): IShader;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Returns the serialized format of this SkPicture. The format may change at anytime and
|
31
|
+
* no promises are made for backwards or forward compatibility.
|
32
|
+
*/
|
33
|
+
serialize(): Uint8Array | null;
|
34
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import type { SkCanvas } from "../Canvas";
|
2
|
+
import type { SkRect } from "../Rect";
|
3
|
+
|
4
|
+
import type { SkPicture } from "./Picture";
|
5
|
+
|
6
|
+
export interface SkPictureRecorder {
|
7
|
+
/**
|
8
|
+
* Returns a canvas on which to draw. When done drawing, call finishRecordingAsPicture()
|
9
|
+
*
|
10
|
+
* @param bounds - a rect to cull the results.
|
11
|
+
*/
|
12
|
+
beginRecording(bounds: SkRect): SkCanvas;
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Returns the captured draw commands as a picture and invalidates the canvas returned earlier.
|
16
|
+
*/
|
17
|
+
finishRecordingAsPicture(): SkPicture;
|
18
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import type { DependencyList } from "react";
|
2
|
+
import { useMemo } from "react";
|
3
|
+
|
4
|
+
import type { SkCanvas } from "../Canvas";
|
5
|
+
import type { SkRect } from "../Rect";
|
6
|
+
import { Skia } from "../Skia";
|
7
|
+
|
8
|
+
import type { SkPicture } from "./Picture";
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Memoizes and returns an SkPicture that can be drawn to another canvas.
|
12
|
+
* @param rect Picture bounds
|
13
|
+
* @param cb Callback for drawing to the canvas
|
14
|
+
* @returns SkPicture
|
15
|
+
*/
|
16
|
+
export const usePicture = (
|
17
|
+
rect: SkRect,
|
18
|
+
cb: (canvas: SkCanvas) => void,
|
19
|
+
deps: DependencyList = []
|
20
|
+
): SkPicture => {
|
21
|
+
return useMemo(() => {
|
22
|
+
const recorder = Skia.PictureRecorder();
|
23
|
+
const canvas = recorder.beginRecording(rect);
|
24
|
+
cb(canvas);
|
25
|
+
return recorder.finishRecordingAsPicture();
|
26
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
27
|
+
}, [cb, rect, deps]);
|
28
|
+
};
|
package/src/skia/Skia.ts
CHANGED
@@ -26,6 +26,7 @@ import "./NativeSetup";
|
|
26
26
|
import type { SkRSXform } from "./RSXform";
|
27
27
|
import type { SkPath } from "./Path/Path";
|
28
28
|
import type { SkContourMeasureIter } from "./ContourMeasure";
|
29
|
+
import type { PictureFactory, SkPictureRecorder } from "./Picture";
|
29
30
|
|
30
31
|
/**
|
31
32
|
* Declares the interface for the native Skia API
|
@@ -41,6 +42,8 @@ export interface Skia {
|
|
41
42
|
resScale: number
|
42
43
|
) => SkContourMeasureIter;
|
43
44
|
Paint: () => SkPaint;
|
45
|
+
PictureRecorder: () => SkPictureRecorder;
|
46
|
+
Picture: PictureFactory;
|
44
47
|
Path: PathFactory;
|
45
48
|
Matrix: () => SkMatrix;
|
46
49
|
ColorFilter: ColorFilterFactory;
|
@@ -106,6 +109,8 @@ export const Skia = {
|
|
106
109
|
XYWHRect: SkiaApi.XYWHRect,
|
107
110
|
RRectXY: SkiaApi.RRectXY,
|
108
111
|
Paint: SkiaApi.Paint,
|
112
|
+
PictureRecorder: SkiaApi.PictureRecorder,
|
113
|
+
Picture: SkiaApi.Picture,
|
109
114
|
Path: SkiaApi.Path,
|
110
115
|
ColorFilter: SkiaApi.ColorFilter,
|
111
116
|
ContourMeasureIter: SkiaApi.ContourMeasureIter,
|
package/src/skia/index.ts
CHANGED
package/src/views/SkiaView.tsx
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import React from "react";
|
2
|
+
import type { ViewProps } from "react-native";
|
2
3
|
import { requireNativeComponent } from "react-native";
|
3
4
|
|
4
5
|
import type { SkImage, SkRect } from "../skia";
|
@@ -6,7 +7,6 @@ import type { SkiaReadonlyValue } from "../values";
|
|
6
7
|
|
7
8
|
import type {
|
8
9
|
DrawMode,
|
9
|
-
SkiaViewProps,
|
10
10
|
RNSkiaDrawCallback,
|
11
11
|
NativeSkiaViewProps,
|
12
12
|
} from "./types";
|
@@ -35,6 +35,30 @@ declare global {
|
|
35
35
|
|
36
36
|
const { SkiaViewApi } = global;
|
37
37
|
|
38
|
+
export interface SkiaViewProps extends ViewProps {
|
39
|
+
/**
|
40
|
+
* Sets the drawing mode for the skia view. There are two drawing
|
41
|
+
* modes, "continuous" and "default", where the continuous mode will
|
42
|
+
* continuously redraw the view, and the default mode will only
|
43
|
+
* redraw when any of the regular react properties are changed like
|
44
|
+
* sizes and margins.
|
45
|
+
*/
|
46
|
+
mode?: DrawMode;
|
47
|
+
/**
|
48
|
+
* When set to true the view will display information about the
|
49
|
+
* average time it takes to render.
|
50
|
+
*/
|
51
|
+
debug?: boolean;
|
52
|
+
/**
|
53
|
+
* Draw callback. Will be called whenever the view is invalidated and
|
54
|
+
* needs to redraw. This is either caused by a change in a react
|
55
|
+
* property, a touch event, or a call to redraw. If the view is in
|
56
|
+
* continuous mode the callback will be called 60 frames per second
|
57
|
+
* by the native view.
|
58
|
+
*/
|
59
|
+
onDraw?: RNSkiaDrawCallback;
|
60
|
+
}
|
61
|
+
|
38
62
|
export class SkiaView extends React.Component<SkiaViewProps> {
|
39
63
|
constructor(props: SkiaViewProps) {
|
40
64
|
super(props);
|
@@ -103,14 +127,14 @@ export class SkiaView extends React.Component<SkiaViewProps> {
|
|
103
127
|
}
|
104
128
|
|
105
129
|
render() {
|
106
|
-
const {
|
130
|
+
const { mode, debug = false, ...viewProps } = this.props;
|
107
131
|
return (
|
108
132
|
<NativeSkiaView
|
109
|
-
style={style}
|
110
133
|
collapsable={false}
|
111
134
|
nativeID={`${this._nativeId}`}
|
112
135
|
mode={mode}
|
113
136
|
debug={debug}
|
137
|
+
{...viewProps}
|
114
138
|
/>
|
115
139
|
);
|
116
140
|
}
|
package/src/views/types.ts
CHANGED
@@ -47,31 +47,6 @@ export type TouchHandler = (touchInfo: Array<Array<TouchInfo>>) => void;
|
|
47
47
|
|
48
48
|
export type RNSkiaDrawCallback = (canvas: SkCanvas, info: DrawingInfo) => void;
|
49
49
|
|
50
|
-
export type SkiaViewProps = {
|
51
|
-
style?: ViewProps["style"];
|
52
|
-
/**
|
53
|
-
* Sets the drawing mode for the skia view. There are two drawing
|
54
|
-
* modes, "continuous" and "default", where the continuous mode will
|
55
|
-
* continuously redraw the view, and the default mode will only
|
56
|
-
* redraw when any of the regular react properties are changed like
|
57
|
-
* sizes and margins.
|
58
|
-
*/
|
59
|
-
mode?: DrawMode;
|
60
|
-
/**
|
61
|
-
* When set to true the view will display information about the
|
62
|
-
* average time it takes to render.
|
63
|
-
*/
|
64
|
-
debug?: boolean;
|
65
|
-
/**
|
66
|
-
* Draw callback. Will be called whenever the view is invalidated and
|
67
|
-
* needs to redraw. This is either caused by a change in a react
|
68
|
-
* property, a touch event, or a call to redraw. If the view is in
|
69
|
-
* continuous mode the callback will be called 60 frames per second
|
70
|
-
* by the native view.
|
71
|
-
*/
|
72
|
-
onDraw?: RNSkiaDrawCallback;
|
73
|
-
};
|
74
|
-
|
75
50
|
/**
|
76
51
|
* Listener interface for value changes
|
77
52
|
*/
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["DropShadow.tsx"],"names":["onDeclare","children","dx","dy","blur","color","shadowOnly","opacity","input","factory","Skia","ImageFilter","MakeDropShadowOnly","MakeDropShadow","DropShadow","props"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AAGA;;AAEA;;;;;;AAUA,MAAMA,SAAS,GAAG,oCAChB,OAAsCC,QAAtC,YAAgE;AAAA,MAA/D;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAhB;AAAuBC,IAAAA;AAAvB,GAA+D;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC9D,QAAMC,KAAK,GAAG,wBAASP,QAAT,CAAd;AACA,QAAMQ,OAAO,GAAGH,UAAU,GACtBI,WAAKC,WAAL,CAAiBC,kBADK,GAEtBF,WAAKC,WAAL,CAAiBE,cAFrB;AAGA,SAAOJ,OAAO,CAACP,EAAD,EAAKC,EAAL,EAASC,IAAT,EAAeA,IAAf,EAAqB,yBAAaC,KAAb,EAAoBE,OAApB,CAArB,EAAmDC,KAAnD,CAAd;AACD,CAPe,CAAlB;;AAUO,MAAMM,UAAU,GAAIC,KAAD,IAA2C;AACnE,sBAAO;AAAe,IAAA,SAAS,EAAEf;AAA1B,KAAyCe,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { Color } from \"../../../skia/Color\";\nimport { processColor } from \"../../../skia/Color\";\n\nimport { getInput } from \"./getInput\";\n\nexport interface DropShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<DropShadowProps>(\n ({ dx, dy, blur, color, shadowOnly }, children, { opacity }) => {\n const input = getInput(children);\n const factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly\n : Skia.ImageFilter.MakeDropShadow;\n return factory(dx, dy, blur, blur, processColor(color, opacity), input);\n }\n);\n\nexport const DropShadow = (props: AnimatedProps<DropShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["DropShadow.tsx"],"names":["React","Skia","createDeclaration","processColor","getInput","onDeclare","children","dx","dy","blur","color","shadowOnly","opacity","input","factory","ImageFilter","MakeDropShadowOnly","MakeDropShadow","DropShadow","props"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,IAAT,QAAqB,eAArB;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AAGA,SAASC,YAAT,QAA6B,qBAA7B;AAEA,SAASC,QAAT,QAAyB,YAAzB;AAUA,MAAMC,SAAS,GAAGH,iBAAiB,CACjC,OAAsCI,QAAtC,YAAgE;AAAA,MAA/D;AAAEC,IAAAA,EAAF;AAAMC,IAAAA,EAAN;AAAUC,IAAAA,IAAV;AAAgBC,IAAAA,KAAhB;AAAuBC,IAAAA;AAAvB,GAA+D;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC9D,QAAMC,KAAK,GAAGT,QAAQ,CAACE,QAAD,CAAtB;AACA,QAAMQ,OAAO,GAAGH,UAAU,GACtBV,IAAI,CAACc,WAAL,CAAiBC,kBADK,GAEtBf,IAAI,CAACc,WAAL,CAAiBE,cAFrB;AAGA,SAAOH,OAAO,CAACP,EAAD,EAAKC,EAAL,EAASC,IAAT,EAAeA,IAAf,EAAqBN,YAAY,CAACO,KAAD,EAAQE,OAAR,CAAjC,EAAmDC,KAAnD,CAAd;AACD,CAPgC,CAAnC;AAUA,OAAO,MAAMK,UAAU,GAAIC,KAAD,IAA2C;AACnE,sBAAO;AAAe,IAAA,SAAS,EAAEd;AAA1B,KAAyCc,KAAzC,EAAP;AACD,CAFM","sourcesContent":["import React from \"react\";\n\nimport { Skia } from \"../../../skia\";\nimport { createDeclaration } from \"../../nodes/Declaration\";\nimport type { AnimatedProps } from \"../../processors/Animations/Animations\";\nimport type { Color } from \"../../../skia/Color\";\nimport { processColor } from \"../../../skia/Color\";\n\nimport { getInput } from \"./getInput\";\n\nexport interface DropShadowProps {\n dx: number;\n dy: number;\n blur: number;\n color: Color;\n shadowOnly?: boolean;\n}\n\nconst onDeclare = createDeclaration<DropShadowProps>(\n ({ dx, dy, blur, color, shadowOnly }, children, { opacity }) => {\n const input = getInput(children);\n const factory = shadowOnly\n ? Skia.ImageFilter.MakeDropShadowOnly\n : Skia.ImageFilter.MakeDropShadow;\n return factory(dx, dy, blur, blur, processColor(color, opacity), input);\n }\n);\n\nexport const DropShadow = (props: AnimatedProps<DropShadowProps>) => {\n return <skDeclaration onDeclare={onDeclare} {...props} />;\n};\n"]}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import React from "react";
|
2
|
-
|
3
|
-
import { Skia } from "../../../skia";
|
4
|
-
import { createDeclaration } from "../../nodes/Declaration";
|
5
|
-
import type { AnimatedProps } from "../../processors/Animations/Animations";
|
6
|
-
import type { Color } from "../../../skia/Color";
|
7
|
-
import { processColor } from "../../../skia/Color";
|
8
|
-
|
9
|
-
import { getInput } from "./getInput";
|
10
|
-
|
11
|
-
export interface DropShadowProps {
|
12
|
-
dx: number;
|
13
|
-
dy: number;
|
14
|
-
blur: number;
|
15
|
-
color: Color;
|
16
|
-
shadowOnly?: boolean;
|
17
|
-
}
|
18
|
-
|
19
|
-
const onDeclare = createDeclaration<DropShadowProps>(
|
20
|
-
({ dx, dy, blur, color, shadowOnly }, children, { opacity }) => {
|
21
|
-
const input = getInput(children);
|
22
|
-
const factory = shadowOnly
|
23
|
-
? Skia.ImageFilter.MakeDropShadowOnly
|
24
|
-
: Skia.ImageFilter.MakeDropShadow;
|
25
|
-
return factory(dx, dy, blur, blur, processColor(color, opacity), input);
|
26
|
-
}
|
27
|
-
);
|
28
|
-
|
29
|
-
export const DropShadow = (props: AnimatedProps<DropShadowProps>) => {
|
30
|
-
return <skDeclaration onDeclare={onDeclare} {...props} />;
|
31
|
-
};
|