@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
@@ -89,12 +89,10 @@ protected:
89
89
 
90
90
  void defineProperties(NodePropsContainer *container) override {
91
91
  JsiBaseDomDeclarationNode::defineProperties(container);
92
- _sourceProp = container->defineProperty(
93
- std::make_shared<NodeProp>(JsiPropId::get("source")));
94
- _uniformsProp = container->defineProperty(std::make_shared<UniformsProp>(
95
- JsiPropId::get("uniforms"), _sourceProp));
96
- _transformProp = container->defineProperty(
97
- std::make_shared<TransformProp>(JsiPropId::get("transform")));
92
+ _sourceProp = container->defineProperty<NodeProp>("source");
93
+ _uniformsProp =
94
+ container->defineProperty<UniformsProp>("uniforms", _sourceProp);
95
+ _transformProp = container->defineProperty<TransformProp>("transform");
98
96
 
99
97
  _sourceProp->require();
100
98
  }
@@ -141,18 +139,13 @@ protected:
141
139
 
142
140
  void defineProperties(NodePropsContainer *container) override {
143
141
  JsiBaseDomDeclarationNode::defineProperties(container);
144
- _txProp = container->defineProperty(
145
- std::make_shared<TileModeProp>(JsiPropId::get("tx")));
146
- _tyProp = container->defineProperty(
147
- std::make_shared<TileModeProp>(JsiPropId::get("ty")));
148
- _filterModeProp = container->defineProperty(
149
- std::make_shared<NodeProp>(JsiPropId::get("fm")));
150
- _mipmapModeProp = container->defineProperty(
151
- std::make_shared<NodeProp>(JsiPropId::get("mm")));
152
-
153
- _imageProps = container->defineProperty(std::make_shared<ImageProps>());
154
- _transformProp = container->defineProperty(
155
- std::make_shared<TransformProp>(JsiPropId::get("transform")));
142
+ _txProp = container->defineProperty<TileModeProp>("tx");
143
+ _tyProp = container->defineProperty<TileModeProp>("ty");
144
+ _filterModeProp = container->defineProperty<NodeProp>("fm");
145
+ _mipmapModeProp = container->defineProperty<NodeProp>("mm");
146
+
147
+ _imageProps = container->defineProperty<ImageProps>();
148
+ _transformProp = container->defineProperty<TransformProp>("transform");
156
149
 
157
150
  _txProp->require();
158
151
  _tyProp->require();
@@ -161,10 +154,8 @@ protected:
161
154
 
162
155
  _transformProp->require();
163
156
 
164
- // Just require the image
165
- container
166
- ->defineProperty(std::make_shared<NodeProp>(JsiPropId::get("image")))
167
- ->require();
157
+ // Add and require the image
158
+ container->defineProperty<NodeProp>("image")->require();
168
159
  }
169
160
 
170
161
  private:
@@ -221,8 +212,7 @@ protected:
221
212
 
222
213
  void defineProperties(NodePropsContainer *container) override {
223
214
  JsiBaseDomDeclarationNode::defineProperties(container);
224
- _colorProp = container->defineProperty(
225
- std::make_shared<ColorProp>(JsiPropId::get("color")));
215
+ _colorProp = container->defineProperty<ColorProp>("color");
226
216
  _colorProp->require();
227
217
  }
228
218
 
@@ -239,18 +229,12 @@ public:
239
229
  protected:
