@shopify/react-native-skia 0.1.172 → 0.1.173
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +1 -0
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +5 -0
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +106 -5
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -1
- package/cpp/api/JsiSkSurface.h +7 -1
- package/cpp/api/JsiSkSurfaceFactory.h +15 -2
- package/cpp/rnskia/RNSkDomView.cpp +2 -4
- package/cpp/rnskia/RNSkJsView.cpp +3 -0
- package/cpp/rnskia/RNSkPictureView.h +3 -0
- package/cpp/rnskia/RNSkPlatformContext.h +9 -0
- package/cpp/rnskia/dom/JsiDomApi.h +1 -0
- package/cpp/rnskia/dom/base/ConcatablePaint.cpp +117 -0
- package/cpp/rnskia/dom/base/ConcatablePaint.h +49 -0
- package/cpp/rnskia/dom/base/Declaration.h +88 -0
- package/cpp/rnskia/dom/base/DeclarationContext.h +79 -0
- package/cpp/rnskia/dom/base/DerivedNodeProp.h +25 -9
- package/cpp/rnskia/dom/base/DrawingContext.cpp +32 -186
- package/cpp/rnskia/dom/base/DrawingContext.h +45 -64
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +35 -106
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +28 -9
- package/cpp/rnskia/dom/base/JsiDomNode.h +46 -17
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +81 -67
- package/cpp/rnskia/dom/base/NodeProp.h +12 -2
- package/cpp/rnskia/dom/base/NodePropsContainer.h +15 -16
- package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +22 -11
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +43 -59
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +16 -17
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +6 -5
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +45 -69
- package/cpp/rnskia/dom/nodes/JsiGroupNode.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +121 -161
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -0
- package/cpp/rnskia/dom/nodes/JsiLayerNode.h +28 -18
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +82 -45
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +68 -101
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +3 -2
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +150 -207
- package/cpp/rnskia/dom/props/BezierProps.h +4 -2
- package/cpp/rnskia/dom/props/BlendModeProp.h +4 -2
- package/cpp/rnskia/dom/props/BoxShadowProps.h +8 -10
- package/cpp/rnskia/dom/props/CircleProp.h +6 -5
- package/cpp/rnskia/dom/props/ClipProp.h +6 -4
- package/cpp/rnskia/dom/props/ColorProp.h +8 -4
- package/cpp/rnskia/dom/props/DrawingProp.h +5 -3
- package/cpp/rnskia/dom/props/FontProp.h +4 -2
- package/cpp/rnskia/dom/props/GlyphsProp.h +4 -2
- package/cpp/rnskia/dom/props/ImageProps.h +9 -6
- package/cpp/rnskia/dom/props/LayerProp.h +6 -4
- package/cpp/rnskia/dom/props/MatrixProp.h +4 -2
- package/cpp/rnskia/dom/props/NumbersProp.h +8 -4
- package/cpp/rnskia/dom/props/PaintProps.h +55 -92
- package/cpp/rnskia/dom/props/PathProp.h +4 -2
- package/cpp/rnskia/dom/props/PictureProp.h +4 -2
- package/cpp/rnskia/dom/props/PointProp.h +4 -2
- package/cpp/rnskia/dom/props/PointsProp.h +8 -4
- package/cpp/rnskia/dom/props/RRectProp.h +23 -16
- package/cpp/rnskia/dom/props/RadiusProp.h +4 -2
- package/cpp/rnskia/dom/props/RectProp.h +18 -12
- package/cpp/rnskia/dom/props/StrokeProps.h +8 -4
- package/cpp/rnskia/dom/props/SvgProp.h +4 -2
- package/cpp/rnskia/dom/props/TextBlobProp.h +10 -8
- package/cpp/rnskia/dom/props/TileModeProp.h +4 -2
- package/cpp/rnskia/dom/props/TransformProp.h +4 -2
- package/cpp/rnskia/dom/props/TransformsProps.h +5 -7
- package/cpp/rnskia/dom/props/UniformsProp.h +4 -2
- package/cpp/rnskia/dom/props/VertexModeProp.h +4 -2
- package/cpp/rnskia/dom/props/VerticesProps.h +7 -11
- package/ios/RNSkia-iOS/DisplayLink.mm +22 -24
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +53 -50
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +38 -25
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaManager.mm +12 -10
- package/ios/RNSkia-iOS/SkiaMetalRenderer.h +5 -0
- package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +53 -0
- package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaUIView.mm +63 -53
- package/ios/RNSkiaModule.mm +5 -7
- package/lib/commonjs/dom/nodes/DrawingNode.js +5 -1
- package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/commonjs/dom/nodes/LayerNode.js +13 -6
- package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/Node.d.ts +6 -11
- package/lib/commonjs/dom/nodes/Node.js +8 -26
- package/lib/commonjs/dom/nodes/Node.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintContext.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/commonjs/dom/nodes/PaintNode.js +32 -15
- package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/commonjs/dom/nodes/RenderNode.js +19 -187
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js +25 -7
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js +3 -0
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/commonjs/dom/nodes/paint/BlendNode.js +16 -47
- package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js +29 -43
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js +45 -42
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js +3 -2
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/commonjs/dom/nodes/paint/PathEffects.js +30 -72
- package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/commonjs/dom/nodes/paint/Shaders.js +28 -18
- package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/commonjs/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/commonjs/dom/types/DeclarationContext.js +118 -0
- package/lib/commonjs/dom/types/DeclarationContext.js.map +1 -0
- package/lib/commonjs/dom/types/DrawingContext.d.ts +18 -1
- package/lib/commonjs/dom/types/DrawingContext.js +330 -0
- package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
- package/lib/commonjs/dom/types/Node.d.ts +4 -10
- package/lib/commonjs/dom/types/Node.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.d.ts +22 -23
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/dom/types/index.d.ts +1 -0
- package/lib/commonjs/dom/types/index.js +13 -0
- package/lib/commonjs/dom/types/index.js.map +1 -1
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +3 -3
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DrawingContext.d.ts +4 -3
- package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +35 -35
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +1 -0
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +2 -0
- package/lib/commonjs/renderer/Offscreen.js +31 -0
- package/lib/commonjs/renderer/Offscreen.js.map +1 -0
- package/lib/commonjs/renderer/Reconciler.js +0 -1
- package/lib/commonjs/renderer/Reconciler.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js +4 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +21 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +6 -4
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.js +3 -14
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.web.js +0 -7
- package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaView.web.js +0 -7
- package/lib/commonjs/views/SkiaView.web.js.map +1 -1
- package/lib/module/dom/nodes/DrawingNode.js +5 -1
- package/lib/module/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/module/dom/nodes/LayerNode.js +13 -7
- package/lib/module/dom/nodes/LayerNode.js.map +1 -1
- package/lib/module/dom/nodes/Node.d.ts +6 -11
- package/lib/module/dom/nodes/Node.js +8 -25
- package/lib/module/dom/nodes/Node.js.map +1 -1
- package/lib/module/dom/nodes/PaintContext.js.map +1 -1
- package/lib/module/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/module/dom/nodes/PaintNode.js +32 -15
- package/lib/module/dom/nodes/PaintNode.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/module/dom/nodes/RenderNode.js +20 -187
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js +23 -4
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/module/dom/nodes/drawings/Box.js +3 -0
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/module/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/module/dom/nodes/paint/BlendNode.js +15 -46
- package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/module/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/module/dom/nodes/paint/ColorFilters.js +29 -43
- package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/module/dom/nodes/paint/ImageFilters.js +48 -41
- package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/module/dom/nodes/paint/MaskFilters.js +3 -2
- package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/module/dom/nodes/paint/PathEffects.js +29 -72
- package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/module/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/module/dom/nodes/paint/Shaders.js +28 -18
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/module/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/module/dom/types/DeclarationContext.js +107 -0
- package/lib/module/dom/types/DeclarationContext.js.map +1 -0
- package/lib/module/dom/types/DrawingContext.d.ts +18 -1
- package/lib/module/dom/types/DrawingContext.js +322 -1
- package/lib/module/dom/types/DrawingContext.js.map +1 -1
- package/lib/module/dom/types/Node.d.ts +4 -10
- package/lib/module/dom/types/Node.js.map +1 -1
- package/lib/module/dom/types/SkDOM.d.ts +22 -23
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/dom/types/index.d.ts +1 -0
- package/lib/module/dom/types/index.js +1 -0
- package/lib/module/dom/types/index.js.map +1 -1
- package/lib/module/index.d.ts +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +3 -3
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DrawingContext.d.ts +4 -3
- package/lib/module/renderer/DrawingContext.js.map +1 -1
- package/lib/module/renderer/HostComponents.d.ts +35 -35
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +1 -0
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +2 -0
- package/lib/module/renderer/Offscreen.js +19 -0
- package/lib/module/renderer/Offscreen.js.map +1 -0
- package/lib/module/renderer/Reconciler.js +0 -1
- package/lib/module/renderer/Reconciler.js.map +1 -1
- package/lib/module/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/module/skia/types/Surface/Surface.js.map +1 -1
- package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/module/skia/web/JsiSkSurface.js +4 -0
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +21 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +6 -4
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.js +2 -11
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +0 -5
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/views/SkiaView.web.js +0 -5
- package/lib/module/views/SkiaView.web.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/typescript/src/dom/nodes/Node.d.ts +6 -11
- package/lib/typescript/src/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/typescript/src/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/typescript/src/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/typescript/src/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/typescript/src/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/typescript/src/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/typescript/src/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/typescript/src/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/typescript/src/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/typescript/src/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/typescript/src/dom/types/DrawingContext.d.ts +18 -1
- package/lib/typescript/src/dom/types/Node.d.ts +4 -10
- package/lib/typescript/src/dom/types/SkDOM.d.ts +22 -23
- package/lib/typescript/src/dom/types/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/renderer/DrawingContext.d.ts +4 -3
- package/lib/typescript/src/renderer/HostComponents.d.ts +35 -35
- package/lib/typescript/src/renderer/Offscreen.d.ts +2 -0
- package/lib/typescript/src/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/package.json +1 -1
- package/src/dom/nodes/DrawingNode.ts +5 -1
- package/src/dom/nodes/LayerNode.ts +13 -11
- package/src/dom/nodes/Node.ts +18 -41
- package/src/dom/nodes/PaintContext.ts +1 -0
- package/src/dom/nodes/PaintNode.ts +28 -18
- package/src/dom/nodes/RenderNode.ts +25 -183
- package/src/dom/nodes/drawings/BackdropFilterNode.ts +18 -11
- package/src/dom/nodes/drawings/Box.ts +6 -4
- package/src/dom/nodes/paint/BlendNode.ts +16 -63
- package/src/dom/nodes/paint/ColorFilters.ts +32 -55
- package/src/dom/nodes/paint/ImageFilters.ts +58 -53
- package/src/dom/nodes/paint/MaskFilters.ts +5 -7
- package/src/dom/nodes/paint/PathEffects.ts +37 -90
- package/src/dom/nodes/paint/Shaders.ts +31 -29
- package/src/dom/types/DeclarationContext.ts +105 -0
- package/src/dom/types/DrawingContext.ts +304 -1
- package/src/dom/types/Node.ts +4 -20
- package/src/dom/types/SkDOM.ts +22 -43
- package/src/dom/types/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/renderer/Canvas.tsx +3 -3
- package/src/renderer/DrawingContext.ts +4 -5
- package/src/renderer/HostComponents.ts +34 -53
- package/src/renderer/HostConfig.ts +1 -0
- package/src/renderer/Offscreen.tsx +24 -0
- package/src/renderer/Reconciler.tsx +0 -1
- package/src/skia/types/Surface/Surface.ts +5 -0
- package/src/skia/types/Surface/SurfaceFactory.ts +7 -0
- package/src/skia/web/JsiSkSurface.ts +4 -0
- package/src/skia/web/JsiSkSurfaceFactory.ts +21 -2
- package/src/views/SkiaBaseWebView.tsx +6 -2
- package/src/views/SkiaDomView.web.tsx +2 -13
- package/src/views/SkiaPictureView.web.tsx +0 -7
- package/src/views/SkiaView.web.tsx +0 -7
@@ -7,36 +7,13 @@ export class ColorFilterDeclaration extends JsiDeclarationNode {
|
|
7
7
|
super(ctx, DeclarationType.ColorFilter, type, props);
|
8
8
|
}
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
insertChildBefore(child, before) {
|
19
|
-
if (!(child instanceof ColorFilterDeclaration)) {
|
20
|
-
throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
|
21
|
-
}
|
22
|
-
|
23
|
-
super.insertChildBefore(child, before);
|
24
|
-
}
|
25
|
-
|
26
|
-
compose(filter) {
|
27
|
-
const children = this._children;
|
28
|
-
|
29
|
-
if (this._children.length === 0) {
|
30
|
-
return filter;
|
31
|
-
} else {
|
32
|
-
return this.Skia.ColorFilter.MakeCompose(filter, children.reduce((acc, child) => {
|
33
|
-
if (acc === null) {
|
34
|
-
return child.materialize();
|
35
|
-
}
|
36
|
-
|
37
|
-
return this.Skia.ColorFilter.MakeCompose(acc, child.materialize());
|
38
|
-
}, null));
|
39
|
-
}
|
10
|
+
composeAndPush(ctx, cf1) {
|
11
|
+
ctx.save();
|
12
|
+
this.decorateChildren(ctx);
|
13
|
+
const cf2 = ctx.colorFilters.popAllAsOne();
|
14
|
+
ctx.restore();
|
15
|
+
const cf = cf2 ? this.Skia.ColorFilter.MakeCompose(cf1, cf2) : cf1;
|
16
|
+
ctx.colorFilters.push(cf);
|
40
17
|
}
|
41
18
|
|
42
19
|
}
|
@@ -45,12 +22,12 @@ export class MatrixColorFilterNode extends ColorFilterDeclaration {
|
|
45
22
|
super(ctx, NodeType.MatrixColorFilter, props);
|
46
23
|
}
|
47
24
|
|
48
|
-
|
25
|
+
decorate(ctx) {
|
49
26
|
const {
|
50
27
|
matrix
|
51
28
|
} = this.props;
|
52
29
|
const cf = this.Skia.ColorFilter.MakeMatrix(matrix);
|
53
|
-
|
30
|
+
this.composeAndPush(ctx, cf);
|
54
31
|
}
|
55
32
|
|
56
33
|
}
|
@@ -59,13 +36,13 @@ export class BlendColorFilterNode extends ColorFilterDeclaration {
|
|
59
36
|
super(ctx, NodeType.BlendColorFilter, props);
|
60
37
|
}
|
61
38
|
|
62
|
-
|
39
|
+
decorate(ctx) {
|
63
40
|
const {
|
64
41
|
mode
|
65
42
|
} = this.props;
|
66
43
|
const color = this.Skia.Color(this.props.color);
|
67
44
|
const cf = this.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);
|
68
|
-
|
45
|
+
this.composeAndPush(ctx, cf);
|
69
46
|
}
|
70
47
|
|
71
48
|
}
|
@@ -74,9 +51,9 @@ export class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration {
|
|
74
51
|
super(ctx, NodeType.LinearToSRGBGammaColorFilter, null);
|
75
52
|
}
|
76
53
|
|
77
|
-
|
54
|
+
decorate(ctx) {
|
78
55
|
const cf = this.Skia.ColorFilter.MakeLinearToSRGBGamma();
|
79
|
-
|
56
|
+
this.composeAndPush(ctx, cf);
|
80
57
|
}
|
81
58
|
|
82
59
|
}
|
@@ -85,9 +62,9 @@ export class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration {
|
|
85
62
|
super(ctx, NodeType.SRGBToLinearGammaColorFilter, null);
|
86
63
|
}
|
87
64
|
|
88
|
-
|
65
|
+
decorate(ctx) {
|
89
66
|
const cf = this.Skia.ColorFilter.MakeSRGBToLinearGamma();
|
90
|
-
|
67
|
+
this.composeAndPush(ctx, cf);
|
91
68
|
}
|
92
69
|
|
93
70
|
}
|
@@ -96,9 +73,9 @@ export class LumaColorFilterNode extends ColorFilterDeclaration {
|
|
96
73
|
super(ctx, NodeType.LumaColorFilter, null);
|
97
74
|
}
|
98
75
|
|
99
|
-
|
76
|
+
decorate(ctx) {
|
100
77
|
const cf = this.Skia.ColorFilter.MakeLumaColorFilter();
|
101
|
-
|
78
|
+
this.composeAndPush(ctx, cf);
|
102
79
|
}
|
103
80
|
|
104
81
|
}
|
@@ -107,12 +84,21 @@ export class LerpColorFilterNode extends ColorFilterDeclaration {
|
|
107
84
|
super(ctx, NodeType.LerpColorFilter, props);
|
108
85
|
}
|
109
86
|
|
110
|
-
|
87
|
+
decorate(ctx) {
|
88
|
+
ctx.save();
|
89
|
+
this.decorateChildren(ctx);
|
111
90
|
const {
|
112
91
|
t
|
113
92
|
} = this.props;
|
114
|
-
const
|
115
|
-
|
93
|
+
const second = ctx.colorFilters.pop();
|
94
|
+
const first = ctx.colorFilters.pop();
|
95
|
+
ctx.restore();
|
96
|
+
|
97
|
+
if (!first || !second) {
|
98
|
+
throw new Error("LerpColorFilterNode: missing two color filters as children");
|
99
|
+
}
|
100
|
+
|
101
|
+
ctx.colorFilters.push(this.Skia.ColorFilter.MakeLerp(t, first, second));
|
116
102
|
}
|
117
103
|
|
118
104
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlendMode","JsiDeclarationNode","DeclarationType","NodeType","enumKey","ColorFilterDeclaration","constructor","ctx","type","props","ColorFilter","
|
1
|
+
{"version":3,"names":["BlendMode","JsiDeclarationNode","DeclarationType","NodeType","enumKey","ColorFilterDeclaration","constructor","ctx","type","props","ColorFilter","composeAndPush","cf1","save","decorateChildren","cf2","colorFilters","popAllAsOne","restore","cf","Skia","MakeCompose","push","MatrixColorFilterNode","MatrixColorFilter","decorate","matrix","MakeMatrix","BlendColorFilterNode","BlendColorFilter","mode","color","Color","MakeBlend","LinearToSRGBGammaColorFilterNode","LinearToSRGBGammaColorFilter","MakeLinearToSRGBGamma","SRGBToLinearGammaColorFilterNode","SRGBToLinearGammaColorFilter","MakeSRGBToLinearGamma","LumaColorFilterNode","LumaColorFilter","MakeLumaColorFilter","LerpColorFilterNode","LerpColorFilter","t","second","pop","first","Error","MakeLerp"],"sources":["ColorFilters.ts"],"sourcesContent":["import type { SkColorFilter } from \"../../../skia/types\";\nimport { BlendMode } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n BlendColorFilterProps,\n MatrixColorFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport type { LerpColorFilterProps } from \"../../types/ColorFilters\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport abstract class ColorFilterDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ColorFilter, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, cf1: SkColorFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n const cf2 = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n const cf = cf2 ? this.Skia.ColorFilter.MakeCompose(cf1, cf2) : cf1;\n ctx.colorFilters.push(cf);\n }\n}\n\nexport class MatrixColorFilterNode extends ColorFilterDeclaration<MatrixColorFilterProps> {\n constructor(ctx: NodeContext, props: MatrixColorFilterProps) {\n super(ctx, NodeType.MatrixColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const cf = this.Skia.ColorFilter.MakeMatrix(matrix);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilterProps> {\n constructor(ctx: NodeContext, props: BlendColorFilterProps) {\n super(ctx, NodeType.BlendColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const color = this.Skia.Color(this.props.color);\n const cf = this.Skia.ColorFilter.MakeBlend(color, BlendMode[enumKey(mode)]);\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LinearToSRGBGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLinearToSRGBGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SRGBToLinearGammaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeSRGBToLinearGamma();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LumaColorFilterNode extends ColorFilterDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.LumaColorFilter, null);\n }\n\n decorate(ctx: DeclarationContext) {\n const cf = this.Skia.ColorFilter.MakeLumaColorFilter();\n this.composeAndPush(ctx, cf);\n }\n}\n\nexport class LerpColorFilterNode extends ColorFilterDeclaration<LerpColorFilterProps> {\n constructor(ctx: NodeContext, props: LerpColorFilterProps) {\n super(ctx, NodeType.LerpColorFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n ctx.save();\n this.decorateChildren(ctx);\n const { t } = this.props;\n const second = ctx.colorFilters.pop();\n const first = ctx.colorFilters.pop();\n ctx.restore();\n if (!first || !second) {\n throw new Error(\n \"LerpColorFilterNode: missing two color filters as children\"\n );\n }\n ctx.colorFilters.push(this.Skia.ColorFilter.MakeLerp(t, first, second));\n }\n}\n"],"mappings":"AACA,SAASA,SAAT,QAA0B,qBAA1B;AAEA,SAASC,kBAAT,QAAmC,SAAnC;AAKA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,aAA1C;AACA,SAASC,OAAT,QAAwB,mBAAxB;AAIA,OAAO,MAAeC,sBAAf,SAAiDJ,kBAAjD,CAAuE;EAC5EK,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWL,eAAe,CAACQ,WAA3B,EAAwCF,IAAxC,EAA8CC,KAA9C;EACD;;EAESE,cAAc,CAACJ,GAAD,EAA0BK,GAA1B,EAA8C;IACpEL,GAAG,CAACM,IAAJ;IACA,KAAKC,gBAAL,CAAsBP,GAAtB;IACA,MAAMQ,GAAG,GAAGR,GAAG,CAACS,YAAJ,CAAiBC,WAAjB,EAAZ;IACAV,GAAG,CAACW,OAAJ;IACA,MAAMC,EAAE,GAAGJ,GAAG,GAAG,KAAKK,IAAL,CAAUV,WAAV,CAAsBW,WAAtB,CAAkCT,GAAlC,EAAuCG,GAAvC,CAAH,GAAiDH,GAA/D;IACAL,GAAG,CAACS,YAAJ,CAAiBM,IAAjB,CAAsBH,EAAtB;EACD;;AAZ2E;AAe9E,OAAO,MAAMI,qBAAN,SAAoClB,sBAApC,CAAmF;EACxFC,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAkD;IAC3D,MAAMF,GAAN,EAAWJ,QAAQ,CAACqB,iBAApB,EAAuCf,KAAvC;EACD;;EAEDgB,QAAQ,CAAClB,GAAD,EAA0B;IAChC,MAAM;MAAEmB;IAAF,IAAa,KAAKjB,KAAxB;IACA,MAAMU,EAAE,GAAG,KAAKC,IAAL,CAAUV,WAAV,CAAsBiB,UAAtB,CAAiCD,MAAjC,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FilterProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps } from "../../types";
|
2
|
+
import type { BlendImageFilterProps, BlurImageFilterProps, DeclarationContext, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, OffsetImageFilterProps, RuntimeShaderImageFilterProps } from "../../types";
|
3
3
|
import { NodeType } from "../../types";
|
4
4
|
import type { NodeContext } from "../Node";
|
5
5
|
import { JsiDeclarationNode } from "../Node";
|
6
|
-
export declare abstract class ImageFilterDeclaration<P
|
6
|
+
export declare abstract class ImageFilterDeclaration<P> extends JsiDeclarationNode<P> {
|
7
7
|
constructor(ctx: NodeContext, type: NodeType, props: P);
|
8
|
-
|
9
|
-
|
8
|
+
protected input(ctx: DeclarationContext): SkImageFilter | null;
|
9
|
+
protected composeAndPush(ctx: DeclarationContext, imgf1: SkImageFilter): void;
|
10
10
|
}
|
11
11
|
export declare class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {
|
12
12
|
constructor(ctx: NodeContext, props: OffsetImageFilterProps);
|
13
|
-
|
13
|
+
decorate(ctx: DeclarationContext): void;
|
14
14
|
}
|
15
15
|
export declare class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {
|
16
16
|
constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps);
|
17
|
-
|
17
|
+
decorate(ctx: DeclarationContext): void;
|
18
18
|
}
|
19
19
|
export declare class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {
|
20
20
|
constructor(ctx: NodeContext, props: BlurImageFilterProps);
|
21
|
-
|
21
|
+
decorate(ctx: DeclarationContext): void;
|
22
22
|
}
|
23
23
|
export declare class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {
|
24
24
|
constructor(ctx: NodeContext, props: DropShadowImageFilterProps);
|
25
|
-
|
25
|
+
decorate(ctx: DeclarationContext): void;
|
26
26
|
}
|
27
27
|
export declare enum MorphologyOperator {
|
28
28
|
Erode = 0,
|
@@ -30,13 +30,13 @@ export declare enum MorphologyOperator {
|
|
30
30
|
}
|
31
31
|
export declare class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {
|
32
32
|
constructor(ctx: NodeContext, props: MorphologyImageFilterProps);
|
33
|
-
|
33
|
+
decorate(ctx: DeclarationContext): void;
|
34
34
|
}
|
35
35
|
export declare class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {
|
36
36
|
constructor(ctx: NodeContext, props: BlendImageFilterProps);
|
37
|
-
|
37
|
+
decorate(ctx: DeclarationContext): void;
|
38
38
|
}
|
39
39
|
export declare class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {
|
40
40
|
constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps);
|
41
|
-
|
41
|
+
decorate(ctx: DeclarationContext): void;
|
42
42
|
}
|
@@ -24,32 +24,27 @@ export class ImageFilterDeclaration extends JsiDeclarationNode {
|
|
24
24
|
super(ctx, DeclarationType.ImageFilter, type, props);
|
25
25
|
}
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
input(ctx) {
|
28
|
+
var _ctx$imageFilters$pop;
|
29
29
|
|
30
|
-
|
31
|
-
return null;
|
32
|
-
}
|
33
|
-
|
34
|
-
return this.getMandatoryChildInstance(index);
|
30
|
+
return (_ctx$imageFilters$pop = ctx.imageFilters.pop()) !== null && _ctx$imageFilters$pop !== void 0 ? _ctx$imageFilters$pop : null;
|
35
31
|
}
|
36
32
|
|
37
|
-
|
38
|
-
|
33
|
+
composeAndPush(ctx, imgf1) {
|
34
|
+
ctx.save();
|
35
|
+
this.decorateChildren(ctx);
|
36
|
+
let imgf2 = ctx.imageFilters.popAllAsOne();
|
37
|
+
const cf = ctx.colorFilters.popAllAsOne();
|
38
|
+
ctx.restore();
|
39
39
|
|
40
|
-
if (
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
return this.Skia.ImageFilter.MakeShader(child.materialize(), null);
|
45
|
-
} else if (child.declarationType === DeclarationType.ColorFilter) {
|
46
|
-
return this.Skia.ImageFilter.MakeColorFilter(child.materialize(), null);
|
47
|
-
} else {
|
48
|
-
throw new Error(`Found invalid child ${child.type} in ${this.type}`);
|
49
|
-
}
|
50
|
-
} else {
|
51
|
-
throw new Error(`Found invalid child ${child.type} in ${this.type}`);
|
40
|
+
if (cf) {
|
41
|
+
var _imgf;
|
42
|
+
|
43
|
+
imgf2 = this.Skia.ImageFilter.MakeCompose((_imgf = imgf2) !== null && _imgf !== void 0 ? _imgf : null, this.Skia.ImageFilter.MakeColorFilter(cf, null));
|
52
44
|
}
|
45
|
+
|
46
|
+
const imgf = imgf2 ? this.Skia.ImageFilter.MakeCompose(imgf1, imgf2) : imgf1;
|
47
|
+
ctx.imageFilters.push(imgf);
|
53
48
|
}
|
54
49
|
|
55
50
|
}
|
@@ -58,12 +53,14 @@ export class OffsetImageFilterNode extends ImageFilterDeclaration {
|
|
58
53
|
super(ctx, NodeType.OffsetImageFilter, props);
|
59
54
|
}
|
60
55
|
|
61
|
-
|
56
|
+
decorate(ctx) {
|
57
|
+
this.decorateChildren(ctx);
|
62
58
|
const {
|
63
59
|
x,
|
64
60
|
y
|
65
61
|
} = this.props;
|
66
|
-
|
62
|
+
const imgf = this.Skia.ImageFilter.MakeOffset(x, y, null);
|
63
|
+
this.composeAndPush(ctx, imgf);
|
67
64
|
}
|
68
65
|
|
69
66
|
}
|
@@ -72,13 +69,14 @@ export class DisplacementMapImageFilterNode extends ImageFilterDeclaration {
|
|
72
69
|
super(ctx, NodeType.DisplacementMapImageFilter, props);
|
73
70
|
}
|
74
71
|
|
75
|
-
|
72
|
+
decorate(ctx) {
|
76
73
|
const {
|
77
74
|
channelX,
|
78
75
|
channelY,
|
79
76
|
scale
|
80
77
|
} = this.props;
|
81
|
-
|
78
|
+
const imgf = this.Skia.ImageFilter.MakeDisplacementMap(ColorChannel[enumKey(channelX)], ColorChannel[enumKey(channelY)], scale, ctx.imageFilters.pop(), this.input(ctx));
|
79
|
+
this.composeAndPush(ctx, imgf);
|
82
80
|
}
|
83
81
|
|
84
82
|
}
|
@@ -87,13 +85,14 @@ export class BlurImageFilterNode extends ImageFilterDeclaration {
|
|
87
85
|
super(ctx, NodeType.BlurImageFilter, props);
|
88
86
|
}
|
89
87
|
|
90
|
-
|
88
|
+
decorate(ctx) {
|
91
89
|
const {
|
92
90
|
mode,
|
93
91
|
blur
|
94
92
|
} = this.props;
|
95
93
|
const sigma = processRadius(this.Skia, blur);
|
96
|
-
|
94
|
+
const imgf = this.Skia.ImageFilter.MakeBlur(sigma.x, sigma.y, TileMode[enumKey(mode)], this.input(ctx));
|
95
|
+
this.composeAndPush(ctx, imgf);
|
97
96
|
}
|
98
97
|
|
99
98
|
}
|
@@ -102,7 +101,7 @@ export class DropShadowImageFilterNode extends ImageFilterDeclaration {
|
|
102
101
|
super(ctx, NodeType.DropShadowImageFilter, props);
|
103
102
|
}
|
104
103
|
|
105
|
-
|
104
|
+
decorate(ctx) {
|
106
105
|
const {
|
107
106
|
dx,
|
108
107
|
dy,
|
@@ -112,7 +111,6 @@ export class DropShadowImageFilterNode extends ImageFilterDeclaration {
|
|
112
111
|
inner
|
113
112
|
} = this.props;
|
114
113
|
const color = this.Skia.Color(cl);
|
115
|
-
const input = this.getOptionalChildInstance(0);
|
116
114
|
let factory;
|
117
115
|
|
118
116
|
if (inner) {
|
@@ -121,7 +119,8 @@ export class DropShadowImageFilterNode extends ImageFilterDeclaration {
|
|
121
119
|
factory = shadowOnly ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter) : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);
|
122
120
|
}
|
123
121
|
|
124
|
-
|
122
|
+
const imgf = factory(dx, dy, blur, blur, color, this.input(ctx));
|
123
|
+
this.composeAndPush(ctx, imgf);
|
125
124
|
}
|
126
125
|
|
127
126
|
}
|
@@ -137,18 +136,20 @@ export class MorphologyImageFilterNode extends ImageFilterDeclaration {
|
|
137
136
|
super(ctx, NodeType.MorphologyImageFilter, props);
|
138
137
|
}
|
139
138
|
|
140
|
-
|
139
|
+
decorate(ctx) {
|
141
140
|
const {
|
142
141
|
operator
|
143
142
|
} = this.props;
|
144
143
|
const r = processRadius(this.Skia, this.props.radius);
|
145
|
-
|
144
|
+
let imgf;
|
146
145
|
|
147
146
|
if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {
|
148
|
-
|
147
|
+
imgf = this.Skia.ImageFilter.MakeErode(r.x, r.y, this.input(ctx));
|
148
|
+
} else {
|
149
|
+
imgf = this.Skia.ImageFilter.MakeDilate(r.x, r.y, this.input(ctx));
|
149
150
|
}
|
150
151
|
|
151
|
-
|
152
|
+
this.composeAndPush(ctx, imgf);
|
152
153
|
}
|
153
154
|
|
154
155
|
}
|
@@ -157,13 +158,19 @@ export class BlendImageFilterNode extends ImageFilterDeclaration {
|
|
157
158
|
super(ctx, NodeType.BlendImageFilter, props);
|
158
159
|
}
|
159
160
|
|
160
|
-
|
161
|
+
decorate(ctx) {
|
161
162
|
const {
|
162
163
|
mode
|
163
164
|
} = this.props;
|
164
|
-
const a =
|
165
|
-
const b =
|
166
|
-
|
165
|
+
const a = ctx.imageFilters.pop();
|
166
|
+
const b = ctx.imageFilters.pop();
|
167
|
+
|
168
|
+
if (!a || !b) {
|
169
|
+
throw new Error("BlendImageFilter requires two image filters");
|
170
|
+
}
|
171
|
+
|
172
|
+
const imgf = this.Skia.ImageFilter.MakeBlend(mode, a, b);
|
173
|
+
this.composeAndPush(ctx, imgf);
|
167
174
|
}
|
168
175
|
|
169
176
|
}
|
@@ -172,7 +179,7 @@ export class RuntimeShaderImageFilterNode extends ImageFilterDeclaration {
|
|
172
179
|
super(ctx, NodeType.RuntimeShaderImageFilter, props);
|
173
180
|
}
|
174
181
|
|
175
|
-
|
182
|
+
decorate(ctx) {
|
176
183
|
const {
|
177
184
|
source,
|
178
185
|
uniforms
|
@@ -183,8 +190,8 @@ export class RuntimeShaderImageFilterNode extends ImageFilterDeclaration {
|
|
183
190
|
processUniforms(source, uniforms, rtb);
|
184
191
|
}
|
185
192
|
|
186
|
-
const
|
187
|
-
|
193
|
+
const imgf = this.Skia.ImageFilter.MakeRuntimeShader(rtb, null, this.input(ctx));
|
194
|
+
this.composeAndPush(ctx, imgf);
|
188
195
|
}
|
189
196
|
|
190
197
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlendMode","ColorChannel","processUniforms","TileMode","DeclarationType","NodeType","processRadius","enumKey","JsiDeclarationNode","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","constructor","ctx","type","props","getOptionalChildInstance","index","child","_children","getMandatoryChildInstance","isImageFilter","materialize","isShader","MakeShader","declarationType","Error","OffsetImageFilterNode","OffsetImageFilter","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","MakeDisplacementMap","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","DropShadowImageFilterNode","DropShadowImageFilter","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processRadius, enumKey } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nexport abstract class ImageFilterDeclaration<\n P,\n Nullable extends null | never = never\n> extends JsiDeclarationNode<P, SkImageFilter, Nullable> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n getOptionalChildInstance(index: number) {\n const child = this._children[index];\n if (!child) {\n return null;\n }\n return this.getMandatoryChildInstance(index);\n }\n\n getMandatoryChildInstance(index: number) {\n const child = this._children[index];\n if (child instanceof JsiDeclarationNode) {\n if (child.isImageFilter()) {\n return child.materialize();\n } else if (child.isShader()) {\n return this.Skia.ImageFilter.MakeShader(child.materialize(), null);\n } else if (child.declarationType === DeclarationType.ColorFilter) {\n return this.Skia.ImageFilter.MakeColorFilter(child.materialize(), null);\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n materialize() {\n const { x, y } = this.props;\n return this.Skia.ImageFilter.MakeOffset(\n x,\n y,\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n materialize() {\n const { channelX, channelY, scale } = this.props;\n return this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n this.getMandatoryChildInstance(0),\n this.getOptionalChildInstance(1)\n );\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n materialize() {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n return this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.DropShadowImageFilter, props);\n }\n\n materialize() {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\n const input = this.getOptionalChildInstance(0);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n materialize() {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n const input = this.getOptionalChildInstance(0);\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n return this.Skia.ImageFilter.MakeErode(r.x, r.y, input);\n }\n return this.Skia.ImageFilter.MakeDilate(r.x, r.y, input);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n materialize() {\n const { mode } = this.props;\n const a = this.getMandatoryChildInstance(0);\n const b = this.getMandatoryChildInstance(1);\n return this.Skia.ImageFilter.MakeBlend(mode, a, b);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n materialize() {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const input = this.getOptionalChildInstance(0);\n return this.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input);\n }\n}\n"],"mappings":"AACA,SACEA,SADF,EAEEC,YAFF,E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KAA3C,CAAP;EACD;;AAb+F;AAgBlG,OAAO,MAAMoE,oBAAN,SAAmCjD,sBAAnC,CAAiF;EACtFC,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAiD;IAC1D,MAAMF,GAAN,EAAWpC,QAAQ,CAACoF,gBAApB,EAAsC9C,KAAtC;EACD;;EAEDO,WAAW,GAAG;IACZ,MAAM;MAAEiB;IAAF,IAAW,KAAKxB,KAAtB;IACA,MAAM+C,CAAC,GAAG,KAAK1C,yBAAL,CAA+B,CAA/B,CAAV;IACA,MAAM2C,CAAC,GAAG,KAAK3C,yBAAL,CAA+B,CAA/B,CAAV;IACA,OAAO,KAAKnC,IAAL,CAAUS,WAAV,CAAsBG,SAAtB,CAAgC0C,IAAhC,EAAsCuB,CAAtC,EAAyCC,CAAzC,CAAP;EACD;;AAVqF;AAaxF,OAAO,MAAMC,4BAAN,SAA2CrD,sBAA3C,CAAiG;EACtGC,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAyD;IAClE,MAAMF,GAAN,EAAWpC,QAAQ,CAACwF,wBAApB,EAA8ClD,KAA9C;EACD;;EAEDO,WAAW,GAAG;IACZ,MAAM;MAAE4C,MAAF;MAAUC;IAAV,IAAuB,KAAKpD,KAAlC;IACA,MAAMqD,GAAG,GAAG,KAAKnF,IAAL,CAAUoF,oBAAV,CAA+BH,MAA/B,CAAZ;;IACA,IAAIC,QAAJ,EAAc;MACZ7F,eAAe,CAAC4F,MAAD,EAASC,QAAT,EAAmBC,GAAnB,CAAf;IACD;;IACD,MAAM5E,KAAK,GAAG,KAAKwB,wBAAL,CAA8B,CAA9B,CAAd;IACA,OAAO,KAAK/B,IAAL,CAAUS,WAAV,CAAsB4E,iBAAtB,CAAwCF,GAAxC,EAA6C,IAA7C,EAAmD5E,KAAnD,CAAP;EACD;;AAbqG"}
|
1
|
+
{"version":3,"names":["BlendMode","ColorChannel","processUniforms","TileMode","DeclarationType","NodeType","processRadius","enumKey","JsiDeclarationNode","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","constructor","ctx","type","props","imageFilters","pop","composeAndPush","imgf1","save","decorateChildren","imgf2","popAllAsOne","cf","colorFilters","restore","imgf","push","OffsetImageFilterNode","OffsetImageFilter","decorate","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","MakeDisplacementMap","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","DropShadowImageFilterNode","DropShadowImageFilter","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","Error","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DeclarationContext,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processRadius, enumKey } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nexport abstract class ImageFilterDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n protected input(ctx: DeclarationContext) {\n return ctx.imageFilters.pop() ?? null;\n }\n\n protected composeAndPush(ctx: DeclarationContext, imgf1: SkImageFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n let imgf2 = ctx.imageFilters.popAllAsOne();\n const cf = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n if (cf) {\n imgf2 = this.Skia.ImageFilter.MakeCompose(\n imgf2 ?? null,\n this.Skia.ImageFilter.MakeColorFilter(cf, null)\n );\n }\n const imgf = imgf2\n ? this.Skia.ImageFilter.MakeCompose(imgf1, imgf2)\n : imgf1;\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { x, y } = this.props;\n const imgf = this.Skia.ImageFilter.MakeOffset(x, y, null);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { channelX, channelY, scale } = this.props;\n const imgf = this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n ctx.imageFilters.pop()!,\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n const imgf = this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.DropShadowImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n const imgf = factory(dx, dy, blur, blur, color, this.input(ctx));\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n let imgf;\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n imgf = this.Skia.ImageFilter.MakeErode(r.x, r.y, this.input(ctx));\n } else {\n imgf = this.Skia.ImageFilter.MakeDilate(r.x, r.y, this.input(ctx));\n }\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const a = ctx.imageFilters.pop();\n const b = ctx.imageFilters.pop();\n if (!a || !b) {\n throw new Error(\"BlendImageFilter requires two image filters\");\n }\n const imgf = this.Skia.ImageFilter.MakeBlend(mode, a, b);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const imgf = this.Skia.ImageFilter.MakeRuntimeShader(\n rtb,\n null,\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n"],"mappings":"AACA,SACEA,SADF,EAEEC,YAFF,EAGEC,eAHF,EAIEC,QAJF,QAKO,qBALP;AAgBA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,aAA1C;AACA,SAASC,aAAT,EAAwBC,OAAxB,QAAuC,cAAvC;AAEA,SA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7C,IAAI,GAAG,KAAK1C,IAAL,CAAUS,WAAV,CAAsBgF,iBAAtB,CACXF,GADW,EAEX,IAFW,EAGX,KAAKhF,KAAL,CAAWqB,GAAX,CAHW,CAAb;IAKA,KAAKK,cAAL,CAAoBL,GAApB,EAAyBc,IAAzB;EACD;;AAjBqG"}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import type { SkMaskFilter } from "../../../skia/types";
|
2
1
|
import type { NodeContext } from "../Node";
|
3
2
|
import { JsiDeclarationNode } from "../Node";
|
4
3
|
import type { BlurMaskFilterProps } from "../../types";
|
5
|
-
|
4
|
+
import type { DeclarationContext } from "../../types/DeclarationContext";
|
5
|
+
export declare class BlurMaskFilterNode extends JsiDeclarationNode<BlurMaskFilterProps> {
|
6
6
|
constructor(ctx: NodeContext, props: BlurMaskFilterProps);
|
7
|
-
|
7
|
+
decorate(ctx: DeclarationContext): void;
|
8
8
|
}
|
@@ -7,13 +7,14 @@ export class BlurMaskFilterNode extends JsiDeclarationNode {
|
|
7
7
|
super(ctx, DeclarationType.MaskFilter, NodeType.BlurMaskFilter, props);
|
8
8
|
}
|
9
9
|
|
10
|
-
|
10
|
+
decorate(ctx) {
|
11
11
|
const {
|
12
12
|
style,
|
13
13
|
blur,
|
14
14
|
respectCTM
|
15
15
|
} = this.props;
|
16
|
-
|
16
|
+
const mf = this.Skia.MaskFilter.MakeBlur(BlurStyle[enumKey(style)], blur, respectCTM);
|
17
|
+
ctx.maskFilters.push(mf);
|
17
18
|
}
|
18
19
|
|
19
20
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlurStyle","JsiDeclarationNode","DeclarationType","NodeType","enumKey","BlurMaskFilterNode","constructor","ctx","props","MaskFilter","BlurMaskFilter","
|
1
|
+
{"version":3,"names":["BlurStyle","JsiDeclarationNode","DeclarationType","NodeType","enumKey","BlurMaskFilterNode","constructor","ctx","props","MaskFilter","BlurMaskFilter","decorate","style","blur","respectCTM","mf","Skia","MakeBlur","maskFilters","push"],"sources":["MaskFilters.ts"],"sourcesContent":["import { BlurStyle } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type { BlurMaskFilterProps } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport class BlurMaskFilterNode extends JsiDeclarationNode<BlurMaskFilterProps> {\n constructor(ctx: NodeContext, props: BlurMaskFilterProps) {\n super(ctx, DeclarationType.MaskFilter, NodeType.BlurMaskFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { style, blur, respectCTM } = this.props;\n const mf = this.Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n ctx.maskFilters.push(mf);\n }\n}\n"],"mappings":"AAAA,SAASA,SAAT,QAA0B,qBAA1B;AAEA,SAASC,kBAAT,QAAmC,SAAnC;AAEA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,aAA1C;AACA,SAASC,OAAT,QAAwB,cAAxB;AAGA,OAAO,MAAMC,kBAAN,SAAiCJ,kBAAjC,CAAyE;EAC9EK,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAA+C;IACxD,MAAMD,GAAN,EAAWL,eAAe,CAACO,UAA3B,EAAuCN,QAAQ,CAACO,cAAhD,EAAgEF,KAAhE;EACD;;EAEDG,QAAQ,CAACJ,GAAD,EAA0B;IAChC,MAAM;MAAEK,KAAF;MAASC,IAAT;MAAeC;IAAf,IAA8B,KAAKN,KAAzC;IACA,MAAMO,EAAE,GAAG,KAAKC,IAAL,CAAUP,UAAV,CAAqBQ,QAArB,CACTjB,SAAS,CAACI,OAAO,CAACQ,KAAD,CAAR,CADA,EAETC,IAFS,EAGTC,UAHS,CAAX;IAKAP,GAAG,CAACW,WAAJ,CAAgBC,IAAhB,CAAqBJ,EAArB;EACD;;AAb6E"}
|
@@ -1,42 +1,39 @@
|
|
1
1
|
import type { SkPathEffect } from "../../../skia/types";
|
2
2
|
import type { NodeContext } from "../Node";
|
3
3
|
import { JsiDeclarationNode } from "../Node";
|
4
|
-
import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps,
|
4
|
+
import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps } from "../../types";
|
5
5
|
import { NodeType } from "../../types";
|
6
|
-
|
6
|
+
import type { DeclarationContext } from "../../types/DeclarationContext";
|
7
|
+
declare abstract class PathEffectDeclaration<P> extends JsiDeclarationNode<P> {
|
7
8
|
constructor(ctx: NodeContext, type: NodeType, props: P);
|
8
|
-
|
9
|
-
insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
|
10
|
-
compose(pe: SkPathEffect): SkPathEffect;
|
11
|
-
getOptionalChildInstance(index: number): any;
|
12
|
-
getMandatoryChildInstance(index: number): any;
|
9
|
+
protected composeAndPush(ctx: DeclarationContext, pe1: SkPathEffect): void;
|
13
10
|
}
|
14
11
|
export declare class DiscretePathEffectNode extends PathEffectDeclaration<DiscretePathEffectProps> {
|
15
12
|
constructor(ctx: NodeContext, props: DiscretePathEffectProps);
|
16
|
-
|
13
|
+
decorate(ctx: DeclarationContext): void;
|
17
14
|
}
|
18
|
-
export declare class Path2DPathEffectNode extends PathEffectDeclaration<Path2DPathEffectProps
|
15
|
+
export declare class Path2DPathEffectNode extends PathEffectDeclaration<Path2DPathEffectProps> {
|
19
16
|
constructor(ctx: NodeContext, props: Path2DPathEffectProps);
|
20
|
-
|
17
|
+
decorate(ctx: DeclarationContext): void;
|
21
18
|
}
|
22
19
|
export declare class DashPathEffectNode extends PathEffectDeclaration<DashPathEffectProps> {
|
23
20
|
constructor(ctx: NodeContext, props: DashPathEffectProps);
|
24
|
-
|
21
|
+
decorate(ctx: DeclarationContext): void;
|
25
22
|
}
|
26
|
-
export declare class CornerPathEffectNode extends PathEffectDeclaration<CornerPathEffectProps
|
23
|
+
export declare class CornerPathEffectNode extends PathEffectDeclaration<CornerPathEffectProps> {
|
27
24
|
constructor(ctx: NodeContext, props: CornerPathEffectProps);
|
28
|
-
|
25
|
+
decorate(ctx: DeclarationContext): void;
|
29
26
|
}
|
30
27
|
export declare class SumPathEffectNode extends PathEffectDeclaration<null> {
|
31
28
|
constructor(ctx: NodeContext);
|
32
|
-
|
29
|
+
decorate(ctx: DeclarationContext): void;
|
33
30
|
}
|
34
|
-
export declare class Line2DPathEffectNode extends PathEffectDeclaration<Line2DPathEffectProps
|
31
|
+
export declare class Line2DPathEffectNode extends PathEffectDeclaration<Line2DPathEffectProps> {
|
35
32
|
constructor(ctx: NodeContext, props: Line2DPathEffectProps);
|
36
|
-
|
33
|
+
decorate(ctx: DeclarationContext): void;
|
37
34
|
}
|
38
|
-
export declare class Path1DPathEffectNode extends PathEffectDeclaration<Path1DPathEffectProps
|
35
|
+
export declare class Path1DPathEffectNode extends PathEffectDeclaration<Path1DPathEffectProps> {
|
39
36
|
constructor(ctx: NodeContext, props: Path1DPathEffectProps);
|
40
|
-
|
37
|
+
decorate(ctx: DeclarationContext): void;
|
41
38
|
}
|
42
39
|
export {};
|