@shopify/react-native-skia 0.1.172 → 0.1.174
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 +56 -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/JsiSkDataFactory.js +0 -1
- package/lib/commonjs/skia/web/JsiSkDataFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkImage.js +34 -3
- package/lib/commonjs/skia/web/JsiSkImage.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 +14 -8
- 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/JsiSkDataFactory.js +0 -1
- package/lib/module/skia/web/JsiSkDataFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/module/skia/web/JsiSkImage.js +31 -3
- package/lib/module/skia/web/JsiSkImage.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 +14 -8
- 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/JsiSkImage.d.ts +1 -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/JsiSkDataFactory.ts +0 -1
- package/src/skia/web/JsiSkImage.ts +26 -2
- package/src/skia/web/JsiSkSurface.ts +4 -0
- package/src/skia/web/JsiSkSurfaceFactory.ts +21 -2
- package/src/views/SkiaBaseWebView.tsx +9 -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
@@ -2,63 +2,32 @@ import { BlendMode } from "../../../skia/types";
|
|
2
2
|
import { DeclarationType, NodeType } from "../../types/NodeType";
|
3
3
|
import { JsiDeclarationNode } from "../Node";
|
4
4
|
import { enumKey } from "../datatypes";
|
5
|
-
import {
|
6
|
-
import { ShaderDeclaration } from "./Shaders";
|
5
|
+
import { composeDeclarations } from "../../types/DeclarationContext";
|
7
6
|
export class BlendNode extends JsiDeclarationNode {
|
8
7
|
constructor(ctx, props) {
|
9
8
|
super(ctx, DeclarationType.ImageFilter, NodeType.Blend, props);
|
10
9
|
}
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
if (child.declarationType === DeclarationType.ImageFilter) {
|
15
|
-
this.declarationType = DeclarationType.ImageFilter;
|
16
|
-
} else {
|
17
|
-
this.declarationType = DeclarationType.Shader;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
21
|
-
|
22
|
-
addChild(child) {
|
23
|
-
if (!(child instanceof JsiDeclarationNode) || child.declarationType !== DeclarationType.Shader && child.declarationType !== DeclarationType.ImageFilter) {
|
24
|
-
throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
|
25
|
-
}
|
26
|
-
|
27
|
-
this.checkChild(child);
|
28
|
-
super.addChild(child);
|
29
|
-
}
|
30
|
-
|
31
|
-
insertChildBefore(child, before) {
|
32
|
-
if (!(child instanceof ImageFilterDeclaration) || !(child instanceof ShaderDeclaration)) {
|
33
|
-
throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
|
34
|
-
}
|
35
|
-
|
36
|
-
this.checkChild(child);
|
37
|
-
super.insertChildBefore(child, before);
|
38
|
-
}
|
39
|
-
|
40
|
-
materialize() {
|
11
|
+
decorate(ctx) {
|
12
|
+
this.decorateChildren(ctx);
|
41
13
|
const {
|
42
14
|
Skia
|
43
15
|
} = this;
|
44
|
-
const blend = BlendMode[enumKey(this.props.mode)];
|
16
|
+
const blend = BlendMode[enumKey(this.props.mode)]; // Blend ImageFilters
|
17
|
+
|
18
|
+
const imageFilters = ctx.imageFilters.popAll();
|
19
|
+
|
20
|
+
if (imageFilters.length > 0) {
|
21
|
+
const composer = Skia.ImageFilter.MakeBlend.bind(Skia.ImageFilter, blend);
|
22
|
+
ctx.imageFilters.push(composeDeclarations(imageFilters, composer));
|
23
|
+
} // Blend Shaders
|
45
24
|
|
46
|
-
if (this.declarationType === DeclarationType.ImageFilter) {
|
47
|
-
return this._children.reverse().reduce((inner, outer) => {
|
48
|
-
if (inner === null) {
|
49
|
-
return outer.materialize();
|
50
|
-
}
|
51
25
|
|
52
|
-
|
53
|
-
}, null);
|
54
|
-
} else {
|
55
|
-
return this._children.reverse().reduce((inner, outer) => {
|
56
|
-
if (inner === null) {
|
57
|
-
return outer.materialize();
|
58
|
-
}
|
26
|
+
const shaders = ctx.shaders.popAll();
|
59
27
|
|
60
|
-
|
61
|
-
|
28
|
+
if (shaders.length > 0) {
|
29
|
+
const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);
|
30
|
+
ctx.shaders.push(composeDeclarations(shaders, composer));
|
62
31
|
}
|
63
32
|
}
|
64
33
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["BlendMode","DeclarationType","NodeType","JsiDeclarationNode","enumKey","
|
1
|
+
{"version":3,"names":["BlendMode","DeclarationType","NodeType","JsiDeclarationNode","enumKey","composeDeclarations","BlendNode","constructor","ctx","props","ImageFilter","Blend","decorate","decorateChildren","Skia","blend","mode","imageFilters","popAll","length","composer","MakeBlend","bind","push","shaders","Shader"],"sources":["BlendNode.ts"],"sourcesContent":["import type { BlendProps } from \"../../types/ImageFilters\";\nimport { BlendMode } from \"../../../skia/types\";\nimport { DeclarationType, NodeType } from \"../../types/NodeType\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nexport class BlendNode extends JsiDeclarationNode<BlendProps> {\n constructor(ctx: NodeContext, props: BlendProps) {\n super(ctx, DeclarationType.ImageFilter, NodeType.Blend, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { Skia } = this;\n const blend = BlendMode[enumKey(this.props.mode)];\n // Blend ImageFilters\n const imageFilters = ctx.imageFilters.popAll();\n if (imageFilters.length > 0) {\n const composer = Skia.ImageFilter.MakeBlend.bind(Skia.ImageFilter, blend);\n ctx.imageFilters.push(composeDeclarations(imageFilters, composer));\n }\n // Blend Shaders\n const shaders = ctx.shaders.popAll();\n if (shaders.length > 0) {\n const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);\n ctx.shaders.push(composeDeclarations(shaders, composer));\n }\n }\n}\n"],"mappings":"AACA,SAASA,SAAT,QAA0B,qBAA1B;AACA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,sBAA1C;AAEA,SAASC,kBAAT,QAAmC,SAAnC;AACA,SAASC,OAAT,QAAwB,cAAxB;AAEA,SAASC,mBAAT,QAAoC,gCAApC;AAEA,OAAO,MAAMC,SAAN,SAAwBH,kBAAxB,CAAuD;EAC5DI,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAsC;IAC/C,MAAMD,GAAN,EAAWP,eAAe,CAACS,WAA3B,EAAwCR,QAAQ,CAACS,KAAjD,EAAwDF,KAAxD;EACD;;EAEDG,QAAQ,CAACJ,GAAD,EAA0B;IAChC,KAAKK,gBAAL,CAAsBL,GAAtB;IACA,MAAM;MAAEM;IAAF,IAAW,IAAjB;IACA,MAAMC,KAAK,GAAGf,SAAS,CAACI,OAAO,CAAC,KAAKK,KAAL,CAAWO,IAAZ,CAAR,CAAvB,CAHgC,CAIhC;;IACA,MAAMC,YAAY,GAAGT,GAAG,CAACS,YAAJ,CAAiBC,MAAjB,EAArB;;IACA,IAAID,YAAY,CAACE,MAAb,GAAsB,CAA1B,EAA6B;MAC3B,MAAMC,QAAQ,GAAGN,IAAI,CAACJ,WAAL,CAAiBW,SAAjB,CAA2BC,IAA3B,CAAgCR,IAAI,CAACJ,WAArC,EAAkDK,KAAlD,CAAjB;MACAP,GAAG,CAACS,YAAJ,CAAiBM,IAAjB,CAAsBlB,mBAAmB,CAACY,YAAD,EAAeG,QAAf,CAAzC;IACD,CAT+B,CAUhC;;;IACA,MAAMI,OAAO,GAAGhB,GAAG,CAACgB,OAAJ,CAAYN,MAAZ,EAAhB;;IACA,IAAIM,OAAO,CAACL,MAAR,GAAiB,CAArB,EAAwB;MACtB,MAAMC,QAAQ,GAAGN,IAAI,CAACW,MAAL,CAAYJ,SAAZ,CAAsBC,IAAtB,CAA2BR,IAAI,CAACW,MAAhC,EAAwCV,KAAxC,CAAjB;MACAP,GAAG,CAACgB,OAAJ,CAAYD,IAAZ,CAAiBlB,mBAAmB,CAACmB,OAAD,EAAUJ,QAAV,CAApC;IACD;EACF;;AArB2D"}
|
@@ -1,36 +1,35 @@
|
|
1
1
|
import type { SkColorFilter } from "../../../skia/types";
|
2
2
|
import type { NodeContext } from "../Node";
|
3
3
|
import { JsiDeclarationNode } from "../Node";
|
4
|
-
import type { BlendColorFilterProps, MatrixColorFilterProps
|
4
|
+
import type { BlendColorFilterProps, MatrixColorFilterProps } from "../../types";
|
5
5
|
import { NodeType } from "../../types";
|
6
6
|
import type { LerpColorFilterProps } from "../../types/ColorFilters";
|
7
|
-
|
7
|
+
import type { DeclarationContext } from "../../types/DeclarationContext";
|
8
|
+
export declare abstract class ColorFilterDeclaration<P> extends JsiDeclarationNode<P> {
|
8
9
|
constructor(ctx: NodeContext, type: NodeType, props: P);
|
9
|
-
|
10
|
-
insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
|
11
|
-
compose(filter: SkColorFilter): SkColorFilter;
|
10
|
+
protected composeAndPush(ctx: DeclarationContext, cf1: SkColorFilter): void;
|
12
11
|
}
|
13
12
|
export declare class MatrixColorFilterNode extends ColorFilterDeclaration<MatrixColorFilterProps> {
|
14
13
|
constructor(ctx: NodeContext, props: MatrixColorFilterProps);
|
15
|
-
|
14
|
+
decorate(ctx: DeclarationContext): void;
|
16
15
|
}
|
17
16
|
export declare class BlendColorFilterNode extends ColorFilterDeclaration<BlendColorFilterProps> {
|
18
17
|
constructor(ctx: NodeContext, props: BlendColorFilterProps);
|
19
|
-
|
18
|
+
decorate(ctx: DeclarationContext): void;
|
20
19
|
}
|
21
20
|
export declare class LinearToSRGBGammaColorFilterNode extends ColorFilterDeclaration<null> {
|
22
21
|
constructor(ctx: NodeContext);
|
23
|
-
|
22
|
+
decorate(ctx: DeclarationContext): void;
|
24
23
|
}
|
25
24
|
export declare class SRGBToLinearGammaColorFilterNode extends ColorFilterDeclaration<null> {
|
26
25
|
constructor(ctx: NodeContext);
|
27
|
-
|
26
|
+
decorate(ctx: DeclarationContext): void;
|
28
27
|
}
|
29
28
|
export declare class LumaColorFilterNode extends ColorFilterDeclaration<null> {
|
30
29
|
constructor(ctx: NodeContext);
|
31
|
-
|
30
|
+
decorate(ctx: DeclarationContext): void;
|
32
31
|
}
|
33
32
|
export declare class LerpColorFilterNode extends ColorFilterDeclaration<LerpColorFilterProps> {
|
34
33
|
constructor(ctx: NodeContext, props: LerpColorFilterProps);
|
35
|
-
|
34
|
+
decorate(ctx: DeclarationContext): void;
|
36
35
|
}
|
@@ -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":"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"}
|
@@ -1,28 +1,28 @@
|
|
1
1
|
import type { SkImageFilter } from "../../../skia/types";
|
2
|
-
import type { BlendImageFilterProps, BlurImageFilterProps, 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
|
}
|