@shopify/react-native-skia 0.1.172 → 0.1.174
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +1 -0
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +5 -0
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +106 -5
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -1
- package/cpp/api/JsiSkSurface.h +7 -1
- package/cpp/api/JsiSkSurfaceFactory.h +15 -2
- package/cpp/rnskia/RNSkDomView.cpp +2 -4
- package/cpp/rnskia/RNSkJsView.cpp +3 -0
- package/cpp/rnskia/RNSkPictureView.h +3 -0
- package/cpp/rnskia/RNSkPlatformContext.h +9 -0
- package/cpp/rnskia/dom/JsiDomApi.h +1 -0
- package/cpp/rnskia/dom/base/ConcatablePaint.cpp +117 -0
- package/cpp/rnskia/dom/base/ConcatablePaint.h +49 -0
- package/cpp/rnskia/dom/base/Declaration.h +88 -0
- package/cpp/rnskia/dom/base/DeclarationContext.h +79 -0
- package/cpp/rnskia/dom/base/DerivedNodeProp.h +25 -9
- package/cpp/rnskia/dom/base/DrawingContext.cpp +32 -186
- package/cpp/rnskia/dom/base/DrawingContext.h +45 -64
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +35 -106
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +28 -9
- package/cpp/rnskia/dom/base/JsiDomNode.h +46 -17
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +81 -67
- package/cpp/rnskia/dom/base/NodeProp.h +12 -2
- package/cpp/rnskia/dom/base/NodePropsContainer.h +15 -16
- package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +22 -11
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +43 -59
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +16 -17
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +6 -5
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +45 -69
- package/cpp/rnskia/dom/nodes/JsiGroupNode.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +121 -161
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -0
- package/cpp/rnskia/dom/nodes/JsiLayerNode.h +28 -18
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +82 -45
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +68 -101
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +3 -2
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +150 -207
- package/cpp/rnskia/dom/props/BezierProps.h +4 -2
- package/cpp/rnskia/dom/props/BlendModeProp.h +4 -2
- package/cpp/rnskia/dom/props/BoxShadowProps.h +8 -10
- package/cpp/rnskia/dom/props/CircleProp.h +6 -5
- package/cpp/rnskia/dom/props/ClipProp.h +6 -4
- package/cpp/rnskia/dom/props/ColorProp.h +8 -4
- package/cpp/rnskia/dom/props/DrawingProp.h +5 -3
- package/cpp/rnskia/dom/props/FontProp.h +4 -2
- package/cpp/rnskia/dom/props/GlyphsProp.h +4 -2
- package/cpp/rnskia/dom/props/ImageProps.h +9 -6
- package/cpp/rnskia/dom/props/LayerProp.h +6 -4
- package/cpp/rnskia/dom/props/MatrixProp.h +4 -2
- package/cpp/rnskia/dom/props/NumbersProp.h +8 -4
- package/cpp/rnskia/dom/props/PaintProps.h +55 -92
- package/cpp/rnskia/dom/props/PathProp.h +4 -2
- package/cpp/rnskia/dom/props/PictureProp.h +4 -2
- package/cpp/rnskia/dom/props/PointProp.h +4 -2
- package/cpp/rnskia/dom/props/PointsProp.h +8 -4
- package/cpp/rnskia/dom/props/RRectProp.h +23 -16
- package/cpp/rnskia/dom/props/RadiusProp.h +4 -2
- package/cpp/rnskia/dom/props/RectProp.h +18 -12
- package/cpp/rnskia/dom/props/StrokeProps.h +8 -4
- package/cpp/rnskia/dom/props/SvgProp.h +4 -2
- package/cpp/rnskia/dom/props/TextBlobProp.h +10 -8
- package/cpp/rnskia/dom/props/TileModeProp.h +4 -2
- package/cpp/rnskia/dom/props/TransformProp.h +4 -2
- package/cpp/rnskia/dom/props/TransformsProps.h +5 -7
- package/cpp/rnskia/dom/props/UniformsProp.h +4 -2
- package/cpp/rnskia/dom/props/VertexModeProp.h +4 -2
- package/cpp/rnskia/dom/props/VerticesProps.h +7 -11
- package/ios/RNSkia-iOS/DisplayLink.mm +22 -24
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +53 -50
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -0
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +56 -25
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaManager.mm +12 -10
- package/ios/RNSkia-iOS/SkiaMetalRenderer.h +5 -0
- package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +53 -0
- package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +17 -17
- package/ios/RNSkia-iOS/SkiaUIView.mm +63 -53
- package/ios/RNSkiaModule.mm +5 -7
- package/lib/commonjs/dom/nodes/DrawingNode.js +5 -1
- package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/commonjs/dom/nodes/LayerNode.js +13 -6
- package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/Node.d.ts +6 -11
- package/lib/commonjs/dom/nodes/Node.js +8 -26
- package/lib/commonjs/dom/nodes/Node.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintContext.js.map +1 -1
- package/lib/commonjs/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/commonjs/dom/nodes/PaintNode.js +32 -15
- package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/commonjs/dom/nodes/RenderNode.js +19 -187
- package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js +25 -7
- package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/commonjs/dom/nodes/drawings/Box.js +3 -0
- package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/commonjs/dom/nodes/paint/BlendNode.js +16 -47
- package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js +29 -43
- package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js +45 -42
- package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js +3 -2
- package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/commonjs/dom/nodes/paint/PathEffects.js +30 -72
- package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/commonjs/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/commonjs/dom/nodes/paint/Shaders.js +28 -18
- package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/commonjs/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/commonjs/dom/types/DeclarationContext.js +118 -0
- package/lib/commonjs/dom/types/DeclarationContext.js.map +1 -0
- package/lib/commonjs/dom/types/DrawingContext.d.ts +18 -1
- package/lib/commonjs/dom/types/DrawingContext.js +330 -0
- package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
- package/lib/commonjs/dom/types/Node.d.ts +4 -10
- package/lib/commonjs/dom/types/Node.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.d.ts +22 -23
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/dom/types/index.d.ts +1 -0
- package/lib/commonjs/dom/types/index.js +13 -0
- package/lib/commonjs/dom/types/index.js.map +1 -1
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +13 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +3 -3
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/DrawingContext.d.ts +4 -3
- package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +35 -35
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/HostConfig.js +1 -0
- package/lib/commonjs/renderer/HostConfig.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +2 -0
- package/lib/commonjs/renderer/Offscreen.js +31 -0
- package/lib/commonjs/renderer/Offscreen.js.map +1 -0
- package/lib/commonjs/renderer/Reconciler.js +0 -1
- package/lib/commonjs/renderer/Reconciler.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkDataFactory.js +0 -1
- package/lib/commonjs/skia/web/JsiSkDataFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkImage.js +34 -3
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js +4 -0
- package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +21 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/commonjs/views/SkiaBaseWebView.js +14 -8
- package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
- package/lib/commonjs/views/SkiaDomView.web.js +3 -14
- package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaPictureView.web.js +0 -7
- package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
- package/lib/commonjs/views/SkiaView.web.js +0 -7
- package/lib/commonjs/views/SkiaView.web.js.map +1 -1
- package/lib/module/dom/nodes/DrawingNode.js +5 -1
- package/lib/module/dom/nodes/DrawingNode.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/module/dom/nodes/LayerNode.js +13 -7
- package/lib/module/dom/nodes/LayerNode.js.map +1 -1
- package/lib/module/dom/nodes/Node.d.ts +6 -11
- package/lib/module/dom/nodes/Node.js +8 -25
- package/lib/module/dom/nodes/Node.js.map +1 -1
- package/lib/module/dom/nodes/PaintContext.js.map +1 -1
- package/lib/module/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/module/dom/nodes/PaintNode.js +32 -15
- package/lib/module/dom/nodes/PaintNode.js.map +1 -1
- package/lib/module/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/module/dom/nodes/RenderNode.js +20 -187
- package/lib/module/dom/nodes/RenderNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js +23 -4
- package/lib/module/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
- package/lib/module/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/module/dom/nodes/drawings/Box.js +3 -0
- package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
- package/lib/module/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/module/dom/nodes/paint/BlendNode.js +15 -46
- package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
- package/lib/module/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/module/dom/nodes/paint/ColorFilters.js +29 -43
- package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/module/dom/nodes/paint/ImageFilters.js +48 -41
- package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/module/dom/nodes/paint/MaskFilters.js +3 -2
- package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
- package/lib/module/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/module/dom/nodes/paint/PathEffects.js +29 -72
- package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
- package/lib/module/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/module/dom/nodes/paint/Shaders.js +28 -18
- package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
- package/lib/module/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/module/dom/types/DeclarationContext.js +107 -0
- package/lib/module/dom/types/DeclarationContext.js.map +1 -0
- package/lib/module/dom/types/DrawingContext.d.ts +18 -1
- package/lib/module/dom/types/DrawingContext.js +322 -1
- package/lib/module/dom/types/DrawingContext.js.map +1 -1
- package/lib/module/dom/types/Node.d.ts +4 -10
- package/lib/module/dom/types/Node.js.map +1 -1
- package/lib/module/dom/types/SkDOM.d.ts +22 -23
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/dom/types/index.d.ts +1 -0
- package/lib/module/dom/types/index.js +1 -0
- package/lib/module/dom/types/index.js.map +1 -1
- package/lib/module/index.d.ts +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +3 -3
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/DrawingContext.d.ts +4 -3
- package/lib/module/renderer/DrawingContext.js.map +1 -1
- package/lib/module/renderer/HostComponents.d.ts +35 -35
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/HostConfig.js +1 -0
- package/lib/module/renderer/HostConfig.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +2 -0
- package/lib/module/renderer/Offscreen.js +19 -0
- package/lib/module/renderer/Offscreen.js.map +1 -0
- package/lib/module/renderer/Reconciler.js +0 -1
- package/lib/module/renderer/Reconciler.js.map +1 -1
- package/lib/module/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/module/skia/types/Surface/Surface.js.map +1 -1
- package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkDataFactory.js +0 -1
- package/lib/module/skia/web/JsiSkDataFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/module/skia/web/JsiSkImage.js +31 -3
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/module/skia/web/JsiSkSurface.js +4 -0
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +21 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +14 -8
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaDomView.web.js +2 -11
- package/lib/module/views/SkiaDomView.web.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +0 -5
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/views/SkiaView.web.js +0 -5
- package/lib/module/views/SkiaView.web.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +33 -34
- package/lib/typescript/src/dom/nodes/Node.d.ts +6 -11
- package/lib/typescript/src/dom/nodes/PaintNode.d.ts +3 -3
- package/lib/typescript/src/dom/nodes/RenderNode.d.ts +2 -3
- package/lib/typescript/src/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
- package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +3 -1
- package/lib/typescript/src/dom/nodes/paint/BlendNode.d.ts +3 -7
- package/lib/typescript/src/dom/nodes/paint/ColorFilters.d.ts +10 -11
- package/lib/typescript/src/dom/nodes/paint/ImageFilters.d.ts +11 -11
- package/lib/typescript/src/dom/nodes/paint/MaskFilters.d.ts +3 -3
- package/lib/typescript/src/dom/nodes/paint/PathEffects.d.ts +15 -18
- package/lib/typescript/src/dom/nodes/paint/Shaders.d.ts +11 -12
- package/lib/typescript/src/dom/types/DeclarationContext.d.ts +29 -0
- package/lib/typescript/src/dom/types/DrawingContext.d.ts +18 -1
- package/lib/typescript/src/dom/types/Node.d.ts +4 -10
- package/lib/typescript/src/dom/types/SkDOM.d.ts +22 -23
- package/lib/typescript/src/dom/types/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/renderer/DrawingContext.d.ts +4 -3
- package/lib/typescript/src/renderer/HostComponents.d.ts +35 -35
- package/lib/typescript/src/renderer/Offscreen.d.ts +2 -0
- package/lib/typescript/src/skia/types/Surface/Surface.d.ts +4 -0
- package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +6 -0
- package/lib/typescript/src/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/package.json +1 -1
- package/src/dom/nodes/DrawingNode.ts +5 -1
- package/src/dom/nodes/LayerNode.ts +13 -11
- package/src/dom/nodes/Node.ts +18 -41
- package/src/dom/nodes/PaintContext.ts +1 -0
- package/src/dom/nodes/PaintNode.ts +28 -18
- package/src/dom/nodes/RenderNode.ts +25 -183
- package/src/dom/nodes/drawings/BackdropFilterNode.ts +18 -11
- package/src/dom/nodes/drawings/Box.ts +6 -4
- package/src/dom/nodes/paint/BlendNode.ts +16 -63
- package/src/dom/nodes/paint/ColorFilters.ts +32 -55
- package/src/dom/nodes/paint/ImageFilters.ts +58 -53
- package/src/dom/nodes/paint/MaskFilters.ts +5 -7
- package/src/dom/nodes/paint/PathEffects.ts +37 -90
- package/src/dom/nodes/paint/Shaders.ts +31 -29
- package/src/dom/types/DeclarationContext.ts +105 -0
- package/src/dom/types/DrawingContext.ts +304 -1
- package/src/dom/types/Node.ts +4 -20
- package/src/dom/types/SkDOM.ts +22 -43
- package/src/dom/types/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/renderer/Canvas.tsx +3 -3
- package/src/renderer/DrawingContext.ts +4 -5
- package/src/renderer/HostComponents.ts +34 -53
- package/src/renderer/HostConfig.ts +1 -0
- package/src/renderer/Offscreen.tsx +24 -0
- package/src/renderer/Reconciler.tsx +0 -1
- package/src/skia/types/Surface/Surface.ts +5 -0
- package/src/skia/types/Surface/SurfaceFactory.ts +7 -0
- package/src/skia/web/JsiSkDataFactory.ts +0 -1
- package/src/skia/web/JsiSkImage.ts +26 -2
- package/src/skia/web/JsiSkSurface.ts +4 -0
- package/src/skia/web/JsiSkSurfaceFactory.ts +21 -2
- package/src/views/SkiaBaseWebView.tsx +9 -2
- package/src/views/SkiaDomView.web.tsx +2 -13
- package/src/views/SkiaPictureView.web.tsx +0 -7
- package/src/views/SkiaView.web.tsx +0 -7
@@ -2,74 +2,55 @@
|
|
2
2
|
|
3
3
|
#include "JsiDomDeclarationNode.h"
|
4
4
|
|
5
|
+
#include <algorithm>
|
5
6
|
#include <memory>
|
6
7
|
#include <string>
|
7
8
|
|
8
9
|
namespace RNSkia {
|
9
10
|
|
10
|
-
class JsiBlendNode : public
|
11
|
+
class JsiBlendNode : public JsiDomDeclarationNode,
|
11
12
|
public JsiDomNodeCtor<JsiBlendNode> {
|
12
13
|
public:
|
13
14
|
explicit JsiBlendNode(std::shared_ptr<RNSkPlatformContext> context)
|
14
|
-
:
|
15
|
+
: JsiDomDeclarationNode(context, "skBlend",
|
16
|
+
DeclarationType::ImageFilter) {}
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
if
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
if (innerShader != nullptr) {
|
47
|
-
innerShader = SkShaders::Blend(blendMode, outer, innerShader);
|
48
|
-
} else {
|
49
|
-
innerShader = outer;
|
50
|
-
}
|
51
|
-
} else if (maybeImageFilter) {
|
52
|
-
sk_sp<SkImageFilter> outer = maybeImageFilter->getCurrent();
|
53
|
-
if (outer != nullptr) {
|
54
|
-
innerImageFilter = SkImageFilters::Blend(blendMode, outer,
|
55
|
-
innerImageFilter, nullptr);
|
56
|
-
} else {
|
57
|
-
innerImageFilter = outer;
|
58
|
-
}
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
// Materialize
|
63
|
-
if (asShader) {
|
64
|
-
context->getMutablePaint()->setShader(innerShader);
|
65
|
-
} else {
|
66
|
-
context->getMutablePaint()->setImageFilter(innerImageFilter);
|
67
|
-
}
|
18
|
+
void decorate(DeclarationContext *context) override {
|
19
|
+
|
20
|
+
// No need to do anything if there are no children here
|
21
|
+
if (getChildren().size() == 0) {
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
decorateChildren(context);
|
26
|
+
|
27
|
+
// Blend mode
|
28
|
+
auto blendMode = *_blendProp->getDerivedValue();
|
29
|
+
|
30
|
+
// Shader
|
31
|
+
auto shader = context->getShaders()->popAsOne(
|
32
|
+
[blendMode](sk_sp<SkShader> inner, sk_sp<SkShader> outer) {
|
33
|
+
return SkShaders::Blend(blendMode, outer, inner);
|
34
|
+
});
|
35
|
+
|
36
|
+
if (shader != nullptr) {
|
37
|
+
context->getShaders()->push(shader);
|
38
|
+
}
|
39
|
+
|
40
|
+
auto imageFilter =
|
41
|
+
context->getImageFilters()->Declaration<sk_sp<SkImageFilter>>::popAsOne(
|
42
|
+
[blendMode](sk_sp<SkImageFilter> inner,
|
43
|
+
sk_sp<SkImageFilter> outer) {
|
44
|
+
return SkImageFilters::Blend(blendMode, outer, inner);
|
45
|
+
});
|
46
|
+
if (imageFilter != nullptr) {
|
47
|
+
context->getImageFilters()->push(imageFilter);
|
68
48
|
}
|
69
49
|
}
|
70
50
|
|
51
|
+
protected:
|
71
52
|
void defineProperties(NodePropsContainer *container) override {
|
72
|
-
|
53
|
+
JsiDomDeclarationNode::defineProperties(container);
|
73
54
|
_blendProp = container->defineProperty<BlendModeProp>("mode");
|
74
55
|
_blendProp->require();
|
75
56
|
}
|
@@ -78,7 +59,7 @@ protected:
|
|
78
59
|
Validates that only declaration nodes can be children
|
79
60
|
*/
|
80
61
|
void addChild(std::shared_ptr<JsiDomNode> child) override {
|
81
|
-
|
62
|
+
JsiDomDeclarationNode::addChild(child);
|
82
63
|
// Verify declaration of either shader or image filter
|
83
64
|
verifyChild(child);
|
84
65
|
}
|
@@ -88,15 +69,18 @@ protected:
|
|
88
69
|
*/
|
89
70
|
void insertChildBefore(std::shared_ptr<JsiDomNode> child,
|
90
71
|
std::shared_ptr<JsiDomNode> before) override {
|
91
|
-
|
72
|
+
JsiDomDeclarationNode::insertChildBefore(child, before);
|
92
73
|
// Verify declaration of either shader or image filter
|
93
74
|
verifyChild(child);
|
94
75
|
}
|
95
76
|
|
96
77
|
private:
|
97
78
|
void verifyChild(std::shared_ptr<JsiDomNode> child) {
|
98
|
-
if (
|
99
|
-
std::
|
79
|
+
if (child->getNodeClass() != NodeClass::DeclarationNode ||
|
80
|
+
(std::static_pointer_cast<JsiDomDeclarationNode>(child)
|
81
|
+
->getDeclarationType() != DeclarationType::Shader &&
|
82
|
+
std::static_pointer_cast<JsiDomDeclarationNode>(child)
|
83
|
+
->getDeclarationType() != DeclarationType::ImageFilter)) {
|
100
84
|
// We'll raise an error when other children are added.
|
101
85
|
std::runtime_error("Blend nodes only supports either shaders or image "
|
102
86
|
"filters as children, got " +
|
@@ -16,33 +16,32 @@
|
|
16
16
|
|
17
17
|
namespace RNSkia {
|
18
18
|
|
19
|
-
class JsiBlurMaskNode : public
|
19
|
+
class JsiBlurMaskNode : public JsiDomDeclarationNode,
|
20
20
|
public JsiDomNodeCtor<JsiBlurMaskNode> {
|
21
21
|
public:
|
22
22
|
explicit JsiBlurMaskNode(std::shared_ptr<RNSkPlatformContext> context)
|
23
|
-
:
|
23
|
+
: JsiDomDeclarationNode(context, "skBlurMaskFilter",
|
24
|
+
DeclarationType::MaskFilter) {}
|
24
25
|
|
25
|
-
|
26
|
-
void decorate(DrawingContext *context) override {
|
27
|
-
if (context->isChanged() || getPropsContainer()->isChanged()) {
|
26
|
+
void decorate(DeclarationContext *context) override {
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
28
|
+
bool respectCTM =
|
29
|
+
_respectCTM->isSet() ? _respectCTM->value().getAsBool() : true;
|
30
|
+
SkBlurStyle style = SkBlurStyle::kNormal_SkBlurStyle;
|
31
|
+
if (_style->isSet()) {
|
32
|
+
style = getBlurStyleFromString(_style->value().getAsString());
|
33
|
+
}
|
35
34
|
|
36
|
-
|
37
|
-
|
35
|
+
auto filter =
|
36
|
+
SkMaskFilter::MakeBlur(style, _blur->value().getAsNumber(), respectCTM);
|
38
37
|
|
39
|
-
|
40
|
-
|
41
|
-
}
|
38
|
+
// Set the mask filter
|
39
|
+
context->getMaskFilters()->push(filter);
|
42
40
|
}
|
43
41
|
|
42
|
+
protected:
|
44
43
|
void defineProperties(NodePropsContainer *container) override {
|
45
|
-
|
44
|
+
JsiDomDeclarationNode::defineProperties(container);
|
46
45
|
|
47
46
|
_style = container->defineProperty<NodeProp>("style");
|
48
47
|
_respectCTM = container->defineProperty<NodeProp>("respectCTM");
|
@@ -7,21 +7,22 @@
|
|
7
7
|
|
8
8
|
namespace RNSkia {
|
9
9
|
|
10
|
-
class JsiBoxShadowNode : public
|
10
|
+
class JsiBoxShadowNode : public JsiDomDeclarationNode,
|
11
11
|
public JsiDomNodeCtor<JsiBoxShadowNode> {
|
12
12
|
public:
|
13
13
|
explicit JsiBoxShadowNode(std::shared_ptr<RNSkPlatformContext> context)
|
14
|
-
:
|
14
|
+
: JsiDomDeclarationNode(context, "skBoxShadow",
|
15
|
+
DeclarationType::Unknown) {}
|
15
16
|
|
16
17
|
BoxShadowProps *getBoxShadowProps() { return _boxShadowProps; }
|
17
18
|
|
18
|
-
|
19
|
-
void decorate(DrawingContext *context) override {
|
19
|
+
void decorate(DeclarationContext *context) override {
|
20
20
|
// Do nothing, we are just a container for properties
|
21
21
|
}
|
22
22
|
|
23
|
+
protected:
|
23
24
|
void defineProperties(NodePropsContainer *container) override {
|
24
|
-
|
25
|
+
JsiDomDeclarationNode::defineProperties(container);
|
25
26
|
_boxShadowProps = container->defineProperty<BoxShadowProps>();
|
26
27
|
}
|
27
28
|
|
@@ -17,39 +17,20 @@
|
|
17
17
|
|
18
18
|
namespace RNSkia {
|
19
19
|
|
20
|
-
class JsiBaseColorFilterNode
|
21
|
-
: public JsiDomDeclarationNode<JsiBaseColorFilterNode,
|
22
|
-
sk_sp<SkColorFilter>> {
|
20
|
+
class JsiBaseColorFilterNode : public JsiDomDeclarationNode {
|
23
21
|
public:
|
24
22
|
JsiBaseColorFilterNode(std::shared_ptr<RNSkPlatformContext> context,
|
25
23
|
const char *type)
|
26
|
-
: JsiDomDeclarationNode
|
27
|
-
context, type) {}
|
24
|
+
: JsiDomDeclarationNode(context, type, DeclarationType::ColorFilter) {}
|
28
25
|
|
29
26
|
protected:
|
30
|
-
sk_sp<SkColorFilter>
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
void setColorFilter(DrawingContext *context, sk_sp<SkColorFilter> f) {
|
39
|
-
set(context, f);
|
40
|
-
}
|
41
|
-
|
42
|
-
void set(DrawingContext *context, sk_sp<SkColorFilter> ColorFilter) override {
|
43
|
-
auto paint = context->getMutablePaint();
|
44
|
-
if (paint->getColorFilter() != nullptr &&
|
45
|
-
paint->getColorFilter() != getCurrent().get()) {
|
46
|
-
paint->setColorFilter(
|
47
|
-
SkColorFilters::Compose(ColorFilter, paint->refColorFilter()));
|
48
|
-
} else {
|
49
|
-
paint->setColorFilter(ColorFilter);
|
50
|
-
}
|
51
|
-
|
52
|
-
setCurrent(ColorFilter);
|
27
|
+
void composeAndPush(DeclarationContext *context, sk_sp<SkColorFilter> cf1) {
|
28
|
+
context->save();
|
29
|
+
decorateChildren(context);
|
30
|
+
auto cf2 = context->getColorFilters()->popAsOne();
|
31
|
+
context->restore();
|
32
|
+
auto cf = cf2 ? SkColorFilters::Compose(cf1, cf2) : cf1;
|
33
|
+
context->getColorFilters()->push(cf);
|
53
34
|
}
|
54
35
|
};
|
55
36
|
|
@@ -61,22 +42,20 @@ public:
|
|
61
42
|
std::shared_ptr<RNSkPlatformContext> context)
|
62
43
|
: JsiBaseColorFilterNode(context, "skMatrixColorFilter") {}
|
63
44
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
if (array.size() > i) {
|
71
|
-
matrix[i] = array[i].getAsNumber();
|
72
|
-
}
|
45
|
+
void decorate(DeclarationContext *context) override {
|
46
|
+
auto array = _matrixProp->value().getAsArray();
|
47
|
+
float matrix[20];
|
48
|
+
for (int i = 0; i < 20; i++) {
|
49
|
+
if (array.size() > i) {
|
50
|
+
matrix[i] = array[i].getAsNumber();
|
73
51
|
}
|
74
|
-
setColorFilter(context, SkColorFilters::Matrix(matrix));
|
75
52
|
}
|
53
|
+
composeAndPush(context, SkColorFilters::Matrix(matrix));
|
76
54
|
}
|
77
55
|
|
56
|
+
protected:
|
78
57
|
void defineProperties(NodePropsContainer *container) override {
|
79
|
-
|
58
|
+
JsiDomDeclarationNode::defineProperties(container);
|
80
59
|
_matrixProp = container->defineProperty<NodeProp>("matrix");
|
81
60
|
_matrixProp->require();
|
82
61
|
}
|
@@ -91,17 +70,15 @@ public:
|
|
91
70
|
explicit JsiBlendColorFilterNode(std::shared_ptr<RNSkPlatformContext> context)
|
92
71
|
: JsiBaseColorFilterNode(context, "skBlendColorFilter") {}
|
93
72
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
SkColorFilters::Blend(*_colorProp->getDerivedValue(),
|
99
|
-
*_blendModeProp->getDerivedValue()));
|
100
|
-
}
|
73
|
+
void decorate(DeclarationContext *context) override {
|
74
|
+
auto color = _colorProp->getDerivedValue();
|
75
|
+
auto mode = _blendModeProp->getDerivedValue();
|
76
|
+
composeAndPush(context, SkColorFilters::Blend(*color, *mode));
|
101
77
|
}
|
102
78
|
|
79
|
+
protected:
|
103
80
|
void defineProperties(NodePropsContainer *container) override {
|
104
|
-
|
81
|
+
JsiDomDeclarationNode::defineProperties(container);
|
105
82
|
_blendModeProp = container->defineProperty<BlendModeProp>("mode");
|
106
83
|
_colorProp = container->defineProperty<ColorProp>("color");
|
107
84
|
|
@@ -122,11 +99,8 @@ public:
|
|
122
99
|
std::shared_ptr<RNSkPlatformContext> context)
|
123
100
|
: JsiBaseColorFilterNode(context, "skLinearToSRGBGammaColorFilter") {}
|
124
101
|
|
125
|
-
|
126
|
-
|
127
|
-
if (isChanged(context)) {
|
128
|
-
setColorFilter(context, SkColorFilters::LinearToSRGBGamma());
|
129
|
-
}
|
102
|
+
void decorate(DeclarationContext *context) override {
|
103
|
+
composeAndPush(context, SkColorFilters::LinearToSRGBGamma());
|
130
104
|
}
|
131
105
|
};
|
132
106
|
|
@@ -138,11 +112,8 @@ public:
|
|
138
112
|
std::shared_ptr<RNSkPlatformContext> context)
|
139
113
|
: JsiBaseColorFilterNode(context, "skSRGBToLinearGammaColorFilter") {}
|
140
114
|
|
141
|
-
|
142
|
-
|
143
|
-
if (isChanged(context)) {
|
144
|
-
setColorFilter(context, SkColorFilters::SRGBToLinearGamma());
|
145
|
-
}
|
115
|
+
void decorate(DeclarationContext *context) override {
|
116
|
+
composeAndPush(context, SkColorFilters::SRGBToLinearGamma());
|
146
117
|
}
|
147
118
|
};
|
148
119
|
|
@@ -152,11 +123,8 @@ public:
|
|
152
123
|
explicit JsiLumaColorFilterNode(std::shared_ptr<RNSkPlatformContext> context)
|
153
124
|
: JsiBaseColorFilterNode(context, "skLumaColorFilter") {}
|
154
125
|
|
155
|
-
|
156
|
-
|
157
|
-
if (isChanged(context)) {
|
158
|
-
setColorFilter(context, SkLumaColorFilter::Make());
|
159
|
-
}
|
126
|
+
void decorate(DeclarationContext *context) override {
|
127
|
+
composeAndPush(context, SkLumaColorFilter::Make());
|
160
128
|
}
|
161
129
|
};
|
162
130
|
|
@@ -166,17 +134,25 @@ public:
|
|
166
134
|
explicit JsiLerpColorFilterNode(std::shared_ptr<RNSkPlatformContext> context)
|
167
135
|
: JsiBaseColorFilterNode(context, "skLerpColorFilter") {}
|
168
136
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
137
|
+
void decorate(DeclarationContext *context) override {
|
138
|
+
context->save();
|
139
|
+
decorateChildren(context);
|
140
|
+
auto second = context->getColorFilters()->pop();
|
141
|
+
auto first = context->getColorFilters()->pop();
|
142
|
+
context->restore();
|
143
|
+
|
144
|
+
if (first == nullptr || second == nullptr) {
|
145
|
+
throw std::runtime_error(
|
146
|
+
"LerpColorFilterNode: missing two color filters as children");
|
175
147
|
}
|
148
|
+
|
149
|
+
auto t = _tProp->value().getAsNumber();
|
150
|
+
context->getColorFilters()->push(SkColorFilters::Lerp(t, first, second));
|
176
151
|
}
|
177
152
|
|
153
|
+
protected:
|
178
154
|
void defineProperties(NodePropsContainer *container) override {
|
179
|
-
|
155
|
+
JsiDomDeclarationNode::defineProperties(container);
|
180
156
|
_tProp = container->defineProperty<NodeProp>("t");
|
181
157
|
_tProp->require();
|
182
158
|
}
|
@@ -15,7 +15,7 @@ public:
|
|
15
15
|
|
16
16
|
void renderNode(DrawingContext *context) override {
|
17
17
|
for (auto &child : getChildren()) {
|
18
|
-
if (child->getNodeClass() ==
|
18
|
+
if (child->getNodeClass() == NodeClass::RenderNode) {
|
19
19
|
std::static_pointer_cast<JsiDomRenderNode>(child)->render(context);
|
20
20
|
}
|
21
21
|
}
|