@shopify/react-native-skia 0.1.172 → 0.1.173

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. package/android/CMakeLists.txt +1 -0
  2. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +5 -0
  3. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +106 -5
  4. package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -1
  5. package/cpp/api/JsiSkSurface.h +7 -1
  6. package/cpp/api/JsiSkSurfaceFactory.h +15 -2
  7. package/cpp/rnskia/RNSkDomView.cpp +2 -4
  8. package/cpp/rnskia/RNSkJsView.cpp +3 -0
  9. package/cpp/rnskia/RNSkPictureView.h +3 -0
  10. package/cpp/rnskia/RNSkPlatformContext.h +9 -0
  11. package/cpp/rnskia/dom/JsiDomApi.h +1 -0
  12. package/cpp/rnskia/dom/base/ConcatablePaint.cpp +117 -0
  13. package/cpp/rnskia/dom/base/ConcatablePaint.h +49 -0
  14. package/cpp/rnskia/dom/base/Declaration.h +88 -0
  15. package/cpp/rnskia/dom/base/DeclarationContext.h +79 -0
  16. package/cpp/rnskia/dom/base/DerivedNodeProp.h +25 -9
  17. package/cpp/rnskia/dom/base/DrawingContext.cpp +32 -186
  18. package/cpp/rnskia/dom/base/DrawingContext.h +45 -64
  19. package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +35 -106
  20. package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +28 -9
  21. package/cpp/rnskia/dom/base/JsiDomNode.h +46 -17
  22. package/cpp/rnskia/dom/base/JsiDomRenderNode.h +81 -67
  23. package/cpp/rnskia/dom/base/NodeProp.h +12 -2
  24. package/cpp/rnskia/dom/base/NodePropsContainer.h +15 -16
  25. package/cpp/rnskia/dom/nodes/JsiBackdropFilterNode.h +22 -11
  26. package/cpp/rnskia/dom/nodes/JsiBlendNode.h +43 -59
  27. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +16 -17
  28. package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +6 -5
  29. package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +45 -69
  30. package/cpp/rnskia/dom/nodes/JsiGroupNode.h +1 -1
  31. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +121 -161
  32. package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -0
  33. package/cpp/rnskia/dom/nodes/JsiLayerNode.h +28 -18
  34. package/cpp/rnskia/dom/nodes/JsiPaintNode.h +82 -45
  35. package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +68 -101
  36. package/cpp/rnskia/dom/nodes/JsiPathNode.h +3 -2
  37. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +150 -207
  38. package/cpp/rnskia/dom/props/BezierProps.h +4 -2
  39. package/cpp/rnskia/dom/props/BlendModeProp.h +4 -2
  40. package/cpp/rnskia/dom/props/BoxShadowProps.h +8 -10
  41. package/cpp/rnskia/dom/props/CircleProp.h +6 -5
  42. package/cpp/rnskia/dom/props/ClipProp.h +6 -4
  43. package/cpp/rnskia/dom/props/ColorProp.h +8 -4
  44. package/cpp/rnskia/dom/props/DrawingProp.h +5 -3
  45. package/cpp/rnskia/dom/props/FontProp.h +4 -2
  46. package/cpp/rnskia/dom/props/GlyphsProp.h +4 -2
  47. package/cpp/rnskia/dom/props/ImageProps.h +9 -6
  48. package/cpp/rnskia/dom/props/LayerProp.h +6 -4
  49. package/cpp/rnskia/dom/props/MatrixProp.h +4 -2
  50. package/cpp/rnskia/dom/props/NumbersProp.h +8 -4
  51. package/cpp/rnskia/dom/props/PaintProps.h +55 -92
  52. package/cpp/rnskia/dom/props/PathProp.h +4 -2
  53. package/cpp/rnskia/dom/props/PictureProp.h +4 -2
  54. package/cpp/rnskia/dom/props/PointProp.h +4 -2
  55. package/cpp/rnskia/dom/props/PointsProp.h +8 -4
  56. package/cpp/rnskia/dom/props/RRectProp.h +23 -16
  57. package/cpp/rnskia/dom/props/RadiusProp.h +4 -2
  58. package/cpp/rnskia/dom/props/RectProp.h +18 -12
  59. package/cpp/rnskia/dom/props/StrokeProps.h +8 -4
  60. package/cpp/rnskia/dom/props/SvgProp.h +4 -2
  61. package/cpp/rnskia/dom/props/TextBlobProp.h +10 -8
  62. package/cpp/rnskia/dom/props/TileModeProp.h +4 -2
  63. package/cpp/rnskia/dom/props/TransformProp.h +4 -2
  64. package/cpp/rnskia/dom/props/TransformsProps.h +5 -7
  65. package/cpp/rnskia/dom/props/UniformsProp.h +4 -2
  66. package/cpp/rnskia/dom/props/VertexModeProp.h +4 -2
  67. package/cpp/rnskia/dom/props/VerticesProps.h +7 -11
  68. package/ios/RNSkia-iOS/DisplayLink.mm +22 -24
  69. package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +53 -50
  70. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +2 -0
  71. package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +38 -25
  72. package/ios/RNSkia-iOS/SkiaDomViewManager.mm +17 -17
  73. package/ios/RNSkia-iOS/SkiaDrawViewManager.mm +17 -17
  74. package/ios/RNSkia-iOS/SkiaManager.mm +12 -10
  75. package/ios/RNSkia-iOS/SkiaMetalRenderer.h +5 -0
  76. package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +53 -0
  77. package/ios/RNSkia-iOS/SkiaPictureViewManager.mm +17 -17
  78. package/ios/RNSkia-iOS/SkiaUIView.mm +63 -53
  79. package/ios/RNSkiaModule.mm +5 -7
  80. package/lib/commonjs/dom/nodes/DrawingNode.js +5 -1
  81. package/lib/commonjs/dom/nodes/DrawingNode.js.map +1 -1
  82. package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +33 -34
  83. package/lib/commonjs/dom/nodes/LayerNode.js +13 -6
  84. package/lib/commonjs/dom/nodes/LayerNode.js.map +1 -1
  85. package/lib/commonjs/dom/nodes/Node.d.ts +6 -11
  86. package/lib/commonjs/dom/nodes/Node.js +8 -26
  87. package/lib/commonjs/dom/nodes/Node.js.map +1 -1
  88. package/lib/commonjs/dom/nodes/PaintContext.js.map +1 -1
  89. package/lib/commonjs/dom/nodes/PaintNode.d.ts +3 -3
  90. package/lib/commonjs/dom/nodes/PaintNode.js +32 -15
  91. package/lib/commonjs/dom/nodes/PaintNode.js.map +1 -1
  92. package/lib/commonjs/dom/nodes/RenderNode.d.ts +2 -3
  93. package/lib/commonjs/dom/nodes/RenderNode.js +19 -187
  94. package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
  95. package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
  96. package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js +25 -7
  97. package/lib/commonjs/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
  98. package/lib/commonjs/dom/nodes/drawings/Box.d.ts +3 -1
  99. package/lib/commonjs/dom/nodes/drawings/Box.js +3 -0
  100. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  101. package/lib/commonjs/dom/nodes/paint/BlendNode.d.ts +3 -7
  102. package/lib/commonjs/dom/nodes/paint/BlendNode.js +16 -47
  103. package/lib/commonjs/dom/nodes/paint/BlendNode.js.map +1 -1
  104. package/lib/commonjs/dom/nodes/paint/ColorFilters.d.ts +10 -11
  105. package/lib/commonjs/dom/nodes/paint/ColorFilters.js +29 -43
  106. package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
  107. package/lib/commonjs/dom/nodes/paint/ImageFilters.d.ts +11 -11
  108. package/lib/commonjs/dom/nodes/paint/ImageFilters.js +45 -42
  109. package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
  110. package/lib/commonjs/dom/nodes/paint/MaskFilters.d.ts +3 -3
  111. package/lib/commonjs/dom/nodes/paint/MaskFilters.js +3 -2
  112. package/lib/commonjs/dom/nodes/paint/MaskFilters.js.map +1 -1
  113. package/lib/commonjs/dom/nodes/paint/PathEffects.d.ts +15 -18
  114. package/lib/commonjs/dom/nodes/paint/PathEffects.js +30 -72
  115. package/lib/commonjs/dom/nodes/paint/PathEffects.js.map +1 -1
  116. package/lib/commonjs/dom/nodes/paint/Shaders.d.ts +11 -12
  117. package/lib/commonjs/dom/nodes/paint/Shaders.js +28 -18
  118. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  119. package/lib/commonjs/dom/types/DeclarationContext.d.ts +29 -0
  120. package/lib/commonjs/dom/types/DeclarationContext.js +118 -0
  121. package/lib/commonjs/dom/types/DeclarationContext.js.map +1 -0
  122. package/lib/commonjs/dom/types/DrawingContext.d.ts +18 -1
  123. package/lib/commonjs/dom/types/DrawingContext.js +330 -0
  124. package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
  125. package/lib/commonjs/dom/types/Node.d.ts +4 -10
  126. package/lib/commonjs/dom/types/Node.js.map +1 -1
  127. package/lib/commonjs/dom/types/SkDOM.d.ts +22 -23
  128. package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
  129. package/lib/commonjs/dom/types/index.d.ts +1 -0
  130. package/lib/commonjs/dom/types/index.js +13 -0
  131. package/lib/commonjs/dom/types/index.js.map +1 -1
  132. package/lib/commonjs/index.d.ts +1 -0
  133. package/lib/commonjs/index.js +13 -0
  134. package/lib/commonjs/index.js.map +1 -1
  135. package/lib/commonjs/renderer/Canvas.js +3 -3
  136. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  137. package/lib/commonjs/renderer/DrawingContext.d.ts +4 -3
  138. package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
  139. package/lib/commonjs/renderer/HostComponents.d.ts +35 -35
  140. package/lib/commonjs/renderer/HostComponents.js.map +1 -1
  141. package/lib/commonjs/renderer/HostConfig.js +1 -0
  142. package/lib/commonjs/renderer/HostConfig.js.map +1 -1
  143. package/lib/commonjs/renderer/Offscreen.d.ts +2 -0
  144. package/lib/commonjs/renderer/Offscreen.js +31 -0
  145. package/lib/commonjs/renderer/Offscreen.js.map +1 -0
  146. package/lib/commonjs/renderer/Reconciler.js +0 -1
  147. package/lib/commonjs/renderer/Reconciler.js.map +1 -1
  148. package/lib/commonjs/skia/types/Surface/Surface.d.ts +4 -0
  149. package/lib/commonjs/skia/types/Surface/Surface.js.map +1 -1
  150. package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +6 -0
  151. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  152. package/lib/commonjs/skia/web/JsiSkSurface.d.ts +1 -0
  153. package/lib/commonjs/skia/web/JsiSkSurface.js +4 -0
  154. package/lib/commonjs/skia/web/JsiSkSurface.js.map +1 -1
  155. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  156. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +21 -1
  157. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  158. package/lib/commonjs/views/SkiaBaseWebView.js +6 -4
  159. package/lib/commonjs/views/SkiaBaseWebView.js.map +1 -1
  160. package/lib/commonjs/views/SkiaDomView.web.js +3 -14
  161. package/lib/commonjs/views/SkiaDomView.web.js.map +1 -1
  162. package/lib/commonjs/views/SkiaPictureView.web.js +0 -7
  163. package/lib/commonjs/views/SkiaPictureView.web.js.map +1 -1
  164. package/lib/commonjs/views/SkiaView.web.js +0 -7
  165. package/lib/commonjs/views/SkiaView.web.js.map +1 -1
  166. package/lib/module/dom/nodes/DrawingNode.js +5 -1
  167. package/lib/module/dom/nodes/DrawingNode.js.map +1 -1
  168. package/lib/module/dom/nodes/JsiSkDOM.d.ts +33 -34
  169. package/lib/module/dom/nodes/LayerNode.js +13 -7
  170. package/lib/module/dom/nodes/LayerNode.js.map +1 -1
  171. package/lib/module/dom/nodes/Node.d.ts +6 -11
  172. package/lib/module/dom/nodes/Node.js +8 -25
  173. package/lib/module/dom/nodes/Node.js.map +1 -1
  174. package/lib/module/dom/nodes/PaintContext.js.map +1 -1
  175. package/lib/module/dom/nodes/PaintNode.d.ts +3 -3
  176. package/lib/module/dom/nodes/PaintNode.js +32 -15
  177. package/lib/module/dom/nodes/PaintNode.js.map +1 -1
  178. package/lib/module/dom/nodes/RenderNode.d.ts +2 -3
  179. package/lib/module/dom/nodes/RenderNode.js +20 -187
  180. package/lib/module/dom/nodes/RenderNode.js.map +1 -1
  181. package/lib/module/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
  182. package/lib/module/dom/nodes/drawings/BackdropFilterNode.js +23 -4
  183. package/lib/module/dom/nodes/drawings/BackdropFilterNode.js.map +1 -1
  184. package/lib/module/dom/nodes/drawings/Box.d.ts +3 -1
  185. package/lib/module/dom/nodes/drawings/Box.js +3 -0
  186. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  187. package/lib/module/dom/nodes/paint/BlendNode.d.ts +3 -7
  188. package/lib/module/dom/nodes/paint/BlendNode.js +15 -46
  189. package/lib/module/dom/nodes/paint/BlendNode.js.map +1 -1
  190. package/lib/module/dom/nodes/paint/ColorFilters.d.ts +10 -11
  191. package/lib/module/dom/nodes/paint/ColorFilters.js +29 -43
  192. package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
  193. package/lib/module/dom/nodes/paint/ImageFilters.d.ts +11 -11
  194. package/lib/module/dom/nodes/paint/ImageFilters.js +48 -41
  195. package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
  196. package/lib/module/dom/nodes/paint/MaskFilters.d.ts +3 -3
  197. package/lib/module/dom/nodes/paint/MaskFilters.js +3 -2
  198. package/lib/module/dom/nodes/paint/MaskFilters.js.map +1 -1
  199. package/lib/module/dom/nodes/paint/PathEffects.d.ts +15 -18
  200. package/lib/module/dom/nodes/paint/PathEffects.js +29 -72
  201. package/lib/module/dom/nodes/paint/PathEffects.js.map +1 -1
  202. package/lib/module/dom/nodes/paint/Shaders.d.ts +11 -12
  203. package/lib/module/dom/nodes/paint/Shaders.js +28 -18
  204. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  205. package/lib/module/dom/types/DeclarationContext.d.ts +29 -0
  206. package/lib/module/dom/types/DeclarationContext.js +107 -0
  207. package/lib/module/dom/types/DeclarationContext.js.map +1 -0
  208. package/lib/module/dom/types/DrawingContext.d.ts +18 -1
  209. package/lib/module/dom/types/DrawingContext.js +322 -1
  210. package/lib/module/dom/types/DrawingContext.js.map +1 -1
  211. package/lib/module/dom/types/Node.d.ts +4 -10
  212. package/lib/module/dom/types/Node.js.map +1 -1
  213. package/lib/module/dom/types/SkDOM.d.ts +22 -23
  214. package/lib/module/dom/types/SkDOM.js.map +1 -1
  215. package/lib/module/dom/types/index.d.ts +1 -0
  216. package/lib/module/dom/types/index.js +1 -0
  217. package/lib/module/dom/types/index.js.map +1 -1
  218. package/lib/module/index.d.ts +1 -0
  219. package/lib/module/index.js +1 -0
  220. package/lib/module/index.js.map +1 -1
  221. package/lib/module/renderer/Canvas.js +3 -3
  222. package/lib/module/renderer/Canvas.js.map +1 -1
  223. package/lib/module/renderer/DrawingContext.d.ts +4 -3
  224. package/lib/module/renderer/DrawingContext.js.map +1 -1
  225. package/lib/module/renderer/HostComponents.d.ts +35 -35
  226. package/lib/module/renderer/HostComponents.js.map +1 -1
  227. package/lib/module/renderer/HostConfig.js +1 -0
  228. package/lib/module/renderer/HostConfig.js.map +1 -1
  229. package/lib/module/renderer/Offscreen.d.ts +2 -0
  230. package/lib/module/renderer/Offscreen.js +19 -0
  231. package/lib/module/renderer/Offscreen.js.map +1 -0
  232. package/lib/module/renderer/Reconciler.js +0 -1
  233. package/lib/module/renderer/Reconciler.js.map +1 -1
  234. package/lib/module/skia/types/Surface/Surface.d.ts +4 -0
  235. package/lib/module/skia/types/Surface/Surface.js.map +1 -1
  236. package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +6 -0
  237. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  238. package/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
  239. package/lib/module/skia/web/JsiSkSurface.js +4 -0
  240. package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
  241. package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  242. package/lib/module/skia/web/JsiSkSurfaceFactory.js +21 -1
  243. package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  244. package/lib/module/views/SkiaBaseWebView.js +6 -4
  245. package/lib/module/views/SkiaBaseWebView.js.map +1 -1
  246. package/lib/module/views/SkiaDomView.web.js +2 -11
  247. package/lib/module/views/SkiaDomView.web.js.map +1 -1
  248. package/lib/module/views/SkiaPictureView.web.js +0 -5
  249. package/lib/module/views/SkiaPictureView.web.js.map +1 -1
  250. package/lib/module/views/SkiaView.web.js +0 -5
  251. package/lib/module/views/SkiaView.web.js.map +1 -1
  252. package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +33 -34
  253. package/lib/typescript/src/dom/nodes/Node.d.ts +6 -11
  254. package/lib/typescript/src/dom/nodes/PaintNode.d.ts +3 -3
  255. package/lib/typescript/src/dom/nodes/RenderNode.d.ts +2 -3
  256. package/lib/typescript/src/dom/nodes/drawings/BackdropFilterNode.d.ts +1 -1
  257. package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +3 -1
  258. package/lib/typescript/src/dom/nodes/paint/BlendNode.d.ts +3 -7
  259. package/lib/typescript/src/dom/nodes/paint/ColorFilters.d.ts +10 -11
  260. package/lib/typescript/src/dom/nodes/paint/ImageFilters.d.ts +11 -11
  261. package/lib/typescript/src/dom/nodes/paint/MaskFilters.d.ts +3 -3
  262. package/lib/typescript/src/dom/nodes/paint/PathEffects.d.ts +15 -18
  263. package/lib/typescript/src/dom/nodes/paint/Shaders.d.ts +11 -12
  264. package/lib/typescript/src/dom/types/DeclarationContext.d.ts +29 -0
  265. package/lib/typescript/src/dom/types/DrawingContext.d.ts +18 -1
  266. package/lib/typescript/src/dom/types/Node.d.ts +4 -10
  267. package/lib/typescript/src/dom/types/SkDOM.d.ts +22 -23
  268. package/lib/typescript/src/dom/types/index.d.ts +1 -0
  269. package/lib/typescript/src/index.d.ts +1 -0
  270. package/lib/typescript/src/renderer/DrawingContext.d.ts +4 -3
  271. package/lib/typescript/src/renderer/HostComponents.d.ts +35 -35
  272. package/lib/typescript/src/renderer/Offscreen.d.ts +2 -0
  273. package/lib/typescript/src/skia/types/Surface/Surface.d.ts +4 -0
  274. package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +6 -0
  275. package/lib/typescript/src/skia/web/JsiSkSurface.d.ts +1 -0
  276. package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  277. package/package.json +1 -1
  278. package/src/dom/nodes/DrawingNode.ts +5 -1
  279. package/src/dom/nodes/LayerNode.ts +13 -11
  280. package/src/dom/nodes/Node.ts +18 -41
  281. package/src/dom/nodes/PaintContext.ts +1 -0
  282. package/src/dom/nodes/PaintNode.ts +28 -18
  283. package/src/dom/nodes/RenderNode.ts +25 -183
  284. package/src/dom/nodes/drawings/BackdropFilterNode.ts +18 -11
  285. package/src/dom/nodes/drawings/Box.ts +6 -4
  286. package/src/dom/nodes/paint/BlendNode.ts +16 -63
  287. package/src/dom/nodes/paint/ColorFilters.ts +32 -55
  288. package/src/dom/nodes/paint/ImageFilters.ts +58 -53
  289. package/src/dom/nodes/paint/MaskFilters.ts +5 -7
  290. package/src/dom/nodes/paint/PathEffects.ts +37 -90
  291. package/src/dom/nodes/paint/Shaders.ts +31 -29
  292. package/src/dom/types/DeclarationContext.ts +105 -0
  293. package/src/dom/types/DrawingContext.ts +304 -1
  294. package/src/dom/types/Node.ts +4 -20
  295. package/src/dom/types/SkDOM.ts +22 -43
  296. package/src/dom/types/index.ts +1 -0
  297. package/src/index.ts +1 -0
  298. package/src/renderer/Canvas.tsx +3 -3
  299. package/src/renderer/DrawingContext.ts +4 -5
  300. package/src/renderer/HostComponents.ts +34 -53
  301. package/src/renderer/HostConfig.ts +1 -0
  302. package/src/renderer/Offscreen.tsx +24 -0
  303. package/src/renderer/Reconciler.tsx +0 -1
  304. package/src/skia/types/Surface/Surface.ts +5 -0
  305. package/src/skia/types/Surface/SurfaceFactory.ts +7 -0
  306. package/src/skia/web/JsiSkSurface.ts +4 -0
  307. package/src/skia/web/JsiSkSurfaceFactory.ts +21 -2
  308. package/src/views/SkiaBaseWebView.tsx +6 -2
  309. package/src/views/SkiaDomView.web.tsx +2 -13
  310. package/src/views/SkiaPictureView.web.tsx +0 -7
  311. package/src/views/SkiaView.web.tsx +0 -7
