@shopify/react-native-skia 0.1.172 → 0.1.174
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +1 -0
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +5 -0
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +106 -5
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -1
- package/cpp/api/JsiSkSurface.h +7 -1
- package/cpp/api/JsiSkSurfaceFactory.h +15 -2
- package/cpp/rnskia/RNSkDomView.cpp +2 -4
- package/cpp/rnskia/RNSkJsView.cpp +3 -0
- package/cpp/rnskia/RNSkPictureView.h +3 -0
- package/cpp/rnskia/RNSkPlatformContext.h +9 -0
- package/cpp/rnskia/dom/JsiDomApi.h +1 -0
- package/cpp/rnskia/dom/base/ConcatablePaint.cpp +117 -0
- package/cpp/rnskia/dom/base/ConcatablePaint.h +49 -0
- package/cpp/rnskia/dom/base/Declaration.h +88 -0
- package/cpp/rnskia/dom/base/DeclarationContext.h +79 -0
- package/cpp/rnskia/dom/base/DerivedNodeProp.h +25 -9
- package/cpp/rnskia/dom/base/DrawingContext.cpp +32 -186
- package/cpp/rnskia/dom/base/DrawingContext.h +45 -64
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +35 -106
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +28 -9
- package/cpp/rnskia/dom/base/JsiDomNode.h +46 -17
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +81 -67
- package/cpp/rnskia/dom/base/NodeProp.h +12 -2
- package/cpp/rnskia/dom/base/NodePropsContainer.h +15 -16
- package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +22 -11
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +43 -59
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +16 -17
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +6 -5
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +45 -69
- package/cpp/rnskia/dom/nodes/JsiGroupNode.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +121 -161
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -0
- package/cpp/rnskia/dom/nodes/JsiLayerNode.h +28 -18
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +82 -45
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +68 -101
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +3 -2
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +150 -207
- package/cpp/rnskia/dom/props/BezierProps.h +4 -2
- package/cpp/rnskia/dom/props/BlendModeProp.h +4 -2
- package/cpp/rnskia/dom/props/BoxShadowProps.h +8 -10
- package/cpp/rnskia/dom/props/CircleProp.h +6 -5
- package/cpp/rnskia/dom/props/ClipProp.h +6 -4
- package/cpp/rnskia/dom/props/ColorProp.h +8 -4
- package/cpp/rnskia/dom/props/DrawingProp.h +5 -3
- package/cpp/rnskia/dom/props/FontProp.h +4 -2
- package/cpp/rnskia/dom/props/GlyphsProp.h +4 -2
- package/cpp/rnskia/dom/props/ImageProps.h +9 -6
- package/cpp/rnskia/dom/props/LayerProp.h +6 -4
- package/cpp/rnskia/dom/props/MatrixProp.h +4 -2
- package/cpp/rnskia/dom/props/NumbersProp.h +8 -4
- package/cpp/rnskia/dom/props/PaintProps.h +55 -92
- package/cpp/rnskia/dom/props/PathProp.h +4 -2
- package/cpp/rnskia/dom/props/PictureProp.h +4 -2
- package/cpp/rnskia/dom/props/PointProp.h +4 -2
- package/cpp/rnskia/dom/props/PointsProp.h +8 -4
- package/cpp/rnskia/dom/props/RRectProp.h +23 -16
- package/cpp/rnskia/dom/props/RadiusProp.h +4 -2
- package/cpp/rnskia/dom/props/RectProp.h +18 -12
- package/cpp/rnskia/dom/props/StrokeProps.h +8 -4
- package/cpp/rnskia/dom/props/SvgProp.h +4 -2
- package/cpp/rnskia/dom/props/TextBlobProp.h +10 -8
- package/cpp/rnskia/dom/props/TileModeProp.h +4 -2
- package/cpp/rnskia/dom/props/TransformProp.h +4 -2
- package/cpp/rnskia/dom/props/TransformsProps.h +5 -7
- package/cpp/rnskia/dom/props/UniformsProp.h +4 -2
- package/cpp/rnskia/dom/props/VertexModeProp.h +4 -2
- package/cpp/rnskia/dom/props/VerticesProps.h +7 -11
- package/ios/RNSkia-iOS/DisplayLink.mm +22 -24
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +53 -50
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +56 -25
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaManager.mm +12 -10
- package/ios/RNSkia-iOS/SkiaMetalRenderer.h +5 -0
- package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +53 -0
- package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaUIView.mm +63 -53
- package/ios/RNSkiaModule.mm +5 -7
- package/lib/commonjs/dom/nodes/DrawingNode.js +5 -1
- package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/commonjs/dom/nodes/LayerNode.js +13 -6
- package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/Node.d.ts +6 -11
- package/lib/commonjs/dom/nodes/Node.js +8 -26
- package/lib/commonjs/dom/nodes/Node.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintContext.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/commonjs/dom/nodes/PaintNode.js +32 -15
- package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/commonjs/dom/nodes/RenderNode.js +19 -187
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js +25 -7
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js +3 -0
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/commonjs/dom/nodes/paint/BlendNode.js +16 -47
- package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js +29 -43
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js +45 -42
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js +3 -2
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/commonjs/dom/nodes/paint/PathEffects.js +30 -72
- package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/commonjs/dom/nodes/paint/Shaders.js +28 -18
- package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/commonjs/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/commonjs/dom/types/DeclarationContext.js +118 -0
- package/lib/commonjs/dom/types/DeclarationContext.js.map +1 -0
- package/lib/commonjs/dom/types/DrawingContext.d.ts +18 -1
- package/lib/commonjs/dom/types/DrawingContext.js +330 -0
- package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
- package/lib/commonjs/dom/types/Node.d.ts +4 -10
- package/lib/commonjs/dom/types/Node.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.d.ts +22 -23
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/dom/types/index.d.ts +1 -0
- package/lib/commonjs/dom/types/index.js +13 -0
- package/lib/commonjs/dom/types/index.js.map +1 -1
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +3 -3
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DrawingContext.d.ts +4 -3
- package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +35 -35
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +1 -0
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +2 -0
- package/lib/commonjs/renderer/Offscreen.js +31 -0
- package/lib/commonjs/renderer/Offscreen.js.map +1 -0
- package/lib/commonjs/renderer/Reconciler.js +0 -1
- package/lib/commonjs/renderer/Reconciler.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkDataFactory.js +0 -1
- package/lib/commonjs/skia/web/JsiSkDataFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkImage.js +34 -3
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js +4 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +21 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +14 -8
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.js +3 -14
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.web.js +0 -7
- package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaView.web.js +0 -7
- package/lib/commonjs/views/SkiaView.web.js.map +1 -1
- package/lib/module/dom/nodes/DrawingNode.js +5 -1
- package/lib/module/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/module/dom/nodes/LayerNode.js +13 -7
- package/lib/module/dom/nodes/LayerNode.js.map +1 -1
- package/lib/module/dom/nodes/Node.d.ts +6 -11
- package/lib/module/dom/nodes/Node.js +8 -25
- package/lib/module/dom/nodes/Node.js.map +1 -1
- package/lib/module/dom/nodes/PaintContext.js.map +1 -1
- package/lib/module/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/module/dom/nodes/PaintNode.js +32 -15
- package/lib/module/dom/nodes/PaintNode.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/module/dom/nodes/RenderNode.js +20 -187
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js +23 -4
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/module/dom/nodes/drawings/Box.js +3 -0
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/module/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/module/dom/nodes/paint/BlendNode.js +15 -46
- package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/module/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/module/dom/nodes/paint/ColorFilters.js +29 -43
- package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/module/dom/nodes/paint/ImageFilters.js +48 -41
- package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/module/dom/nodes/paint/MaskFilters.js +3 -2
- package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/module/dom/nodes/paint/PathEffects.js +29 -72
- package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/module/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/module/dom/nodes/paint/Shaders.js +28 -18
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/module/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/module/dom/types/DeclarationContext.js +107 -0
- package/lib/module/dom/types/DeclarationContext.js.map +1 -0
- package/lib/module/dom/types/DrawingContext.d.ts +18 -1
- package/lib/module/dom/types/DrawingContext.js +322 -1
- package/lib/module/dom/types/DrawingContext.js.map +1 -1
- package/lib/module/dom/types/Node.d.ts +4 -10
- package/lib/module/dom/types/Node.js.map +1 -1
- package/lib/module/dom/types/SkDOM.d.ts +22 -23
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/dom/types/index.d.ts +1 -0
- package/lib/module/dom/types/index.js +1 -0
- package/lib/module/dom/types/index.js.map +1 -1
- package/lib/module/index.d.ts +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +3 -3
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DrawingContext.d.ts +4 -3
- package/lib/module/renderer/DrawingContext.js.map +1 -1
- package/lib/module/renderer/HostComponents.d.ts +35 -35
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +1 -0
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +2 -0
- package/lib/module/renderer/Offscreen.js +19 -0
- package/lib/module/renderer/Offscreen.js.map +1 -0
- package/lib/module/renderer/Reconciler.js +0 -1
- package/lib/module/renderer/Reconciler.js.map +1 -1
- package/lib/module/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/module/skia/types/Surface/Surface.js.map +1 -1
- package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkDataFactory.js +0 -1
- package/lib/module/skia/web/JsiSkDataFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/module/skia/web/JsiSkImage.js +31 -3
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/module/skia/web/JsiSkSurface.js +4 -0
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +21 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +14 -8
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.js +2 -11
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +0 -5
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/views/SkiaView.web.js +0 -5
- package/lib/module/views/SkiaView.web.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/typescript/src/dom/nodes/Node.d.ts +6 -11
- package/lib/typescript/src/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/typescript/src/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/typescript/src/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/typescript/src/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/typescript/src/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/typescript/src/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/typescript/src/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/typescript/src/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/typescript/src/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/typescript/src/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/typescript/src/dom/types/DrawingContext.d.ts +18 -1
- package/lib/typescript/src/dom/types/Node.d.ts +4 -10
- package/lib/typescript/src/dom/types/SkDOM.d.ts +22 -23
- package/lib/typescript/src/dom/types/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/renderer/DrawingContext.d.ts +4 -3
- package/lib/typescript/src/renderer/HostComponents.d.ts +35 -35
- package/lib/typescript/src/renderer/Offscreen.d.ts +2 -0
- package/lib/typescript/src/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/package.json +1 -1
- package/src/dom/nodes/DrawingNode.ts +5 -1
- package/src/dom/nodes/LayerNode.ts +13 -11
- package/src/dom/nodes/Node.ts +18 -41
- package/src/dom/nodes/PaintContext.ts +1 -0
- package/src/dom/nodes/PaintNode.ts +28 -18
- package/src/dom/nodes/RenderNode.ts +25 -183
- package/src/dom/nodes/drawings/BackdropFilterNode.ts +18 -11
- package/src/dom/nodes/drawings/Box.ts +6 -4
- package/src/dom/nodes/paint/BlendNode.ts +16 -63
- package/src/dom/nodes/paint/ColorFilters.ts +32 -55
- package/src/dom/nodes/paint/ImageFilters.ts +58 -53
- package/src/dom/nodes/paint/MaskFilters.ts +5 -7
- package/src/dom/nodes/paint/PathEffects.ts +37 -90
- package/src/dom/nodes/paint/Shaders.ts +31 -29
- package/src/dom/types/DeclarationContext.ts +105 -0
- package/src/dom/types/DrawingContext.ts +304 -1
- package/src/dom/types/Node.ts +4 -20
- package/src/dom/types/SkDOM.ts +22 -43
- package/src/dom/types/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/renderer/Canvas.tsx +3 -3
- package/src/renderer/DrawingContext.ts +4 -5
- package/src/renderer/HostComponents.ts +34 -53
- package/src/renderer/HostConfig.ts +1 -0
- package/src/renderer/Offscreen.tsx +24 -0
- package/src/renderer/Reconciler.tsx +0 -1
- package/src/skia/types/Surface/Surface.ts +5 -0
- package/src/skia/types/Surface/SurfaceFactory.ts +7 -0
- package/src/skia/web/JsiSkDataFactory.ts +0 -1
- package/src/skia/web/JsiSkImage.ts +26 -2
- package/src/skia/web/JsiSkSurface.ts +4 -0
- package/src/skia/web/JsiSkSurfaceFactory.ts +21 -2
- package/src/views/SkiaBaseWebView.tsx +9 -2
- package/src/views/SkiaDomView.web.tsx +2 -13
- package/src/views/SkiaPictureView.web.tsx +0 -7
- package/src/views/SkiaView.web.tsx +0 -7
@@ -17,40 +17,20 @@
|
|
17
17
|
|
18
18
|
namespace RNSkia {
|
19
19
|
|
20
|
-
class JsiBasePathEffectNode
|
21
|
-
: public JsiDomDeclarationNode<JsiBasePathEffectNode, sk_sp<SkPathEffect>> {
|
20
|
+
class JsiBasePathEffectNode : public JsiDomDeclarationNode {
|
22
21
|
public:
|
23
22
|
JsiBasePathEffectNode(std::shared_ptr<RNSkPlatformContext> context,
|
24
23
|
const char *type)
|
25
|
-
: JsiDomDeclarationNode
|
26
|
-
context, type) {}
|
24
|
+
: JsiDomDeclarationNode(context, type, DeclarationType::PathEffect) {}
|
27
25
|
|
28
26
|
protected:
|
29
|
-
void
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
auto
|
35
|
-
|
36
|
-
return ptr->getCurrent();
|
37
|
-
}
|
38
|
-
return nullptr;
|
39
|
-
}
|
40
|
-
|
41
|
-
/**
|
42
|
-
Sets or composes the path effect
|
43
|
-
*/
|
44
|
-
void set(DrawingContext *context, sk_sp<SkPathEffect> pathEffect) override {
|
45
|
-
auto paint = context->getMutablePaint();
|
46
|
-
if (paint->getPathEffect() != nullptr &&
|
47
|
-
paint->getPathEffect() != getCurrent().get()) {
|
48
|
-
paint->setPathEffect(
|
49
|
-
SkPathEffect::MakeCompose(paint->refPathEffect(), pathEffect));
|
50
|
-
} else {
|
51
|
-
paint->setPathEffect(pathEffect);
|
52
|
-
}
|
53
|
-
setCurrent(pathEffect);
|
27
|
+
void composeAndPush(DeclarationContext *context, sk_sp<SkPathEffect> pe1) {
|
28
|
+
context->save();
|
29
|
+
decorateChildren(context);
|
30
|
+
auto pe2 = context->getPathEffects()->popAsOne();
|
31
|
+
context->restore();
|
32
|
+
auto pe = pe2 ? SkPathEffect::MakeCompose(pe1, pe2) : pe1;
|
33
|
+
context->getPathEffects()->push(pe);
|
54
34
|
}
|
55
35
|
};
|
56
36
|
|
@@ -60,30 +40,28 @@ public:
|
|
60
40
|
explicit JsiDashPathEffectNode(std::shared_ptr<RNSkPlatformContext> context)
|
61
41
|
: JsiBasePathEffectNode(context, "skDashPathEffect") {}
|
62
42
|
|
63
|
-
|
64
|
-
void decorate(DrawingContext *context) override {
|
65
|
-
if (isChanged(context)) {
|
43
|
+
void decorate(DeclarationContext *context) override {
|
66
44
|
|
67
|
-
|
68
|
-
|
45
|
+
// Phase
|
46
|
+
auto phase = _phase->isSet() ? _phase->value().getAsNumber() : 0;
|
69
47
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
48
|
+
// Copy intervals
|
49
|
+
std::vector<SkScalar> intervals;
|
50
|
+
auto intervalsArray = _intervals->value().getAsArray();
|
51
|
+
for (size_t i = 0; i < intervalsArray.size(); ++i) {
|
52
|
+
intervals.push_back(intervalsArray[i].getAsNumber());
|
53
|
+
}
|
76
54
|
|
77
|
-
|
78
|
-
|
79
|
-
|
55
|
+
// Create effect
|
56
|
+
auto pathEffect = SkDashPathEffect::Make(
|
57
|
+
intervals.data(), static_cast<int>(intervals.size()), phase);
|
80
58
|
|
81
|
-
|
82
|
-
}
|
59
|
+
composeAndPush(context, pathEffect);
|
83
60
|
}
|
84
61
|
|
62
|
+
protected:
|
85
63
|
void defineProperties(NodePropsContainer *container) override {
|
86
|
-
|
64
|
+
JsiDomDeclarationNode::defineProperties(container);
|
87
65
|
|
88
66
|
_intervals = container->defineProperty<NodeProp>("intervals");
|
89
67
|
_phase = container->defineProperty<NodeProp>("phase");
|
@@ -104,22 +82,19 @@ public:
|
|
104
82
|
std::shared_ptr<RNSkPlatformContext> context)
|
105
83
|
: JsiBasePathEffectNode(context, "skDiscretePathEffect") {}
|
106
84
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
SkDiscretePathEffect::Make(_lengthProp->value().getAsNumber(),
|
114
|
-
_deviationProp->value().getAsNumber(),
|
115
|
-
_seedProp->value().getAsNumber());
|
85
|
+
void decorate(DeclarationContext *context) override {
|
86
|
+
// Create effect
|
87
|
+
auto pathEffect =
|
88
|
+
SkDiscretePathEffect::Make(_lengthProp->value().getAsNumber(),
|
89
|
+
_deviationProp->value().getAsNumber(),
|
90
|
+
_seedProp->value().getAsNumber());
|
116
91
|
|
117
|
-
|
118
|
-
}
|
92
|
+
composeAndPush(context, pathEffect);
|
119
93
|
}
|
120
94
|
|
95
|
+
protected:
|
121
96
|
void defineProperties(NodePropsContainer *container) override {
|
122
|
-
|
97
|
+
JsiDomDeclarationNode::defineProperties(container);
|
123
98
|
|
124
99
|
_lengthProp = container->defineProperty<NodeProp>("length");
|
125
100
|
_deviationProp = container->defineProperty<NodeProp>("deviation");
|
@@ -142,19 +117,16 @@ public:
|
|
142
117
|
explicit JsiCornerPathEffectNode(std::shared_ptr<RNSkPlatformContext> context)
|
143
118
|
: JsiBasePathEffectNode(context, "skCornerPathEffect") {}
|
144
119
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
// Create effect
|
150
|
-
auto pathEffect = SkCornerPathEffect::Make(_rProp->value().getAsNumber());
|
120
|
+
void decorate(DeclarationContext *context) override {
|
121
|
+
// Create effect
|
122
|
+
auto pathEffect = SkCornerPathEffect::Make(_rProp->value().getAsNumber());
|
151
123
|
|
152
|
-
|
153
|
-
}
|
124
|
+
composeAndPush(context, pathEffect);
|
154
125
|
}
|
155
126
|
|
127
|
+
protected:
|
156
128
|
void defineProperties(NodePropsContainer *container) override {
|
157
|
-
|
129
|
+
JsiDomDeclarationNode::defineProperties(container);
|
158
130
|
|
159
131
|
_rProp = container->defineProperty<NodeProp>("r");
|
160
132
|
_rProp->require();
|
@@ -170,22 +142,19 @@ public:
|
|
170
142
|
explicit JsiPath1DPathEffectNode(std::shared_ptr<RNSkPlatformContext> context)
|
171
143
|
: JsiBasePathEffectNode(context, "skPath1DPathEffect") {}
|
172
144
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
*_pathProp->getDerivedValue(), _advanceProp->value().getAsNumber(),
|
180
|
-
_phaseProp->value().getAsNumber(),
|
181
|
-
getStyleFromStringValue(_styleProp->value().getAsString()));
|
145
|
+
void decorate(DeclarationContext *context) override {
|
146
|
+
// Create effect
|
147
|
+
auto pathEffect = SkPath1DPathEffect::Make(
|
148
|
+
*_pathProp->getDerivedValue(), _advanceProp->value().getAsNumber(),
|
149
|
+
_phaseProp->value().getAsNumber(),
|
150
|
+
getStyleFromStringValue(_styleProp->value().getAsString()));
|
182
151
|
|
183
|
-
|
184
|
-
}
|
152
|
+
composeAndPush(context, pathEffect);
|
185
153
|
}
|
186
154
|
|
155
|
+
protected:
|
187
156
|
void defineProperties(NodePropsContainer *container) override {
|
188
|
-
|
157
|
+
JsiDomDeclarationNode::defineProperties(container);
|
189
158
|
|
190
159
|
_phaseProp = container->defineProperty<NodeProp>("phase");
|
191
160
|
_advanceProp = container->defineProperty<NodeProp>("advance");
|
@@ -224,19 +193,17 @@ public:
|
|
224
193
|
: JsiBasePathEffectNode(context, "skPath2DPathEffect") {}
|
225
194
|
|
226
195
|
protected:
|
227
|
-
void decorate(
|
228
|
-
if (isChanged(context)) {
|
196
|
+
void decorate(DeclarationContext *context) override {
|
229
197
|
|
230
|
-
|
231
|
-
|
232
|
-
|
198
|
+
// Create effect
|
199
|
+
auto pathEffect = SkPath2DPathEffect::Make(*_matrixProp->getDerivedValue(),
|
200
|
+
*_pathProp->getDerivedValue());
|
233
201
|
|
234
|
-
|
235
|
-
}
|
202
|
+
composeAndPush(context, pathEffect);
|
236
203
|
}
|
237
204
|
|
238
205
|
void defineProperties(NodePropsContainer *container) override {
|
239
|
-
|
206
|
+
JsiDomDeclarationNode::defineProperties(container);
|
240
207
|
|
241
208
|
_matrixProp = container->defineProperty<MatrixProp>("matrix");
|
242
209
|
_pathProp = container->defineProperty<PathProp>("path");
|
@@ -257,19 +224,17 @@ public:
|
|
257
224
|
: JsiBasePathEffectNode(context, "skLine2DPathEffect") {}
|
258
225
|
|
259
226
|
protected:
|
260
|
-
void decorate(
|
261
|
-
if (isChanged(context)) {
|
227
|
+
void decorate(DeclarationContext *context) override {
|
262
228
|
|
263
|
-
|
264
|
-
|
265
|
-
|
229
|
+
// Create effect
|
230
|
+
auto pathEffect = SkLine2DPathEffect::Make(
|
231
|
+
_widthProp->value().getAsNumber(), *_matrixProp->getDerivedValue());
|
266
232
|
|
267
|
-
|
268
|
-
}
|
233
|
+
composeAndPush(context, pathEffect);
|
269
234
|
}
|
270
235
|
|
271
236
|
void defineProperties(NodePropsContainer *container) override {
|
272
|
-
|
237
|
+
JsiDomDeclarationNode::defineProperties(container);
|
273
238
|
|
274
239
|
_matrixProp = container->defineProperty<MatrixProp>("matrix");
|
275
240
|
_widthProp = container->defineProperty<NodeProp>("width");
|
@@ -290,12 +255,14 @@ public:
|
|
290
255
|
: JsiBasePathEffectNode(context, "skSumPathEffect") {}
|
291
256
|
|
292
257
|
protected:
|
293
|
-
void decorate(
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
258
|
+
void decorate(DeclarationContext *context) override {
|
259
|
+
decorateChildren(context);
|
260
|
+
auto pe =
|
261
|
+
context->getPathEffects()->Declaration<sk_sp<SkPathEffect>>::popAsOne(
|
262
|
+
[=](sk_sp<SkPathEffect> inner, sk_sp<SkPathEffect> outer) {
|
263
|
+
return SkPathEffect::MakeSum(inner, outer);
|
264
|
+
});
|
265
|
+
context->getPathEffects()->push(pe);
|
299
266
|
}
|
300
267
|
};
|
301
268
|
} // namespace RNSkia
|
@@ -169,8 +169,9 @@ private:
|
|
169
169
|
|
170
170
|
class StrokeOptsProps : public BaseDerivedProp {
|
171
171
|
public:
|
172
|
-
StrokeOptsProps(
|
173
|
-
|
172
|
+
explicit StrokeOptsProps(const std::function<void(BaseNodeProp *)> &onChange)
|
173
|
+
: BaseDerivedProp(onChange) {
|
174
|
+
_strokeProp = defineProperty<NodeProp>("stroke");
|
174
175
|
}
|
175
176
|
|
176
177
|
private:
|