@shopify/react-native-skia 1.11.1 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +0 -8
- package/android/cpp/jni/JniLoad.cpp +0 -2
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -1
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaPictureViewManagerDelegate.java +4 -2
- package/cpp/jsi/ViewProperty.h +5 -16
- package/cpp/rnskia/RNSkManager.cpp +1 -7
- package/lib/commonjs/dom/nodes/index.d.ts +0 -1
- package/lib/commonjs/dom/nodes/index.js +0 -11
- package/lib/commonjs/dom/nodes/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -6
- package/lib/commonjs/external/reanimated/renderHelpers.js +0 -73
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/index.d.ts +0 -1
- package/lib/commonjs/index.js +0 -12
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +10 -1
- package/lib/commonjs/renderer/Canvas.js +3 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/sksg/Container.d.ts +2 -0
- package/lib/commonjs/sksg/Container.js +10 -0
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/Elements.d.ts +65 -0
- package/lib/commonjs/sksg/Elements.js +6 -0
- package/lib/commonjs/sksg/Elements.js.map +1 -0
- package/lib/commonjs/sksg/Reconciler.d.ts +1 -0
- package/lib/commonjs/sksg/Reconciler.js +2 -0
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/commonjs/views/index.d.ts +0 -1
- package/lib/commonjs/views/index.js +0 -11
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/module/dom/nodes/index.d.ts +0 -1
- package/lib/module/dom/nodes/index.js +0 -1
- package/lib/module/dom/nodes/index.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +0 -6
- package/lib/module/external/reanimated/renderHelpers.js +0 -68
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/index.d.ts +0 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +10 -1
- package/lib/module/renderer/Canvas.js +1 -0
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +2 -0
- package/lib/module/sksg/Container.js +10 -0
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/Elements.d.ts +65 -0
- package/lib/module/sksg/Elements.js +2 -0
- package/lib/module/sksg/Elements.js.map +1 -0
- package/lib/module/sksg/Reconciler.d.ts +1 -0
- package/lib/module/sksg/Reconciler.js +2 -0
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/module/views/index.d.ts +0 -1
- package/lib/module/views/index.js +0 -1
- package/lib/module/views/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -3
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +2 -0
- package/lib/typescript/lib/commonjs/sksg/Elements.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +6 -0
- package/lib/typescript/lib/module/dom/nodes/index.d.ts +0 -1
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +0 -3
- package/lib/typescript/lib/module/index.d.ts +0 -1
- package/lib/typescript/lib/module/mock/index.d.ts +0 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Container.d.ts +2 -0
- package/lib/typescript/lib/module/sksg/Elements.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +6 -0
- package/lib/typescript/lib/module/views/index.d.ts +0 -1
- package/lib/typescript/src/dom/nodes/index.d.ts +0 -1
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +0 -6
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +10 -1
- package/lib/typescript/src/sksg/Container.d.ts +2 -0
- package/lib/typescript/src/sksg/Elements.d.ts +65 -0
- package/lib/typescript/src/sksg/Reconciler.d.ts +1 -0
- package/lib/typescript/src/views/index.d.ts +0 -1
- package/package.json +1 -1
- package/src/dom/nodes/index.ts +0 -1
- package/src/external/reanimated/renderHelpers.ts +1 -78
- package/src/index.ts +0 -1
- package/src/renderer/Canvas.tsx +11 -1
- package/src/sksg/Container.ts +11 -0
- package/src/sksg/Elements.tsx +136 -0
- package/src/sksg/Reconciler.ts +2 -0
- package/src/views/index.ts +0 -1
- package/android/cpp/jni/include/JniSkiaDomView.h +0 -82
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomView.java +0 -41
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaDomViewManager.java +0 -32
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerDelegate.java +0 -34
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDomViewManagerInterface.java +0 -18
- package/cpp/rnskia/RNSkDomView.cpp +0 -121
- package/cpp/rnskia/RNSkDomView.h +0 -97
- package/cpp/rnskia/dom/JsiDomApi.h +0 -165
- package/cpp/rnskia/dom/base/BaseNodeProp.h +0 -72
- package/cpp/rnskia/dom/base/ConcatablePaint.cpp +0 -117
- package/cpp/rnskia/dom/base/ConcatablePaint.h +0 -49
- package/cpp/rnskia/dom/base/Declaration.h +0 -86
- package/cpp/rnskia/dom/base/DeclarationContext.h +0 -79
- package/cpp/rnskia/dom/base/DerivedNodeProp.h +0 -203
- package/cpp/rnskia/dom/base/DrawingContext.cpp +0 -55
- package/cpp/rnskia/dom/base/DrawingContext.h +0 -104
- package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +0 -119
- package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +0 -71
- package/cpp/rnskia/dom/base/JsiDomNode.h +0 -572
- package/cpp/rnskia/dom/base/JsiDomRenderNode.h +0 -262
- package/cpp/rnskia/dom/base/NodeProp.h +0 -139
- package/cpp/rnskia/dom/base/NodePropsContainer.h +0 -158
- package/cpp/rnskia/dom/nodes/JsiAtlasNode.h +0 -64
- package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +0 -49
- package/cpp/rnskia/dom/nodes/JsiBlendNode.h +0 -94
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +0 -75
- package/cpp/rnskia/dom/nodes/JsiBoxNode.h +0 -94
- package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +0 -33
- package/cpp/rnskia/dom/nodes/JsiCircleNode.h +0 -35
- package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +0 -164
- package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +0 -37
- package/cpp/rnskia/dom/nodes/JsiFillNode.h +0 -22
- package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +0 -53
- package/cpp/rnskia/dom/nodes/JsiGroupNode.h +0 -25
- package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +0 -361
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +0 -43
- package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +0 -63
- package/cpp/rnskia/dom/nodes/JsiLayerNode.h +0 -74
- package/cpp/rnskia/dom/nodes/JsiLineNode.h +0 -38
- package/cpp/rnskia/dom/nodes/JsiOvalNode.h +0 -32
- package/cpp/rnskia/dom/nodes/JsiPaintNode.h +0 -119
- package/cpp/rnskia/dom/nodes/JsiParagraphNode.h +0 -62
- package/cpp/rnskia/dom/nodes/JsiPatchNode.h +0 -50
- package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +0 -268
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +0 -181
- package/cpp/rnskia/dom/nodes/JsiPictureNode.h +0 -31
- package/cpp/rnskia/dom/nodes/JsiPointsNode.h +0 -48
- package/cpp/rnskia/dom/nodes/JsiRRectNode.h +0 -33
- package/cpp/rnskia/dom/nodes/JsiRectNode.h +0 -33
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +0 -434
- package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +0 -44
- package/cpp/rnskia/dom/nodes/JsiTextNode.h +0 -51
- package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +0 -33
- package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +0 -41
- package/cpp/rnskia/dom/props/BezierProps.h +0 -65
- package/cpp/rnskia/dom/props/BlendModeProp.h +0 -103
- package/cpp/rnskia/dom/props/BoxShadowProps.h +0 -62
- package/cpp/rnskia/dom/props/CircleProp.h +0 -49
- package/cpp/rnskia/dom/props/ClipProp.h +0 -57
- package/cpp/rnskia/dom/props/ColorProp.h +0 -96
- package/cpp/rnskia/dom/props/FontProp.h +0 -42
- package/cpp/rnskia/dom/props/GlyphsProp.h +0 -55
- package/cpp/rnskia/dom/props/LayerProp.h +0 -52
- package/cpp/rnskia/dom/props/MatrixProp.h +0 -54
- package/cpp/rnskia/dom/props/NumbersProp.h +0 -67
- package/cpp/rnskia/dom/props/PaintProps.h +0 -133
- package/cpp/rnskia/dom/props/ParagraphProp.h +0 -45
- package/cpp/rnskia/dom/props/PathProp.h +0 -59
- package/cpp/rnskia/dom/props/PictureProp.h +0 -40
- package/cpp/rnskia/dom/props/PointProp.h +0 -65
- package/cpp/rnskia/dom/props/PointsProp.h +0 -81
- package/cpp/rnskia/dom/props/RRectProp.h +0 -222
- package/cpp/rnskia/dom/props/RSXformProp.h +0 -52
- package/cpp/rnskia/dom/props/RadiusProp.h +0 -43
- package/cpp/rnskia/dom/props/RectProp.h +0 -164
- package/cpp/rnskia/dom/props/SamplingProp.h +0 -54
- package/cpp/rnskia/dom/props/SkImageProps.h +0 -196
- package/cpp/rnskia/dom/props/StrokeProps.h +0 -79
- package/cpp/rnskia/dom/props/SvgProp.h +0 -45
- package/cpp/rnskia/dom/props/TextBlobProp.h +0 -133
- package/cpp/rnskia/dom/props/TileModeProp.h +0 -52
- package/cpp/rnskia/dom/props/TransformProp.h +0 -147
- package/cpp/rnskia/dom/props/TransformsProps.h +0 -66
- package/cpp/rnskia/dom/props/UniformsProp.h +0 -159
- package/cpp/rnskia/dom/props/VertexModeProp.h +0 -49
- package/cpp/rnskia/dom/props/VerticesProps.h +0 -63
- package/ios/RNSkia-iOS/SkiaDomView.h +0 -7
- package/ios/RNSkia-iOS/SkiaDomView.mm +0 -63
- package/ios/RNSkia-iOS/SkiaDomViewManager.h +0 -8
- package/ios/RNSkia-iOS/SkiaDomViewManager.mm +0 -51
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +0 -64
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +0 -196
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +0 -1
- package/lib/commonjs/renderer/CanvasOld.d.ts +0 -11
- package/lib/commonjs/renderer/CanvasOld.js +0 -96
- package/lib/commonjs/renderer/CanvasOld.js.map +0 -1
- package/lib/commonjs/renderer/Container.d.ts +0 -10
- package/lib/commonjs/renderer/Container.js +0 -26
- package/lib/commonjs/renderer/Container.js.map +0 -1
- package/lib/commonjs/renderer/HostComponents.d.ts +0 -129
- package/lib/commonjs/renderer/HostComponents.js +0 -141
- package/lib/commonjs/renderer/HostComponents.js.map +0 -1
- package/lib/commonjs/renderer/HostConfig.d.ts +0 -18
- package/lib/commonjs/renderer/HostConfig.js +0 -157
- package/lib/commonjs/renderer/HostConfig.js.map +0 -1
- package/lib/commonjs/renderer/Reconciler.d.ts +0 -9
- package/lib/commonjs/renderer/Reconciler.js +0 -44
- package/lib/commonjs/renderer/Reconciler.js.map +0 -1
- package/lib/commonjs/specs/SkiaDomViewNativeComponent.d.ts +0 -6
- package/lib/commonjs/specs/SkiaDomViewNativeComponent.js +0 -11
- package/lib/commonjs/specs/SkiaDomViewNativeComponent.js.map +0 -1
- package/lib/commonjs/views/SkiaDomView.d.ts +0 -33
- package/lib/commonjs/views/SkiaDomView.js +0 -119
- package/lib/commonjs/views/SkiaDomView.js.map +0 -1
- package/lib/commonjs/views/SkiaDomView.web.d.ts +0 -0
- package/lib/commonjs/views/SkiaDomView.web.js +0 -2
- package/lib/commonjs/views/SkiaDomView.web.js.map +0 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +0 -64
- package/lib/module/dom/nodes/JsiSkDOM.js +0 -189
- package/lib/module/dom/nodes/JsiSkDOM.js.map +0 -1
- package/lib/module/renderer/CanvasOld.d.ts +0 -11
- package/lib/module/renderer/CanvasOld.js +0 -87
- package/lib/module/renderer/CanvasOld.js.map +0 -1
- package/lib/module/renderer/Container.d.ts +0 -10
- package/lib/module/renderer/Container.js +0 -19
- package/lib/module/renderer/Container.js.map +0 -1
- package/lib/module/renderer/HostComponents.d.ts +0 -129
- package/lib/module/renderer/HostComponents.js +0 -134
- package/lib/module/renderer/HostComponents.js.map +0 -1
- package/lib/module/renderer/HostConfig.d.ts +0 -18
- package/lib/module/renderer/HostConfig.js +0 -150
- package/lib/module/renderer/HostConfig.js.map +0 -1
- package/lib/module/renderer/Reconciler.d.ts +0 -9
- package/lib/module/renderer/Reconciler.js +0 -36
- package/lib/module/renderer/Reconciler.js.map +0 -1
- package/lib/module/specs/SkiaDomViewNativeComponent.d.ts +0 -6
- package/lib/module/specs/SkiaDomViewNativeComponent.js +0 -4
- package/lib/module/specs/SkiaDomViewNativeComponent.js.map +0 -1
- package/lib/module/views/SkiaDomView.d.ts +0 -33
- package/lib/module/views/SkiaDomView.js +0 -111
- package/lib/module/views/SkiaDomView.js.map +0 -1
- package/lib/module/views/SkiaDomView.web.d.ts +0 -0
- package/lib/module/views/SkiaDomView.web.js +0 -2
- package/lib/module/views/SkiaDomView.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +0 -60
- package/lib/typescript/lib/commonjs/renderer/CanvasOld.d.ts +0 -3
- package/lib/typescript/lib/commonjs/renderer/Container.d.ts +0 -9
- package/lib/typescript/lib/commonjs/renderer/HostComponents.d.ts +0 -2
- package/lib/typescript/lib/commonjs/renderer/HostConfig.d.ts +0 -40
- package/lib/typescript/lib/commonjs/renderer/Reconciler.d.ts +0 -10
- package/lib/typescript/lib/commonjs/specs/SkiaDomViewNativeComponent.d.ts +0 -3
- package/lib/typescript/lib/commonjs/views/SkiaDomView.d.ts +0 -30
- package/lib/typescript/lib/commonjs/views/SkiaDomView.web.d.ts +0 -0
- package/lib/typescript/lib/module/dom/nodes/JsiSkDOM.d.ts +0 -59
- package/lib/typescript/lib/module/renderer/CanvasOld.d.ts +0 -3
- package/lib/typescript/lib/module/renderer/Container.d.ts +0 -9
- package/lib/typescript/lib/module/renderer/HostComponents.d.ts +0 -1
- package/lib/typescript/lib/module/renderer/HostConfig.d.ts +0 -39
- package/lib/typescript/lib/module/renderer/Reconciler.d.ts +0 -9
- package/lib/typescript/lib/module/specs/SkiaDomViewNativeComponent.d.ts +0 -2
- package/lib/typescript/lib/module/views/SkiaDomView.d.ts +0 -27
- package/lib/typescript/lib/module/views/SkiaDomView.web.d.ts +0 -0
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +0 -64
- package/lib/typescript/src/renderer/CanvasOld.d.ts +0 -11
- package/lib/typescript/src/renderer/Container.d.ts +0 -10
- package/lib/typescript/src/renderer/HostComponents.d.ts +0 -129
- package/lib/typescript/src/renderer/HostConfig.d.ts +0 -18
- package/lib/typescript/src/renderer/Reconciler.d.ts +0 -9
- package/lib/typescript/src/specs/SkiaDomViewNativeComponent.d.ts +0 -6
- package/lib/typescript/src/views/SkiaDomView.d.ts +0 -33
- package/lib/typescript/src/views/SkiaDomView.web.d.ts +0 -0
- package/src/dom/nodes/JsiSkDOM.ts +0 -298
- package/src/renderer/CanvasOld.tsx +0 -126
- package/src/renderer/Container.tsx +0 -19
- package/src/renderer/HostComponents.ts +0 -399
- package/src/renderer/HostConfig.ts +0 -258
- package/src/renderer/Reconciler.tsx +0 -54
- package/src/specs/SkiaDomViewNativeComponent.ts +0 -9
- package/src/views/SkiaDomView.tsx +0 -124
- package/src/views/SkiaDomView.web.tsx +0 -0
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "JsiDomDeclarationNode.h"
|
|
4
|
-
|
|
5
|
-
#include <algorithm>
|
|
6
|
-
#include <memory>
|
|
7
|
-
#include <string>
|
|
8
|
-
|
|
9
|
-
namespace RNSkia {
|
|
10
|
-
|
|
11
|
-
class JsiBlendNode : public JsiDomDeclarationNode,
|
|
12
|
-
public JsiDomNodeCtor<JsiBlendNode> {
|
|
13
|
-
public:
|
|
14
|
-
explicit JsiBlendNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
15
|
-
: JsiDomDeclarationNode(context, "skBlend",
|
|
16
|
-
DeclarationType::ImageFilter) {}
|
|
17
|
-
|
|
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);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
protected:
|
|
52
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
53
|
-
JsiDomDeclarationNode::defineProperties(container);
|
|
54
|
-
_blendProp = container->defineProperty<BlendModeProp>("mode");
|
|
55
|
-
_blendProp->require();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
Validates that only declaration nodes can be children
|
|
60
|
-
*/
|
|
61
|
-
void addChild(std::shared_ptr<JsiDomNode> child) override {
|
|
62
|
-
JsiDomDeclarationNode::addChild(child);
|
|
63
|
-
// Verify declaration of either shader or image filter
|
|
64
|
-
verifyChild(child);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
Validates that only declaration nodes can be children
|
|
69
|
-
*/
|
|
70
|
-
void insertChildBefore(std::shared_ptr<JsiDomNode> child,
|
|
71
|
-
std::shared_ptr<JsiDomNode> before) override {
|
|
72
|
-
JsiDomDeclarationNode::insertChildBefore(child, before);
|
|
73
|
-
// Verify declaration of either shader or image filter
|
|
74
|
-
verifyChild(child);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private:
|
|
78
|
-
void verifyChild(std::shared_ptr<JsiDomNode> child) {
|
|
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)) {
|
|
84
|
-
// We'll raise an error when other children are added.
|
|
85
|
-
std::runtime_error("Blend nodes only supports either shaders or image "
|
|
86
|
-
"filters as children, got " +
|
|
87
|
-
std::string(child->getType()) + ".");
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
BlendModeProp *_blendProp;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
} // namespace RNSkia
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "JsiDomDeclarationNode.h"
|
|
4
|
-
|
|
5
|
-
#include "NodeProp.h"
|
|
6
|
-
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <string>
|
|
9
|
-
|
|
10
|
-
#pragma clang diagnostic push
|
|
11
|
-
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
12
|
-
|
|
13
|
-
#include "include/core/SkBlurTypes.h"
|
|
14
|
-
#include "include/core/SkMaskFilter.h"
|
|
15
|
-
|
|
16
|
-
#pragma clang diagnostic pop
|
|
17
|
-
|
|
18
|
-
namespace RNSkia {
|
|
19
|
-
|
|
20
|
-
class JsiBlurMaskNode : public JsiDomDeclarationNode,
|
|
21
|
-
public JsiDomNodeCtor<JsiBlurMaskNode> {
|
|
22
|
-
public:
|
|
23
|
-
explicit JsiBlurMaskNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
24
|
-
: JsiDomDeclarationNode(context, "skBlurMaskFilter",
|
|
25
|
-
DeclarationType::MaskFilter) {}
|
|
26
|
-
|
|
27
|
-
void decorate(DeclarationContext *context) override {
|
|
28
|
-
|
|
29
|
-
bool respectCTM =
|
|
30
|
-
_respectCTM->isSet() ? _respectCTM->value().getAsBool() : true;
|
|
31
|
-
SkBlurStyle style = SkBlurStyle::kNormal_SkBlurStyle;
|
|
32
|
-
if (_style->isSet()) {
|
|
33
|
-
style = getBlurStyleFromString(_style->value().getAsString());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
auto filter =
|
|
37
|
-
SkMaskFilter::MakeBlur(style, _blur->value().getAsNumber(), respectCTM);
|
|
38
|
-
|
|
39
|
-
// Set the mask filter
|
|
40
|
-
context->getMaskFilters()->push(filter);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
protected:
|
|
44
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
45
|
-
JsiDomDeclarationNode::defineProperties(container);
|
|
46
|
-
|
|
47
|
-
_style = container->defineProperty<NodeProp>("style");
|
|
48
|
-
_respectCTM = container->defineProperty<NodeProp>("respectCTM");
|
|
49
|
-
_blur = container->defineProperty<NodeProp>("blur");
|
|
50
|
-
|
|
51
|
-
_blur->require();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
private:
|
|
55
|
-
SkBlurStyle getBlurStyleFromString(const std::string &value) {
|
|
56
|
-
if (value == "normal") {
|
|
57
|
-
return SkBlurStyle::kNormal_SkBlurStyle;
|
|
58
|
-
} else if (value == "solid") {
|
|
59
|
-
return SkBlurStyle::kSolid_SkBlurStyle;
|
|
60
|
-
} else if (value == "outer") {
|
|
61
|
-
return SkBlurStyle::kOuter_SkBlurStyle;
|
|
62
|
-
} else if (value == "inner") {
|
|
63
|
-
return SkBlurStyle::kInner_SkBlurStyle;
|
|
64
|
-
}
|
|
65
|
-
getContext()->raiseError(std::runtime_error(
|
|
66
|
-
"The value \"" + value + "\" is not " + "a valid blur style."));
|
|
67
|
-
return SkBlurStyle::kNormal_SkBlurStyle;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
NodeProp *_style;
|
|
71
|
-
NodeProp *_respectCTM;
|
|
72
|
-
NodeProp *_blur;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
} // namespace RNSkia
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "JsiBoxShadowNode.h"
|
|
4
|
-
#include "JsiDomRenderNode.h"
|
|
5
|
-
|
|
6
|
-
#include <memory>
|
|
7
|
-
#include <vector>
|
|
8
|
-
|
|
9
|
-
namespace RNSkia {
|
|
10
|
-
|
|
11
|
-
class JsiBoxNode : public JsiDomRenderNode, public JsiDomNodeCtor<JsiBoxNode> {
|
|
12
|
-
public:
|
|
13
|
-
explicit JsiBoxNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
14
|
-
: JsiDomRenderNode(context, "skBox") {}
|
|
15
|
-
|
|
16
|
-
protected:
|
|
17
|
-
void renderNode(DrawingContext *context) override {
|
|
18
|
-
// Get rect - we'll try to end up with an rrect:
|
|
19
|
-
auto box = *_boxProp->getDerivedValue();
|
|
20
|
-
|
|
21
|
-
// Get shadows
|
|
22
|
-
std::vector<std::shared_ptr<JsiBoxShadowNode>> shadows;
|
|
23
|
-
for (auto &child : getChildren()) {
|
|
24
|
-
auto shadowNode = std::dynamic_pointer_cast<JsiBoxShadowNode>(child);
|
|
25
|
-
if (shadowNode != nullptr && shadowNode->getBoxShadowProps()->isSet()) {
|
|
26
|
-
shadows.push_back(shadowNode);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// Render outer shadows
|
|
30
|
-
for (auto &shadow : shadows) {
|
|
31
|
-
if (!shadow->getBoxShadowProps()->isInner()) {
|
|
32
|
-
// Now let's render
|
|
33
|
-
auto dx = shadow->getBoxShadowProps()->getDx();
|
|
34
|
-
auto dy = shadow->getBoxShadowProps()->getDy();
|
|
35
|
-
auto spread = shadow->getBoxShadowProps()->getSpread();
|
|
36
|
-
|
|
37
|
-
context->getCanvas()->drawRRect(
|
|
38
|
-
inflate(box, spread, spread, dx, dy),
|
|
39
|
-
*shadow->getBoxShadowProps()->getDerivedValue());
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Render box
|
|
44
|
-
context->getCanvas()->drawRRect(box, *context->getPaint());
|
|
45
|
-
|
|
46
|
-
// Render inner shadows
|
|
47
|
-
for (auto &shadow : shadows) {
|
|
48
|
-
if (shadow->getBoxShadowProps()->isInner()) {
|
|
49
|
-
// Now let's render
|
|
50
|
-
auto dx = shadow->getBoxShadowProps()->getDx();
|
|
51
|
-
auto dy = shadow->getBoxShadowProps()->getDy();
|
|
52
|
-
auto spread = shadow->getBoxShadowProps()->getSpread();
|
|
53
|
-
auto delta = SkPoint::Make(10 + std::abs(dx), 10 + std::abs(dy));
|
|
54
|
-
|
|
55
|
-
context->getCanvas()->save();
|
|
56
|
-
context->getCanvas()->clipRRect(box, SkClipOp::kIntersect, false);
|
|
57
|
-
|
|
58
|
-
auto inner = deflate(box, spread, spread, dx, dy);
|
|
59
|
-
auto outer = inflate(box, delta.x(), delta.y());
|
|
60
|
-
|
|
61
|
-
// Render!
|
|
62
|
-
context->getCanvas()->drawDRRect(
|
|
63
|
-
outer, inner, *shadow->getBoxShadowProps()->getDerivedValue());
|
|
64
|
-
|
|
65
|
-
context->getCanvas()->restore();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
71
|
-
JsiDomRenderNode::defineProperties(container);
|
|
72
|
-
_boxProp = container->defineProperty<BoxProps>("box");
|
|
73
|
-
_boxProp->require();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
private:
|
|
77
|
-
SkRRect inflate(const SkRRect &box, SkScalar dx, SkScalar dy, SkScalar tx = 0,
|
|
78
|
-
SkScalar ty = 0) {
|
|
79
|
-
return SkRRect::MakeRectXY(
|
|
80
|
-
SkRect::MakeXYWH(box.rect().x() - dx + tx, box.rect().y() - dy + ty,
|
|
81
|
-
box.rect().width() + 2 * dx,
|
|
82
|
-
box.rect().height() + 2 * dy),
|
|
83
|
-
box.getSimpleRadii().x() + dx, box.getSimpleRadii().y() + dy);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
SkRRect deflate(const SkRRect &box, SkScalar dx, SkScalar dy, SkScalar tx = 0,
|
|
87
|
-
SkScalar ty = 0) {
|
|
88
|
-
return inflate(box, -dx, -dy, tx, ty);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
BoxProps *_boxProp;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
} // namespace RNSkia
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "BoxShadowProps.h"
|
|
4
|
-
#include "JsiDomDeclarationNode.h"
|
|
5
|
-
|
|
6
|
-
#include <memory>
|
|
7
|
-
|
|
8
|
-
namespace RNSkia {
|
|
9
|
-
|
|
10
|
-
class JsiBoxShadowNode : public JsiDomDeclarationNode,
|
|
11
|
-
public JsiDomNodeCtor<JsiBoxShadowNode> {
|
|
12
|
-
public:
|
|
13
|
-
explicit JsiBoxShadowNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
14
|
-
: JsiDomDeclarationNode(context, "skBoxShadow",
|
|
15
|
-
DeclarationType::Unknown) {}
|
|
16
|
-
|
|
17
|
-
BoxShadowProps *getBoxShadowProps() { return _boxShadowProps; }
|
|
18
|
-
|
|
19
|
-
void decorate(DeclarationContext *context) override {
|
|
20
|
-
// Do nothing, we are just a container for properties
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
protected:
|
|
24
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
25
|
-
JsiDomDeclarationNode::defineProperties(container);
|
|
26
|
-
_boxShadowProps = container->defineProperty<BoxShadowProps>();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private:
|
|
30
|
-
BoxShadowProps *_boxShadowProps;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
} // namespace RNSkia
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "CircleProp.h"
|
|
4
|
-
#include "JsiDomDrawingNode.h"
|
|
5
|
-
|
|
6
|
-
#include <memory>
|
|
7
|
-
|
|
8
|
-
namespace RNSkia {
|
|
9
|
-
|
|
10
|
-
class JsiCircleNode : public JsiDomDrawingNode,
|
|
11
|
-
public JsiDomNodeCtor<JsiCircleNode> {
|
|
12
|
-
public:
|
|
13
|
-
explicit JsiCircleNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
14
|
-
: JsiDomDrawingNode(context, "skCircle") {}
|
|
15
|
-
|
|
16
|
-
protected:
|
|
17
|
-
void draw(DrawingContext *context) override {
|
|
18
|
-
auto circle = _circleProp->getDerivedValue();
|
|
19
|
-
auto r = _radiusProp->value().getAsNumber();
|
|
20
|
-
context->getCanvas()->drawCircle(*circle, r, *context->getPaint());
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
24
|
-
JsiDomDrawingNode::defineProperties(container);
|
|
25
|
-
_circleProp = container->defineProperty<CircleProp>();
|
|
26
|
-
_radiusProp = container->defineProperty<NodeProp>("r");
|
|
27
|
-
_radiusProp->require();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
private:
|
|
31
|
-
CircleProp *_circleProp;
|
|
32
|
-
NodeProp *_radiusProp;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
} // namespace RNSkia
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "JsiDomDeclarationNode.h"
|
|
4
|
-
|
|
5
|
-
#include "BlendModeProp.h"
|
|
6
|
-
#include "ColorProp.h"
|
|
7
|
-
#include "NodeProp.h"
|
|
8
|
-
|
|
9
|
-
#include <memory>
|
|
10
|
-
|
|
11
|
-
#pragma clang diagnostic push
|
|
12
|
-
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
13
|
-
|
|
14
|
-
#include "include/core/SkColorFilter.h"
|
|
15
|
-
|
|
16
|
-
#pragma clang diagnostic pop
|
|
17
|
-
|
|
18
|
-
namespace RNSkia {
|
|
19
|
-
|
|
20
|
-
class JsiBaseColorFilterNode : public JsiDomDeclarationNode {
|
|
21
|
-
public:
|
|
22
|
-
JsiBaseColorFilterNode(std::shared_ptr<RNSkPlatformContext> context,
|
|
23
|
-
const char *type)
|
|
24
|
-
: JsiDomDeclarationNode(context, type, DeclarationType::ColorFilter) {}
|
|
25
|
-
|
|
26
|
-
protected:
|
|
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);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
class JsiMatrixColorFilterNode
|
|
38
|
-
: public JsiBaseColorFilterNode,
|
|
39
|
-
public JsiDomNodeCtor<JsiMatrixColorFilterNode> {
|
|
40
|
-
public:
|
|
41
|
-
explicit JsiMatrixColorFilterNode(
|
|
42
|
-
std::shared_ptr<RNSkPlatformContext> context)
|
|
43
|
-
: JsiBaseColorFilterNode(context, "skMatrixColorFilter") {}
|
|
44
|
-
|
|
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();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
composeAndPush(context, SkColorFilters::Matrix(matrix));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
protected:
|
|
57
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
58
|
-
JsiDomDeclarationNode::defineProperties(container);
|
|
59
|
-
_matrixProp = container->defineProperty<NodeProp>("matrix");
|
|
60
|
-
_matrixProp->require();
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
private:
|
|
64
|
-
NodeProp *_matrixProp;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
class JsiBlendColorFilterNode : public JsiBaseColorFilterNode,
|
|
68
|
-
public JsiDomNodeCtor<JsiBlendColorFilterNode> {
|
|
69
|
-
public:
|
|
70
|
-
explicit JsiBlendColorFilterNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
71
|
-
: JsiBaseColorFilterNode(context, "skBlendColorFilter") {}
|
|
72
|
-
|
|
73
|
-
void decorate(DeclarationContext *context) override {
|
|
74
|
-
auto color = _colorProp->getDerivedValue();
|
|
75
|
-
auto mode = _blendModeProp->getDerivedValue();
|
|
76
|
-
composeAndPush(context, SkColorFilters::Blend(*color, *mode));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
protected:
|
|
80
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
81
|
-
JsiDomDeclarationNode::defineProperties(container);
|
|
82
|
-
_blendModeProp = container->defineProperty<BlendModeProp>("mode");
|
|
83
|
-
_colorProp = container->defineProperty<ColorProp>("color");
|
|
84
|
-
|
|
85
|
-
_blendModeProp->require();
|
|
86
|
-
_colorProp->require();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private:
|
|
90
|
-
BlendModeProp *_blendModeProp;
|
|
91
|
-
ColorProp *_colorProp;
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
class JsiLinearToSRGBGammaColorFilterNode
|
|
95
|
-
: public JsiBaseColorFilterNode,
|
|
96
|
-
public JsiDomNodeCtor<JsiLinearToSRGBGammaColorFilterNode> {
|
|
97
|
-
public:
|
|
98
|
-
explicit JsiLinearToSRGBGammaColorFilterNode(
|
|
99
|
-
std::shared_ptr<RNSkPlatformContext> context)
|
|
100
|
-
: JsiBaseColorFilterNode(context, "skLinearToSRGBGammaColorFilter") {}
|
|
101
|
-
|
|
102
|
-
void decorate(DeclarationContext *context) override {
|
|
103
|
-
composeAndPush(context, SkColorFilters::LinearToSRGBGamma());
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
class JsiSRGBToLinearGammaColorFilterNode
|
|
108
|
-
: public JsiBaseColorFilterNode,
|
|
109
|
-
public JsiDomNodeCtor<JsiSRGBToLinearGammaColorFilterNode> {
|
|
110
|
-
public:
|
|
111
|
-
explicit JsiSRGBToLinearGammaColorFilterNode(
|
|
112
|
-
std::shared_ptr<RNSkPlatformContext> context)
|
|
113
|
-
: JsiBaseColorFilterNode(context, "skSRGBToLinearGammaColorFilter") {}
|
|
114
|
-
|
|
115
|
-
void decorate(DeclarationContext *context) override {
|
|
116
|
-
composeAndPush(context, SkColorFilters::SRGBToLinearGamma());
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
class JsiLumaColorFilterNode : public JsiBaseColorFilterNode,
|
|
121
|
-
public JsiDomNodeCtor<JsiLumaColorFilterNode> {
|
|
122
|
-
public:
|
|
123
|
-
explicit JsiLumaColorFilterNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
124
|
-
: JsiBaseColorFilterNode(context, "skLumaColorFilter") {}
|
|
125
|
-
|
|
126
|
-
void decorate(DeclarationContext *context) override {
|
|
127
|
-
composeAndPush(context, SkLumaColorFilter::Make());
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
class JsiLerpColorFilterNode : public JsiBaseColorFilterNode,
|
|
132
|
-
public JsiDomNodeCtor<JsiLerpColorFilterNode> {
|
|
133
|
-
public:
|
|
134
|
-
explicit JsiLerpColorFilterNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
135
|
-
: JsiBaseColorFilterNode(context, "skLerpColorFilter") {}
|
|
136
|
-
|
|
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");
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
auto t = _tProp->value().getAsNumber();
|
|
150
|
-
context->getColorFilters()->push(SkColorFilters::Lerp(t, first, second));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
protected:
|
|
154
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
155
|
-
JsiDomDeclarationNode::defineProperties(container);
|
|
156
|
-
_tProp = container->defineProperty<NodeProp>("t");
|
|
157
|
-
_tProp->require();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
private:
|
|
161
|
-
NodeProp *_tProp;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
} // namespace RNSkia
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "JsiDomDrawingNode.h"
|
|
4
|
-
#include "RRectProp.h"
|
|
5
|
-
|
|
6
|
-
#include <memory>
|
|
7
|
-
|
|
8
|
-
namespace RNSkia {
|
|
9
|
-
|
|
10
|
-
class JsiDiffRectNode : public JsiDomDrawingNode,
|
|
11
|
-
public JsiDomNodeCtor<JsiDiffRectNode> {
|
|
12
|
-
public:
|
|
13
|
-
explicit JsiDiffRectNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
14
|
-
: JsiDomDrawingNode(context, "skDiffRect") {}
|
|
15
|
-
|
|
16
|
-
protected:
|
|
17
|
-
void draw(DrawingContext *context) override {
|
|
18
|
-
context->getCanvas()->drawDRRect(*_outerRectProp->getDerivedValue(),
|
|
19
|
-
*_innerRectProp->getDerivedValue(),
|
|
20
|
-
*context->getPaint());
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
24
|
-
JsiDomDrawingNode::defineProperties(container);
|
|
25
|
-
_innerRectProp = container->defineProperty<RRectProp>("inner");
|
|
26
|
-
_outerRectProp = container->defineProperty<RRectProp>("outer");
|
|
27
|
-
|
|
28
|
-
_innerRectProp->require();
|
|
29
|
-
_outerRectProp->require();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
private:
|
|
33
|
-
RRectProp *_innerRectProp;
|
|
34
|
-
RRectProp *_outerRectProp;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
} // namespace RNSkia
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "JsiDomDrawingNode.h"
|
|
4
|
-
#include "RectProp.h"
|
|
5
|
-
|
|
6
|
-
#include <memory>
|
|
7
|
-
|
|
8
|
-
namespace RNSkia {
|
|
9
|
-
|
|
10
|
-
class JsiFillNode : public JsiDomDrawingNode,
|
|
11
|
-
public JsiDomNodeCtor<JsiFillNode> {
|
|
12
|
-
public:
|
|
13
|
-
explicit JsiFillNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
14
|
-
: JsiDomDrawingNode(context, "skFill") {}
|
|
15
|
-
|
|
16
|
-
protected:
|
|
17
|
-
void draw(DrawingContext *context) override {
|
|
18
|
-
context->getCanvas()->drawPaint(*context->getPaint());
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
} // namespace RNSkia
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "JsiDomDrawingNode.h"
|
|
4
|
-
|
|
5
|
-
#include "FontProp.h"
|
|
6
|
-
#include "GlyphsProp.h"
|
|
7
|
-
|
|
8
|
-
#include <memory>
|
|
9
|
-
|
|
10
|
-
namespace RNSkia {
|
|
11
|
-
|
|
12
|
-
class JsiGlyphsNode : public JsiDomDrawingNode,
|
|
13
|
-
public JsiDomNodeCtor<JsiGlyphsNode> {
|
|
14
|
-
public:
|
|
15
|
-
explicit JsiGlyphsNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
16
|
-
: JsiDomDrawingNode(context, "skGlyphs") {}
|
|
17
|
-
|
|
18
|
-
protected:
|
|
19
|
-
void draw(DrawingContext *context) override {
|
|
20
|
-
auto x = _xProp->value().getAsNumber();
|
|
21
|
-
auto y = _yProp->value().getAsNumber();
|
|
22
|
-
auto font = _fontProp->getDerivedValue();
|
|
23
|
-
if (font != nullptr) {
|
|
24
|
-
auto glyphInfo = _glyphsProp->getDerivedValue();
|
|
25
|
-
|
|
26
|
-
context->getCanvas()->drawGlyphs(
|
|
27
|
-
static_cast<int>(glyphInfo->glyphIds.size()),
|
|
28
|
-
glyphInfo->glyphIds.data(), glyphInfo->positions.data(),
|
|
29
|
-
SkPoint::Make(x, y), *font, *context->getPaint());
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
void defineProperties(NodePropsContainer *container) override {
|
|
34
|
-
JsiDomDrawingNode::defineProperties(container);
|
|
35
|
-
|
|
36
|
-
_fontProp = container->defineProperty<FontProp>("font");
|
|
37
|
-
_glyphsProp = container->defineProperty<GlyphsProp>("glyphs");
|
|
38
|
-
_xProp = container->defineProperty<NodeProp>("x");
|
|
39
|
-
_yProp = container->defineProperty<NodeProp>("y");
|
|
40
|
-
|
|
41
|
-
_glyphsProp->require();
|
|
42
|
-
_xProp->require();
|
|
43
|
-
_yProp->require();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private:
|
|
47
|
-
FontProp *_fontProp;
|
|
48
|
-
GlyphsProp *_glyphsProp;
|
|
49
|
-
NodeProp *_xProp;
|
|
50
|
-
NodeProp *_yProp;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
} // namespace RNSkia
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
#pragma once
|
|
3
|
-
|
|
4
|
-
#include "JsiDomRenderNode.h"
|
|
5
|
-
|
|
6
|
-
#include <memory>
|
|
7
|
-
|
|
8
|
-
namespace RNSkia {
|
|
9
|
-
|
|
10
|
-
class JsiGroupNode : public JsiDomRenderNode,
|
|
11
|
-
public JsiDomNodeCtor<JsiGroupNode> {
|
|
12
|
-
public:
|
|
13
|
-
explicit JsiGroupNode(std::shared_ptr<RNSkPlatformContext> context)
|
|
14
|
-
: JsiDomRenderNode(context, "skGroup") {}
|
|
15
|
-
|
|
16
|
-
void renderNode(DrawingContext *context) override {
|
|
17
|
-
for (auto &child : getChildren()) {
|
|
18
|
-
if (child->getNodeClass() == NodeClass::RenderNode) {
|
|
19
|
-
std::static_pointer_cast<JsiDomRenderNode>(child)->render(context);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
} // namespace RNSkia
|