@@ -25,8 +25,10 @@ static PropId PropNameFit = JsiPropId::get("fit");
25
25
 
26
26
  class ImageProp : public DerivedSkProp<SkImage> {
27
27
  public:
28
- explicit ImageProp(PropId name) : DerivedSkProp<SkImage>() {
29
- _imageProp = addProperty(std::make_shared<NodeProp>(name));
28
+ explicit ImageProp(PropId name,
29
+ const std::function<void(BaseNodeProp *)> &onChange)
30
+ : DerivedSkProp<SkImage>(onChange) {
31
+ _imageProp = defineProperty<NodeProp>(name);
30
32
  }
31
33
 
32
34
  void updateDerivedValue() override {
@@ -52,10 +54,11 @@ private:
52
54
 
53
55
  class ImageProps : public DerivedProp<FitRects> {
54
56
  public:
55
- ImageProps() : DerivedProp<FitRects>() {
56
- _fitProp = addProperty(std::make_shared<NodeProp>(PropNameFit));
57
- _imageProp = addProperty(std::make_shared<ImageProp>(PropNameImage));
58
- _rectProp = addProperty(std::make_shared<RectProps>(PropNameRect));
57
+ explicit ImageProps(const std::function<void(BaseNodeProp *)> &onChange)
58
+ : DerivedProp<FitRects>(onChange) {
59
+ _fitProp = defineProperty<NodeProp>(PropNameFit);
60
+ _imageProp = defineProperty<ImageProp>(PropNameImage);
61
+ _rectProp = defineProperty<RectProps>(PropNameRect);
59
62
  }
60
63
 
61
64
  void updateDerivedValue() override {
@@ -10,9 +10,11 @@ namespace RNSkia {
10
10
 
11
11
  class LayerProp : public DerivedProp<SkPaint> {
12
12
  public:
13
- explicit LayerProp(PropId name) : DerivedProp<SkPaint>() {
14
- _layerPaintProp = addProperty(std::make_shared<PaintProp>(name));
15
- _layerBoolProp = addProperty(std::make_shared<NodeProp>(name));
13
+ explicit LayerProp(PropId name,
14
+ const std::function<void(BaseNodeProp *)> &onChange)
15
+ : DerivedProp<SkPaint>(onChange) {
16
+ _layerPaintProp = defineProperty<PaintProp>(name);
17
+ _layerBoolProp = defineProperty<NodeProp>(name);
16
18
  }
17
19
 
18
20
  /**
@@ -31,7 +33,7 @@ public:
31
33
 
32
34
  if (_layerPaintProp->isSet()) {
33
35
  // We have a paint object for the layer property
34
- setDerivedValue(_layerPaintProp->getDerivedValue());
36
+ setDerivedValue(_layerPaintProp->getUnsafeDerivedValue());
35
37
  _isBool = false;
36
38
  } else {
37
39
  _isBool = false;
@@ -11,8 +11,10 @@ static PropId PropNameMatrix = JsiPropId::get("matrix");
11
11
 
12
12
  class MatrixProp : public DerivedProp<SkMatrix> {
13
13
  public:
14
- explicit MatrixProp(PropId name) : DerivedProp<SkMatrix>() {
15
- _matrixProp = addProperty(std::make_shared<NodeProp>(name));
14
+ explicit MatrixProp(PropId name,
15
+ const std::function<void(BaseNodeProp *)> &onChange)
16
+ : DerivedProp<SkMatrix>(onChange) {
17
+ _matrixProp = defineProperty<NodeProp>(name);
16
18
  }
17
19
 
18
20
  void updateDerivedValue() override {
@@ -11,8 +11,10 @@ namespace RNSkia {
11
11
 
12
12
  class NumbersProp : public DerivedProp<std::vector<SkScalar>> {
13
13
  public:
14
- explicit NumbersProp(PropId name) : DerivedProp<std::vector<SkScalar>>() {
15
- _positionProp = addProperty(std::make_shared<NodeProp>(name));
14
+ explicit NumbersProp(PropId name,
15
+ const std::function<void(BaseNodeProp *)> &onChange)
16
+ : DerivedProp<std::vector<SkScalar>>(onChange) {
17
+ _positionProp = defineProperty<NodeProp>(name);
16
18
  }
17
19
 
18
20
  void updateDerivedValue() override {
@@ -36,8 +38,10 @@ private:
36
38
 
37
39
  class Numbers16Prop : public DerivedProp<std::vector<u_int16_t>> {
38
40
  public:
39
- explicit Numbers16Prop(PropId name) : DerivedProp<std::vector<u_int16_t>>() {
40
- _prop = addProperty(std::make_shared<NodeProp>(name));
41
+ explicit Numbers16Prop(PropId name,
42
+ const std::function<void(BaseNodeProp *)> &onChange)
43
+ : DerivedProp<std::vector<u_int16_t>>(onChange) {
44
+ _prop = defineProperty<NodeProp>(name);
41
45
  }
42
46
 
43
47
  void updateDerivedValue() override {
@@ -21,11 +21,14 @@ namespace RNSkia {
21
21
 
22
22
  class PaintProp : public DerivedProp<SkPaint> {
23
23
  public:
24
- explicit PaintProp(PropId name) : DerivedProp<SkPaint>() {
25
- _paintProp = addProperty(std::make_shared<NodeProp>(name));
24
+ explicit PaintProp(PropId name,
25
+ const std::function<void(BaseNodeProp *)> &onChange)
26
+ : DerivedProp<SkPaint>(onChange) {
27
+ _paintProp = defineProperty<NodeProp>(name);
26
28
  }
27
29
 
28
- PaintProp() : PaintProp(JsiPropId::get("paint")) {}
30
+ explicit PaintProp(const std::function<void(BaseNodeProp *)> &onChange)
31
+ : PaintProp(JsiPropId::get("paint"), onChange) {}
29
32
 
30
33
  void updateDerivedValue() override {
31
34
  if (_paintProp->isSet()) {
@@ -50,108 +53,68 @@ private:
50
53
  NodeProp *_paintProp;
51
54
  };
52
55
 
53
- class PaintProps : public BaseDerivedProp {
56
+ class PaintDrawingContextProp : public DerivedProp<DrawingContext> {
54
57
  public:
55
- PaintProps() : BaseDerivedProp() {
56
- _color = addProperty(std::make_shared<ColorProp>(JsiPropId::get("color")));
57
- _style = addProperty(std::make_shared<NodeProp>(JsiPropId::get("style")));
58
- _strokeWidth =
59
- addProperty(std::make_shared<NodeProp>(JsiPropId::get("strokeWidth")));
60
- _blendMode = addProperty(
61
- std::make_shared<BlendModeProp>(JsiPropId::get("blendMode")));
62
- _strokeJoin = addProperty(
63
- std::make_shared<StrokeJoinProp>(JsiPropId::get("strokeJoin")));
64
- _strokeCap = addProperty(
65
- std::make_shared<StrokeCapProp>(JsiPropId::get("strokeCap")));
66
- _strokeMiter =
67
- addProperty(std::make_shared<NodeProp>(JsiPropId::get("strokeMiter")));
68
- _antiAlias =
69
- addProperty(std::make_shared<NodeProp>(JsiPropId::get("antiAlias")));
70
- _opacity =
71
- addProperty(std::make_shared<NodeProp>(JsiPropId::get("opacity")));
58
+ explicit PaintDrawingContextProp(
59
+ PropId name, const std::function<void(BaseNodeProp *)> &onChange)
60
+ : DerivedProp<DrawingContext>(onChange) {
61
+ _paintProp = defineProperty<NodeProp>(name);
72
62
  }
73
63
 
74
- void decorate(DrawingContext *context) {
75
- // Now we can start updating the context
76
-
77
- // Opacity
78
- if (_opacity->isChanged() || context->isChanged()) {
79
- auto parent = context->getParent();
80
- auto paint = context->getMutablePaint();
81
- if (_opacity->isSet()) {
82
- auto currentOpacity = _opacity->value().getAsNumber();
83
- auto parent = context->getParent();
84
- if (parent != nullptr) {
85
- currentOpacity *= parent->getPaint()->getAlphaf();
86
- }
87
- paint->setAlphaf(currentOpacity);
88
- } else {
89
- if (parent != nullptr) {
90
- paint->setAlphaf(parent->getPaint()->getAlphaf());
64
+ explicit PaintDrawingContextProp(
65
+ const std::function<void(BaseNodeProp *)> &onChange)
66
+ : PaintDrawingContextProp(JsiPropId::get("paint"), onChange) {}
67
+
68
+ void updateDerivedValue() override {
69
+ if (_paintProp->isSet()) {
70
+ if (_paintProp->value().getType() == PropType::HostObject) {
71
+ // Read paint property as Host Object - JsiSkPaint
72
+ auto ptr = _paintProp->value().getAs<JsiSkPaint>();
73
+ if (ptr != nullptr) {
74
+ setDerivedValue(std::make_shared<DrawingContext>(ptr->getObject()));
91
75
  } else {
92
- paint->setAlphaf(1.0);
76
+ throw std::runtime_error("Expected SkPaint object, got unknown "
77
+ "object when reading paint property.");
93
78
  }
79
+ } else {
80
+ setDerivedValue(nullptr);
94
81
  }
82
+ } else {
83
+ setDerivedValue(nullptr);
95
84
  }
85
+ }
96
86
 
97
- // COLOR
98
- if (_color->isSet() && (_color->isChanged() || context->isChanged())) {
99
- auto paint = context->getMutablePaint();
100
- auto opacity = paint->getAlphaf();
101
- paint->setShader(nullptr);
102
- paint->setColor(*_color->getDerivedValue());
103
- paint->setAlphaf(opacity * paint->getColor4f().fA);
104
- }
87
+ private:
88
+ NodeProp *_paintProp;
89
+ };
105
90
 
106
- // Style
107
- if (_style->isSet() && (_style->isChanged() || context->isChanged())) {
108
- auto styleValue = _style->value().getAsString();
109
- if (styleValue == "stroke") {
110
- context->getMutablePaint()->setStyle(SkPaint::Style::kStroke_Style);
111
- } else if (styleValue == "fill") {
112
- context->getMutablePaint()->setStyle(SkPaint::Style::kFill_Style);
113
- } else {
114
- throw std::runtime_error(
115
- styleValue + " is not a valud value for the style property.");
116
- }
117
- }
118
- // Stroke Width
119
- if (_strokeWidth->isSet() &&
120
- (_strokeWidth->isChanged() || context->isChanged())) {
121
- context->getMutablePaint()->setStrokeWidth(
122
- _strokeWidth->value().getAsNumber());
123
- }
124
- // Blend mode
125
- if (_blendMode->isSet() &&
126
- (_blendMode->isChanged() || context->isChanged())) {
127
- context->getMutablePaint()->setBlendMode(*_blendMode->getDerivedValue());
128
- }
129
- // Stroke Join
130
- if (_strokeJoin->isSet() &&
131
- (_strokeJoin->isChanged() || context->isChanged())) {
132
- context->getMutablePaint()->setStrokeJoin(
133
- *_strokeJoin->getDerivedValue());
134
- }
135
- // Stroke Cap
136
- if (_strokeCap->isSet() &&
137
- (_strokeCap->isChanged() || context->isChanged())) {
138
- context->getMutablePaint()->setStrokeCap(*_strokeCap->getDerivedValue());
139
- }
140
- // Stroke Miter
141
- if (_strokeMiter->isSet() &&
142
- (_strokeMiter->isChanged() || context->isChanged())) {
143
- context->getMutablePaint()->setStrokeMiter(
144
- _strokeMiter->value().getAsNumber());
145
- }
146
- // AntiAlias
147
- if (_antiAlias->isSet() &&
148
- (_antiAlias->isChanged() || context->isChanged())) {
149
- context->getMutablePaint()->setAntiAlias(_antiAlias->value().getAsBool());
150
- }
91
+ class PaintProps : public BaseDerivedProp {
92
+ public:
93
+ explicit PaintProps(const std::function<void(BaseNodeProp *)> &onChange)
94
+ : BaseDerivedProp(onChange) {
95
+ _color = defineProperty<ColorProp>("color");
96
+ _style = defineProperty<NodeProp>("style");
97
+ _strokeWidth = defineProperty<NodeProp>("strokeWidth");
98
+ _blendMode = defineProperty<BlendModeProp>("blendMode");
99
+ _strokeJoin = defineProperty<StrokeJoinProp>("strokeJoin");
100
+ _strokeCap = defineProperty<StrokeCapProp>("strokeCap");
101
+ _strokeMiter = defineProperty<NodeProp>("strokeMiter");
102
+ _antiAlias = defineProperty<NodeProp>("antiAlias");
103
+ _opacity = defineProperty<NodeProp>("opacity");
151
104
  }
152
105
 
153
106
  void updateDerivedValue() override {}
154
107
 
108
+ ColorProp *getColor() { return _color; }
109
+ NodeProp *getStyle() { return _style; }
110
+ NodeProp *getStrokeWidth() { return _strokeWidth; }
111
+ BlendModeProp *getBlendMode() { return _blendMode; }
112
+ StrokeJoinProp *getStrokeJoin() { return _strokeJoin; }
113
+ StrokeCapProp *getStrokeCap() { return _strokeCap; }
114
+ NodeProp *getStrokeMiter() { return _strokeMiter; }
115
+ NodeProp *getAntiAlias() { return _antiAlias; }
116
+ NodeProp *getOpacity() { return _opacity; }
117
+
155
118
  private:
156
119
  ColorProp *_color;
157
120
  NodeProp *_style;
@@ -16,8 +16,10 @@ namespace RNSkia {
16
16
 
17
17
  class PathProp : public DerivedProp<SkPath> {
18
18
  public:
19
- explicit PathProp(PropId name) : DerivedProp<SkPath>() {
20
- _pathProp = addProperty(std::make_shared<NodeProp>(name));
19
+ explicit PathProp(PropId name,
20
+ const std::function<void(BaseNodeProp *)> &onChange)
21
+ : DerivedProp<SkPath>(onChange) {
22
+ _pathProp = defineProperty<NodeProp>(name);
21
23
  }
22
24
 
23
25
  void updateDerivedValue() override {
@@ -11,8 +11,10 @@ namespace RNSkia {
11
11
 
12
12
  class PictureProp : public DerivedSkProp<SkPicture> {
13
13
  public:
14
- explicit PictureProp(PropId name) : DerivedSkProp<SkPicture>() {
15
- _pictureProp = addProperty(std::make_shared<NodeProp>(name));
14
+ explicit PictureProp(PropId name,
15
+ const std::function<void(BaseNodeProp *)> &onChange)
16
+ : DerivedSkProp<SkPicture>(onChange) {
17
+ _pictureProp = defineProperty<NodeProp>(name);
16
18
  }
17
19
 
18
20
  void updateDerivedValue() override {
@@ -20,8 +20,10 @@ static PropId PropNameY = JsiPropId::get("y");
20
20
 
21
21
  class PointProp : public DerivedProp<SkPoint> {
22
22
  public:
23
- explicit PointProp(PropId name) : DerivedProp<SkPoint>() {
24
- _pointProp = addProperty(std::make_shared<NodeProp>(name));
23
+ explicit PointProp(PropId name,
24
+ const std::function<void(BaseNodeProp *)> &onChange)
25
+ : DerivedProp<SkPoint>(onChange) {
26
+ _pointProp = defineProperty<NodeProp>(name);
25
27
  }
26
28
 
27
29
  void updateDerivedValue() override {
@@ -19,8 +19,10 @@ namespace RNSkia {
19
19
 
20
20
  class PointModeProp : public DerivedProp<SkCanvas::PointMode> {
21
21
  public:
22
- explicit PointModeProp(PropId name) : DerivedProp<SkCanvas::PointMode>() {
23
- _pointModeProp = addProperty(std::make_shared<NodeProp>(name));
22
+ explicit PointModeProp(PropId name,
23
+ const std::function<void(BaseNodeProp *)> &onChange)
24
+ : DerivedProp<SkCanvas::PointMode>(onChange) {
25
+ _pointModeProp = defineProperty<NodeProp>(name);
24
26
  }
25
27
 
26
28
  void updateDerivedValue() override {
@@ -51,8 +53,10 @@ private:
51
53
 
52
54
  class PointsProp : public DerivedProp<std::vector<SkPoint>> {
53
55
  public:
54
- explicit PointsProp(PropId name) : DerivedProp<std::vector<SkPoint>>() {
55
- _pointsProp = addProperty(std::make_shared<NodeProp>(name));
56
+ explicit PointsProp(PropId name,
57
+ const std::function<void(BaseNodeProp *)> &onChange)
58
+ : DerivedProp<std::vector<SkPoint>>(onChange) {
59
+ _pointsProp = defineProperty<NodeProp>(name);
56
60
  }
57
61
 
58
62
  void updateDerivedValue() override {
@@ -27,8 +27,10 @@ static PropId PropNameR = JsiPropId::get("r");
27
27
  */
28
28
  class RRectProp : public DerivedProp<SkRRect> {
29
29
  public:
30
- explicit RRectProp(PropId name) : DerivedProp() {
31
- _prop = addProperty(std::make_shared<NodeProp>(name));
30
+ explicit RRectProp(PropId name,
31
+ const std::function<void(BaseNodeProp *)> &onChange)
32
+ : DerivedProp(onChange) {
33
+ _prop = defineProperty<NodeProp>(name);
32
34
  }
33
35
 
34
36
  void updateDerivedValue() override {
@@ -78,12 +80,14 @@ private:
78
80
  */
79
81
  class RRectPropFromProps : public DerivedProp<SkRRect> {
80
82
  public:
81
- RRectPropFromProps() : DerivedProp<SkRRect>() {
82
- _x = addProperty(std::make_shared<NodeProp>(PropNameX));
83
- _y = addProperty(std::make_shared<NodeProp>(PropNameY));
84
- _width = addProperty(std::make_shared<NodeProp>(PropNameWidth));
85
- _height = addProperty(std::make_shared<NodeProp>(PropNameHeight));
86
- _r = addProperty(std::make_shared<NodeProp>(PropNameR));
83
+ explicit RRectPropFromProps(
84
+ const std::function<void(BaseNodeProp *)> &onChange)
85
+ : DerivedProp<SkRRect>(onChange) {
86
+ _x = defineProperty<NodeProp>(PropNameX);
87
+ _y = defineProperty<NodeProp>(PropNameY);
88
+ _width = defineProperty<NodeProp>(PropNameWidth);
89
+ _height = defineProperty<NodeProp>(PropNameHeight);
90
+ _r = defineProperty<NodeProp>(PropNameR);
87
91
  }
88
92
 
89
93
  void updateDerivedValue() override {
@@ -111,17 +115,18 @@ private:
111
115
  */
112
116
  class RRectProps : public DerivedProp<SkRRect> {
113
117
  public:
114
- explicit RRectProps(PropId name) : DerivedProp<SkRRect>() {
115
- _rectProp = addProperty<RRectProp>(std::make_shared<RRectProp>(name));
116
- _rectPropFromProps =
117
- addProperty<RRectPropFromProps>(std::make_shared<RRectPropFromProps>());
118
+ explicit RRectProps(PropId name,
119
+ const std::function<void(BaseNodeProp *)> &onChange)
120
+ : DerivedProp<SkRRect>(onChange) {
121
+ _rectProp = defineProperty<RRectProp>(name);
122
+ _rectPropFromProps = defineProperty<RRectPropFromProps>();
118
123
  }
119
124
 
120
125
  void updateDerivedValue() override {
121
126
  if (_rectProp->isSet()) {
122
- setDerivedValue(_rectProp->getDerivedValue());
127
+ setDerivedValue(_rectProp->getUnsafeDerivedValue());
123
128
  } else if (_rectPropFromProps->isSet()) {
124
- setDerivedValue(_rectPropFromProps->getDerivedValue());
129
+ setDerivedValue(_rectPropFromProps->getUnsafeDerivedValue());
125
130
  } else {
126
131
  setDerivedValue(nullptr);
127
132
  }
@@ -138,8 +143,10 @@ private:
138
143
  */
139
144
  class BoxProps : public DerivedProp<SkRRect> {
140
145
  public:
141
- explicit BoxProps(PropId name) : DerivedProp<SkRRect>() {
142
- _boxProp = addProperty(std::make_shared<NodeProp>(name));
146
+ explicit BoxProps(PropId name,
147
+ const std::function<void(BaseNodeProp *)> &onChange)
148
+ : DerivedProp<SkRRect>(onChange) {
149
+ _boxProp = defineProperty<NodeProp>(name);
143
150
  }
144
151
 
145
152
  void updateDerivedValue() override {
@@ -16,8 +16,10 @@ namespace RNSkia {
16
16
 
17
17
  class RadiusProp : public DerivedProp<SkPoint> {
18
18
  public:
19
- explicit RadiusProp(PropId name) : DerivedProp<SkPoint>() {
20
- _radiusProp = addProperty(std::make_shared<NodeProp>(name));
19
+ explicit RadiusProp(PropId name,
20
+ const std::function<void(BaseNodeProp *)> &onChange)
21
+ : DerivedProp<SkPoint>(onChange) {
22
+ _radiusProp = defineProperty<NodeProp>(name);
21
23
  }
22
24
 
23
25
  void updateDerivedValue() override {
@@ -25,8 +25,10 @@ static PropId PropNameHeight = JsiPropId::get("height");
25
25
  */
26
26
  class RectProp : public DerivedProp<SkRect> {
27
27
  public:
28
- explicit RectProp(PropId name) : DerivedProp() {
29
- _prop = addProperty(std::make_shared<NodeProp>(name));
28
+ explicit RectProp(PropId name,
29
+ const std::function<void(BaseNodeProp *)> &onChange)
30
+ : DerivedProp(onChange) {
31
+ _prop = defineProperty<NodeProp>(name);
30
32
  }
31
33
 
32
34
  void updateDerivedValue() override {
@@ -68,11 +70,13 @@ private:
68
70
  */
69
71
  class RectPropFromProps : public DerivedProp<SkRect> {
70
72
  public:
71
- RectPropFromProps() : DerivedProp<SkRect>() {
72
- _x = addProperty(std::make_shared<NodeProp>(PropNameX));
73
- _y = addProperty(std::make_shared<NodeProp>(PropNameY));
74
- _width = addProperty(std::make_shared<NodeProp>(PropNameWidth));
75
- _height = addProperty(std::make_shared<NodeProp>(PropNameHeight));
73
+ explicit RectPropFromProps(
74
+ const std::function<void(BaseNodeProp *)> &onChange)
75
+ : DerivedProp<SkRect>(onChange) {
76
+ _x = defineProperty<NodeProp>(PropNameX);
77
+ _y = defineProperty<NodeProp>(PropNameY);
78
+ _width = defineProperty<NodeProp>(PropNameWidth);
79
+ _height = defineProperty<NodeProp>(PropNameHeight);
76
80
  }
77
81
 
78
82
  void updateDerivedValue() override {
@@ -103,16 +107,18 @@ private:
103
107
  */
104
108
  class RectProps : public DerivedProp<SkRect> {
105
109
  public:
106
- explicit RectProps(PropId name) : DerivedProp<SkRect>() {
107
- _rectProp = addProperty(std::make_shared<RectProp>(name));
108
- _rectPropFromProps = addProperty(std::make_shared<RectPropFromProps>());
110
+ explicit RectProps(PropId name,
111
+ const std::function<void(BaseNodeProp *)> &onChange)
112
+ : DerivedProp<SkRect>(onChange) {
113
+ _rectProp = defineProperty<RectProp>(name);
114
+ _rectPropFromProps = defineProperty<RectPropFromProps>();
109
115
  }
110
116
 
111
117
  void updateDerivedValue() override {
112
118
  if (_rectProp->isSet()) {
113
- setDerivedValue(_rectProp->getDerivedValue());
119
+ setDerivedValue(_rectProp->getUnsafeDerivedValue());
114
120
  } else if (_rectPropFromProps->isSet()) {
115
- setDerivedValue(_rectPropFromProps->getDerivedValue());
121
+ setDerivedValue(_rectPropFromProps->getUnsafeDerivedValue());
116
122
  } else {
117
123
  setDerivedValue(nullptr);
118
124
  }
@@ -16,8 +16,10 @@ namespace RNSkia {
16
16
 
17
17
  class StrokeCapProp : public DerivedProp<SkPaint::Cap> {
18
18
  public:
19
- explicit StrokeCapProp(PropId name) : DerivedProp<SkPaint::Cap>() {
20
- _strokeCap = addProperty(std::make_shared<NodeProp>(name));
19
+ explicit StrokeCapProp(PropId name,
20
+ const std::function<void(BaseNodeProp *)> &onChange)
21
+ : DerivedProp<SkPaint::Cap>(onChange) {
22
+ _strokeCap = defineProperty<NodeProp>(name);
21
23
  }
22
24
 
23
25
  void updateDerivedValue() override {
@@ -45,8 +47,10 @@ private:
45
47
 
46
48
  class StrokeJoinProp : public DerivedProp<SkPaint::Join> {
47
49
  public:
48
- explicit StrokeJoinProp(PropId name) : DerivedProp<SkPaint::Join>() {
49
- _strokeJoin = addProperty(std::make_shared<NodeProp>(name));
50
+ explicit StrokeJoinProp(PropId name,
51
+ const std::function<void(BaseNodeProp *)> &onChange)
52
+ : DerivedProp<SkPaint::Join>(onChange) {
53
+ _strokeJoin = defineProperty<NodeProp>(name);
50
54
  }
51
55
 
52
56
  void updateDerivedValue() override {
@@ -10,8 +10,10 @@ namespace RNSkia {
10
10
 
11
11
  class SvgProp : public DerivedSkProp<SkSVGDOM> {
12
12
  public:
13
- explicit SvgProp(PropId name) : DerivedSkProp<SkSVGDOM>() {
14
- _imageSvgProp = addProperty(std::make_shared<NodeProp>(name));
13
+ explicit SvgProp(PropId name,
14
+ const std::function<void(BaseNodeProp *)> &onChange)
15
+ : DerivedSkProp<SkSVGDOM>(onChange) {
16
+ _imageSvgProp = defineProperty<NodeProp>(name);
15
17
  }
16
18
 
17
19
  void updateDerivedValue() override {
@@ -12,8 +12,10 @@ namespace RNSkia {
12
12
 
13
13
  class TextBlobProp : public DerivedSkProp<SkTextBlob> {
14
14
  public:
15
- explicit TextBlobProp(PropId name) : DerivedSkProp<SkTextBlob>() {
16
- _textBlobProp = addProperty(std::make_shared<NodeProp>(name));
15
+ explicit TextBlobProp(PropId name,
16
+ const std::function<void(BaseNodeProp *)> &onChange)
17
+ : DerivedSkProp<SkTextBlob>(onChange) {
18
+ _textBlobProp = defineProperty<NodeProp>(name);
17
19
  }
18
20
 
19
21
  void updateDerivedValue() override {
@@ -37,12 +39,12 @@ private:
37
39
 
38
40
  class TextPathBlobProp : public DerivedSkProp<SkTextBlob> {
39
41
  public:
40
- TextPathBlobProp() : DerivedSkProp<SkTextBlob>() {
41
- _fontProp = addProperty(std::make_shared<FontProp>(JsiPropId::get("font")));
42
- _textProp = addProperty(std::make_shared<NodeProp>(JsiPropId::get("text")));
43
- _pathProp = addProperty(std::make_shared<PathProp>(JsiPropId::get("path")));
44
- _offsetProp = addProperty(
45
- std::make_shared<NodeProp>(JsiPropId::get("initialOffset")));
42
+ explicit TextPathBlobProp(const std::function<void(BaseNodeProp *)> &onChange)
43
+ : DerivedSkProp<SkTextBlob>(onChange) {
44
+ _fontProp = defineProperty<FontProp>("font");
45
+ _textProp = defineProperty<NodeProp>("text");
46
+ _pathProp = defineProperty<PathProp>("path");
47
+ _offsetProp = defineProperty<NodeProp>("initialOffset");
46
48
 
47
49
  _fontProp->require();
48
50
  _textProp->require();
@@ -16,8 +16,10 @@ namespace RNSkia {
16
16
 
17
17
  class TileModeProp : public DerivedProp<SkTileMode> {
18
18
  public:
19
- explicit TileModeProp(PropId name) : DerivedProp<SkTileMode>() {
20
- _tileModeProp = addProperty(std::make_shared<NodeProp>(name));
19
+ explicit TileModeProp(PropId name,
20
+ const std::function<void(BaseNodeProp *)> &onChange)
21
+ : DerivedProp<SkTileMode>(onChange) {
22
+ _tileModeProp = defineProperty<NodeProp>(name);
21
23
  }
22
24
 
23
25
  void updateDerivedValue() override {
@@ -20,8 +20,10 @@ static PropId PropNameRotateZ = JsiPropId::get("rotateZ");
20
20
 
21
21
  class TransformProp : public DerivedProp<SkMatrix> {
22
22
  public:
23
- explicit TransformProp(PropId name) : DerivedProp<SkMatrix>() {
24
- _transformProp = addProperty(std::make_shared<NodeProp>(name));
23
+ explicit TransformProp(PropId name,
24
+ const std::function<void(BaseNodeProp *)> &onChange)
25
+ : DerivedProp<SkMatrix>(onChange) {
26
+ _transformProp = defineProperty<NodeProp>(name);
25
27
  }
26
28
 
27
29
  void updateDerivedValue() override {
@@ -12,13 +12,11 @@ namespace RNSkia {
12
12
 
13
13
  class TransformsProps : public DerivedProp<SkMatrix> {
14
14
  public:
15
- TransformsProps() : DerivedProp<SkMatrix>() {
16
- _transformProp = addProperty(
17
- std::make_shared<TransformProp>(JsiPropId::get("transform")));
18
- _originProp =
19
- addProperty(std::make_shared<PointProp>(JsiPropId::get("origin")));
20
- _matrixProp =
21
- addProperty(std::make_shared<MatrixProp>(JsiPropId::get("matrix")));
15
+ explicit TransformsProps(const std::function<void(BaseNodeProp *)> &onChange)
16
+ : DerivedProp<SkMatrix>(onChange) {
17
+ _transformProp = defineProperty<TransformProp>("transform");
18
+ _originProp = defineProperty<PointProp>("origin");
19
+ _matrixProp = defineProperty<MatrixProp>("matrix");
22
20
  }
23
21
 
24
22
  void updateDerivedValue() override {
@@ -80,8 +80,10 @@ void processUniform(std::vector<SkScalar> &values, SkRuntimeEffect *source,
80
80
 
81
81
  class UniformsProp : public DerivedSkProp<SkData> {
82
82
  public:
83
- UniformsProp(PropId name, NodeProp *sourceProp) : DerivedSkProp<SkData>() {
84
- _uniformsProp = addProperty(std::make_shared<NodeProp>(name));
83
+ UniformsProp(PropId name, NodeProp *sourceProp,
84
+ const std::function<void(BaseNodeProp *)> &onChange)
85
+ : DerivedSkProp<SkData>(onChange) {
86
+ _uniformsProp = defineProperty<NodeProp>(name);
85
87
  _sourceProp = sourceProp;
86
88
  }
87
89
 
@@ -16,8 +16,10 @@ namespace RNSkia {
16
16
 
17
17
  class VertexModeProp : public DerivedProp<SkVertices::VertexMode> {
18
18
  public:
19
- explicit VertexModeProp(PropId name) : DerivedProp<SkVertices::VertexMode>() {
20
- _vertexModeProp = addProperty(std::make_shared<NodeProp>(name));
19
+ explicit VertexModeProp(PropId name,
20
+ const std::function<void(BaseNodeProp *)> &onChange)
21
+ : DerivedProp<SkVertices::VertexMode>(onChange) {
22
+ _vertexModeProp = defineProperty<NodeProp>(name);
21
23
  }
22
24
 
23
25
  void updateDerivedValue() override {