@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
@@ -2,50 +2,50 @@
|
|
2
2
|
#include "SkiaPictureViewManager.h"
|
3
3
|
#include <React/RCTBridge+Private.h>
|
4
4
|
|
5
|
-
#include <RNSkPlatformContext.h>
|
6
|
-
#include <RNSkPictureView.h>
|
7
5
|
#include <RNSkIOSView.h>
|
6
|
+
#include <RNSkPictureView.h>
|
7
|
+
#include <RNSkPlatformContext.h>
|
8
8
|
|
9
9
|
#include "SkiaManager.h"
|
10
|
-
#include <RNSkiaModule.h>
|
11
10
|
#include "SkiaUIView.h"
|
12
|
-
|
13
|
-
|
11
|
+
#include <RNSkiaModule.h>
|
14
12
|
|
15
13
|
@implementation SkiaPictureViewManager
|
16
14
|
|
17
15
|
RCT_EXPORT_MODULE(SkiaPictureView)
|
18
16
|
|
19
|
-
- (SkiaManager*)
|
17
|
+
- (SkiaManager *)skiaManager {
|
20
18
|
auto bridge = [RCTBridge currentBridge];
|
21
|
-
auto skiaModule = (RNSkiaModule*)[bridge moduleForName:@"RNSkia"];
|
19
|
+
auto skiaModule = (RNSkiaModule *)[bridge moduleForName:@"RNSkia"];
|
22
20
|
return [skiaModule manager];
|
23
21
|
}
|
24
22
|
|
25
23
|
RCT_CUSTOM_VIEW_PROPERTY(nativeID, NSNumber, SkiaUIView) {
|
26
24
|
// Get parameter
|
27
25
|
int nativeId = [[RCTConvert NSString:json] intValue];
|
28
|
-
[(SkiaUIView*)view setNativeId:nativeId];
|
26
|
+
[(SkiaUIView *)view setNativeId:nativeId];
|
29
27
|
}
|
30
28
|
|
31
29
|
RCT_CUSTOM_VIEW_PROPERTY(mode, NSString, SkiaUIView) {
|
32
|
-
std::string mode =
|
33
|
-
|
30
|
+
std::string mode =
|
31
|
+
json != NULL ? [[RCTConvert NSString:json] UTF8String] : "default";
|
32
|
+
[(SkiaUIView *)view setDrawingMode:mode];
|
34
33
|
}
|
35
34
|
|
36
35
|
RCT_CUSTOM_VIEW_PROPERTY(debug, BOOL, SkiaUIView) {
|
37
36
|
bool debug = json != NULL ? [RCTConvert BOOL:json] : false;
|
38
|
-
[(SkiaUIView*)view setDebugMode:
|
37
|
+
[(SkiaUIView *)view setDebugMode:debug];
|
39
38
|
}
|
40
39
|
|
41
|
-
- (UIView *)view
|
42
|
-
{
|
40
|
+
- (UIView *)view {
|
43
41
|
auto skManager = [[self skiaManager] skManager];
|
44
42
|
// Pass SkManager as a raw pointer to avoid circular dependenciesr
|
45
|
-
return [[SkiaUIView alloc]
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
return [[SkiaUIView alloc]
|
44
|
+
initWithManager:skManager.get()
|
45
|
+
factory:[](std::shared_ptr<RNSkia::RNSkPlatformContext> context) {
|
46
|
+
return std::make_shared<RNSkiOSView<RNSkia::RNSkPictureView>>(
|
47
|
+
context);
|
48
|
+
}];
|
49
49
|
}
|
50
50
|
|
51
51
|
@end
|
@@ -9,19 +9,22 @@
|
|
9
9
|
|
10
10
|
@implementation SkiaUIView {
|
11
11
|
std::shared_ptr<RNSkBaseiOSView> _impl;
|
12
|
-
RNSkia::RNSkManager*
|
12
|
+
RNSkia::RNSkManager *_manager;
|
13
13
|
RNSkia::RNSkDrawingMode _drawingMode;
|
14
|
-
std::function<std::shared_ptr<RNSkBaseiOSView>(
|
14
|
+
std::function<std::shared_ptr<RNSkBaseiOSView>(
|
15
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext>)>
|
16
|
+
_factory;
|
15
17
|
bool _debugMode;
|
16
18
|
size_t _nativeId;
|
17
19
|
}
|
18
20
|
|
19
21
|
#pragma mark Initialization and destruction
|
20
22
|
|
21
|
-
- (instancetype)
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
- (instancetype)initWithManager:(RNSkia::RNSkManager *)manager
|
24
|
+
factory:
|
25
|
+
(std::function<std::shared_ptr<RNSkBaseiOSView>(
|
26
|
+
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)
|
27
|
+
factory {
|
25
28
|
self = [super init];
|
26
29
|
if (self) {
|
27
30
|
_manager = manager;
|
@@ -31,28 +34,29 @@
|
|
31
34
|
_factory = factory;
|
32
35
|
|
33
36
|
// Listen to notifications about module invalidation
|
34
|
-
[[NSNotificationCenter defaultCenter]
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
[[NSNotificationCenter defaultCenter]
|
38
|
+
addObserver:self
|
39
|
+
selector:@selector(willInvalidateModules)
|
40
|
+
name:RCTBridgeWillInvalidateModulesNotification
|
41
|
+
object:nil];
|
38
42
|
}
|
39
43
|
return self;
|
40
44
|
}
|
41
45
|
|
42
|
-
- (void)
|
46
|
+
- (void)willInvalidateModules {
|
43
47
|
_impl = nullptr;
|
44
48
|
_manager = nullptr;
|
45
49
|
}
|
46
50
|
|
47
51
|
#pragma mark Lifecycle
|
48
52
|
|
49
|
-
- (void)
|
53
|
+
- (void)willMoveToSuperview:(UIView *)newWindow {
|
50
54
|
if (newWindow == NULL) {
|
51
55
|
// Remove implementation view when the parent view is not set
|
52
|
-
if(_impl != nullptr) {
|
56
|
+
if (_impl != nullptr) {
|
53
57
|
[_impl->getLayer() removeFromSuperlayer];
|
54
58
|
|
55
|
-
if(_nativeId != 0 && _manager != nullptr) {
|
59
|
+
if (_nativeId != 0 && _manager != nullptr) {
|
56
60
|
_manager->setSkiaView(_nativeId, nullptr);
|
57
61
|
}
|
58
62
|
|
@@ -60,13 +64,14 @@
|
|
60
64
|
}
|
61
65
|
} else {
|
62
66
|
// Create implementation view when the parent view is set
|
63
|
-
if(_impl == nullptr && _manager != nullptr) {
|
67
|
+
if (_impl == nullptr && _manager != nullptr) {
|
64
68
|
_impl = _factory(_manager->getPlatformContext());
|
65
|
-
if(_impl == nullptr) {
|
66
|
-
throw std::runtime_error(
|
69
|
+
if (_impl == nullptr) {
|
70
|
+
throw std::runtime_error(
|
71
|
+
"Expected Skia view implementation, got nullptr.");
|
67
72
|
}
|
68
|
-
[self.layer addSublayer:
|
69
|
-
if(_nativeId != 0) {
|
73
|
+
[self.layer addSublayer:_impl->getLayer()];
|
74
|
+
if (_nativeId != 0) {
|
70
75
|
_manager->setSkiaView(_nativeId, _impl->getDrawView());
|
71
76
|
}
|
72
77
|
_impl->getDrawView()->setDrawingMode(_drawingMode);
|
@@ -75,71 +80,76 @@
|
|
75
80
|
}
|
76
81
|
}
|
77
82
|
|
78
|
-
- (void)
|
79
|
-
if(_manager != nullptr && _nativeId != 0) {
|
83
|
+
- (void)dealloc {
|
84
|
+
if (_manager != nullptr && _nativeId != 0) {
|
80
85
|
_manager->unregisterSkiaView(_nativeId);
|
81
86
|
}
|
82
87
|
|
83
|
-
[[NSNotificationCenter defaultCenter]
|
88
|
+
[[NSNotificationCenter defaultCenter]
|
89
|
+
removeObserver:self
|
90
|
+
name:RCTBridgeWillInvalidateModulesNotification
|
91
|
+
object:nil];
|
84
92
|
|
85
93
|
assert(_impl == nullptr);
|
86
94
|
}
|
87
95
|
|
88
96
|
#pragma mark Layout
|
89
97
|
|
90
|
-
- (void)
|
98
|
+
- (void)layoutSubviews {
|
91
99
|
[super layoutSubviews];
|
92
|
-
if(_impl != nullptr) {
|
100
|
+
if (_impl != nullptr) {
|
93
101
|
_impl->setSize(self.bounds.size.width, self.bounds.size.height);
|
94
102
|
}
|
95
103
|
}
|
96
104
|
|
97
105
|
#pragma mark Properties
|
98
106
|
|
99
|
-
-(void)
|
100
|
-
_drawingMode = mode.compare("continuous") == 0
|
107
|
+
- (void)setDrawingMode:(std::string)mode {
|
108
|
+
_drawingMode = mode.compare("continuous") == 0
|
109
|
+
? RNSkia::RNSkDrawingMode::Continuous
|
110
|
+
: RNSkia::RNSkDrawingMode::Default;
|
101
111
|
|
102
|
-
if(_impl != nullptr) {
|
112
|
+
if (_impl != nullptr) {
|
103
113
|
_impl->getDrawView()->setDrawingMode(_drawingMode);
|
104
114
|
}
|
105
115
|
}
|
106
116
|
|
107
|
-
-(void)
|
117
|
+
- (void)setDebugMode:(bool)debugMode {
|
108
118
|
_debugMode = debugMode;
|
109
|
-
if(_impl != nullptr) {
|
119
|
+
if (_impl != nullptr) {
|
110
120
|
_impl->getDrawView()->setShowDebugOverlays(debugMode);
|
111
121
|
}
|
112
122
|
}
|
113
123
|
|
114
|
-
- (void)
|
124
|
+
- (void)setNativeId:(size_t)nativeId {
|
115
125
|
_nativeId = nativeId;
|
116
126
|
|
117
|
-
if(_impl != nullptr) {
|
127
|
+
if (_impl != nullptr) {
|
118
128
|
_manager->registerSkiaView(nativeId, _impl->getDrawView());
|
119
129
|
}
|
120
130
|
}
|
121
131
|
|
122
132
|
#pragma mark External API
|
123
133
|
|
124
|
-
- (std::shared_ptr<RNSkBaseiOSView>)
|
134
|
+
- (std::shared_ptr<RNSkBaseiOSView>)impl {
|
125
135
|
return _impl;
|
126
136
|
}
|
127
137
|
|
128
138
|
#pragma mark Touch handling
|
129
139
|
|
130
|
-
- (void)
|
140
|
+
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
131
141
|
[self handleTouches:touches withEvent:event];
|
132
142
|
}
|
133
143
|
|
134
|
-
-(void)
|
144
|
+
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
135
145
|
[self handleTouches:touches withEvent:event];
|
136
146
|
}
|
137
147
|
|
138
|
-
-(void)
|
148
|
+
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
139
149
|
[self handleTouches:touches withEvent:event];
|
140
150
|
}
|
141
151
|
|
142
|
-
- (void)
|
152
|
+
- (void)handleTouches:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
143
153
|
if (event.type == UIEventTypeTouches) {
|
144
154
|
std::vector<RNSkia::RNSkTouchInfo> nextTouches;
|
145
155
|
for (UITouch *touch in touches) {
|
@@ -150,27 +160,27 @@
|
|
150
160
|
nextTouch.force = [touch force];
|
151
161
|
nextTouch.id = [touch hash];
|
152
162
|
auto phase = [touch phase];
|
153
|
-
switch(phase) {
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
163
|
+
switch (phase) {
|
164
|
+
case UITouchPhaseBegan:
|
165
|
+
nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Start;
|
166
|
+
break;
|
167
|
+
case UITouchPhaseMoved:
|
168
|
+
nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
|
169
|
+
break;
|
170
|
+
case UITouchPhaseEnded:
|
171
|
+
nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::End;
|
172
|
+
break;
|
173
|
+
case UITouchPhaseCancelled:
|
174
|
+
nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Cancelled;
|
175
|
+
break;
|
176
|
+
default:
|
177
|
+
nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
|
178
|
+
break;
|
169
179
|
}
|
170
180
|
|
171
181
|
nextTouches.push_back(nextTouch);
|
172
182
|
}
|
173
|
-
if(_impl != nullptr) {
|
183
|
+
if (_impl != nullptr) {
|
174
184
|
_impl->getDrawView()->updateTouchState(nextTouches);
|
175
185
|
}
|
176
186
|
}
|
package/ios/RNSkiaModule.mm
CHANGED
@@ -3,14 +3,14 @@
|
|
3
3
|
#import <React/RCTBridge+Private.h>
|
4
4
|
|
5
5
|
@implementation RNSkiaModule {
|
6
|
-
SkiaManager*
|
6
|
+
SkiaManager *skiaManager;
|
7
7
|
}
|
8
8
|
|
9
9
|
RCT_EXPORT_MODULE(RNSkia)
|
10
10
|
|
11
11
|
#pragma Accessors
|
12
12
|
|
13
|
-
-(SkiaManager*)
|
13
|
+
- (SkiaManager *)manager {
|
14
14
|
return skiaManager;
|
15
15
|
}
|
16
16
|
|
@@ -20,21 +20,19 @@ RCT_EXPORT_MODULE(RNSkia)
|
|
20
20
|
return YES;
|
21
21
|
}
|
22
22
|
|
23
|
-
- (void)invalidate
|
24
|
-
{
|
23
|
+
- (void)invalidate {
|
25
24
|
if (skiaManager != nil) {
|
26
25
|
[skiaManager invalidate];
|
27
26
|
}
|
28
27
|
skiaManager = nil;
|
29
28
|
}
|
30
29
|
|
31
|
-
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
|
32
|
-
{
|
30
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
|
33
31
|
if (skiaManager != nil) {
|
34
32
|
// Already initialized, ignore call.
|
35
33
|
return @true;
|
36
34
|
}
|
37
|
-
RCTBridge*
|
35
|
+
RCTBridge *bridge = [RCTBridge currentBridge];
|
38
36
|
skiaManager = [[SkiaManager alloc] initWithBridge:bridge];
|
39
37
|
return @true;
|
40
38
|
}
|
@@ -66,7 +66,11 @@ class JsiDrawingNode extends _RenderNode.JsiRenderNode {
|
|
66
66
|
|
67
67
|
this.children().map(child => {
|
68
68
|
if (child instanceof _PaintNode.PaintNode) {
|
69
|
-
const
|
69
|
+
const declCtx = ctx.declarationCtx;
|
70
|
+
declCtx.save();
|
71
|
+
child.decorate(declCtx);
|
72
|
+
const paint = declCtx.paints.pop();
|
73
|
+
declCtx.restore();
|
70
74
|
this.draw({ ...ctx,
|
71
75
|
paint
|
72
76
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiDrawingNode","JsiRenderNode","constructor","ctx","type","props","derived","deriveProps","setProps","setProp","name","value","hasChanged","addChild","child","JsiDeclarationNode","Error","insertChildBefore","before","renderNode","paint","draw","children","map","PaintNode","
|
1
|
+
{"version":3,"names":["JsiDrawingNode","JsiRenderNode","constructor","ctx","type","props","derived","deriveProps","setProps","setProp","name","value","hasChanged","addChild","child","JsiDeclarationNode","Error","insertChildBefore","before","renderNode","paint","draw","children","map","PaintNode","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): void;\n protected abstract deriveProps(): C;\n}\n"],"mappings":";;;;;;;AASA;;AACA;;AACA;;;;AAEO,MAAeA,cAAf,SACGC,yBADH,CAGP;EAGEC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWC,IAAX,EAAiBC,KAAjB;;IADsD;;IAEtD,KAAKC,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDC,QAAQ,CAACH,KAAD,EAAW;IACjB,MAAMG,QAAN,CAAeH,KAAf;IACA,KAAKC,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDE,OAAO,CAAoBC,IAApB,EAA6BC,KAA7B,EAA0C;IAC/C,MAAMC,UAAU,GAAG,MAAMH,OAAN,CAAcC,IAAd,EAAoBC,KAApB,CAAnB;;IACA,IAAIC,UAAJ,EAAgB;MACd,KAAKN,OAAL,GAAe,KAAKC,WAAL,EAAf;IACD;;IACD,OAAOK,UAAP;EACD;;EAEDC,QAAQ,CAACC,KAAD,EAA6B;IACnC,IAAI,EAAEA,KAAK,YAAYC,wBAAnB,CAAJ,EAA4C;MAC1C,MAAM,IAAIC,KAAJ,CAAW,cAAaF,KAAK,CAACV,IAAK,OAAM,KAAKA,IAAK,EAAnD,CAAN;IACD;;IACD,MAAMS,QAAN,CAAeC,KAAf;IACA,KAAKR,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDU,iBAAiB,CAACH,KAAD,EAAuBI,MAAvB,EAAoD;IACnE,IAAI,EAAEJ,KAAK,YAAYC,wBAAnB,CAAJ,EAA4C;MAC1C,MAAM,IAAIC,KAAJ,CAAW,cAAaF,KAAK,CAACV,IAAK,OAAM,KAAKA,IAAK,EAAnD,CAAN;IACD;;IACD,MAAMa,iBAAN,CAAwBH,KAAxB,EAA+BI,MAA/B;IACA,KAAKZ,OAAL,GAAe,KAAKC,WAAL,EAAf;EACD;;EAEDY,UAAU,CAAChB,GAAD,EAA4B;IACpC,IAAI,KAAKE,KAAL,CAAWe,KAAf,EAAsB;MACpB,KAAKC,IAAL,CAAU,EAAE,GAAGlB,GAAL;QAAUiB,KAAK,EAAE,KAAKf,KAAL,CAAWe;MAA5B,CAAV;IACD,CAFD,MAEO;MACL,KAAKC,IAAL,CAAUlB,GAAV;IACD;;IACD,KAAKmB,QAAL,GAAgBC,GAAhB,CAAqBT,KAAD,IAAW;MAC7B,IAAIA,KAAK,YAAYU,oBAArB,EAAgC;QAC9B,MAAMC,OAAO,GAAGtB,GAAG,CAACuB,cAApB;QACAD,OAAO,CAACE,IAAR;QACAb,KAAK,CAACc,QAAN,CAAeH,OAAf;QACA,MAAML,KAAK,GAAGK,OAAO,CAACI,MAAR,CAAeC,GAAf,EAAd;QACAL,OAAO,CAACM,OAAR;QACA,KAAKV,IAAL,CAAU,EAAE,GAAGlB,GAAL;UAAUiB;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
|
}
|
@@ -11,19 +11,26 @@ var _RenderNode = require("./RenderNode");
|
|
11
11
|
|
12
12
|
var _Node = require("./Node");
|
13
13
|
|
14
|
-
const isLayer = node => node instanceof _Node.JsiDeclarationNode && node.isPaint();
|
15
|
-
|
16
14
|
class LayerNode extends _RenderNode.JsiRenderNode {
|
17
15
|
constructor(ctx, props) {
|
18
16
|
super(ctx, _types.NodeType.Layer, props);
|
19
17
|
}
|
20
18
|
|
21
19
|
renderNode(ctx) {
|
20
|
+
let hasLayer = false;
|
22
21
|
const [layer, ...children] = this.children();
|
23
22
|
|
24
|
-
if (
|
25
|
-
const
|
26
|
-
|
23
|
+
if (layer instanceof _Node.JsiDeclarationNode) {
|
24
|
+
const declCtx = ctx.declarationCtx;
|
25
|
+
declCtx.save();
|
26
|
+
layer.decorate(declCtx);
|
27
|
+
const paint = declCtx.paints.pop();
|
28
|
+
declCtx.restore();
|
29
|
+
|
30
|
+
if (paint) {
|
31
|
+
hasLayer = true;
|
32
|
+
ctx.canvas.saveLayer(paint);
|
33
|
+
}
|
27
34
|
}
|
28
35
|
|
29
36
|
children.map(child => {
|
@@ -32,7 +39,7 @@ class LayerNode extends _RenderNode.JsiRenderNode {
|
|
32
39
|
}
|
33
40
|
});
|
34
41
|
|
35
|
-
if (
|
42
|
+
if (hasLayer) {
|
36
43
|
ctx.canvas.restore();
|
37
44
|
}
|
38
45
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["LayerNode","JsiRenderNode","constructor","ctx","props","NodeType","Layer","renderNode","hasLayer","layer","children","JsiDeclarationNode","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;;AAGA;;AAEA;;AAEO,MAAMA,SAAN,SAAwBC,yBAAxB,CAAqD;EAC1DC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAAyC;IAClD,MAAMD,GAAN,EAAWE,eAAA,CAASC,KAApB,EAA2BF,KAA3B;EACD;;EAEDG,UAAU,CAACJ,GAAD,EAA4B;IACpC,IAAIK,QAAQ,GAAG,KAAf;IACA,MAAM,CAACC,KAAD,EAAQ,GAAGC,QAAX,IAAuB,KAAKA,QAAL,EAA7B;;IACA,IAAID,KAAK,YAAYE,wBAArB,EAAyC;MACvC,MAAMC,OAAO,GAAGT,GAAG,CAACU,cAApB;MACAD,OAAO,CAACE,IAAR;MACAL,KAAK,CAACM,QAAN,CAAeH,OAAf;MACA,MAAMI,KAAK,GAAGJ,OAAO,CAACK,MAAR,CAAeC,GAAf,EAAd;MACAN,OAAO,CAACO,OAAR;;MACA,IAAIH,KAAJ,EAAW;QACTR,QAAQ,GAAG,IAAX;QACAL,GAAG,CAACiB,MAAJ,CAAWC,SAAX,CAAqBL,KAArB;MACD;IACF;;IACDN,QAAQ,CAACY,GAAT,CAAcC,KAAD,IAAW;MACtB,IAAIA,KAAK,YAAYtB,yBAArB,EAAoC;QAClCsB,KAAK,CAACC,MAAN,CAAarB,GAAb;MACD;IACF,CAJD;;IAKA,IAAIK,QAAJ,EAAc;MACZL,GAAG,CAACiB,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
|
}
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
});
|
6
6
|
exports.JsiNode = exports.JsiDeclarationNode = void 0;
|
7
7
|
|
8
|
-
var _types = require("../types");
|
9
|
-
|
10
8
|
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; }
|
11
9
|
|
12
10
|
class JsiNode {
|
@@ -86,6 +84,14 @@ class JsiDeclarationNode extends JsiNode {
|
|
86
84
|
_defineProperty(this, "invalidate", () => {});
|
87
85
|
}
|
88
86
|
|
87
|
+
decorateChildren(ctx) {
|
88
|
+
this.children().forEach(child => {
|
89
|
+
if (child instanceof JsiDeclarationNode) {
|
90
|
+
child.decorate(ctx);
|
91
|
+
}
|
92
|
+
});
|
93
|
+
}
|
94
|
+
|
89
95
|
addChild(child) {
|
90
96
|
if (!(child instanceof JsiDeclarationNode)) {
|
91
97
|
throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
|
@@ -128,30 +134,6 @@ class JsiDeclarationNode extends JsiNode {
|
|
128
134
|
return hasChanged;
|
129
135
|
}
|
130
136
|
|
131
|
-
isPaint() {
|
132
|
-
return this.declarationType === _types.DeclarationType.Paint;
|
133
|
-
}
|
134
|
-
|
135
|
-
isImageFilter() {
|
136
|
-
return this.declarationType === _types.DeclarationType.ImageFilter;
|
137
|
-
}
|
138
|
-
|
139
|
-
isColorFilter() {
|
140
|
-
return this.declarationType === _types.DeclarationType.ColorFilter;
|
141
|
-
}
|
142
|
-
|
143
|
-
isShader() {
|
144
|
-
return this.declarationType === _types.DeclarationType.Shader;
|
145
|
-
}
|
146
|
-
|
147
|
-
isMaskFilter() {
|
148
|
-
return this.declarationType === _types.DeclarationType.MaskFilter;
|
149
|
-
}
|
150
|
-
|
151
|
-
isPathEffect() {
|
152
|
-
return this.declarationType === _types.DeclarationType.PathEffect;
|
153
|
-
}
|
154
|
-
|
155
137
|
}
|
156
138
|
|
157
139
|
exports.JsiDeclarationNode = JsiDeclarationNode;
|