@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
@@ -5,13 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.SkiaDomView = void 0;
|
7
7
|
|
8
|
-
var _reactNative = require("react-native");
|
9
|
-
|
10
8
|
var _skia = require("../skia");
|
11
9
|
|
12
|
-
var
|
10
|
+
var _DrawingContext = require("../dom/types/DrawingContext");
|
13
11
|
|
14
|
-
|
12
|
+
var _SkiaBaseWebView = require("./SkiaBaseWebView");
|
15
13
|
|
16
14
|
class SkiaDomView extends _SkiaBaseWebView.SkiaBaseWebView {
|
17
15
|
constructor(props) {
|
@@ -35,17 +33,8 @@ class SkiaDomView extends _SkiaBaseWebView.SkiaBaseWebView {
|
|
35
33
|
}
|
36
34
|
|
37
35
|
if (this.props.root) {
|
38
|
-
const
|
39
|
-
|
40
|
-
const ctx = {
|
41
|
-
canvas,
|
42
|
-
paint,
|
43
|
-
opacity: 1
|
44
|
-
};
|
45
|
-
canvas.save();
|
46
|
-
canvas.scale(pd, pd);
|
36
|
+
const ctx = new _DrawingContext.JsiDrawingContext(_skia.Skia, canvas);
|
47
37
|
this.props.root.render(ctx);
|
48
|
-
canvas.restore();
|
49
38
|
}
|
50
39
|
}
|
51
40
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["SkiaDomView","SkiaBaseWebView","constructor","props","renderInCanvas","canvas","touches","onTouch","onSize","width","height","getSize","current","root","ctx","JsiDrawingContext","Skia","render"],"sources":["SkiaDomView.web.tsx"],"sourcesContent":["import { Skia } from \"../skia\";\nimport type { SkCanvas } from \"../skia/types\";\nimport { JsiDrawingContext } from \"../dom/types/DrawingContext\";\n\nimport { SkiaBaseWebView } from \"./SkiaBaseWebView\";\nimport type { SkiaDomViewProps, TouchInfo } from \"./types\";\n\nexport class SkiaDomView extends SkiaBaseWebView<SkiaDomViewProps> {\n constructor(props: SkiaDomViewProps) {\n super(props);\n }\n\n protected renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void {\n if (this.props.onTouch) {\n this.props.onTouch([touches]);\n }\n if (this.props.onSize) {\n const { width, height } = this.getSize();\n this.props.onSize.current = { width, height };\n }\n if (this.props.root) {\n const ctx = new JsiDrawingContext(Skia, canvas);\n this.props.root.render(ctx);\n }\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AAGO,MAAMA,WAAN,SAA0BC,gCAA1B,CAA4D;EACjEC,WAAW,CAACC,KAAD,EAA0B;IACnC,MAAMA,KAAN;EACD;;EAESC,cAAc,CAACC,MAAD,EAAmBC,OAAnB,EAA+C;IACrE,IAAI,KAAKH,KAAL,CAAWI,OAAf,EAAwB;MACtB,KAAKJ,KAAL,CAAWI,OAAX,CAAmB,CAACD,OAAD,CAAnB;IACD;;IACD,IAAI,KAAKH,KAAL,CAAWK,MAAf,EAAuB;MACrB,MAAM;QAAEC,KAAF;QAASC;MAAT,IAAoB,KAAKC,OAAL,EAA1B;MACA,KAAKR,KAAL,CAAWK,MAAX,CAAkBI,OAAlB,GAA4B;QAAEH,KAAF;QAASC;MAAT,CAA5B;IACD;;IACD,IAAI,KAAKP,KAAL,CAAWU,IAAf,EAAqB;MACnB,MAAMC,GAAG,GAAG,IAAIC,iCAAJ,CAAsBC,UAAtB,EAA4BX,MAA5B,CAAZ;MACA,KAAKF,KAAL,CAAWU,IAAX,CAAgBI,MAAhB,CAAuBH,GAAvB;IACD;EACF;;AAjBgE"}
|
@@ -5,12 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.SkiaPictureView = void 0;
|
7
7
|
|
8
|
-
var _reactNative = require("react-native");
|
9
|
-
|
10
8
|
var _SkiaBaseWebView = require("./SkiaBaseWebView");
|
11
9
|
|
12
|
-
const pd = _reactNative.PixelRatio.get();
|
13
|
-
|
14
10
|
class SkiaPictureView extends _SkiaBaseWebView.SkiaBaseWebView {
|
15
11
|
constructor(props) {
|
16
12
|
super(props);
|
@@ -18,10 +14,7 @@ class SkiaPictureView extends _SkiaBaseWebView.SkiaBaseWebView {
|
|
18
14
|
|
19
15
|
renderInCanvas(canvas) {
|
20
16
|
if (this.props.picture) {
|
21
|
-
canvas.save();
|
22
|
-
canvas.scale(pd, pd);
|
23
17
|
canvas.drawPicture(this.props.picture);
|
24
|
-
canvas.restore();
|
25
18
|
}
|
26
19
|
}
|
27
20
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["SkiaPictureView","SkiaBaseWebView","constructor","props","renderInCanvas","canvas","picture","drawPicture"],"sources":["SkiaPictureView.web.tsx"],"sourcesContent":["import type { SkCanvas } from \"../skia/types\";\n\nimport type { SkiaPictureViewProps } from \"./types\";\nimport { SkiaBaseWebView } from \"./SkiaBaseWebView\";\n\nexport class SkiaPictureView extends SkiaBaseWebView<SkiaPictureViewProps> {\n constructor(props: SkiaPictureViewProps) {\n super(props);\n }\n\n protected renderInCanvas(canvas: SkCanvas): void {\n if (this.props.picture) {\n canvas.drawPicture(this.props.picture);\n }\n }\n}\n"],"mappings":";;;;;;;AAGA;;AAEO,MAAMA,eAAN,SAA8BC,gCAA9B,CAAoE;EACzEC,WAAW,CAACC,KAAD,EAA8B;IACvC,MAAMA,KAAN;EACD;;EAESC,cAAc,CAACC,MAAD,EAAyB;IAC/C,IAAI,KAAKF,KAAL,CAAWG,OAAf,EAAwB;MACtBD,MAAM,CAACE,WAAP,CAAmB,KAAKJ,KAAL,CAAWG,OAA9B;IACD;EACF;;AATwE"}
|
@@ -5,12 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.SkiaView = void 0;
|
7
7
|
|
8
|
-
var _reactNative = require("react-native");
|
9
|
-
|
10
8
|
var _SkiaBaseWebView = require("./SkiaBaseWebView");
|
11
9
|
|
12
|
-
const pd = _reactNative.PixelRatio.get();
|
13
|
-
|
14
10
|
class SkiaView extends _SkiaBaseWebView.SkiaBaseWebView {
|
15
11
|
constructor(props) {
|
16
12
|
super(props);
|
@@ -24,10 +20,7 @@ class SkiaView extends _SkiaBaseWebView.SkiaBaseWebView {
|
|
24
20
|
timestamp: Date.now(),
|
25
21
|
touches: touches.map(t => [t])
|
26
22
|
};
|
27
|
-
canvas.save();
|
28
|
-
canvas.scale(pd, pd);
|
29
23
|
this.props.onDraw(canvas, info);
|
30
|
-
canvas.restore();
|
31
24
|
}
|
32
25
|
}
|
33
26
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["SkiaView","SkiaBaseWebView","constructor","props","renderInCanvas","canvas","touches","onDraw","info","height","width","timestamp","Date","now","map","t"],"sources":["SkiaView.web.tsx"],"sourcesContent":["import type { SkCanvas } from \"../skia/types\";\n\nimport type { DrawingInfo, SkiaDrawViewProps, TouchInfo } from \"./types\";\nimport { SkiaBaseWebView } from \"./SkiaBaseWebView\";\n\nexport class SkiaView extends SkiaBaseWebView<SkiaDrawViewProps> {\n constructor(props: SkiaDrawViewProps) {\n super(props);\n }\n\n protected renderInCanvas(canvas: SkCanvas, touches: TouchInfo[]): void {\n if (this.props.onDraw) {\n const info: DrawingInfo = {\n height: this.height,\n width: this.width,\n timestamp: Date.now(),\n touches: touches.map((t) => [t]),\n };\n this.props.onDraw(canvas, info);\n }\n }\n}\n"],"mappings":";;;;;;;AAGA;;AAEO,MAAMA,QAAN,SAAuBC,gCAAvB,CAA0D;EAC/DC,WAAW,CAACC,KAAD,EAA2B;IACpC,MAAMA,KAAN;EACD;;EAESC,cAAc,CAACC,MAAD,EAAmBC,OAAnB,EAA+C;IACrE,IAAI,KAAKH,KAAL,CAAWI,MAAf,EAAuB;MACrB,MAAMC,IAAiB,GAAG;QACxBC,MAAM,EAAE,KAAKA,MADW;QAExBC,KAAK,EAAE,KAAKA,KAFY;QAGxBC,SAAS,EAAEC,IAAI,CAACC,GAAL,EAHa;QAIxBP,OAAO,EAAEA,OAAO,CAACQ,GAAR,CAAaC,CAAD,IAAO,CAACA,CAAD,CAAnB;MAJe,CAA1B;MAMA,KAAKZ,KAAL,CAAWI,MAAX,CAAkBF,MAAlB,EAA0BG,IAA1B;IACD;EACF;;AAf8D"}
|
@@ -56,7 +56,11 @@ export class JsiDrawingNode extends JsiRenderNode {
|
|
56
56
|
|
57
57
|
this.children().map(child => {
|
58
58
|
if (child instanceof PaintNode) {
|
59
|
-
const
|
59
|
+
const declCtx = ctx.declarationCtx;
|
60
|
+
declCtx.save();
|
61
|
+
child.decorate(declCtx);
|
62
|
+
const paint = declCtx.paints.pop();
|
63
|
+
declCtx.restore();
|
60
64
|
this.draw({ ...ctx,
|
61
65
|
paint
|
62
66
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiDeclarationNode","PaintNode","JsiRenderNode","JsiDrawingNode","constructor","ctx","type","props","derived","deriveProps","setProps","setProp","name","value","hasChanged","addChild","child","Error","insertChildBefore","before","renderNode","paint","draw","children","map","
|
1
|
+
{"version":3,"names":["JsiDeclarationNode","PaintNode","JsiRenderNode","JsiDrawingNode","constructor","ctx","type","props","derived","deriveProps","setProps","setProp","name","value","hasChanged","addChild","child","Error","insertChildBefore","before","renderNode","paint","draw","children","map","declCtx","declarationCtx","save","decorate","paints","pop","restore"],"sources":["DrawingNode.ts"],"sourcesContent":["import type {\n DrawingContext,\n DrawingNodeProps,\n Node,\n NodeType,\n RenderNode,\n} from \"../types\";\n\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\nimport { PaintNode } from \"./PaintNode\";\nimport { JsiRenderNode } from \"./RenderNode\";\n\nexport abstract class JsiDrawingNode<P extends DrawingNodeProps, C>\n extends JsiRenderNode<P>\n implements RenderNode<P>\n{\n protected derived?: C;\n\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, type, props);\n this.derived = this.deriveProps();\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.derived = this.deriveProps();\n }\n\n setProp<K extends keyof P>(name: K, value: P[K]) {\n const hasChanged = super.setProp(name, value);\n if (hasChanged) {\n this.derived = this.deriveProps();\n }\n return hasChanged;\n }\n\n addChild(child: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n this.derived = this.deriveProps();\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n this.derived = this.deriveProps();\n }\n\n renderNode(ctx: DrawingContext): void {\n if (this.props.paint) {\n this.draw({ ...ctx, paint: this.props.paint });\n } else {\n this.draw(ctx);\n }\n this.children().map((child) => {\n if (child instanceof PaintNode) {\n const declCtx = ctx.declarationCtx;\n declCtx.save();\n child.decorate(declCtx);\n const paint = declCtx.paints.pop()!;\n declCtx.restore();\n this.draw({ ...ctx, paint });\n }\n });\n }\n\n protected abstract draw(ctx: DrawingContext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,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDW,UAAU,CAACf,GAAD,EAA4B;IACpC,IAAI,KAAKE,KAAL,CAAWc,KAAf,EAAsB;MACpB,KAAKC,IAAL,CAAU,EAAE,GAAGjB,GAAL;QAAUgB,KAAK,EAAE,KAAKd,KAAL,CAAWc;MAA5B,CAAV;IACD,CAFD,MAEO;MACL,KAAKC,IAAL,CAAUjB,GAAV;IACD;;IACD,KAAKkB,QAAL,GAAgBC,GAAhB,CAAqBR,KAAD,IAAW;MAC7B,IAAIA,KAAK,YAAYf,SAArB,EAAgC;QAC9B,MAAMwB,OAAO,GAAGpB,GAAG,CAACqB,cAApB;QACAD,OAAO,CAACE,IAAR;QACAX,KAAK,CAACY,QAAN,CAAeH,OAAf;QACA,MAAMJ,KAAK,GAAGI,OAAO,CAACI,MAAR,CAAeC,GAAf,EAAd;QACAL,OAAO,CAACM,OAAR;QACA,KAAKT,IAAL,CAAU,EAAE,GAAGjB,GAAL;UAAUgB;QAAV,CAAV;MACD;IACF,CATD;EAUD;;AArDH"}
|
@@ -1,14 +1,13 @@
|
|
1
1
|
import type { PathProps, SkDOM, GroupProps, ImageProps, BlurImageFilterProps, MatrixColorFilterProps, CircleProps, BlurMaskFilterProps, LinearGradientProps, PaintProps, ShaderProps, ImageShaderProps, CustomDrawingNodeProps, LineProps, OvalProps, PatchProps, PointsProps, RectProps, RoundedRectProps, VerticesProps, TextProps, DiffRectProps, OffsetImageFilterProps, BlendColorFilterProps, TextPathProps, TextBlobProps, GlyphsProps, TwoPointConicalGradientProps, TurbulenceProps, SweepGradientProps, RadialGradientProps, FractalNoiseProps, ColorProps, PictureProps, ImageSVGProps, LerpColorFilterProps, DrawingNodeProps, BoxProps, BoxShadowProps, ChildrenProps } from "../types";
|
2
2
|
import type { BlendImageFilterProps, BlendProps, DisplacementMapImageFilterProps, DropShadowImageFilterProps, MorphologyImageFilterProps, RuntimeShaderImageFilterProps } from "../types/ImageFilters";
|
3
3
|
import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps } from "../types/PathEffects";
|
4
|
-
import { CornerPathEffectNode, Path1DPathEffectNode, Path2DPathEffectNode, Line2DPathEffectNode, BlendNode } from "./paint";
|
5
4
|
import type { NodeContext } from "./Node";
|
6
5
|
export declare class JsiSkDOM implements SkDOM {
|
7
6
|
private ctx;
|
8
7
|
constructor(ctx: NodeContext);
|
9
8
|
Layer(props?: ChildrenProps): import("../types").RenderNode<ChildrenProps>;
|
10
9
|
Group(props?: GroupProps): import("../types").RenderNode<GroupProps>;
|
11
|
-
Paint(props: PaintProps): import("../types").DeclarationNode<PaintProps
|
10
|
+
Paint(props: PaintProps): import("../types").DeclarationNode<PaintProps>;
|
12
11
|
Fill(props?: DrawingNodeProps): import("../types").RenderNode<PaintProps>;
|
13
12
|
Image(props: ImageProps): import("../types").RenderNode<ImageProps>;
|
14
13
|
Circle(props: CircleProps): import("../types").RenderNode<CircleProps>;
|
@@ -28,38 +27,38 @@ export declare class JsiSkDOM implements SkDOM {
|
|
28
27
|
DiffRect(props: DiffRectProps): import("../types").RenderNode<DiffRectProps>;
|
29
28
|
Picture(props: PictureProps): import("../types").RenderNode<PictureProps>;
|
30
29
|
ImageSVG(props: ImageSVGProps): import("../types").RenderNode<ImageSVGProps>;
|
31
|
-
BlurMaskFilter(props: BlurMaskFilterProps): import("../types").DeclarationNode<BlurMaskFilterProps
|
32
|
-
BlendImageFilter(props: BlendImageFilterProps): import("../types").DeclarationNode<BlendImageFilterProps
|
33
|
-
DropShadowImageFilter(props: DropShadowImageFilterProps): import("../types").DeclarationNode<DropShadowImageFilterProps
|
34
|
-
DisplacementMapImageFilter(props: DisplacementMapImageFilterProps): import("../types").DeclarationNode<DisplacementMapImageFilterProps
|
35
|
-
BlurImageFilter(props: BlurImageFilterProps): import("../types").DeclarationNode<BlurImageFilterProps
|
36
|
-
OffsetImageFilter(props: OffsetImageFilterProps): import("../types").DeclarationNode<OffsetImageFilterProps
|
37
|
-
MorphologyImageFilter(props: MorphologyImageFilterProps): import("../types").DeclarationNode<MorphologyImageFilterProps
|
38
|
-
RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps): import("../types").DeclarationNode<RuntimeShaderImageFilterProps
|
39
|
-
MatrixColorFilter(props: MatrixColorFilterProps): import("../types").DeclarationNode<MatrixColorFilterProps
|
40
|
-
BlendColorFilter(props: BlendColorFilterProps): import("../types").DeclarationNode<BlendColorFilterProps
|
41
|
-
LumaColorFilter(): import("../types").DeclarationNode<null
|
42
|
-
LinearToSRGBGammaColorFilter(): import("../types").DeclarationNode<null
|
43
|
-
SRGBToLinearGammaColorFilter(): import("../types").DeclarationNode<null
|
44
|
-
LerpColorFilter(props: LerpColorFilterProps): import("../types").DeclarationNode<LerpColorFilterProps
|
45
|
-
Shader(props: ShaderProps): import("../types").DeclarationNode<ShaderProps
|
46
|
-
ImageShader(props: ImageShaderProps): import("../types").DeclarationNode<ImageShaderProps
|
47
|
-
ColorShader(props: ColorProps): import("../types").DeclarationNode<ColorProps
|
48
|
-
SweepGradient(props: SweepGradientProps): import("../types").DeclarationNode<SweepGradientProps
|
49
|
-
Turbulence(props: TurbulenceProps): import("../types").DeclarationNode<TurbulenceProps
|
50
|
-
FractalNoise(props: FractalNoiseProps): import("../types").DeclarationNode<FractalNoiseProps
|
51
|
-
LinearGradient(props: LinearGradientProps): import("../types").DeclarationNode<LinearGradientProps
|
52
|
-
RadialGradient(props: RadialGradientProps): import("../types").DeclarationNode<RadialGradientProps
|
53
|
-
TwoPointConicalGradient(props: TwoPointConicalGradientProps): import("../types").DeclarationNode<TwoPointConicalGradientProps
|
54
|
-
CornerPathEffect(props: CornerPathEffectProps):
|
55
|
-
DiscretePathEffect(props: DiscretePathEffectProps): import("../types").DeclarationNode<DiscretePathEffectProps
|
56
|
-
DashPathEffect(props: DashPathEffectProps): import("../types").DeclarationNode<DashPathEffectProps
|
57
|
-
Path1DPathEffect(props: Path1DPathEffectProps):
|
58
|
-
Path2DPathEffect(props: Path2DPathEffectProps):
|
59
|
-
SumPathEffect(): import("../types").DeclarationNode<null
|
60
|
-
Line2DPathEffect(props: Line2DPathEffectProps):
|
61
|
-
Blend(props: BlendProps):
|
30
|
+
BlurMaskFilter(props: BlurMaskFilterProps): import("../types").DeclarationNode<BlurMaskFilterProps>;
|
31
|
+
BlendImageFilter(props: BlendImageFilterProps): import("../types").DeclarationNode<BlendImageFilterProps>;
|
32
|
+
DropShadowImageFilter(props: DropShadowImageFilterProps): import("../types").DeclarationNode<DropShadowImageFilterProps>;
|
33
|
+
DisplacementMapImageFilter(props: DisplacementMapImageFilterProps): import("../types").DeclarationNode<DisplacementMapImageFilterProps>;
|
34
|
+
BlurImageFilter(props: BlurImageFilterProps): import("../types").DeclarationNode<BlurImageFilterProps>;
|
35
|
+
OffsetImageFilter(props: OffsetImageFilterProps): import("../types").DeclarationNode<OffsetImageFilterProps>;
|
36
|
+
MorphologyImageFilter(props: MorphologyImageFilterProps): import("../types").DeclarationNode<MorphologyImageFilterProps>;
|
37
|
+
RuntimeShaderImageFilter(props: RuntimeShaderImageFilterProps): import("../types").DeclarationNode<RuntimeShaderImageFilterProps>;
|
38
|
+
MatrixColorFilter(props: MatrixColorFilterProps): import("../types").DeclarationNode<MatrixColorFilterProps>;
|
39
|
+
BlendColorFilter(props: BlendColorFilterProps): import("../types").DeclarationNode<BlendColorFilterProps>;
|
40
|
+
LumaColorFilter(): import("../types").DeclarationNode<null>;
|
41
|
+
LinearToSRGBGammaColorFilter(): import("../types").DeclarationNode<null>;
|
42
|
+
SRGBToLinearGammaColorFilter(): import("../types").DeclarationNode<null>;
|
43
|
+
LerpColorFilter(props: LerpColorFilterProps): import("../types").DeclarationNode<LerpColorFilterProps>;
|
44
|
+
Shader(props: ShaderProps): import("../types").DeclarationNode<ShaderProps>;
|
45
|
+
ImageShader(props: ImageShaderProps): import("../types").DeclarationNode<ImageShaderProps>;
|
46
|
+
ColorShader(props: ColorProps): import("../types").DeclarationNode<ColorProps>;
|
47
|
+
SweepGradient(props: SweepGradientProps): import("../types").DeclarationNode<SweepGradientProps>;
|
48
|
+
Turbulence(props: TurbulenceProps): import("../types").DeclarationNode<TurbulenceProps>;
|
49
|
+
FractalNoise(props: FractalNoiseProps): import("../types").DeclarationNode<FractalNoiseProps>;
|
50
|
+
LinearGradient(props: LinearGradientProps): import("../types").DeclarationNode<LinearGradientProps>;
|
51
|
+
RadialGradient(props: RadialGradientProps): import("../types").DeclarationNode<RadialGradientProps>;
|
52
|
+
TwoPointConicalGradient(props: TwoPointConicalGradientProps): import("../types").DeclarationNode<TwoPointConicalGradientProps>;
|
53
|
+
CornerPathEffect(props: CornerPathEffectProps): import("../types").DeclarationNode<CornerPathEffectProps>;
|
54
|
+
DiscretePathEffect(props: DiscretePathEffectProps): import("../types").DeclarationNode<DiscretePathEffectProps>;
|
55
|
+
DashPathEffect(props: DashPathEffectProps): import("../types").DeclarationNode<DashPathEffectProps>;
|
56
|
+
Path1DPathEffect(props: Path1DPathEffectProps): import("../types").DeclarationNode<Path1DPathEffectProps>;
|
57
|
+
Path2DPathEffect(props: Path2DPathEffectProps): import("../types").DeclarationNode<Path2DPathEffectProps>;
|
58
|
+
SumPathEffect(): import("../types").DeclarationNode<null>;
|
59
|
+
Line2DPathEffect(props: Line2DPathEffectProps): import("../types").DeclarationNode<Line2DPathEffectProps>;
|
60
|
+
Blend(props: BlendProps): import("../types").DeclarationNode<BlendProps>;
|
62
61
|
BackdropFilter(props: ChildrenProps): import("../types").RenderNode<ChildrenProps>;
|
63
62
|
Box(props: BoxProps): import("../types").RenderNode<BoxProps>;
|
64
|
-
BoxShadow(props: BoxShadowProps): import("../types").DeclarationNode<BoxShadowProps
|
63
|
+
BoxShadow(props: BoxShadowProps): import("../types").DeclarationNode<BoxShadowProps>;
|
65
64
|
}
|
@@ -1,20 +1,26 @@
|
|
1
1
|
import { NodeType } from "../types";
|
2
2
|
import { JsiRenderNode } from "./RenderNode";
|
3
3
|
import { JsiDeclarationNode } from "./Node";
|
4
|
-
|
5
|
-
const isLayer = node => node instanceof JsiDeclarationNode && node.isPaint();
|
6
|
-
|
7
4
|
export class LayerNode extends JsiRenderNode {
|
8
5
|
constructor(ctx, props) {
|
9
6
|
super(ctx, NodeType.Layer, props);
|
10
7
|
}
|
11
8
|
|
12
9
|
renderNode(ctx) {
|
10
|
+
let hasLayer = false;
|
13
11
|
const [layer, ...children] = this.children();
|
14
12
|
|
15
|
-
if (
|
16
|
-
const
|
17
|
-
|
13
|
+
if (layer instanceof JsiDeclarationNode) {
|
14
|
+
const declCtx = ctx.declarationCtx;
|
15
|
+
declCtx.save();
|
16
|
+
layer.decorate(declCtx);
|
17
|
+
const paint = declCtx.paints.pop();
|
18
|
+
declCtx.restore();
|
19
|
+
|
20
|
+
if (paint) {
|
21
|
+
hasLayer = true;
|
22
|
+
ctx.canvas.saveLayer(paint);
|
23
|
+
}
|
18
24
|
}
|
19
25
|
|
20
26
|
children.map(child => {
|
@@ -23,7 +29,7 @@ export class LayerNode extends JsiRenderNode {
|
|
23
29
|
}
|
24
30
|
});
|
25
31
|
|
26
|
-
if (
|
32
|
+
if (hasLayer) {
|
27
33
|
ctx.canvas.restore();
|
28
34
|
}
|
29
35
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NodeType","JsiRenderNode","JsiDeclarationNode","
|
1
|
+
{"version":3,"names":["NodeType","JsiRenderNode","JsiDeclarationNode","LayerNode","constructor","ctx","props","Layer","renderNode","hasLayer","layer","children","declCtx","declarationCtx","save","decorate","paint","paints","pop","restore","canvas","saveLayer","map","child","render"],"sources":["LayerNode.ts"],"sourcesContent":["import type { DrawingContext } from \"../types\";\nimport { NodeType } from \"../types\";\nimport type { ChildrenProps } from \"../types/Common\";\n\nimport { JsiRenderNode } from \"./RenderNode\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nexport class LayerNode extends JsiRenderNode<ChildrenProps> {\n constructor(ctx: NodeContext, props: ChildrenProps) {\n super(ctx, NodeType.Layer, props);\n }\n\n renderNode(ctx: DrawingContext): void {\n let hasLayer = false;\n const [layer, ...children] = this.children();\n if (layer instanceof JsiDeclarationNode) {\n const declCtx = ctx.declarationCtx;\n declCtx.save();\n layer.decorate(declCtx);\n const paint = declCtx.paints.pop();\n declCtx.restore();\n if (paint) {\n hasLayer = true;\n ctx.canvas.saveLayer(paint);\n }\n }\n children.map((child) => {\n if (child instanceof JsiRenderNode) {\n child.render(ctx);\n }\n });\n if (hasLayer) {\n ctx.canvas.restore();\n }\n }\n}\n"],"mappings":"AACA,SAASA,QAAT,QAAyB,UAAzB;AAGA,SAASC,aAAT,QAA8B,cAA9B;AAEA,SAASC,kBAAT,QAAmC,QAAnC;AAEA,OAAO,MAAMC,SAAN,SAAwBF,aAAxB,CAAqD;EAC1DG,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAyC;IAClD,MAAMD,GAAN,EAAWL,QAAQ,CAACO,KAApB,EAA2BD,KAA3B;EACD;;EAEDE,UAAU,CAACH,GAAD,EAA4B;IACpC,IAAII,QAAQ,GAAG,KAAf;IACA,MAAM,CAACC,KAAD,EAAQ,GAAGC,QAAX,IAAuB,KAAKA,QAAL,EAA7B;;IACA,IAAID,KAAK,YAAYR,kBAArB,EAAyC;MACvC,MAAMU,OAAO,GAAGP,GAAG,CAACQ,cAApB;MACAD,OAAO,CAACE,IAAR;MACAJ,KAAK,CAACK,QAAN,CAAeH,OAAf;MACA,MAAMI,KAAK,GAAGJ,OAAO,CAACK,MAAR,CAAeC,GAAf,EAAd;MACAN,OAAO,CAACO,OAAR;;MACA,IAAIH,KAAJ,EAAW;QACTP,QAAQ,GAAG,IAAX;QACAJ,GAAG,CAACe,MAAJ,CAAWC,SAAX,CAAqBL,KAArB;MACD;IACF;;IACDL,QAAQ,CAACW,GAAT,CAAcC,KAAD,IAAW;MACtB,IAAIA,KAAK,YAAYtB,aAArB,EAAoC;QAClCsB,KAAK,CAACC,MAAN,CAAanB,GAAb;MACD;IACF,CAJD;;IAKA,IAAII,QAAJ,EAAc;MACZJ,GAAG,CAACe,MAAJ,CAAWD,OAAX;IACD;EACF;;AA3ByD"}
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import type {
|
2
|
-
import type { Node, DeclarationNode, NodeType } from "../types";
|
3
|
-
import { DeclarationType } from "../types";
|
1
|
+
import type { Skia } from "../../skia/types";
|
2
|
+
import type { Node, DeclarationNode, NodeType, DeclarationType } from "../types";
|
4
3
|
import type { DependencyManager } from "../../renderer/DependencyManager";
|
4
|
+
import type { DeclarationContext } from "../types/DeclarationContext";
|
5
5
|
export interface NodeContext {
|
6
6
|
Skia: Skia;
|
7
7
|
depMgr: DependencyManager;
|
@@ -23,21 +23,16 @@ export declare abstract class JsiNode<P> implements Node<P> {
|
|
23
23
|
insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
|
24
24
|
}
|
25
25
|
export declare type Invalidate = () => void;
|
26
|
-
export declare abstract class JsiDeclarationNode<P
|
26
|
+
export declare abstract class JsiDeclarationNode<P> extends JsiNode<P> implements DeclarationNode<P> {
|
27
27
|
declarationType: DeclarationType;
|
28
28
|
private invalidate;
|
29
29
|
constructor(ctx: NodeContext, declarationType: DeclarationType, type: NodeType, props: P);
|
30
|
-
abstract
|
30
|
+
abstract decorate(ctx: DeclarationContext): void;
|
31
|
+
protected decorateChildren(ctx: DeclarationContext): void;
|
31
32
|
addChild(child: Node<unknown>): void;
|
32
33
|
insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
|
33
34
|
dispose(): void;
|
34
35
|
setInvalidate(invalidate: Invalidate): void;
|
35
36
|
setProps(props: P): void;
|
36
37
|
setProp<K extends keyof P>(name: K, v: P[K]): boolean;
|
37
|
-
isPaint(): this is DeclarationNode<unknown, SkPaint>;
|
38
|
-
isImageFilter(): this is DeclarationNode<unknown, SkImageFilter>;
|
39
|
-
isColorFilter(): this is DeclarationNode<unknown, SkColorFilter>;
|
40
|
-
isShader(): this is DeclarationNode<unknown, SkShader>;
|
41
|
-
isMaskFilter(): this is DeclarationNode<unknown, SkMaskFilter>;
|
42
|
-
isPathEffect(): this is DeclarationNode<unknown, SkPathEffect>;
|
43
38
|
}
|
@@ -1,6 +1,5 @@
|
|
1
1
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
2
2
|
|
3
|
-
import { DeclarationType } from "../types";
|
4
3
|
export class JsiNode {
|
5
4
|
constructor(ctx, type, props) {
|
6
5
|
this.type = type;
|
@@ -75,6 +74,14 @@ export class JsiDeclarationNode extends JsiNode {
|
|
75
74
|
_defineProperty(this, "invalidate", () => {});
|
76
75
|
}
|
77
76
|
|
77
|
+
decorateChildren(ctx) {
|
78
|
+
this.children().forEach(child => {
|
79
|
+
if (child instanceof JsiDeclarationNode) {
|
80
|
+
child.decorate(ctx);
|
81
|
+
}
|
82
|
+
});
|
83
|
+
}
|
84
|
+
|
78
85
|
addChild(child) {
|
79
86
|
if (!(child instanceof JsiDeclarationNode)) {
|
80
87
|
throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
|
@@ -117,29 +124,5 @@ export class JsiDeclarationNode extends JsiNode {
|
|
117
124
|
return hasChanged;
|
118
125
|
}
|
119
126
|
|
120
|
-
isPaint() {
|
121
|
-
return this.declarationType === DeclarationType.Paint;
|
122
|
-
}
|
123
|
-
|
124
|
-
isImageFilter() {
|
125
|
-
return this.declarationType === DeclarationType.ImageFilter;
|
126
|
-
}
|
127
|
-
|
128
|
-
isColorFilter() {
|
129
|
-
return this.declarationType === DeclarationType.ColorFilter;
|
130
|
-
}
|
131
|
-
|
132
|
-
isShader() {
|
133
|
-
return this.declarationType === DeclarationType.Shader;
|
134
|
-
}
|
135
|
-
|
136
|
-
isMaskFilter() {
|
137
|
-
return this.declarationType === DeclarationType.MaskFilter;
|
138
|
-
}
|
139
|
-
|
140
|
-
isPathEffect() {
|
141
|
-
return this.declarationType === DeclarationType.PathEffect;
|
142
|
-
}
|
143
|
-
|
144
127
|
}
|
145
128
|
//# sourceMappingURL=Node.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["JsiNode","constructor","ctx","type","props","Skia","depMgr","setProps","setProp","name","v","hasChanged","getProps","children","_children","addChild","child","push","dispose","unsubscribeNode","forEach","removeChild","index","indexOf","node","splice","insertChildBefore","before","beforeIndex","JsiDeclarationNode","declarationType","decorateChildren","decorate","Error","invalidate","setInvalidate"],"sources":["Node.ts"],"sourcesContent":["import type { Skia } from \"../../skia/types\";\nimport type {\n Node,\n DeclarationNode,\n NodeType,\n DeclarationType,\n} from \"../types\";\nimport type { DependencyManager } from \"../../renderer/DependencyManager\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nexport interface NodeContext {\n Skia: Skia;\n depMgr: DependencyManager;\n}\n\nexport abstract class JsiNode<P> implements Node<P> {\n protected _children: JsiNode<unknown>[] = [];\n protected Skia: Skia;\n protected depMgr: DependencyManager;\n\n constructor(ctx: NodeContext, public type: NodeType, protected props: P) {\n this.Skia = ctx.Skia;\n this.depMgr = ctx.depMgr;\n }\n\n setProps(props: P) {\n this.props = props;\n }\n\n setProp<K extends keyof P>(name: K, v: P[K]) {\n const hasChanged = this.props[name] !== v;\n this.props[name] = v;\n return hasChanged;\n }\n\n getProps() {\n return this.props;\n }\n\n children() {\n return this._children;\n }\n\n addChild(child: Node<unknown>) {\n this._children.push(child as JsiNode<unknown>);\n }\n\n dispose() {\n this.depMgr.unsubscribeNode(this);\n this._children.forEach((child) => child.dispose());\n }\n\n removeChild(child: Node<unknown>) {\n const index = this._children.indexOf(child as JsiNode<unknown>);\n if (index !== -1) {\n const [node] = this._children.splice(index, 1);\n node.dispose();\n }\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>) {\n const index = this._children.indexOf(child as JsiNode<unknown>);\n if (index !== -1) {\n this._children.splice(index, 1);\n }\n const beforeIndex = this._children.indexOf(before as JsiNode<unknown>);\n this._children.splice(beforeIndex, 0, child as JsiNode<unknown>);\n }\n}\n\nexport type Invalidate = () => void;\n\nexport abstract class JsiDeclarationNode<P>\n extends JsiNode<P>\n implements DeclarationNode<P>\n{\n private invalidate: Invalidate = () => {};\n\n constructor(\n ctx: NodeContext,\n public declarationType: DeclarationType,\n type: NodeType,\n props: P\n ) {\n super(ctx, type, props);\n }\n\n abstract decorate(ctx: DeclarationContext): void;\n\n protected decorateChildren(ctx: DeclarationContext) {\n this.children().forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n }\n\n addChild(child: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n this.invalidate();\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof JsiDeclarationNode)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n this.invalidate();\n }\n\n dispose() {\n this.invalidate();\n super.dispose();\n }\n\n setInvalidate(invalidate: Invalidate) {\n this.invalidate = invalidate;\n }\n\n setProps(props: P) {\n super.setProps(props);\n this.invalidate();\n }\n\n setProp<K extends keyof P>(name: K, v: P[K]) {\n const hasChanged = super.setProp(name, v);\n if (hasChanged) {\n this.invalidate();\n }\n return hasChanged;\n }\n}\n"],"mappings":";;AAeA,OAAO,MAAeA,OAAf,CAA6C;EAKlDC,WAAW,CAACC,GAAD,EAA0BC,IAA1B,EAAoDC,KAApD,EAA8D;IAAA,KAApCD,IAAoC,GAApCA,IAAoC;IAAA,KAAVC,KAAU,GAAVA,KAAU;;IAAA,mCAJ/B,EAI+B;;IAAA;;IAAA;;IACvE,KAAKC,IAAL,GAAYH,GAAG,CAACG,IAAhB;IACA,KAAKC,MAAL,GAAcJ,GAAG,CAACI,MAAlB;EACD;;EAEDC,QAAQ,CAACH,KA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OAAO,CAAoBC,IAApB,EAA6BC,CAA7B,EAAsC;IAC3C,MAAMC,UAAU,GAAG,MAAMH,OAAN,CAAcC,IAAd,EAAoBC,CAApB,CAAnB;;IACA,IAAIC,UAAJ,EAAgB;MACd,KAAKuB,UAAL;IACD;;IACD,OAAOvB,UAAP;EACD;;AA1DH"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":[],"sources":["PaintContext.ts"],"sourcesContent":["import type {\n BlendMode,\n PaintStyle,\n SkColorFilter,\n SkImageFilter,\n SkMaskFilter,\n SkPathEffect,\n SkShader,\n StrokeCap,\n StrokeJoin,\n} from \"../../skia/types\";\nimport type { SkColor } from \"../../skia/types/Color\";\n\nexport interface PaintContext {\n color?: SkColor;\n strokeWidth?: number;\n blendMode?: BlendMode;\n style?: PaintStyle;\n strokeJoin?: StrokeJoin;\n strokeCap?: StrokeCap;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n\n shader?: SkShader;\n colorFilter?: SkColorFilter;\n imageFilter?: SkImageFilter;\n maskFilter?: SkMaskFilter;\n pathEffect?: SkPathEffect;\n}\n"],"mappings":""}
|
1
|
+
{"version":3,"names":[],"sources":["PaintContext.ts"],"sourcesContent":["import type {\n BlendMode,\n PaintStyle,\n SkColorFilter,\n SkImageFilter,\n SkMaskFilter,\n SkPathEffect,\n SkShader,\n StrokeCap,\n StrokeJoin,\n} from \"../../skia/types\";\nimport type { SkColor } from \"../../skia/types/Color\";\n\n// TODO: to remove\nexport interface PaintContext {\n color?: SkColor;\n strokeWidth?: number;\n blendMode?: BlendMode;\n style?: PaintStyle;\n strokeJoin?: StrokeJoin;\n strokeCap?: StrokeCap;\n strokeMiter?: number;\n opacity?: number;\n antiAlias?: boolean;\n\n shader?: SkShader;\n colorFilter?: SkColorFilter;\n imageFilter?: SkImageFilter;\n maskFilter?: SkMaskFilter;\n pathEffect?: SkPathEffect;\n}\n"],"mappings":""}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import type { SkPaint } from "../../skia/types";
|
2
1
|
import type { DeclarationNode, PaintProps } from "../types";
|
2
|
+
import type { DeclarationContext } from "../types/DeclarationContext";
|
3
3
|
import type { NodeContext } from "./Node";
|
4
4
|
import { JsiDeclarationNode } from "./Node";
|
5
|
-
export declare class PaintNode extends JsiDeclarationNode<PaintProps
|
5
|
+
export declare class PaintNode extends JsiDeclarationNode<PaintProps> implements DeclarationNode<PaintProps> {
|
6
6
|
constructor(ctx: NodeContext, props?: PaintProps);
|
7
|
-
|
7
|
+
decorate(ctx: DeclarationContext): void;
|
8
8
|
}
|
@@ -8,7 +8,7 @@ export class PaintNode extends JsiDeclarationNode {
|
|
8
8
|
super(ctx, DeclarationType.Paint, NodeType.Paint, props);
|
9
9
|
}
|
10
10
|
|
11
|
-
|
11
|
+
decorate(ctx) {
|
12
12
|
const {
|
13
13
|
color,
|
14
14
|
strokeWidth,
|
@@ -58,25 +58,42 @@ export class PaintNode extends JsiDeclarationNode {
|
|
58
58
|
paint.setAntiAlias(antiAlias);
|
59
59
|
}
|
60
60
|
|
61
|
+
ctx.save();
|
62
|
+
|
61
63
|
this._children.forEach(child => {
|
62
64
|
if (child instanceof JsiDeclarationNode) {
|
63
|
-
|
64
|
-
paint.setShader(child.materialize());
|
65
|
-
} else if (child.isColorFilter()) {
|
66
|
-
paint.setColorFilter(child.materialize());
|
67
|
-
} else if (child.isImageFilter()) {
|
68
|
-
paint.setImageFilter(child.materialize());
|
69
|
-
} else if (child.isMaskFilter()) {
|
70
|
-
paint.setMaskFilter(child.materialize());
|
71
|
-
} else if (child.isPathEffect()) {
|
72
|
-
paint.setPathEffect(child.materialize());
|
73
|
-
} else {
|
74
|
-
throw new Error(`Unknown paint child ${child.type}`);
|
75
|
-
}
|
65
|
+
child.decorate(ctx);
|
76
66
|
}
|
77
67
|
});
|
78
68
|
|
79
|
-
|
69
|
+
const colorFilter = ctx.colorFilters.popAllAsOne();
|
70
|
+
const imageFilter = ctx.imageFilters.popAllAsOne();
|
71
|
+
const shader = ctx.shaders.pop();
|
72
|
+
const maskFilter = ctx.maskFilters.pop();
|
73
|
+
const pathEffect = ctx.pathEffects.popAllAsOne();
|
74
|
+
ctx.restore();
|
75
|
+
|
76
|
+
if (imageFilter) {
|
77
|
+
paint.setImageFilter(imageFilter);
|
78
|
+
}
|
79
|
+
|
80
|
+
if (shader) {
|
81
|
+
paint.setShader(shader);
|
82
|
+
}
|
83
|
+
|
84
|
+
if (pathEffect) {
|
85
|
+
paint.setPathEffect(pathEffect);
|
86
|
+
}
|
87
|
+
|
88
|
+
if (colorFilter) {
|
89
|
+
paint.setColorFilter(colorFilter);
|
90
|
+
}
|
91
|
+
|
92
|
+
if (maskFilter) {
|
93
|
+
paint.setMaskFilter(maskFilter);
|
94
|
+
}
|
95
|
+
|
96
|
+
ctx.paints.push(paint);
|
80
97
|
}
|
81
98
|
|
82
99
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["StrokeCap","StrokeJoin","PaintStyle","BlendMode","DeclarationType","NodeType","enumKey","JsiDeclarationNode","PaintNode","constructor","ctx","props","Paint","
|
1
|
+
{"version":3,"names":["StrokeCap","StrokeJoin","PaintStyle","BlendMode","DeclarationType","NodeType","enumKey","JsiDeclarationNode","PaintNode","constructor","ctx","props","Paint","decorate","color","strokeWidth","blendMode","style","strokeJoin","strokeCap","strokeMiter","opacity","antiAlias","paint","Skia","undefined","setColor","Color","setStrokeWidth","setBlendMode","setStyle","setStrokeJoin","setStrokeCap","setStrokeMiter","setAlphaf","setAntiAlias","save","_children","forEach","child","colorFilter","colorFilters","popAllAsOne","imageFilter","imageFilters","shader","shaders","pop","maskFilter","maskFilters","pathEffect","pathEffects","restore","setImageFilter","setShader","setPathEffect","setColorFilter","setMaskFilter","paints","push"],"sources":["PaintNode.ts"],"sourcesContent":["import { StrokeCap, StrokeJoin, PaintStyle, BlendMode } from \"../../skia/types\";\nimport type { DeclarationNode, PaintProps } from \"../types\";\nimport { DeclarationType, NodeType } from \"../types\";\nimport type { DeclarationContext } from \"../types/DeclarationContext\";\n\nimport { enumKey } from \"./datatypes\";\nimport type { NodeContext } from \"./Node\";\nimport { JsiDeclarationNode } from \"./Node\";\n\nexport class PaintNode\n extends JsiDeclarationNode<PaintProps>\n implements DeclarationNode<PaintProps>\n{\n constructor(ctx: NodeContext, props: PaintProps = {}) {\n super(ctx, DeclarationType.Paint, NodeType.Paint, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const {\n color,\n strokeWidth,\n blendMode,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n opacity,\n antiAlias,\n } = this.props;\n const paint = this.Skia.Paint();\n if (color !== undefined) {\n paint.setColor(this.Skia.Color(color));\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (opacity !== undefined) {\n paint.setAlphaf(opacity);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n ctx.save();\n this._children.forEach((child) => {\n if (child instanceof JsiDeclarationNode) {\n child.decorate(ctx);\n }\n });\n const colorFilter = ctx.colorFilters.popAllAsOne();\n const imageFilter = ctx.imageFilters.popAllAsOne();\n const shader = ctx.shaders.pop();\n const maskFilter = ctx.maskFilters.pop();\n const pathEffect = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n if (imageFilter) {\n paint.setImageFilter(imageFilter);\n }\n if (shader) {\n paint.setShader(shader);\n }\n if (pathEffect) {\n paint.setPathEffect(pathEffect);\n }\n if (colorFilter) {\n paint.setColorFilter(colorFilter);\n }\n if (maskFilter) {\n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AJ,EAAiB;MACfjB,KAAK,CAACiC,cAAN,CAAqBhB,WAArB;IACD;;IACD,IAAIQ,UAAJ,EAAgB;MACdzB,KAAK,CAACkC,aAAN,CAAoBT,UAApB;IACD;;IACDtC,GAAG,CAACgD,MAAJ,CAAWC,IAAX,CAAgBpC,KAAhB;EACD;;AAzEH"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { SkMatrix, SkRect, SkRRect, SkPath, SkPaint } from "../../skia/types";
|
2
|
-
import type { RenderNode, GroupProps,
|
2
|
+
import type { RenderNode, GroupProps, NodeType, Node, DrawingContext } from "../types";
|
3
3
|
import type { NodeContext } from "./Node";
|
4
4
|
import { JsiNode } from "./Node";
|
5
5
|
interface PaintCache {
|
@@ -20,8 +20,7 @@ export declare abstract class JsiRenderNode<P extends GroupProps> extends JsiNod
|
|
20
20
|
insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
|
21
21
|
private computeClip;
|
22
22
|
private computeMatrix;
|
23
|
-
|
24
|
-
render(parentCtx: DrawingContext): void;
|
23
|
+
render(ctx: DrawingContext): void;
|
25
24
|
abstract renderNode(ctx: DrawingContext): void;
|
26
25
|
}
|
27
26
|
export {};
|