@shopify/react-native-skia 0.1.162 → 0.1.164

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +2 -0
  2. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +2 -2
  3. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +2 -2
  4. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +5 -5
  5. package/cpp/api/JsiSkCanvas.h +8 -8
  6. package/cpp/api/JsiSkColor.h +1 -1
  7. package/cpp/api/JsiSkColorFilter.h +1 -1
  8. package/cpp/api/JsiSkColorFilterFactory.h +2 -2
  9. package/cpp/api/JsiSkContourMeasure.h +1 -1
  10. package/cpp/api/JsiSkContourMeasureIter.h +2 -2
  11. package/cpp/api/JsiSkData.h +2 -2
  12. package/cpp/api/JsiSkDataFactory.h +1 -1
  13. package/cpp/api/JsiSkFont.h +2 -2
  14. package/cpp/api/JsiSkImage.h +3 -3
  15. package/cpp/api/JsiSkImageFilter.h +1 -1
  16. package/cpp/api/JsiSkImageFilterFactory.h +1 -1
  17. package/cpp/api/JsiSkImageInfo.h +1 -1
  18. package/cpp/api/JsiSkMaskFilter.h +1 -1
  19. package/cpp/api/JsiSkMaskFilterFactory.h +1 -1
  20. package/cpp/api/JsiSkMatrix.h +1 -1
  21. package/cpp/api/JsiSkPaint.h +7 -1
  22. package/cpp/api/JsiSkPath.h +15 -15
  23. package/cpp/api/JsiSkPathEffect.h +1 -1
  24. package/cpp/api/JsiSkPathEffectFactory.h +4 -4
  25. package/cpp/api/JsiSkPathFactory.h +2 -2
  26. package/cpp/api/JsiSkPicture.h +1 -1
  27. package/cpp/api/JsiSkPictureFactory.h +2 -2
  28. package/cpp/api/JsiSkPictureRecorder.h +2 -2
  29. package/cpp/api/JsiSkPoint.h +1 -1
  30. package/cpp/api/JsiSkRRect.h +1 -1
  31. package/cpp/api/JsiSkRSXform.h +1 -1
  32. package/cpp/api/JsiSkRect.h +1 -1
  33. package/cpp/api/JsiSkRuntimeEffect.h +1 -1
  34. package/cpp/api/JsiSkRuntimeShaderBuilder.h +1 -1
  35. package/cpp/api/JsiSkSVGFactory.h +1 -1
  36. package/cpp/api/JsiSkShader.h +2 -2
  37. package/cpp/api/JsiSkShaderFactory.h +3 -3
  38. package/cpp/api/JsiSkSurface.h +1 -1
  39. package/cpp/api/JsiSkSurfaceFactory.h +2 -2
  40. package/cpp/api/JsiSkTextBlob.h +1 -1
  41. package/cpp/api/JsiSkTextBlobFactory.h +1 -1
  42. package/cpp/api/JsiSkTypeface.h +2 -2
  43. package/cpp/api/JsiSkVertices.h +1 -1
  44. package/cpp/jsi/JsiHostObject.h +25 -25
  45. package/cpp/rnskia/RNSkJsView.h +3 -3
  46. package/cpp/rnskia/RNSkPictureView.h +3 -3
  47. package/cpp/rnskia/RNSkPlatformContext.h +5 -3
  48. package/cpp/rnskia/RNSkView.h +2 -2
  49. package/cpp/rnskia/dom/base/DrawingContext.cpp +24 -9
  50. package/cpp/rnskia/dom/base/DrawingContext.h +3 -2
  51. package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +12 -2
  52. package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +4 -4
  53. package/cpp/rnskia/dom/base/JsiDomNode.h +68 -10
  54. package/cpp/rnskia/dom/base/JsiDomRenderNode.h +26 -61
  55. package/cpp/rnskia/dom/base/NodeProp.h +2 -1
  56. package/cpp/rnskia/dom/base/NodePropsContainer.h +10 -0
  57. package/cpp/rnskia/dom/nodes/JsiBlendNode.h +7 -9
  58. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +3 -6
  59. package/cpp/rnskia/dom/nodes/JsiBoxNode.h +2 -4
  60. package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +1 -2
  61. package/cpp/rnskia/dom/nodes/JsiCircleNode.h +2 -3
  62. package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +4 -8
  63. package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +1 -2
  64. package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +2 -7
  65. package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +4 -8
  66. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +19 -37
  67. package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -1
  68. package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +2 -4
  69. package/cpp/rnskia/dom/nodes/JsiLineNode.h +2 -7
  70. package/cpp/rnskia/dom/nodes/JsiOvalNode.h +1 -3
  71. package/cpp/rnskia/dom/nodes/JsiPaintNode.h +2 -3
  72. package/cpp/rnskia/dom/nodes/JsiPatchNode.h +4 -8
  73. package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +14 -28
  74. package/cpp/rnskia/dom/nodes/JsiPathNode.h +16 -24
  75. package/cpp/rnskia/dom/nodes/JsiPictureNode.h +1 -2
  76. package/cpp/rnskia/dom/nodes/JsiPointsNode.h +2 -5
  77. package/cpp/rnskia/dom/nodes/JsiRRectNode.h +1 -2
  78. package/cpp/rnskia/dom/nodes/JsiRectNode.h +1 -2
  79. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +37 -69
  80. package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +3 -6
  81. package/cpp/rnskia/dom/nodes/JsiTextNode.h +4 -8
  82. package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +1 -2
  83. package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +2 -4
  84. package/cpp/rnskia/dom/props/BlendModeProp.h +2 -2
  85. package/cpp/rnskia/dom/props/PaintProps.h +3 -0
  86. package/cpp/rnskia/dom/props/TransformProp.h +0 -2
  87. package/cpp/utils/RNSkLog.h +1 -1
  88. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +8 -7
  89. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -1
  90. package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +4 -4
  91. package/ios/RNSkia-iOS/SkiaManager.mm +5 -5
  92. package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +3 -3
  93. package/ios/RNSkia-iOS/SkiaUIView.mm +10 -10
  94. package/lib/commonjs/dom/nodes/RenderNode.js +12 -16
  95. package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
  96. package/lib/commonjs/dom/nodes/datatypes/index.js +0 -13
  97. package/lib/commonjs/dom/nodes/datatypes/index.js.map +1 -1
  98. package/lib/commonjs/dom/nodes/drawings/Box.js +6 -6
  99. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  100. package/lib/commonjs/dom/nodes/drawings/PatchNode.js +3 -7
  101. package/lib/commonjs/dom/nodes/drawings/PatchNode.js.map +1 -1
  102. package/lib/commonjs/dom/nodes/drawings/VerticesNode.js +1 -1
  103. package/lib/commonjs/dom/nodes/drawings/VerticesNode.js.map +1 -1
  104. package/lib/commonjs/dom/nodes/paint/ColorFilters.js +1 -3
  105. package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
  106. package/lib/commonjs/dom/nodes/paint/ImageFilters.js +1 -1
  107. package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
  108. package/lib/commonjs/dom/nodes/paint/Shaders.js +1 -3
  109. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  110. package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
  111. package/lib/commonjs/renderer/Canvas.js +2 -11
  112. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  113. package/lib/commonjs/renderer/Container.js +2 -1
  114. package/lib/commonjs/renderer/Container.js.map +1 -1
  115. package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
  116. package/lib/commonjs/renderer/components/Mask.js +11 -25
  117. package/lib/commonjs/renderer/components/Mask.js.map +1 -1
  118. package/lib/commonjs/renderer/index.js +0 -13
  119. package/lib/commonjs/renderer/index.js.map +1 -1
  120. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  121. package/lib/commonjs/skia/web/JsiSkPaint.js +4 -0
  122. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  123. package/lib/commonjs/web/LoadSkiaWeb.js +1 -1
  124. package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
  125. package/lib/module/dom/nodes/RenderNode.js +12 -16
  126. package/lib/module/dom/nodes/RenderNode.js.map +1 -1
  127. package/lib/module/dom/nodes/datatypes/index.js +0 -1
  128. package/lib/module/dom/nodes/datatypes/index.js.map +1 -1
  129. package/lib/module/dom/nodes/drawings/Box.js +6 -5
  130. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  131. package/lib/module/dom/nodes/drawings/PatchNode.js +4 -8
  132. package/lib/module/dom/nodes/drawings/PatchNode.js.map +1 -1
  133. package/lib/module/dom/nodes/drawings/VerticesNode.js +2 -2
  134. package/lib/module/dom/nodes/drawings/VerticesNode.js.map +1 -1
  135. package/lib/module/dom/nodes/paint/ColorFilters.js +1 -2
  136. package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
  137. package/lib/module/dom/nodes/paint/ImageFilters.js +2 -2
  138. package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
  139. package/lib/module/dom/nodes/paint/Shaders.js +1 -2
  140. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  141. package/lib/module/dom/types/DrawingContext.js.map +1 -1
  142. package/lib/module/renderer/Canvas.js +3 -10
  143. package/lib/module/renderer/Canvas.js.map +1 -1
  144. package/lib/module/renderer/Container.js +2 -1
  145. package/lib/module/renderer/Container.js.map +1 -1
  146. package/lib/module/renderer/DrawingContext.js.map +1 -1
  147. package/lib/module/renderer/components/Mask.js +9 -21
  148. package/lib/module/renderer/components/Mask.js.map +1 -1
  149. package/lib/module/renderer/index.js +0 -1
  150. package/lib/module/renderer/index.js.map +1 -1
  151. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  152. package/lib/module/skia/web/JsiSkPaint.js +4 -0
  153. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  154. package/lib/module/web/LoadSkiaWeb.js +1 -1
  155. package/lib/module/web/LoadSkiaWeb.js.map +1 -1
  156. package/lib/typescript/src/dom/nodes/datatypes/index.d.ts +0 -1
  157. package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +1 -1
  158. package/lib/typescript/src/dom/nodes/drawings/PatchNode.d.ts +1 -1
  159. package/lib/typescript/src/dom/types/DrawingContext.d.ts +0 -1
  160. package/lib/typescript/src/renderer/Container.d.ts +1 -1
  161. package/lib/typescript/src/renderer/DrawingContext.d.ts +3 -5
  162. package/lib/typescript/src/renderer/index.d.ts +0 -1
  163. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +4 -0
  164. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  165. package/package.json +1 -1
  166. package/src/dom/nodes/RenderNode.ts +11 -21
  167. package/src/dom/nodes/datatypes/index.ts +0 -1
  168. package/src/dom/nodes/drawings/Box.ts +7 -4
  169. package/src/dom/nodes/drawings/PatchNode.ts +4 -18
  170. package/src/dom/nodes/drawings/VerticesNode.ts +2 -2
  171. package/src/dom/nodes/paint/ColorFilters.ts +1 -2
  172. package/src/dom/nodes/paint/ImageFilters.ts +2 -2
  173. package/src/dom/nodes/paint/Shaders.ts +1 -2
  174. package/src/dom/types/DrawingContext.ts +0 -1
  175. package/src/renderer/Canvas.tsx +2 -12
  176. package/src/renderer/Container.tsx +1 -1
  177. package/src/renderer/DrawingContext.ts +5 -5
  178. package/src/renderer/components/Mask.tsx +11 -20
  179. package/src/renderer/index.ts +0 -1
  180. package/src/skia/types/Paint/Paint.ts +5 -0
  181. package/src/skia/web/JsiSkPaint.ts +4 -0
  182. package/src/web/LoadSkiaWeb.tsx +1 -1
  183. package/lib/commonjs/dom/nodes/datatypes/Color.js +0 -27
  184. package/lib/commonjs/dom/nodes/datatypes/Color.js.map +0 -1
  185. package/lib/commonjs/renderer/useCanvas.js +0 -32
  186. package/lib/commonjs/renderer/useCanvas.js.map +0 -1
  187. package/lib/module/dom/nodes/datatypes/Color.js +0 -11
  188. package/lib/module/dom/nodes/datatypes/Color.js.map +0 -1
  189. package/lib/module/renderer/useCanvas.js +0 -15
  190. package/lib/module/renderer/useCanvas.js.map +0 -1
  191. package/lib/typescript/src/dom/nodes/datatypes/Color.d.ts +0 -7
  192. package/lib/typescript/src/renderer/useCanvas.d.ts +0 -9
  193. package/src/dom/nodes/datatypes/Color.ts +0 -15
  194. package/src/renderer/useCanvas.ts +0 -21