240
230
  void defineProperties(NodePropsContainer *container) override {
241
231
  JsiBaseDomDeclarationNode::defineProperties(container);
242
- _freqXProp = container->defineProperty(
243
- std::make_shared<NodeProp>(JsiPropId::get("freqX")));
244
- _freqYProp = container->defineProperty(
245
- std::make_shared<NodeProp>(JsiPropId::get("freqY")));
246
- _octavesProp = container->defineProperty(
247
- std::make_shared<NodeProp>(JsiPropId::get("octaves")));
248
- _seedProp = container->defineProperty(
249
- std::make_shared<NodeProp>(JsiPropId::get("seed")));
250
- _tileWidthProp = container->defineProperty(
251
- std::make_shared<NodeProp>(JsiPropId::get("tileWidth")));
252
- _tileHeightProp = container->defineProperty(
253
- std::make_shared<NodeProp>(JsiPropId::get("tileHeight")));
232
+ _freqXProp = container->defineProperty<NodeProp>("freqX");
233
+ _freqYProp = container->defineProperty<NodeProp>("freqY");
234
+ _octavesProp = container->defineProperty<NodeProp>("octaves");
235
+ _seedProp = container->defineProperty<NodeProp>("seed");
236
+ _tileWidthProp = container->defineProperty<NodeProp>("tileWidth");
237
+ _tileHeightProp = container->defineProperty<NodeProp>("tileHeight");
254
238
 
255
239
  _freqXProp->require();
256
240
  _freqYProp->require();
@@ -317,17 +301,12 @@ public:
317
301
 
318
302
  void defineProperties(NodePropsContainer *container) override {
319
303
  JsiBaseDomDeclarationNode::defineProperties(container);
320
- _transformsProps =
321
- container->defineProperty(std::make_shared<TransformsProps>());
322
-
323
- _colorsProp = container->defineProperty(
324
- std::make_shared<ColorsProp>(JsiPropId::get("colors")));
325
- _positionsProp = container->defineProperty(
326
- std::make_shared<NumbersProp>(JsiPropId::get("positions")));
327
- _modeProp = container->defineProperty(
328
- std::make_shared<TileModeProp>(JsiPropId::get("mode")));
329
- _flagsProp = container->defineProperty(
330
- std::make_shared<NodeProp>(JsiPropId::get("flags")));
304
+ _transformsProps = container->defineProperty<TransformsProps>();
305
+
306
+ _colorsProp = container->defineProperty<ColorsProp>("colors");
307
+ _positionsProp = container->defineProperty<NumbersProp>("positions");
308
+ _modeProp = container->defineProperty<TileModeProp>("mode");
309
+ _flagsProp = container->defineProperty<NodeProp>("flags");
331
310
 
332
311
  _colorsProp->require();
333
312
  }
@@ -385,10 +364,8 @@ protected:
385
364
 
386
365
  void defineProperties(NodePropsContainer *container) override {
387
366
  JsiBaseGradientNode::defineProperties(container);
388
- _startProp = container->defineProperty(
389
- std::make_shared<PointProp>(JsiPropId::get("start")));
390
- _endProp = container->defineProperty(
391
- std::make_shared<PointProp>(JsiPropId::get("end")));
367
+ _startProp = container->defineProperty<PointProp>("start");
368
+ _endProp = container->defineProperty<PointProp>("end");
392
369
 
393
370
  _startProp->require();
394
371
  _endProp->require();
@@ -420,10 +397,8 @@ protected:
420
397
 
421
398
  void defineProperties(NodePropsContainer *container) override {
422
399
  JsiBaseGradientNode::defineProperties(container);
423
- _centerProp = container->defineProperty(
424
- std::make_shared<PointProp>(JsiPropId::get("c")));
425
- _radiusProp = container->defineProperty(
426
- std::make_shared<NodeProp>(JsiPropId::get("r")));
400
+ _centerProp = container->defineProperty<PointProp>("c");
401
+ _radiusProp = container->defineProperty<NodeProp>("r");
427
402
 
428
403
  _centerProp->require();
429
404
  _radiusProp->require();
@@ -457,12 +432,9 @@ protected:
457
432
 
458
433
  void defineProperties(NodePropsContainer *container) override {
459
434
  JsiBaseGradientNode::defineProperties(container);
460
- _startProp = container->defineProperty(
461
- std::make_shared<NodeProp>(JsiPropId::get("start")));
462
- _endProp = container->defineProperty(
463
- std::make_shared<NodeProp>(JsiPropId::get("end")));
464
- _centerProp = container->defineProperty(
465
- std::make_shared<PointProp>(JsiPropId::get("c")));
435
+ _startProp = container->defineProperty<NodeProp>("start");
436
+ _endProp = container->defineProperty<NodeProp>("end");
437
+ _centerProp = container->defineProperty<PointProp>("c");
466
438
  }
467
439
 
468
440
  private:
@@ -497,14 +469,10 @@ protected:
497
469
 
498
470
  void defineProperties(NodePropsContainer *container) override {
499
471
  JsiBaseGradientNode::defineProperties(container);
500
- _startProp = container->defineProperty(
501
- std::make_shared<PointProp>(JsiPropId::get("start")));
502
- _startRProp = container->defineProperty(
503
- std::make_shared<NodeProp>(JsiPropId::get("startR")));
504
- _endProp = container->defineProperty(
505
- std::make_shared<PointProp>(JsiPropId::get("end")));
506
- _endRProp = container->defineProperty(
507
- std::make_shared<NodeProp>(JsiPropId::get("endR")));
472
+ _startProp = container->defineProperty<PointProp>("start");
473
+ _startRProp = container->defineProperty<NodeProp>("startR");
474
+ _endProp = container->defineProperty<PointProp>("end");
475
+ _endRProp = container->defineProperty<NodeProp>("endR");
508
476
  }
509
477
 
510
478
  private:
@@ -26,12 +26,9 @@ protected:
26
26
  void defineProperties(NodePropsContainer *container) override {
27
27
  JsiDomDrawingNode::defineProperties(container);
28
28
 
29
- _textBlobProp = container->defineProperty(
30
- std::make_shared<TextBlobProp>(JsiPropId::get("blob")));
31
- _xProp = container->defineProperty(
32
- std::make_shared<NodeProp>(JsiPropId::get("x")));
33
- _yProp = container->defineProperty(
34
- std::make_shared<NodeProp>(JsiPropId::get("y")));
29
+ _textBlobProp = container->defineProperty<TextBlobProp>("blob");
30
+ _xProp = container->defineProperty<NodeProp>("x");
31
+ _yProp = container->defineProperty<NodeProp>("y");
35
32
 
36
33
  _textBlobProp->require();
37
34
  _xProp->require();
@@ -29,14 +29,10 @@ protected:
29
29
  void defineProperties(NodePropsContainer *container) override {
30
30
  JsiDomDrawingNode::defineProperties(container);
31
31
 
32
- _fontProp = container->defineProperty(
33
- std::make_shared<FontProp>(JsiPropId::get("font")));
34
- _textProp = container->defineProperty(
35
- std::make_shared<NodeProp>(JsiPropId::get("text")));
36
- _xProp = container->defineProperty(
37
- std::make_shared<NodeProp>(JsiPropId::get("x")));
38
- _yProp = container->defineProperty(
39
- std::make_shared<NodeProp>(JsiPropId::get("y")));
32
+ _fontProp = container->defineProperty<FontProp>("font");
33
+ _textProp = container->defineProperty<NodeProp>("text");
34
+ _xProp = container->defineProperty<NodeProp>("x");
35
+ _yProp = container->defineProperty<NodeProp>("y");
40
36
 
41
37
  _fontProp->require();
42
38
  _textProp->require();
@@ -21,8 +21,7 @@ protected:
21
21
 
22
22
  void defineProperties(NodePropsContainer *container) override {
23
23
  JsiDomDrawingNode::defineProperties(container);
24
- _textBlobProp =
25
- container->defineProperty(std::make_shared<TextPathBlobProp>());
24
+ _textBlobProp = container->defineProperty<TextPathBlobProp>();
26
25
  }
27
26
 
28
27
  private:
@@ -29,10 +29,8 @@ protected:
29
29
 
30
30
  void defineProperties(NodePropsContainer *container) override {
31
31
  JsiDomDrawingNode::defineProperties(container);
32
- _verticesProps =
33
- container->defineProperty(std::make_shared<VerticesProps>());
34
- _blendModeProp = container->defineProperty(
35
- std::make_shared<BlendModeProp>(JsiPropId::get("blendMode")));
32
+ _verticesProps = container->defineProperty<VerticesProps>();
33
+ _blendModeProp = container->defineProperty<BlendModeProp>("blendMode");
36
34
  }
37
35
 
38
36
  private:
@@ -43,11 +43,11 @@ private:
43
43
  return SkBlendMode::kDstOver;
44
44
  } else if (value == "srcIn") {
45
45
  return SkBlendMode::kSrcIn;
46
- } else if (value == "kDstIn") {
46
+ } else if (value == "dstIn") {
47
47
  return SkBlendMode::kDstIn;
48
48
  } else if (value == "srcOut") {
49
49
  return SkBlendMode::kSrcOut;
50
- } else if (value == "dtsOut") {
50
+ } else if (value == "dstOut") {
51
51
  return SkBlendMode::kDstOut;
52
52
  } else if (value == "srcATop") {
53
53
  return SkBlendMode::kSrcATop;
@@ -105,6 +105,9 @@ public:
105
105
  paint->setShader(nullptr);
106
106
  paint->setColor(*_color->getDerivedValue());
107
107
  paint->setAlphaf(context->getOpacity() * paint->getColor4f().fA);
108
+ } else if (context->isChanged()) {
109
+ auto paint = context->getMutablePaint();
110
+ paint->setAlphaf(context->getOpacity());
108
111
  }
109
112
 
110
113
  // Style
@@ -8,8 +8,6 @@
8
8
 
9
9
  namespace RNSkia {
10
10
 
11
- static PropId PropNameTransform = JsiPropId::get("transform");
12
-
13
11
  static PropId PropNameTranslateX = JsiPropId::get("translateX");
14
12
  static PropId PropNameTranslateY = JsiPropId::get("translateY");
15
13
  static PropId PropNameScale = JsiPropId::get("scale");
@@ -50,7 +50,7 @@ public:
50
50
  __android_log_write(ANDROID_LOG_INFO, "RNSkia", buffer);
51
51
  #endif
52
52
  #ifdef TARGET_OS_IPHONE
53
- syslog(LOG_ERR, "%s\n", buffer);
53
+ syslog(LOG_ERR, "RNSKIA: %s\n", buffer);
54
54
  #endif
55
55
  va_end(args);
56
56
  }
@@ -4,9 +4,9 @@
4
4
  #pragma clang diagnostic push
5
5
  #pragma clang diagnostic ignored "-Wdocumentation"
6
6
 
7
- #import <SkColorSpace.h>
8
- #import <SkSurface.h>
9
- #import <SkCanvas.h>
7
+ #import "SkColorSpace.h"
8
+ #import "SkSurface.h"
9
+ #import "SkCanvas.h"
10
10
 
11
11
  #import <include/gpu/GrDirectContext.h>
12
12
 
@@ -33,9 +33,9 @@ RNSkCanvasProvider(requestRedraw),
33
33
  #pragma clang diagnostic ignored "-Wunguarded-availability-new"
34
34
  _layer = [CAMetalLayer layer];
35
35
  #pragma clang diagnostic pop
36
-
36
+
37
37
  auto device = MTLCreateSystemDefaultDevice();
38
-
38
+
39
39
  _layer.framebufferOnly = NO;
40
40
  _layer.device = device;
41
41
  _layer.opaque = false;
@@ -74,12 +74,13 @@ void RNSkMetalCanvasProvider::renderToCanvas(const std::function<void(SkCanvas*)
74
74
  renderContext->commandQueue = id<MTLCommandQueue>(CFRetain((GrMTLHandle)[device newCommandQueue]));
75
75
  renderContext->skContext = GrDirectContext::MakeMetal((__bridge void*)device, (__bridge void*)renderContext->commandQueue);
76
76
  }
77
-
77
+
78
78
  // Wrap in auto release pool since we want the system to clean up after rendering
79
79
  // and not wait until later - we've seen some example of memory usage growing very
80
80
  // fast in the simulator without this.
81
81
  @autoreleasepool
82
82
  {
83
+
83
84
  GrMTLHandle drawableHandle;
84
85
  auto skSurface = SkSurface::MakeFromCAMetalLayer(renderContext->skContext.get(),
85
86
  (__bridge GrMTLHandle)_layer,
@@ -114,7 +115,7 @@ void RNSkMetalCanvasProvider::setSize(int width, int height) {
114
115
  _layer.frame = CGRectMake(0, 0, width, height);
115
116
  _layer.drawableSize = CGSizeMake(width * _context->getPixelDensity(),
116
117
  height* _context->getPixelDensity());
117
-
118
+
118
119
  _requestRedraw();
119
120
  }
120
121
 
@@ -12,7 +12,7 @@
12
12
  #pragma clang diagnostic push
13
13
  #pragma clang diagnostic ignored "-Wdocumentation"
14
14
 
15
- #include <SkStream.h>
15
+ #include "SkStream.h"
16
16
 
17
17
  #pragma clang diagnostic pop
18
18
 
@@ -48,6 +48,7 @@ public:
48
48
  ~RNSkiOSPlatformContext() {
49
49
  CFNotificationCenterRemoveEveryObserver(
50
50
  CFNotificationCenterGetLocalCenter(), this);
51
+ stopDrawLoop();
51
52
  }
52
53
 
53
54
  void startDrawLoop() override;
@@ -1,13 +1,13 @@
1
- #include <SkiaDrawViewManager.h>
1
+ #include "SkiaDrawViewManager.h"
2
2
  #include <React/RCTBridge+Private.h>
3
3
 
4
4
  #include <RNSkPlatformContext.h>
5
5
  #include <RNSkJsView.h>
6
6
  #include <RNSkIOSView.h>
7
7
 
8
- #include <SkiaManager.h>
8
+ #include "SkiaManager.h"
9
9
  #include <RNSkiaModule.h>
10
- #include <SkiaUIView.h>
10
+ #include "SkiaUIView.h"
11
11
 
12
12
 
13
13
 
@@ -24,7 +24,7 @@ RCT_EXPORT_MODULE(SkiaDrawView)
24
24
  RCT_CUSTOM_VIEW_PROPERTY(nativeID, NSNumber, SkiaUIView) {
25
25
  // Get parameter
26
26
  int nativeId = [[RCTConvert NSString:json] intValue];
27
- [(SkiaUIView*)view setNativeId:nativeId];
27
+ [(SkiaUIView*)view setNativeId:nativeId];
28
28
  }
29
29
 
30
30
  RCT_CUSTOM_VIEW_PROPERTY(mode, NSString, SkiaUIView) {
@@ -1,4 +1,4 @@
1
- #import <SkiaManager.h>
1
+ #import "SkiaManager.h"
2
2
 
3
3
  #import <Foundation/Foundation.h>
4
4
 
@@ -32,16 +32,16 @@
32
32
  if (self) {
33
33
  RCTCxxBridge *cxxBridge = (RCTCxxBridge *)bridge;
34
34
  if (cxxBridge.runtime) {
35
-
35
+
36
36
  auto callInvoker = bridge.jsCallInvoker;
37
37
  facebook::jsi::Runtime* jsRuntime = (facebook::jsi::Runtime*)cxxBridge.runtime;
38
-
38
+
39
39
  // Create platform context
40
40
  _platformContext = std::make_shared<RNSkia::RNSkiOSPlatformContext>(jsRuntime, callInvoker);
41
-
41
+
42
42
  // Create the RNSkiaManager (cross platform)
43
43
  _skManager = std::make_shared<RNSkia::RNSkManager>(jsRuntime, callInvoker, _platformContext);
44
-
44
+
45
45
  }
46
46
  }
47
47
  return self;
@@ -1,14 +1,14 @@
1
1
 
2
- #include <SkiaPictureViewManager.h>
2
+ #include "SkiaPictureViewManager.h"
3
3
  #include <React/RCTBridge+Private.h>
4
4
 
5
5
  #include <RNSkPlatformContext.h>
6
6
  #include <RNSkPictureView.h>
7
7
  #include <RNSkIOSView.h>
8
8
 
9
- #include <SkiaManager.h>
9
+ #include "SkiaManager.h"
10
10
  #include <RNSkiaModule.h>
11
- #include <SkiaUIView.h>
11
+ #include "SkiaUIView.h"
12
12
 
13
13
 
14
14
 
@@ -1,6 +1,6 @@
1
1
  #import <React/RCTBridge.h>
2
2
 
3
- #import <SkiaUIView.h>
3
+ #import "SkiaUIView.h"
4
4
 
5
5
  #include <utility>
6
6
  #include <vector>
@@ -29,7 +29,7 @@
29
29
  _debugMode = false;
30
30
  _drawingMode = RNSkia::RNSkDrawingMode::Default;
31
31
  _factory = factory;
32
-
32
+
33
33
  // Listen to notifications about module invalidation
34
34
  [[NSNotificationCenter defaultCenter] addObserver:self
35
35
  selector:@selector(willInvalidateModules)
@@ -51,11 +51,11 @@
51
51
  // Remove implementation view when the parent view is not set
52
52
  if(_impl != nullptr) {
53
53
  [_impl->getLayer() removeFromSuperlayer];
54
-
54
+
55
55
  if(_nativeId != 0 && _manager != nullptr) {
56
56
  _manager->setSkiaView(_nativeId, nullptr);
57
57
  }
58
-
58
+
59
59
  _impl = nullptr;
60
60
  }
61
61
  } else {
@@ -79,9 +79,9 @@
79
79
  if(_manager != nullptr && _nativeId != 0) {
80
80
  _manager->unregisterSkiaView(_nativeId);
81
81
  }
82
-
82
+
83
83
  [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil];
84
-
84
+
85
85
  assert(_impl == nullptr);
86
86
  }
87
87
 
@@ -98,7 +98,7 @@
98
98
 
99
99
  -(void) setDrawingMode:(std::string) mode {
100
100
  _drawingMode = mode.compare("continuous") == 0 ? RNSkia::RNSkDrawingMode::Continuous : RNSkia::RNSkDrawingMode::Default;
101
-
101
+
102
102
  if(_impl != nullptr) {
103
103
  _impl->getDrawView()->setDrawingMode(_drawingMode);
104
104
  }
@@ -113,7 +113,7 @@
113
113
 
114
114
  - (void) setNativeId:(size_t) nativeId {
115
115
  _nativeId = nativeId;
116
-
116
+
117
117
  if(_impl != nullptr) {
118
118
  _manager->registerSkiaView(nativeId, _impl->getDrawView());
119
119
  }
@@ -147,7 +147,7 @@
147
147
  RNSkia::RNSkTouchInfo nextTouch;
148
148
  nextTouch.x = position.x;
149
149
  nextTouch.y = position.y;
150
- nextTouch.force = [touch force];
150
+ nextTouch.force = [touch force];
151
151
  nextTouch.id = [touch hash];
152
152
  auto phase = [touch phase];
153
153
  switch(phase) {
@@ -167,7 +167,7 @@
167
167
  nextTouch.type = RNSkia::RNSkTouchInfo::TouchType::Active;
168
168
  break;
169
169
  }
170
-
170
+
171
171
  nextTouches.push_back(nextTouch);
172
172
  }
173
173
  if(_impl != nullptr) {
@@ -115,7 +115,9 @@ class JsiRenderNode extends _Node.JsiNode {
115
115
  } = this.props;
116
116
 
117
117
  if (color !== undefined || strokeWidth !== undefined || blendMode !== undefined || style !== undefined || strokeJoin !== undefined || strokeCap !== undefined || strokeMiter !== undefined || opacity !== undefined || antiAlias !== undefined) {
118
- ctx = {};
118
+ ctx = {
119
+ opacity: 1
120
+ };
119
121
 
120
122
  if (color !== undefined) {
121
123
  ctx.color = this.Skia.Color(color);
@@ -193,11 +195,10 @@ class JsiRenderNode extends _Node.JsiNode {
193
195
  const {
194
196
  canvas
195
197
  } = parentCtx;
196
- const opacity = this.props.opacity !== undefined ? parentCtx.opacity * this.props.opacity : parentCtx.opacity;
197
198
 
198
199
  if (this.paintCache === null || this.paintCache.parent !== parentCtx.paint) {
199
200
  const paintCtx = this.getPaintCtx();
200
- const child = paintCtx ? concatPaint(parentCtx.paint, paintCtx, parentCtx.opacity) : parentCtx.paint;
201
+ const child = paintCtx ? concatPaint(parentCtx.paint.copy(), paintCtx) : parentCtx.paint;
201
202
  this.paintCache = {
202
203
  parent: parentCtx.paint,
203
204
  child
@@ -207,7 +208,6 @@ class JsiRenderNode extends _Node.JsiNode {
207
208
  const paint = this.paintCache.child; // TODO: can we only recreate a new context here if needed?
208
209
 
209
210
  const ctx = { ...parentCtx,
210
- opacity,
211
211
  paint
212
212
  };
213
213
  const hasTransform = matrix !== undefined || transform !== undefined;
@@ -250,7 +250,7 @@ class JsiRenderNode extends _Node.JsiNode {
250
250
 
251
251
  exports.JsiRenderNode = JsiRenderNode;
252
252
 
253
- const concatPaint = (parent, _ref, opacity) => {
253
+ const concatPaint = (paint, _ref) => {
254
254
  let {
255
255
  color,
256
256
  strokeWidth,
@@ -261,22 +261,22 @@ const concatPaint = (parent, _ref, opacity) => {
261
261
  imageFilter,
262
262
  maskFilter,
263
263
  pathEffect,
264
- opacity: alpha,
264
+ opacity,
265
265
  strokeCap,
266
266
  strokeJoin,
267
267
  strokeMiter,
268
268
  style
269
269
  } = _ref;
270
- const paint = parent.copy();
270
+
271
+ if (opacity !== undefined) {
272
+ paint.setAlphaf(paint.getAlphaf() * opacity);
273
+ }
271
274
 
272
275
  if (color !== undefined) {
276
+ const currentOpacity = paint.getAlphaf();
273
277
  paint.setShader(null);
274
- color[3] *= opacity;
275
278
  paint.setColor(color);
276
- } else {
277
- const cl = paint.getColor();
278
- cl[3] = opacity;
279
- paint.setColor(cl);
279
+ paint.setAlphaf(currentOpacity * paint.getAlphaf());
280
280
  }
281
281
 
282
282
  if (strokeWidth !== undefined) {
@@ -311,10 +311,6 @@ const concatPaint = (parent, _ref, opacity) => {
311
311
  paint.setPathEffect(pathEffect);
312
312
  }
313
313
 
314
- if (alpha !== undefined) {
315
- paint.setAlphaf(alpha * opacity);
316
- }
317
-
318
314
  if (strokeCap !== undefined) {
319
315
  paint.setStrokeCap(strokeCap);
320
316
  }