@@ -77,8 +77,7 @@ protected:
77
77
 
78
78
  void defineProperties(NodePropsContainer *container) override {
79
79
  JsiBaseDomDeclarationNode::defineProperties(container);
80
- _matrixProp = container->defineProperty(
81
- std::make_shared<NodeProp>(JsiPropId::get("matrix")));
80
+ _matrixProp = container->defineProperty<NodeProp>("matrix");
82
81
  _matrixProp->require();
83
82
  }
84
83
 
@@ -103,10 +102,8 @@ protected:
103
102
 
104
103
  void defineProperties(NodePropsContainer *container) override {
105
104
  JsiBaseDomDeclarationNode::defineProperties(container);
106
- _blendModeProp = container->defineProperty(
107
- std::make_shared<BlendModeProp>(JsiPropId::get("mode")));
108
- _colorProp = container->defineProperty(
109
- std::make_shared<ColorProp>(JsiPropId::get("color")));
105
+ _blendModeProp = container->defineProperty<BlendModeProp>("mode");
106
+ _colorProp = container->defineProperty<ColorProp>("color");
110
107
 
111
108
  _blendModeProp->require();
112
109
  _colorProp->require();
@@ -180,8 +177,7 @@ protected:
180
177
 
181
178
  void defineProperties(NodePropsContainer *container) override {
182
179
  JsiBaseDomDeclarationNode::defineProperties(container);
183
- _tProp = container->defineProperty(
184
- std::make_shared<NodeProp>(JsiPropId::get("t")));
180
+ _tProp = container->defineProperty<NodeProp>("t");
185
181
  _tProp->require();
186
182
  }
187
183
 
@@ -100,8 +100,7 @@ protected:
100
100
  std::bind(&JsiCustomDrawingNode::notifyPictureNeeded, this,
101
101
  std::placeholders::_1);
102
102
 
103
- _drawingProp = container->defineProperty(
104
- std::make_shared<DrawingProp>(JsiPropId::get("drawing"), cb));
103
+ _drawingProp = container->defineProperty<DrawingProp>("drawing", cb);
105
104
  }
106
105
 
107
106
  private:
@@ -7,9 +7,6 @@
7
7
 
8
8
  namespace RNSkia {
9
9
 
10
- static PropId PropNameInner = JsiPropId::get("inner");
11
- static PropId PropNameOuter = JsiPropId::get("outer");
12
-
13
10
  class JsiDiffRectNode : public JsiDomDrawingNode,
14
11
  public JsiDomNodeCtor<JsiDiffRectNode> {
15
12
  public:
@@ -25,10 +22,8 @@ protected:
25
22
 
26
23
  void defineProperties(NodePropsContainer *container) override {
27
24
  JsiDomDrawingNode::defineProperties(container);
28
- _innerRectProp =
29
- container->defineProperty(std::make_shared<RRectProp>(PropNameInner));
30
- _outerRectProp =
31
- container->defineProperty(std::make_shared<RRectProp>(PropNameOuter));
25
+ _innerRectProp = container->defineProperty<RRectProp>("inner");
26
+ _outerRectProp = container->defineProperty<RRectProp>("outer");
32
27
 
33
28
  _innerRectProp->require();
34
29
  _outerRectProp->require();
@@ -31,14 +31,10 @@ protected:
31
31
  void defineProperties(NodePropsContainer *container) override {
32
32
  JsiDomDrawingNode::defineProperties(container);
33
33
 
34
- _fontProp = container->defineProperty(
35
- std::make_shared<FontProp>(JsiPropId::get("font")));
36
- _glyphsProp = container->defineProperty(
37
- std::make_shared<GlyphsProp>(JsiPropId::get("glyphs")));
38
- _xProp = container->defineProperty(
39
- std::make_shared<NodeProp>(JsiPropId::get("x")));
40
- _yProp = container->defineProperty(
41
- std::make_shared<NodeProp>(JsiPropId::get("y")));
34
+ _fontProp = container->defineProperty<FontProp>("font");
35
+ _glyphsProp = container->defineProperty<GlyphsProp>("glyphs");
36
+ _xProp = container->defineProperty<NodeProp>("x");
37
+ _yProp = container->defineProperty<NodeProp>("y");
42
38
 
43
39
  _fontProp->require();
44
40
  _glyphsProp->require();
@@ -94,8 +94,7 @@ protected:
94
94
 
95
95
  void defineProperties(NodePropsContainer *container) override {
96
96
  JsiBaseDomDeclarationNode::defineProperties(container);
97
- _blendModeProp = container->defineProperty(
98
- std::make_shared<BlendModeProp>(JsiPropId::get("mode")));
97
+ _blendModeProp = container->defineProperty<BlendModeProp>("mode");
99
98
  _blendModeProp->require();
100
99
  }
101
100
 
@@ -154,19 +153,13 @@ protected:
154
153
 
155
154
  void defineProperties(NodePropsContainer *container) override {
156
155
  JsiBaseDomDeclarationNode::defineProperties(container);
157
- _dxProp = container->defineProperty(
158
- std::make_shared<NodeProp>(JsiPropId::get("dx")));
159
- _dyProp = container->defineProperty(
160
- std::make_shared<NodeProp>(JsiPropId::get("dy")));
161
- _blurProp = container->defineProperty(
162
- std::make_shared<NodeProp>(JsiPropId::get("blur")));
163
- _colorProp = container->defineProperty(
164
- std::make_shared<ColorProp>(JsiPropId::get("color")));
165
-
166
- _innerProp = container->defineProperty(
167
- std::make_shared<NodeProp>(JsiPropId::get("inner")));
168
- _shadowOnlyProp = container->defineProperty(
169
- std::make_shared<NodeProp>(JsiPropId::get("shadowOnly")));
156
+ _dxProp = container->defineProperty<NodeProp>("dx");
157
+ _dyProp = container->defineProperty<NodeProp>("dy");
158
+ _blurProp = container->defineProperty<NodeProp>("blur");
159
+ _colorProp = container->defineProperty<ColorProp>("color");
160
+
161
+ _innerProp = container->defineProperty<NodeProp>("inner");
162
+ _shadowOnlyProp = container->defineProperty<NodeProp>("shadowOnly");
170
163
 
171
164
  _dxProp->require();
172
165
  _dyProp->require();
@@ -212,12 +205,9 @@ protected:
212
205
 
213
206
  void defineProperties(NodePropsContainer *container) override {
214
207
  JsiBaseDomDeclarationNode::defineProperties(container);
215
- _channelXProp = container->defineProperty(
216
- std::make_shared<NodeProp>(JsiPropId::get("channelX")));
217
- _channelYProp = container->defineProperty(
218
- std::make_shared<NodeProp>(JsiPropId::get("channelY")));
219
- _scaleProp = container->defineProperty(
220
- std::make_shared<NodeProp>(JsiPropId::get("scale")));
208
+ _channelXProp = container->defineProperty<NodeProp>("channelX");
209
+ _channelYProp = container->defineProperty<NodeProp>("channelY");
210
+ _scaleProp = container->defineProperty<NodeProp>("scale");
221
211
 
222
212
  _channelXProp->require();
223
213
  _channelYProp->require();
@@ -266,10 +256,8 @@ protected:
266
256
 
267
257
  void defineProperties(NodePropsContainer *container) override {
268
258
  JsiBaseDomDeclarationNode::defineProperties(container);
269
- _blurProp = container->defineProperty(
270
- std::make_shared<RadiusProp>(JsiPropId::get("blur")));
271
- _tileModeProp = container->defineProperty(
272
- std::make_shared<TileModeProp>(JsiPropId::get("mode")));
259
+ _blurProp = container->defineProperty<RadiusProp>("blur");
260
+ _tileModeProp = container->defineProperty<TileModeProp>("mode");
273
261
 
274
262
  _blurProp->require();
275
263
  }
@@ -302,10 +290,8 @@ protected:
302
290
 
303
291
  void defineProperties(NodePropsContainer *container) override {
304
292
  JsiBaseDomDeclarationNode::defineProperties(container);
305
- _xProp = container->defineProperty(
306
- std::make_shared<NodeProp>(JsiPropId::get("x")));
307
- _yProp = container->defineProperty(
308
- std::make_shared<NodeProp>(JsiPropId::get("y")));
293
+ _xProp = container->defineProperty<NodeProp>("x");
294
+ _yProp = container->defineProperty<NodeProp>("y");
309
295
 
310
296
  _xProp->require();
311
297
  _yProp->require();
@@ -346,10 +332,8 @@ protected:
346
332
 
347
333
  void defineProperties(NodePropsContainer *container) override {
348
334
  JsiBaseDomDeclarationNode::defineProperties(container);
349
- _operatorProp = container->defineProperty(
350
- std::make_shared<NodeProp>(JsiPropId::get("operator")));
351
- _radiusProp = container->defineProperty(
352
- std::make_shared<RadiusProp>(JsiPropId::get("radius")));
335
+ _operatorProp = container->defineProperty<NodeProp>("operator");
336
+ _radiusProp = container->defineProperty<RadiusProp>("radius");
353
337
 
354
338
  _operatorProp->require();
355
339
  _radiusProp->require();
@@ -398,11 +382,9 @@ protected:
398
382
 
399
383
  void defineProperties(NodePropsContainer *container) override {
400
384
  JsiBaseDomDeclarationNode::defineProperties(container);
401
- _sourceProp = container->defineProperty(
402
- std::make_shared<NodeProp>(JsiPropId::get("source")));
385
+ _sourceProp = container->defineProperty<NodeProp>("source");
403
386
  _uniformsProp =
404
- container->defineProperty(std::make_shared<SimpleUniformsProp>(
405
- JsiPropId::get("uniforms"), _sourceProp));
387
+ container->defineProperty<SimpleUniformsProp>("uniforms", _sourceProp);
406
388
 
407
389
  _sourceProp->require();
408
390
  }
@@ -23,7 +23,7 @@ protected:
23
23
 
24
24
  void defineProperties(NodePropsContainer *container) override {
25
25
  JsiDomDrawingNode::defineProperties(container);
26
- _imageProps = container->defineProperty(std::make_shared<ImageProps>());
26
+ _imageProps = container->defineProperty<ImageProps>();
27
27
  _imageProps->require();
28
28
  }
29
29
 
@@ -28,10 +28,8 @@ protected:
28
28
 
29
29
  void defineProperties(NodePropsContainer *container) override {
30
30
  JsiDomDrawingNode::defineProperties(container);
31
- _svgDomProp = container->defineProperty(
32
- std::make_shared<SvgProp>(JsiPropId::get("svg")));
33
- _rectProp = container->defineProperty(
34
- std::make_shared<RectProps>(JsiPropId::get("rect")));
31
+ _svgDomProp = container->defineProperty<SvgProp>("svg");
32
+ _rectProp = container->defineProperty<RectProps>("rect");
35
33
 
36
34
  _svgDomProp->require();
37
35
  }
@@ -7,9 +7,6 @@
7
7
 
8
8
  namespace RNSkia {
9
9
 
10
- static PropId PropNamePoint1 = JsiPropId::get("p1");
11
- static PropId PropNamePoint2 = JsiPropId::get("p2");
12
-
13
10
  class JsiLineNode : public JsiDomDrawingNode,
14
11
  public JsiDomNodeCtor<JsiLineNode> {
15
12
  public:
@@ -26,10 +23,8 @@ protected:
26
23
 
27
24
  void defineProperties(NodePropsContainer *container) override {
28
25
  JsiDomDrawingNode::defineProperties(container);
29
- _p1Prop =
30
- container->defineProperty(std::make_shared<PointProp>(PropNamePoint1));
31
- _p2Prop =
32
- container->defineProperty(std::make_shared<PointProp>(PropNamePoint2));
26
+ _p1Prop = container->defineProperty<PointProp>("p1");
27
+ _p2Prop = container->defineProperty<PointProp>("p2");
33
28
 
34
29
  _p1Prop->require();
35
30
  _p2Prop->require();
@@ -15,15 +15,13 @@ public:
15
15
 
16
16
  protected:
17
17
  void draw(DrawingContext *context) override {
18
- RNSkLogger::logToConsole(context->getDebugDescription());
19
18
  context->getCanvas()->drawOval(*_rectProp->getDerivedValue(),
20
19
  *context->getPaint());
21
20
  }
22
21
 
23
22
  void defineProperties(NodePropsContainer *container) override {
24
23
  JsiDomDrawingNode::defineProperties(container);
25
- _rectProp =
26
- container->defineProperty(std::make_shared<RectProps>(PropNameRect));
24
+ _rectProp = container->defineProperty<RectProps>("rect");
27
25
  _rectProp->require();
28
26
  }
29
27
 
@@ -64,9 +64,8 @@ protected:
64
64
  void defineProperties(NodePropsContainer *container) override {
65
65
  JsiBaseDomDeclarationNode::defineProperties(container);
66
66
 
67
- _paintProps = container->defineProperty(std::make_shared<PaintProps>());
68
- _opacityProp =
69
- container->defineProperty(std::make_shared<NodeProp>(PropNameOpacity));
67
+ _paintProps = container->defineProperty<PaintProps>();
68
+ _opacityProp = container->defineProperty<NodeProp>("opacity");
70
69
  }
71
70
 
72
71
  private:
@@ -32,14 +32,10 @@ protected:
32
32
 
33
33
  void defineProperties(NodePropsContainer *container) override {
34
34
  JsiDomDrawingNode::defineProperties(container);
35
- _colorsProp = container->defineProperty(
36
- std::make_shared<ColorsProp>(JsiPropId::get("colors")));
37
- _textureProp = container->defineProperty(
38
- std::make_shared<PointsProp>(JsiPropId::get("texture")));
39
- _blendModeProp = container->defineProperty(
40
- std::make_shared<BlendModeProp>(JsiPropId::get("blendMode")));
41
- _patchProp = container->defineProperty(
42
- std::make_shared<BezierProp>(JsiPropId::get("patch")));
35
+ _colorsProp = container->defineProperty<ColorsProp>("colors");
36
+ _textureProp = container->defineProperty<PointsProp>("texture");
37
+ _blendModeProp = container->defineProperty<BlendModeProp>("blendMode");
38
+ _patchProp = container->defineProperty<BezierProp>("patch");
43
39
 
44
40
  _patchProp->require();
45
41
  }
@@ -85,10 +85,8 @@ protected:
85
85
  void defineProperties(NodePropsContainer *container) override {
86
86
  JsiBaseDomDeclarationNode::defineProperties(container);
87
87
 
88
- _intervals = container->defineProperty(
89
- std::make_shared<NodeProp>(JsiPropId::get("intervals")));
90
- _phase = container->defineProperty(
91
- std::make_shared<NodeProp>(JsiPropId::get("phase")));
88
+ _intervals = container->defineProperty<NodeProp>("intervals");
89
+ _phase = container->defineProperty<NodeProp>("phase");
92
90
 
93
91
  _intervals->require();
94
92
  }
@@ -123,12 +121,9 @@ protected:
123
121
  void defineProperties(NodePropsContainer *container) override {
124
122
  JsiBaseDomDeclarationNode::defineProperties(container);
125
123
 
126
- _lengthProp = container->defineProperty(
127
- std::make_shared<NodeProp>(JsiPropId::get("length")));
128
- _deviationProp = container->defineProperty(
129
- std::make_shared<NodeProp>(JsiPropId::get("deviation")));
130
- _seedProp = container->defineProperty(
131
- std::make_shared<NodeProp>(JsiPropId::get("seed")));
124
+ _lengthProp = container->defineProperty<NodeProp>("length");
125
+ _deviationProp = container->defineProperty<NodeProp>("deviation");
126
+ _seedProp = container->defineProperty<NodeProp>("seed");
132
127
 
133
128
  _lengthProp->require();
134
129
  _deviationProp->require();
@@ -161,8 +156,7 @@ protected:
161
156
  void defineProperties(NodePropsContainer *container) override {
162
157
  JsiBaseDomDeclarationNode::defineProperties(container);
163
158
 
164
- _rProp = container->defineProperty(
165
- std::make_shared<NodeProp>(JsiPropId::get("r")));
159
+ _rProp = container->defineProperty<NodeProp>("r");
166
160
  _rProp->require();
167
161
  }
168
162
 
@@ -193,14 +187,10 @@ protected:
193
187
  void defineProperties(NodePropsContainer *container) override {
194
188
  JsiBaseDomDeclarationNode::defineProperties(container);
195
189
 
196
- _phaseProp = container->defineProperty(
197
- std::make_shared<NodeProp>(JsiPropId::get("phase")));
198
- _advanceProp = container->defineProperty(
199
- std::make_shared<NodeProp>(JsiPropId::get("advance")));
200
- _pathProp = container->defineProperty(
201
- std::make_shared<PathProp>(JsiPropId::get("path")));
202
- _styleProp = container->defineProperty(
203
- std::make_shared<NodeProp>(JsiPropId::get("style")));
190
+ _phaseProp = container->defineProperty<NodeProp>("phase");
191
+ _advanceProp = container->defineProperty<NodeProp>("advance");
192
+ _pathProp = container->defineProperty<PathProp>("path");
193
+ _styleProp = container->defineProperty<NodeProp>("style");
204
194
 
205
195
  _phaseProp->require();
206
196
  _advanceProp->require();
@@ -248,10 +238,8 @@ protected:
248
238
  void defineProperties(NodePropsContainer *container) override {
249
239
  JsiBaseDomDeclarationNode::defineProperties(container);
250
240
 
251
- _matrixProp = container->defineProperty(
252
- std::make_shared<MatrixProp>(JsiPropId::get("matrix")));
253
- _pathProp = container->defineProperty(
254
- std::make_shared<PathProp>(JsiPropId::get("path")));
241
+ _matrixProp = container->defineProperty<MatrixProp>("matrix");
242
+ _pathProp = container->defineProperty<PathProp>("path");
255
243
 
256
244
  _matrixProp->require();
257
245
  _pathProp->require();
@@ -283,10 +271,8 @@ protected:
283
271
  void defineProperties(NodePropsContainer *container) override {
284
272
  JsiBaseDomDeclarationNode::defineProperties(container);
285
273
 
286
- _matrixProp = container->defineProperty(
287
- std::make_shared<MatrixProp>(JsiPropId::get("matrix")));
288
- _widthProp = container->defineProperty(
289
- std::make_shared<NodeProp>(JsiPropId::get("width")));
274
+ _matrixProp = container->defineProperty<MatrixProp>("matrix");
275
+ _widthProp = container->defineProperty<NodeProp>("width");
290
276
 
291
277
  _matrixProp->require();
292
278
  _widthProp->require();
@@ -15,12 +15,7 @@
15
15
 
16
16
  namespace RNSkia {
17
17
 
18
- static PropId PropNamePath = JsiPropId::get("path");
19
- static PropId PropNameStart = JsiPropId::get("start");
20
- static PropId PropNameEnd = JsiPropId::get("end");
21
- static PropId PropNameFillType = JsiPropId::get("fillType");
22
18
  static PropId PropNameMiterLimit = JsiPropId::get("miter_limit");
23
- static PropId PropNameStroke = JsiPropId::get("stroke");
24
19
  static PropId PropNamePrecision = JsiPropId::get("precision");
25
20
 
26
21
  class JsiPathNode : public JsiDomDrawingNode,
@@ -43,25 +38,27 @@ protected:
43
38
  _strokeOptsProp->isSet() &&
44
39
  _strokeOptsProp->value().getType() == PropType::Object;
45
40
 
46
- auto willMutatePath =
47
- hasStartOffset || hasEndOffset || hasFillStyle || hasStrokeOptions;
41
+ auto willMutatePath = hasStartOffset == true || hasEndOffset == true ||
42
+ hasFillStyle == true || hasStrokeOptions == true;
48
43
 
49
44
  if (willMutatePath) {
50
45
  // We'll trim the path
51
46
  SkPath filteredPath(*_pathProp->getDerivedValue());
52
- auto pe = SkTrimPathEffect::Make(_startProp->value().getAsNumber(),
53
- _endProp->value().getAsNumber(),
54
- SkTrimPathEffect::Mode::kNormal);
47
+ auto start =
48
+ _startProp->isSet() ? _startProp->value().getAsNumber() : 0.0;
49
+ auto end = _endProp->isSet() ? _endProp->value().getAsNumber() : 1.0;
50
+ auto pe =
51
+ SkTrimPathEffect::Make(start, end, SkTrimPathEffect::Mode::kNormal);
55
52
 
56
53
  if (pe != nullptr) {
57
54
  SkStrokeRec rec(SkStrokeRec::InitStyle::kHairline_InitStyle);
58
- if (!pe->filterPath(_pathProp->getDerivedValue().get(), filteredPath,
59
- &rec, nullptr)) {
55
+ if (!pe->filterPath(&filteredPath, filteredPath, &rec, nullptr)) {
60
56
  throw std::runtime_error(
61
57
  "Failed trimming path with parameters start: " +
62
58
  std::to_string(_startProp->value().getAsNumber()) +
63
59
  ", end: " + std::to_string(_endProp->value().getAsNumber()));
64
60
  }
61
+ filteredPath.swap(filteredPath);
65
62
  _path = std::make_shared<SkPath>(filteredPath);
66
63
  } else if (hasStartOffset || hasEndOffset) {
67
64
  throw std::runtime_error(
@@ -69,7 +66,7 @@ protected:
69
66
  std::to_string(_startProp->value().getAsNumber()) +
70
67
  ", end: " + std::to_string(_endProp->value().getAsNumber()));
71
68
  } else {
72
- _path = std::make_shared<SkPath>(*_pathProp->getDerivedValue());
69
+ _path = std::make_shared<SkPath>(filteredPath);
73
70
  }
74
71
 
75
72
  // Set fill style
@@ -130,16 +127,11 @@ protected:
130
127
 
131
128
  void defineProperties(NodePropsContainer *container) override {
132
129
  JsiDomDrawingNode::defineProperties(container);
133
- _pathProp =
134
- container->defineProperty(std::make_shared<PathProp>(PropNamePath));
135
- _startProp =
136
- container->defineProperty(std::make_shared<NodeProp>(PropNameStart));
137
- _endProp =
138
- container->defineProperty(std::make_shared<NodeProp>(PropNameEnd));
139
- _fillTypeProp =
140
- container->defineProperty(std::make_shared<NodeProp>(PropNameFillType));
141
- _strokeOptsProp =
142
- container->defineProperty(std::make_shared<NodeProp>(PropNameStroke));
130
+ _pathProp = container->defineProperty<PathProp>("path");
131
+ _startProp = container->defineProperty<NodeProp>("start");
132
+ _endProp = container->defineProperty<NodeProp>("end");
133
+ _fillTypeProp = container->defineProperty<NodeProp>("fillType");
134
+ _strokeOptsProp = container->defineProperty<NodeProp>("stroke");
143
135
 
144
136
  _pathProp->require();
145
137
  }
@@ -171,7 +163,7 @@ private:
171
163
  class StrokeOptsProps : public BaseDerivedProp {
172
164
  public:
173
165
  StrokeOptsProps() : BaseDerivedProp() {
174
- _strokeProp = addProperty(std::make_shared<NodeProp>(PropNameStroke));
166
+ _strokeProp = addProperty(std::make_shared<NodeProp>("stroke"));
175
167
  }
176
168
 
177
169
  private:
@@ -20,8 +20,7 @@ protected:
20
20
 
21
21
  void defineProperties(NodePropsContainer *container) override {
22
22
  JsiDomDrawingNode::defineProperties(container);
23
- _pictureProp = container->defineProperty(
24
- std::make_shared<PictureProp>(JsiPropId::get("picture")));
23
+ _pictureProp = container->defineProperty<PictureProp>("picture");
25
24
  _pictureProp->require();
26
25
  }
27
26
 
@@ -14,7 +14,6 @@
14
14
 
15
15
  namespace RNSkia {
16
16
 
17
- static PropId PropNamePoints = JsiPropId::get("points");
18
17
  static PropId PropNamePointsMode = JsiPropId::get("mode");
19
18
 
20
19
  class JsiPointsNode : public JsiDomDrawingNode,
@@ -34,10 +33,8 @@ protected:
34
33
 
35
34
  void defineProperties(NodePropsContainer *container) override {
36
35
  JsiDomDrawingNode::defineProperties(container);
37
- _pointModeProp = container->defineProperty(
38
- std::make_shared<PointModeProp>(PropNamePointsMode));
39
- _pointsProp =
40
- container->defineProperty(std::make_shared<PointsProp>(PropNamePoints));
36
+ _pointModeProp = container->defineProperty<PointModeProp>("mode");
37
+ _pointsProp = container->defineProperty<PointsProp>("points");
41
38
 
42
39
  _pointsProp->require();
43
40
  _pointModeProp->require();
@@ -22,8 +22,7 @@ protected:
22
22
  void defineProperties(NodePropsContainer *container) override {
23
23
  JsiDomDrawingNode::defineProperties(container);
24
24
 
25
- _rrectProp =
26
- container->defineProperty(std::make_shared<RRectProps>(PropNameRect));
25
+ _rrectProp = container->defineProperty<RRectProps>("rect");
27
26
  _rrectProp->require();
28
27
  }
29
28
 
@@ -22,8 +22,7 @@ protected:
22
22
  void defineProperties(NodePropsContainer *container) override {
23
23
  JsiDomDrawingNode::defineProperties(container);
24
24
 
25
- _rectProp =
26
- container->defineProperty(std::make_shared<RectProps>(PropNameRect));
25
+ _rectProp = container->defineProperty<RectProps>("rect");
27
26
  _rectProp->require();
28
27
  }
29
28