@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
@@ -35,32 +35,23 @@ class ImageFilterDeclaration extends _Node.JsiDeclarationNode {
35
35
  super(ctx, _types2.DeclarationType.ImageFilter, type, props);
36
36
  }
37
37
 
38
- getOptionalChildInstance(index) {
39
- const child = this._children[index];
40
-
41
- if (!child) {
42
- return null;
43
- }
44
-
45
- return this.getMandatoryChildInstance(index);
38
+ input(ctx) {
39
+ return ctx.imageFilters.pop() ?? null;
46
40
  }
47
41
 
48
- getMandatoryChildInstance(index) {
49
- const child = this._children[index];
42
+ composeAndPush(ctx, imgf1) {
43
+ ctx.save();
44
+ this.decorateChildren(ctx);
45
+ let imgf2 = ctx.imageFilters.popAllAsOne();
46
+ const cf = ctx.colorFilters.popAllAsOne();
47
+ ctx.restore();
50
48
 
51
- if (child instanceof _Node.JsiDeclarationNode) {
52
- if (child.isImageFilter()) {
53
- return child.materialize();
54
- } else if (child.isShader()) {
55
- return this.Skia.ImageFilter.MakeShader(child.materialize(), null);
56
- } else if (child.declarationType === _types2.DeclarationType.ColorFilter) {
57
- return this.Skia.ImageFilter.MakeColorFilter(child.materialize(), null);
58
- } else {
59
- throw new Error(`Found invalid child ${child.type} in ${this.type}`);
60
- }
61
- } else {
62
- throw new Error(`Found invalid child ${child.type} in ${this.type}`);
49
+ if (cf) {
50
+ imgf2 = this.Skia.ImageFilter.MakeCompose(imgf2 ?? null, this.Skia.ImageFilter.MakeColorFilter(cf, null));
63
51
  }
52
+
53
+ const imgf = imgf2 ? this.Skia.ImageFilter.MakeCompose(imgf1, imgf2) : imgf1;
54
+ ctx.imageFilters.push(imgf);
64
55
  }
65
56
 
66
57
  }
@@ -72,12 +63,14 @@ class OffsetImageFilterNode extends ImageFilterDeclaration {
72
63
  super(ctx, _types2.NodeType.OffsetImageFilter, props);
73
64
  }
74
65
 
75
- materialize() {
66
+ decorate(ctx) {
67
+ this.decorateChildren(ctx);
76
68
  const {
77
69
  x,
78
70
  y
79
71
  } = this.props;
80
- return this.Skia.ImageFilter.MakeOffset(x, y, this.getOptionalChildInstance(0));
72
+ const imgf = this.Skia.ImageFilter.MakeOffset(x, y, null);
73
+ this.composeAndPush(ctx, imgf);
81
74
  }
82
75
 
83
76
  }
@@ -89,13 +82,14 @@ class DisplacementMapImageFilterNode extends ImageFilterDeclaration {
89
82
  super(ctx, _types2.NodeType.DisplacementMapImageFilter, props);
90
83
  }
91
84
 
92
- materialize() {
85
+ decorate(ctx) {
93
86
  const {
94
87
  channelX,
95
88
  channelY,
96
89
  scale
97
90
  } = this.props;
98
- return this.Skia.ImageFilter.MakeDisplacementMap(_types.ColorChannel[(0, _datatypes.enumKey)(channelX)], _types.ColorChannel[(0, _datatypes.enumKey)(channelY)], scale, this.getMandatoryChildInstance(0), this.getOptionalChildInstance(1));
91
+ const imgf = this.Skia.ImageFilter.MakeDisplacementMap(_types.ColorChannel[(0, _datatypes.enumKey)(channelX)], _types.ColorChannel[(0, _datatypes.enumKey)(channelY)], scale, ctx.imageFilters.pop(), this.input(ctx));
92
+ this.composeAndPush(ctx, imgf);
99
93
  }
100
94
 
101
95
  }
@@ -107,13 +101,14 @@ class BlurImageFilterNode extends ImageFilterDeclaration {
107
101
  super(ctx, _types2.NodeType.BlurImageFilter, props);
108
102
  }
109
103
 
110
- materialize() {
104
+ decorate(ctx) {
111
105
  const {
112
106
  mode,
113
107
  blur
114
108
  } = this.props;
115
109
  const sigma = (0, _datatypes.processRadius)(this.Skia, blur);
116
- return this.Skia.ImageFilter.MakeBlur(sigma.x, sigma.y, _types.TileMode[(0, _datatypes.enumKey)(mode)], this.getOptionalChildInstance(0));
110
+ const imgf = this.Skia.ImageFilter.MakeBlur(sigma.x, sigma.y, _types.TileMode[(0, _datatypes.enumKey)(mode)], this.input(ctx));
111
+ this.composeAndPush(ctx, imgf);
117
112
  }
118
113
 
119
114
  }
@@ -125,7 +120,7 @@ class DropShadowImageFilterNode extends ImageFilterDeclaration {
125
120
  super(ctx, _types2.NodeType.DropShadowImageFilter, props);
126
121
  }
127
122
 
128
- materialize() {
123
+ decorate(ctx) {
129
124
  const {
130
125
  dx,
131
126
  dy,
@@ -135,7 +130,6 @@ class DropShadowImageFilterNode extends ImageFilterDeclaration {
135
130
  inner
136
131
  } = this.props;
137
132
  const color = this.Skia.Color(cl);
138
- const input = this.getOptionalChildInstance(0);
139
133
  let factory;
140
134
 
141
135
  if (inner) {
@@ -144,7 +138,8 @@ class DropShadowImageFilterNode extends ImageFilterDeclaration {
144
138
  factory = shadowOnly ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter) : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);
145
139
  }
146
140
 
147
- return factory(dx, dy, blur, blur, color, input);
141
+ const imgf = factory(dx, dy, blur, blur, color, this.input(ctx));
142
+ this.composeAndPush(ctx, imgf);
148
143
  }
149
144
 
150
145
  }
@@ -163,18 +158,20 @@ class MorphologyImageFilterNode extends ImageFilterDeclaration {
163
158
  super(ctx, _types2.NodeType.MorphologyImageFilter, props);
164
159
  }
165
160
 
166
- materialize() {
161
+ decorate(ctx) {
167
162
  const {
168
163
  operator
169
164
  } = this.props;
170
165
  const r = (0, _datatypes.processRadius)(this.Skia, this.props.radius);
171
- const input = this.getOptionalChildInstance(0);
166
+ let imgf;
172
167
 
173
168
  if (MorphologyOperator[(0, _datatypes.enumKey)(operator)] === MorphologyOperator.Erode) {
174
- return this.Skia.ImageFilter.MakeErode(r.x, r.y, input);
169
+ imgf = this.Skia.ImageFilter.MakeErode(r.x, r.y, this.input(ctx));
170
+ } else {
171
+ imgf = this.Skia.ImageFilter.MakeDilate(r.x, r.y, this.input(ctx));
175
172
  }
176
173
 
177
- return this.Skia.ImageFilter.MakeDilate(r.x, r.y, input);
174
+ this.composeAndPush(ctx, imgf);
178
175
  }
179
176
 
180
177
  }
@@ -186,13 +183,19 @@ class BlendImageFilterNode extends ImageFilterDeclaration {
186
183
  super(ctx, _types2.NodeType.BlendImageFilter, props);
187
184
  }
188
185
 
189
- materialize() {
186
+ decorate(ctx) {
190
187
  const {
191
188
  mode
192
189
  } = this.props;
193
- const a = this.getMandatoryChildInstance(0);
194
- const b = this.getMandatoryChildInstance(1);
195
- return this.Skia.ImageFilter.MakeBlend(mode, a, b);
190
+ const a = ctx.imageFilters.pop();
191
+ const b = ctx.imageFilters.pop();
192
+
193
+ if (!a || !b) {
194
+ throw new Error("BlendImageFilter requires two image filters");
195
+ }
196
+
197
+ const imgf = this.Skia.ImageFilter.MakeBlend(mode, a, b);
198
+ this.composeAndPush(ctx, imgf);
196
199
  }
197
200
 
198
201
  }
@@ -204,7 +207,7 @@ class RuntimeShaderImageFilterNode extends ImageFilterDeclaration {
204
207
  super(ctx, _types2.NodeType.RuntimeShaderImageFilter, props);
205
208
  }
206
209
 
207
- materialize() {
210
+ decorate(ctx) {
208
211
  const {
209
212
  source,
210
213
  uniforms
@@ -215,8 +218,8 @@ class RuntimeShaderImageFilterNode extends ImageFilterDeclaration {
215
218
  (0, _types.processUniforms)(source, uniforms, rtb);
216
219
  }
217
220
 
218
- const input = this.getOptionalChildInstance(0);
219
- return this.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input);
221
+ const imgf = this.Skia.ImageFilter.MakeRuntimeShader(rtb, null, this.input(ctx));
222
+ this.composeAndPush(ctx, imgf);
220
223
  }
221
224
 
222
225
  }
@@ -1 +1 @@
1
- {"version":3,"names":["Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","BlendMode","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","TileMode","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","getOptionalChildInstance","index","child","_children","getMandatoryChildInstance","isImageFilter","materialize","isShader","MakeShader","declarationType","Error","OffsetImageFilterNode","NodeType","OffsetImageFilter","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","MakeDisplacementMap","ColorChannel","enumKey","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","processRadius","DropShadowImageFilterNode","DropShadowImageFilter","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","processUniforms","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processRadius, enumKey } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nexport abstract class ImageFilterDeclaration<\n P,\n Nullable extends null | never = never\n> extends JsiDeclarationNode<P, SkImageFilter, Nullable> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n getOptionalChildInstance(index: number) {\n const child = this._children[index];\n if (!child) {\n return null;\n }\n return this.getMandatoryChildInstance(index);\n }\n\n getMandatoryChildInstance(index: number) {\n const child = this._children[index];\n if (child instanceof JsiDeclarationNode) {\n if (child.isImageFilter()) {\n return child.materialize();\n } else if (child.isShader()) {\n return this.Skia.ImageFilter.MakeShader(child.materialize(), null);\n } else if (child.declarationType === DeclarationType.ColorFilter) {\n return this.Skia.ImageFilter.MakeColorFilter(child.materialize(), null);\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n materialize() {\n const { x, y } = this.props;\n return this.Skia.ImageFilter.MakeOffset(\n x,\n y,\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n materialize() {\n const { channelX, channelY, scale } = this.props;\n return this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n this.getMandatoryChildInstance(0),\n this.getOptionalChildInstance(1)\n );\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n materialize() {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n return this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.getOptionalChildInstance(0)\n );\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.DropShadowImageFilter, props);\n }\n\n materialize() {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\n const input = this.getOptionalChildInstance(0);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n return factory(dx, dy, blur, blur, color, input);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n materialize() {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n const input = this.getOptionalChildInstance(0);\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n return this.Skia.ImageFilter.MakeErode(r.x, r.y, input);\n }\n return this.Skia.ImageFilter.MakeDilate(r.x, r.y, input);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n materialize() {\n const { mode } = this.props;\n const a = this.getMandatoryChildInstance(0);\n const b = this.getMandatoryChildInstance(1);\n return this.Skia.ImageFilter.MakeBlend(mode, a, b);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n materialize() {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const input = this.getOptionalChildInstance(0);\n return this.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input);\n }\n}\n"],"mappings":";;;;;;;AACA;;AAeA;;AACA;;AAEA;;AAEA,MAAMA,KAAK,GAAGC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CAAd;;AAEA,MAAMC,eAAe,GAAG,CACtBC,IADsB,EAEtBC,UAFsB,EAGtBC,EAHsB,EAItBC,EAJsB,EAKtBC,MALsB,EAMtBC,MANsB,EAOtBC,KAPsB,EAQtBC,KARsB,KASnB;EACH,MAAMC,aAAa,GAAGR,IAAI,CAACS,WAAL,CAAiBC,eAAjB,CACpBV,IAAI,CAACW,WAAL,CAAiBC,SAAjB,CAA2BhB,KAA3B,EAAkCiB,gBAAA,CAAUC,GAA5C,CADoB,EAEpB,IAFoB,CAAtB;EAIA,MAAMC,WAAW,GAAGf,IAAI,CAACS,WAAL,CAAiBC,eAAjB,CAClBV,IAAI,CAACW,WAAL,CAAiBC,SAAjB,CAA2BhB,KAA3B,EAAkCiB,g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IACZ,MAAM;MAAEgD,MAAF;MAAUC;IAAV,IAAuB,KAAKzD,KAAlC;IACA,MAAM0D,GAAG,GAAG,KAAK3F,IAAL,CAAU4F,oBAAV,CAA+BH,MAA/B,CAAZ;;IACA,IAAIC,QAAJ,EAAc;MACZ,IAAAG,sBAAA,EAAgBJ,MAAhB,EAAwBC,QAAxB,EAAkCC,GAAlC;IACD;;IACD,MAAMpF,KAAK,GAAG,KAAK4B,wBAAL,CAA8B,CAA9B,CAAd;IACA,OAAO,KAAKnC,IAAL,CAAUS,WAAV,CAAsBqF,iBAAtB,CAAwCH,GAAxC,EAA6C,IAA7C,EAAmDpF,KAAnD,CAAP;EACD;;AAbqG"}
1
+ {"version":3,"names":["Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","BlendMode","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","TileMode","Decal","f4","MakeCompose","SrcOver","ImageFilterDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","imageFilters","pop","composeAndPush","imgf1","save","decorateChildren","imgf2","popAllAsOne","cf","colorFilters","restore","imgf","push","OffsetImageFilterNode","NodeType","OffsetImageFilter","decorate","x","y","DisplacementMapImageFilterNode","DisplacementMapImageFilter","channelX","channelY","scale","MakeDisplacementMap","ColorChannel","enumKey","BlurImageFilterNode","BlurImageFilter","mode","blur","sigma","processRadius","DropShadowImageFilterNode","DropShadowImageFilter","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","MorphologyOperator","MorphologyImageFilterNode","MorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","BlendImageFilterNode","BlendImageFilter","a","b","Error","RuntimeShaderImageFilterNode","RuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","processUniforms","MakeRuntimeShader"],"sources":["ImageFilters.ts"],"sourcesContent":["import type { SkImageFilter, SkColor, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n DeclarationContext,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { processRadius, enumKey } from \"../datatypes\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nexport abstract class ImageFilterDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.ImageFilter, type, props);\n }\n\n protected input(ctx: DeclarationContext) {\n return ctx.imageFilters.pop() ?? null;\n }\n\n protected composeAndPush(ctx: DeclarationContext, imgf1: SkImageFilter) {\n ctx.save();\n this.decorateChildren(ctx);\n let imgf2 = ctx.imageFilters.popAllAsOne();\n const cf = ctx.colorFilters.popAllAsOne();\n ctx.restore();\n if (cf) {\n imgf2 = this.Skia.ImageFilter.MakeCompose(\n imgf2 ?? null,\n this.Skia.ImageFilter.MakeColorFilter(cf, null)\n );\n }\n const imgf = imgf2\n ? this.Skia.ImageFilter.MakeCompose(imgf1, imgf2)\n : imgf1;\n ctx.imageFilters.push(imgf);\n }\n}\n\nexport class OffsetImageFilterNode extends ImageFilterDeclaration<OffsetImageFilterProps> {\n constructor(ctx: NodeContext, props: OffsetImageFilterProps) {\n super(ctx, NodeType.OffsetImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const { x, y } = this.props;\n const imgf = this.Skia.ImageFilter.MakeOffset(x, y, null);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DisplacementMapImageFilterNode extends ImageFilterDeclaration<DisplacementMapImageFilterProps> {\n constructor(ctx: NodeContext, props: DisplacementMapImageFilterProps) {\n super(ctx, NodeType.DisplacementMapImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { channelX, channelY, scale } = this.props;\n const imgf = this.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n ctx.imageFilters.pop()!,\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class BlurImageFilterNode extends ImageFilterDeclaration<BlurImageFilterProps> {\n constructor(ctx: NodeContext, props: BlurImageFilterProps) {\n super(ctx, NodeType.BlurImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode, blur } = this.props;\n const sigma = processRadius(this.Skia, blur);\n const imgf = this.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class DropShadowImageFilterNode extends ImageFilterDeclaration<DropShadowImageFilterProps> {\n constructor(ctx: NodeContext, props: DropShadowImageFilterProps) {\n super(ctx, NodeType.DropShadowImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { dx, dy, blur, shadowOnly, color: cl, inner } = this.props;\n const color = this.Skia.Color(cl);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, this.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? this.Skia.ImageFilter.MakeDropShadowOnly.bind(this.Skia.ImageFilter)\n : this.Skia.ImageFilter.MakeDropShadow.bind(this.Skia.ImageFilter);\n }\n const imgf = factory(dx, dy, blur, blur, color, this.input(ctx));\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nexport class MorphologyImageFilterNode extends ImageFilterDeclaration<MorphologyImageFilterProps> {\n constructor(ctx: NodeContext, props: MorphologyImageFilterProps) {\n super(ctx, NodeType.MorphologyImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { operator } = this.props;\n const r = processRadius(this.Skia, this.props.radius);\n let imgf;\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n imgf = this.Skia.ImageFilter.MakeErode(r.x, r.y, this.input(ctx));\n } else {\n imgf = this.Skia.ImageFilter.MakeDilate(r.x, r.y, this.input(ctx));\n }\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class BlendImageFilterNode extends ImageFilterDeclaration<BlendImageFilterProps> {\n constructor(ctx: NodeContext, props: BlendImageFilterProps) {\n super(ctx, NodeType.BlendImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { mode } = this.props;\n const a = ctx.imageFilters.pop();\n const b = ctx.imageFilters.pop();\n if (!a || !b) {\n throw new Error(\"BlendImageFilter requires two image filters\");\n }\n const imgf = this.Skia.ImageFilter.MakeBlend(mode, a, b);\n this.composeAndPush(ctx, imgf);\n }\n}\n\nexport class RuntimeShaderImageFilterNode extends ImageFilterDeclaration<RuntimeShaderImageFilterProps> {\n constructor(ctx: NodeContext, props: RuntimeShaderImageFilterProps) {\n super(ctx, NodeType.RuntimeShaderImageFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { source, uniforms } = this.props;\n const rtb = this.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const imgf = this.Skia.ImageFilter.MakeRuntimeShader(\n rtb,\n null,\n this.input(ctx)\n );\n this.composeAndPush(ctx, imgf);\n }\n}\n"],"mappings":";;;;;;;AACA;;AAgBA;;AACA;;AAEA;;AAEA,MAAMA,KAAK,GAAGC,YAAY,CAACC,EAAb,CAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,CAAd;;AAEA,MAAMC,eAAe,GAAG,CACtBC,IADsB,EAEtBC,UAFsB,EAGtBC,EAHsB,EAItBC,EAJsB,EAKtBC,MALsB,EAMtBC,MANsB,EAOtBC,KAPsB,EAQtBC,KARsB,KASnB;EACH,MAAMC,aAAa,GAAGR,IAAI,CAACS,WAAL,CAAiBC,eAAjB,CACpBV,IAAI,CAACW,WAAL,CAAiBC,SAAjB,CAA2BhB,KAA3B,EAAkCiB,gBAAA,CAAUC,GAA5C,CADoB,EAEpB,IAFoB,CAAtB;EAIA,MAAMC,WAAW,GAAGf,IAAI,CAACS,WAAL,CAAiBC,eAAjB,CAClBV,IAAI,CAACW,WAAL,CAAiBC,SAAjB,CAA2BhB,KAA3B,EAAkCiB,gBAAA,CAAUG,KAA5C,CADkB,EAElB,IAFkB,CAApB;EAIA,MAAMC,EAAE,GAAGjB,IAAI,CAACS,WAAL,CAAiBC,eAAjB,CACTV,IAAI,CAACW,WAAL,CAAiBC,SAAjB,CAA2BN,KAA3B,EAAkCO,gBAAA,CAAUK,MAA5C,CADS,EAET,IAFS,CAAX;EAIA,MAAMC,EAAE,GAAGnB,IAAI,CAACS,WAAL,CAAiBW,UAAjB,CAA4B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AAyD;IAClE,MAAMF,GAAN,EAAWkB,gBAAA,CAAS2C,wBAApB,EAA8C3D,KAA9C;EACD;;EAEDkB,QAAQ,CAACpB,GAAD,EAA0B;IAChC,MAAM;MAAE8D,MAAF;MAAUC;IAAV,IAAuB,KAAK7D,KAAlC;IACA,MAAM8D,GAAG,GAAG,KAAK/F,IAAL,CAAUgG,oBAAV,CAA+BH,MAA/B,CAAZ;;IACA,IAAIC,QAAJ,EAAc;MACZ,IAAAG,sBAAA,EAAgBJ,MAAhB,EAAwBC,QAAxB,EAAkCC,GAAlC;IACD;;IACD,MAAMjD,IAAI,GAAG,KAAK9C,IAAL,CAAUS,WAAV,CAAsByF,iBAAtB,CACXH,GADW,EAEX,IAFW,EAGX,KAAKxF,KAAL,CAAWwB,GAAX,CAHW,CAAb;IAKA,KAAKM,cAAL,CAAoBN,GAApB,EAAyBe,IAAzB;EACD;;AAjBqG"}
@@ -1,8 +1,8 @@
1
- import type { SkMaskFilter } from "../../../skia/types";
2
1
  import type { NodeContext } from "../Node";
3
2
  import { JsiDeclarationNode } from "../Node";
4
3
  import type { BlurMaskFilterProps } from "../../types";
5
- export declare class BlurMaskFilterNode extends JsiDeclarationNode<BlurMaskFilterProps, SkMaskFilter> {
4
+ import type { DeclarationContext } from "../../types/DeclarationContext";
5
+ export declare class BlurMaskFilterNode extends JsiDeclarationNode<BlurMaskFilterProps> {
6
6
  constructor(ctx: NodeContext, props: BlurMaskFilterProps);
7
- materialize(): SkMaskFilter;
7
+ decorate(ctx: DeclarationContext): void;
8
8
  }
@@ -18,13 +18,14 @@ class BlurMaskFilterNode extends _Node.JsiDeclarationNode {
18
18
  super(ctx, _types2.DeclarationType.MaskFilter, _types2.NodeType.BlurMaskFilter, props);
19
19
  }
20
20
 
21
- materialize() {
21
+ decorate(ctx) {
22
22
  const {
23
23
  style,
24
24
  blur,
25
25
  respectCTM
26
26
  } = this.props;
27
- return this.Skia.MaskFilter.MakeBlur(_types.BlurStyle[(0, _datatypes.enumKey)(style)], blur, respectCTM);
27
+ const mf = this.Skia.MaskFilter.MakeBlur(_types.BlurStyle[(0, _datatypes.enumKey)(style)], blur, respectCTM);
28
+ ctx.maskFilters.push(mf);
28
29
  }
29
30
 
30
31
  }
@@ -1 +1 @@
1
- {"version":3,"names":["BlurMaskFilterNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","MaskFilter","NodeType","BlurMaskFilter","materialize","style","blur","respectCTM","Skia","MakeBlur","BlurStyle","enumKey"],"sources":["MaskFilters.ts"],"sourcesContent":["import type { SkMaskFilter } from \"../../../skia/types\";\nimport { BlurStyle } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type { BlurMaskFilterProps } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes\";\n\nexport class BlurMaskFilterNode extends JsiDeclarationNode<\n BlurMaskFilterProps,\n SkMaskFilter\n> {\n constructor(ctx: NodeContext, props: BlurMaskFilterProps) {\n super(ctx, DeclarationType.MaskFilter, NodeType.BlurMaskFilter, props);\n }\n\n materialize() {\n const { style, blur, respectCTM } = this.props;\n return this.Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n }\n}\n"],"mappings":";;;;;;;AACA;;AAEA;;AAEA;;AACA;;AAEO,MAAMA,kBAAN,SAAiCC,wBAAjC,CAGL;EACAC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAA+C;IACxD,MAAMD,GAAN,EAAWE,uBAAA,CAAgBC,UAA3B,EAAuCC,gBAAA,CAASC,cAAhD,EAAgEJ,KAAhE;EACD;;EAEDK,WAAW,GAAG;IACZ,MAAM;MAAEC,KAAF;MAASC,IAAT;MAAeC;IAAf,IAA8B,KAAKR,KAAzC;IACA,OAAO,KAAKS,IAAL,CAAUP,UAAV,CAAqBQ,QAArB,CACLC,gBAAA,CAAU,IAAAC,kBAAA,EAAQN,KAAR,CAAV,CADK,EAELC,IAFK,EAGLC,UAHK,CAAP;EAKD;;AAZD"}
1
+ {"version":3,"names":["BlurMaskFilterNode","JsiDeclarationNode","constructor","ctx","props","DeclarationType","MaskFilter","NodeType","BlurMaskFilter","decorate","style","blur","respectCTM","mf","Skia","MakeBlur","BlurStyle","enumKey","maskFilters","push"],"sources":["MaskFilters.ts"],"sourcesContent":["import { BlurStyle } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type { BlurMaskFilterProps } from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\n\nexport class BlurMaskFilterNode extends JsiDeclarationNode<BlurMaskFilterProps> {\n constructor(ctx: NodeContext, props: BlurMaskFilterProps) {\n super(ctx, DeclarationType.MaskFilter, NodeType.BlurMaskFilter, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { style, blur, respectCTM } = this.props;\n const mf = this.Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n ctx.maskFilters.push(mf);\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;AACA;;AAGO,MAAMA,kBAAN,SAAiCC,wBAAjC,CAAyE;EAC9EC,WAAW,CAACC,GAAD,EAAmBC,KAAnB,EAA+C;IACxD,MAAMD,GAAN,EAAWE,uBAAA,CAAgBC,UAA3B,EAAuCC,gBAAA,CAASC,cAAhD,EAAgEJ,KAAhE;EACD;;EAEDK,QAAQ,CAACN,GAAD,EAA0B;IAChC,MAAM;MAAEO,KAAF;MAASC,IAAT;MAAeC;IAAf,IAA8B,KAAKR,KAAzC;IACA,MAAMS,EAAE,GAAG,KAAKC,IAAL,CAAUR,UAAV,CAAqBS,QAArB,CACTC,gBAAA,CAAU,IAAAC,kBAAA,EAAQP,KAAR,CAAV,CADS,EAETC,IAFS,EAGTC,UAHS,CAAX;IAKAT,GAAG,CAACe,WAAJ,CAAgBC,IAAhB,CAAqBN,EAArB;EACD;;AAb6E"}
@@ -1,42 +1,39 @@
1
1
  import type { SkPathEffect } from "../../../skia/types";
2
2
  import type { NodeContext } from "../Node";
3
3
  import { JsiDeclarationNode } from "../Node";
4
- import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps, Node, Path1DPathEffectProps, Path2DPathEffectProps } from "../../types";
4
+ import type { CornerPathEffectProps, DashPathEffectProps, DiscretePathEffectProps, Line2DPathEffectProps, Path1DPathEffectProps, Path2DPathEffectProps } from "../../types";
5
5
  import { NodeType } from "../../types";
6
- declare abstract class PathEffectDeclaration<P, Nullable extends null | never = never> extends JsiDeclarationNode<P, SkPathEffect, Nullable> {
6
+ import type { DeclarationContext } from "../../types/DeclarationContext";
7
+ declare abstract class PathEffectDeclaration<P> extends JsiDeclarationNode<P> {
7
8
  constructor(ctx: NodeContext, type: NodeType, props: P);
8
- addChild(child: Node<unknown>): void;
9
- insertChildBefore(child: Node<unknown>, before: Node<unknown>): void;
10
- compose(pe: SkPathEffect): SkPathEffect;
11
- getOptionalChildInstance(index: number): any;
12
- getMandatoryChildInstance(index: number): any;
9
+ protected composeAndPush(ctx: DeclarationContext, pe1: SkPathEffect): void;
13
10
  }
14
11
  export declare class DiscretePathEffectNode extends PathEffectDeclaration<DiscretePathEffectProps> {
15
12
  constructor(ctx: NodeContext, props: DiscretePathEffectProps);
16
- materialize(): SkPathEffect;
13
+ decorate(ctx: DeclarationContext): void;
17
14
  }
18
- export declare class Path2DPathEffectNode extends PathEffectDeclaration<Path2DPathEffectProps, null> {
15
+ export declare class Path2DPathEffectNode extends PathEffectDeclaration<Path2DPathEffectProps> {
19
16
  constructor(ctx: NodeContext, props: Path2DPathEffectProps);
20
- materialize(): SkPathEffect | null;
17
+ decorate(ctx: DeclarationContext): void;
21
18
  }
22
19
  export declare class DashPathEffectNode extends PathEffectDeclaration<DashPathEffectProps> {
23
20
  constructor(ctx: NodeContext, props: DashPathEffectProps);
24
- materialize(): SkPathEffect;
21
+ decorate(ctx: DeclarationContext): void;
25
22
  }
26
- export declare class CornerPathEffectNode extends PathEffectDeclaration<CornerPathEffectProps, null> {
23
+ export declare class CornerPathEffectNode extends PathEffectDeclaration<CornerPathEffectProps> {
27
24
  constructor(ctx: NodeContext, props: CornerPathEffectProps);
28
- materialize(): SkPathEffect | null;
25
+ decorate(ctx: DeclarationContext): void;
29
26
  }
30
27
  export declare class SumPathEffectNode extends PathEffectDeclaration<null> {
31
28
  constructor(ctx: NodeContext);
32
- materialize(): SkPathEffect;
29
+ decorate(ctx: DeclarationContext): void;
33
30
  }
34
- export declare class Line2DPathEffectNode extends PathEffectDeclaration<Line2DPathEffectProps, null> {
31
+ export declare class Line2DPathEffectNode extends PathEffectDeclaration<Line2DPathEffectProps> {
35
32
  constructor(ctx: NodeContext, props: Line2DPathEffectProps);
36
- materialize(): SkPathEffect | null;
33
+ decorate(ctx: DeclarationContext): void;
37
34
  }
38
- export declare class Path1DPathEffectNode extends PathEffectDeclaration<Path1DPathEffectProps, null> {
35
+ export declare class Path1DPathEffectNode extends PathEffectDeclaration<Path1DPathEffectProps> {
39
36
  constructor(ctx: NodeContext, props: Path1DPathEffectProps);
40
- materialize(): SkPathEffect | null;
37
+ decorate(ctx: DeclarationContext): void;
41
38
  }
42
39
  export {};
@@ -15,65 +15,20 @@ var _Enum = require("../datatypes/Enum");
15
15
 
16
16
  var _datatypes = require("../datatypes");
17
17
 
18
+ var _DeclarationContext = require("../../types/DeclarationContext");
19
+
18
20
  class PathEffectDeclaration extends _Node.JsiDeclarationNode {
19
21
  constructor(ctx, type, props) {
20
22
  super(ctx, _types2.DeclarationType.PathEffect, type, props);
21
23
  }
22
24
 
23
- addChild(child) {
24
- if (!(child instanceof PathEffectDeclaration)) {
25
- throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
26
- }
27
-
28
- super.addChild(child);
29
- }
30
-
31
- insertChildBefore(child, before) {
32
- if (!(child instanceof PathEffectDeclaration)) {
33
- throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);
34
- }
35
-
36
- super.insertChildBefore(child, before);
37
- }
38
-
39
- compose(pe) {
40
- const children = this._children;
41
-
42
- if (this._children.length === 0) {
43
- return pe;
44
- } else {
45
- return this.Skia.PathEffect.MakeCompose(pe, children.reduce((acc, child) => {
46
- if (acc === null) {
47
- return child.materialize();
48
- }
49
-
50
- return this.Skia.PathEffect.MakeCompose(acc, child.materialize());
51
- }, null));
52
- }
53
- }
54
-
55
- getOptionalChildInstance(index) {
56
- const child = this._children[index];
57
-
58
- if (!child) {
59
- return null;
60
- }
61
-
62
- return this.getMandatoryChildInstance(index);
63
- }
64
-
65
- getMandatoryChildInstance(index) {
66
- const child = this._children[index];
67
-
68
- if (child instanceof _Node.JsiDeclarationNode) {
69
- if (child.isPathEffect()) {
70
- return child.materialize();
71
- } else {
72
- throw new Error(`Found invalid child ${child.type} in ${this.type}`);
73
- }
74
- } else {
75
- throw new Error(`Found invalid child ${child.type} in ${this.type}`);
76
- }
25
+ composeAndPush(ctx, pe1) {
26
+ ctx.save();
27
+ this.decorateChildren(ctx);
28
+ const pe2 = ctx.pathEffects.popAllAsOne();
29
+ ctx.restore();
30
+ const pe = pe2 ? this.Skia.PathEffect.MakeCompose(pe1, pe2) : pe1;
31
+ ctx.pathEffects.push(pe);
77
32
  }
78
33
 
79
34
  }
@@ -83,14 +38,14 @@ class DiscretePathEffectNode extends PathEffectDeclaration {
83
38
  super(ctx, _types2.NodeType.DiscretePathEffect, props);
84
39
  }
85
40
 
86
- materialize() {
41
+ decorate(ctx) {
87
42
  const {
88
43
  length,
89
44
  deviation,
90
45
  seed
91
46
  } = this.props;
92
47
  const pe = this.Skia.PathEffect.MakeDiscrete(length, deviation, seed);
93
- return this.compose(pe);
48
+ this.composeAndPush(ctx, pe);
94
49
  }
95
50
 
96
51
  }
@@ -102,7 +57,7 @@ class Path2DPathEffectNode extends PathEffectDeclaration {
102
57
  super(ctx, _types2.NodeType.Path2DPathEffect, props);
103
58
  }
104
59
 
105
- materialize() {
60
+ decorate(ctx) {
106
61
  const {
107
62
  matrix
108
63
  } = this.props;
@@ -110,10 +65,10 @@ class Path2DPathEffectNode extends PathEffectDeclaration {
110
65
  const pe = this.Skia.PathEffect.MakePath2D(matrix, path);
111
66
 
112
67
  if (pe === null) {
113
- return null;
68
+ throw new Error("Path2DPathEffectNode: invalid path");
114
69
  }
115
70
 
116
- return this.compose(pe);
71
+ this.composeAndPush(ctx, pe);
117
72
  }
118
73
 
119
74
  }
@@ -125,13 +80,13 @@ class DashPathEffectNode extends PathEffectDeclaration {
125
80
  super(ctx, _types2.NodeType.DashPathEffect, props);
126
81
  }
127
82
 
128
- materialize() {
83
+ decorate(ctx) {
129
84
  const {
130
85
  intervals,
131
86
  phase
132
87
  } = this.props;
133
88
  const pe = this.Skia.PathEffect.MakeDash(intervals, phase);
134
- return this.compose(pe);
89
+ this.composeAndPush(ctx, pe);
135
90
  }
136
91
 
137
92
  }
@@ -143,17 +98,17 @@ class CornerPathEffectNode extends PathEffectDeclaration {
143
98
  super(ctx, _types2.NodeType.CornerPathEffect, props);
144
99
  }
145
100
 
146
- materialize() {
101
+ decorate(ctx) {
147
102
  const {
148
103
  r
149
104
  } = this.props;
150
105
  const pe = this.Skia.PathEffect.MakeCorner(r);
151
106
 
152
107
  if (pe === null) {
153
- return null;
108
+ throw new Error("CornerPathEffectNode: couldn't create path effect");
154
109
  }
155
110
 
156
- return this.compose(pe);
111
+ this.composeAndPush(ctx, pe);
157
112
  }
158
113
 
159
114
  }
@@ -165,8 +120,11 @@ class SumPathEffectNode extends PathEffectDeclaration {
165
120
  super(ctx, _types2.NodeType.SumPathEffect, null);
166
121
  }
167
122
 
168
- materialize() {
169
- return this.Skia.PathEffect.MakeSum(this.getMandatoryChildInstance(0), this.getMandatoryChildInstance(1));
123
+ decorate(ctx) {
124
+ this.decorateChildren(ctx);
125
+ const pes = ctx.pathEffects.popAll();
126
+ const pe = (0, _DeclarationContext.composeDeclarations)(pes, this.Skia.PathEffect.MakeSum.bind(this.Skia.PathEffect));
127
+ ctx.pathEffects.push(pe);
170
128
  }
171
129
 
172
130
  }
@@ -178,7 +136,7 @@ class Line2DPathEffectNode extends PathEffectDeclaration {
178
136
  super(ctx, _types2.NodeType.Line2DPathEffect, props);
179
137
  }
180
138
 
181
- materialize() {
139
+ decorate(ctx) {
182
140
  const {
183
141
  width,
184
142
  matrix
@@ -186,10 +144,10 @@ class Line2DPathEffectNode extends PathEffectDeclaration {
186
144
  const pe = this.Skia.PathEffect.MakeLine2D(width, matrix);
187
145
 
188
146
  if (pe === null) {
189
- return null;
147
+ throw new Error("Line2DPathEffectNode: could not create path effect");
190
148
  }
191
149
 
192
- return this.compose(pe);
150
+ this.composeAndPush(ctx, pe);
193
151
  }
194
152
 
195
153
  }
@@ -201,7 +159,7 @@ class Path1DPathEffectNode extends PathEffectDeclaration {
201
159
  super(ctx, _types2.NodeType.Path1DPathEffect, props);
202
160
  }
203
161
 
204
- materialize() {
162
+ decorate(ctx) {
205
163
  const {
206
164
  advance,
207
165
  phase,
@@ -211,10 +169,10 @@ class Path1DPathEffectNode extends PathEffectDeclaration {
211
169
  const pe = this.Skia.PathEffect.MakePath1D(path, advance, phase, _types.Path1DEffectStyle[(0, _Enum.enumKey)(style)]);
212
170
 
213
171
  if (pe === null) {
214
- return null;
172
+ throw new Error("Path1DPathEffectNode: could not create path effect");
215
173
  }
216
174
 
217
- return this.compose(pe);
175
+ this.composeAndPush(ctx, pe);
218
176
  }
219
177
 
220
178
  }
@@ -1 +1 @@
1
- {"version":3,"names":["PathEffectDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","PathEffect","addChild","child","Error","insertChildBefore","before","compose","pe","children","_children","length","Skia","MakeCompose","reduce","acc","materialize","getOptionalChildInstance","index","getMandatoryChildInstance","isPathEffect","DiscretePathEffectNode","NodeType","DiscretePathEffect","deviation","seed","MakeDiscrete","Path2DPathEffectNode","Path2DPathEffect","matrix","path","processPath","MakePath2D","DashPathEffectNode","DashPathEffect","intervals","phase","MakeDash","CornerPathEffectNode","CornerPathEffect","r","MakeCorner","SumPathEffectNode","SumPathEffect","MakeSum","Line2DPathEffectNode","Line2DPathEffect","width","MakeLine2D","Path1DPathEffectNode","Path1DPathEffect","advance","style","MakePath1D","Path1DEffectStyle","enumKey"],"sources":["PathEffects.ts"],"sourcesContent":["import { Path1DEffectStyle } from \"../../../skia/types\";\nimport type { SkPathEffect } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Node,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport { processPath } from \"../datatypes\";\n\nabstract class PathEffectDeclaration<\n P,\n Nullable extends null | never = never\n> extends JsiDeclarationNode<P, SkPathEffect, Nullable> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.PathEffect, type, props);\n }\n\n addChild(child: Node<unknown>) {\n if (!(child instanceof PathEffectDeclaration)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.addChild(child);\n }\n\n insertChildBefore(child: Node<unknown>, before: Node<unknown>): void {\n if (!(child instanceof PathEffectDeclaration)) {\n throw new Error(`Cannot add child of type ${child.type} to ${this.type}`);\n }\n super.insertChildBefore(child, before);\n }\n\n compose(pe: SkPathEffect) {\n const children = this._children as PathEffectDeclaration<unknown>[];\n if (this._children.length === 0) {\n return pe;\n } else {\n return this.Skia.PathEffect.MakeCompose(\n pe,\n children.reduce<SkPathEffect | null>((acc, child) => {\n if (acc === null) {\n return child.materialize();\n }\n return this.Skia.PathEffect.MakeCompose(acc, child.materialize());\n }, null) as SkPathEffect\n );\n }\n }\n getOptionalChildInstance(index: number) {\n const child = this._children[index];\n if (!child) {\n return null;\n }\n return this.getMandatoryChildInstance(index);\n }\n\n getMandatoryChildInstance(index: number) {\n const child = this._children[index];\n if (child instanceof JsiDeclarationNode) {\n if (child.isPathEffect()) {\n return child.materialize();\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n } else {\n throw new Error(`Found invalid child ${child.type} in ${this.type}`);\n }\n }\n}\n\nexport class DiscretePathEffectNode extends PathEffectDeclaration<DiscretePathEffectProps> {\n constructor(ctx: NodeContext, props: DiscretePathEffectProps) {\n super(ctx, NodeType.DiscretePathEffect, props);\n }\n\n materialize() {\n const { length, deviation, seed } = this.props;\n const pe = this.Skia.PathEffect.MakeDiscrete(length, deviation, seed);\n return this.compose(pe);\n }\n}\n\nexport class Path2DPathEffectNode extends PathEffectDeclaration<\n Path2DPathEffectProps,\n null\n> {\n constructor(ctx: NodeContext, props: Path2DPathEffectProps) {\n super(ctx, NodeType.Path2DPathEffect, props);\n }\n\n materialize() {\n const { matrix } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath2D(matrix, path);\n if (pe === null) {\n return null;\n }\n return this.compose(pe);\n }\n}\n\nexport class DashPathEffectNode extends PathEffectDeclaration<DashPathEffectProps> {\n constructor(ctx: NodeContext, props: DashPathEffectProps) {\n super(ctx, NodeType.DashPathEffect, props);\n }\n\n materialize() {\n const { intervals, phase } = this.props;\n const pe = this.Skia.PathEffect.MakeDash(intervals, phase);\n return this.compose(pe);\n }\n}\n\nexport class CornerPathEffectNode extends PathEffectDeclaration<\n CornerPathEffectProps,\n null\n> {\n constructor(ctx: NodeContext, props: CornerPathEffectProps) {\n super(ctx, NodeType.CornerPathEffect, props);\n }\n\n materialize() {\n const { r } = this.props;\n const pe = this.Skia.PathEffect.MakeCorner(r);\n if (pe === null) {\n return null;\n }\n return this.compose(pe);\n }\n}\n\nexport class SumPathEffectNode extends PathEffectDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SumPathEffect, null);\n }\n\n materialize() {\n return this.Skia.PathEffect.MakeSum(\n this.getMandatoryChildInstance(0),\n this.getMandatoryChildInstance(1)\n );\n }\n}\n\nexport class Line2DPathEffectNode extends PathEffectDeclaration<\n Line2DPathEffectProps,\n null\n> {\n constructor(ctx: NodeContext, props: Line2DPathEffectProps) {\n super(ctx, NodeType.Line2DPathEffect, props);\n }\n\n materialize() {\n const { width, matrix } = this.props;\n const pe = this.Skia.PathEffect.MakeLine2D(width, matrix);\n if (pe === null) {\n return null;\n }\n return this.compose(pe);\n }\n}\n\nexport class Path1DPathEffectNode extends PathEffectDeclaration<\n Path1DPathEffectProps,\n null\n> {\n constructor(ctx: NodeContext, props: Path1DPathEffectProps) {\n super(ctx, NodeType.Path1DPathEffect, props);\n }\n\n materialize() {\n const { advance, phase, style } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath1D(\n path,\n advance,\n phase,\n Path1DEffectStyle[enumKey(style)]\n );\n if (pe === null) {\n return null;\n }\n return this.compose(pe);\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAGA;;AAUA;;AACA;;AACA;;AAEA,MAAeA,qBAAf,SAGUC,wBAHV,CAGwD;EACtDC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWG,uBAAA,CAAgBC,UAA3B,EAAuCH,IAAvC,EAA6CC,KAA7C;EACD;;EAEDG,QAAQ,CAACC,KAAD,EAAuB;IAC7B,IAAI,EAAEA,KAAK,YAAYT,qBAAnB,CAAJ,EAA+C;MAC7C,MAAM,IAAIU,KAAJ,CAAW,4BAA2BD,KAAK,CAACL,IAAK,OAAM,KAAKA,IAAK,EAAjE,CAAN;IACD;;IACD,MAAMI,QAAN,CAAeC,KAAf;EACD;;EAEDE,iBAAiB,CAACF,KAAD,EAAuBG,MAAvB,EAAoD;IACnE,IAAI,EAAEH,KAAK,YAAYT,qBAAnB,CAAJ,EAA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sC/C,KAAtC;EACD;;EAEDiB,WAAW,GAAG;IACZ,MAAM;MAAE+B,KAAF;MAASlB;IAAT,IAAoB,KAAK9B,KAA/B;IACA,MAAMS,EAAE,GAAG,KAAKI,IAAL,CAAUX,UAAV,CAAqB+C,UAArB,CAAgCD,KAAhC,EAAuClB,MAAvC,CAAX;;IACA,IAAIrB,EAAE,KAAK,IAAX,EAAiB;MACf,OAAO,IAAP;IACD;;IACD,OAAO,KAAKD,OAAL,CAAaC,EAAb,CAAP;EACD;;AAZD;;;;AAeK,MAAMyC,oBAAN,SAAmCvD,qBAAnC,CAGL;EACAE,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAiD;IAC1D,MAAMF,GAAN,EAAWyB,gBAAA,CAAS4B,gBAApB,EAAsCnD,KAAtC;EACD;;EAEDiB,WAAW,GAAG;IACZ,MAAM;MAAEmC,OAAF;MAAWf,KAAX;MAAkBgB;IAAlB,IAA4B,KAAKrD,KAAvC;IACA,MAAM+B,IAAI,GAAG,IAAAC,sBAAA,EAAY,KAAKnB,IAAjB,EAAuB,KAAKb,KAAL,CAAW+B,IAAlC,CAAb;IACA,MAAMtB,EAAE,GAAG,KAAKI,IAAL,CAAUX,UAAV,CAAqBoD,UAArB,CACTvB,IADS,EAETqB,OAFS,EAGTf,KAHS,EAITkB,wBAAA,CAAkB,IAAAC,aAAA,EAAQH,KAAR,CAAlB,CAJS,CAAX;;IAMA,IAAI5C,EAAE,KAAK,IAAX,EAAiB;MACf,OAAO,IAAP;IACD;;IACD,OAAO,KAAKD,OAAL,CAAaC,EAAb,CAAP;EACD;;AAlBD"}
1
+ {"version":3,"names":["PathEffectDeclaration","JsiDeclarationNode","constructor","ctx","type","props","DeclarationType","PathEffect","composeAndPush","pe1","save","decorateChildren","pe2","pathEffects","popAllAsOne","restore","pe","Skia","MakeCompose","push","DiscretePathEffectNode","NodeType","DiscretePathEffect","decorate","length","deviation","seed","MakeDiscrete","Path2DPathEffectNode","Path2DPathEffect","matrix","path","processPath","MakePath2D","Error","DashPathEffectNode","DashPathEffect","intervals","phase","MakeDash","CornerPathEffectNode","CornerPathEffect","r","MakeCorner","SumPathEffectNode","SumPathEffect","pes","popAll","composeDeclarations","MakeSum","bind","Line2DPathEffectNode","Line2DPathEffect","width","MakeLine2D","Path1DPathEffectNode","Path1DPathEffect","advance","style","MakePath1D","Path1DEffectStyle","enumKey"],"sources":["PathEffects.ts"],"sourcesContent":["import { Path1DEffectStyle } from \"../../../skia/types\";\nimport type { SkPathEffect } from \"../../../skia/types\";\nimport type { NodeContext } from \"../Node\";\nimport { JsiDeclarationNode } from \"../Node\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../../types\";\nimport { DeclarationType, NodeType } from \"../../types\";\nimport { enumKey } from \"../datatypes/Enum\";\nimport { processPath } from \"../datatypes\";\nimport type { DeclarationContext } from \"../../types/DeclarationContext\";\nimport { composeDeclarations } from \"../../types/DeclarationContext\";\n\nabstract class PathEffectDeclaration<P> extends JsiDeclarationNode<P> {\n constructor(ctx: NodeContext, type: NodeType, props: P) {\n super(ctx, DeclarationType.PathEffect, type, props);\n }\n\n protected composeAndPush(ctx: DeclarationContext, pe1: SkPathEffect) {\n ctx.save();\n this.decorateChildren(ctx);\n const pe2 = ctx.pathEffects.popAllAsOne();\n ctx.restore();\n const pe = pe2 ? this.Skia.PathEffect.MakeCompose(pe1, pe2) : pe1;\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class DiscretePathEffectNode extends PathEffectDeclaration<DiscretePathEffectProps> {\n constructor(ctx: NodeContext, props: DiscretePathEffectProps) {\n super(ctx, NodeType.DiscretePathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { length, deviation, seed } = this.props;\n const pe = this.Skia.PathEffect.MakeDiscrete(length, deviation, seed);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path2DPathEffectNode extends PathEffectDeclaration<Path2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path2DPathEffectProps) {\n super(ctx, NodeType.Path2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { matrix } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath2D(matrix, path);\n if (pe === null) {\n throw new Error(\"Path2DPathEffectNode: invalid path\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class DashPathEffectNode extends PathEffectDeclaration<DashPathEffectProps> {\n constructor(ctx: NodeContext, props: DashPathEffectProps) {\n super(ctx, NodeType.DashPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { intervals, phase } = this.props;\n const pe = this.Skia.PathEffect.MakeDash(intervals, phase);\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class CornerPathEffectNode extends PathEffectDeclaration<CornerPathEffectProps> {\n constructor(ctx: NodeContext, props: CornerPathEffectProps) {\n super(ctx, NodeType.CornerPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { r } = this.props;\n const pe = this.Skia.PathEffect.MakeCorner(r);\n if (pe === null) {\n throw new Error(\"CornerPathEffectNode: couldn't create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class SumPathEffectNode extends PathEffectDeclaration<null> {\n constructor(ctx: NodeContext) {\n super(ctx, NodeType.SumPathEffect, null);\n }\n\n decorate(ctx: DeclarationContext) {\n this.decorateChildren(ctx);\n const pes = ctx.pathEffects.popAll();\n const pe = composeDeclarations(\n pes,\n this.Skia.PathEffect.MakeSum.bind(this.Skia.PathEffect)\n );\n ctx.pathEffects.push(pe);\n }\n}\n\nexport class Line2DPathEffectNode extends PathEffectDeclaration<Line2DPathEffectProps> {\n constructor(ctx: NodeContext, props: Line2DPathEffectProps) {\n super(ctx, NodeType.Line2DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { width, matrix } = this.props;\n const pe = this.Skia.PathEffect.MakeLine2D(width, matrix);\n if (pe === null) {\n throw new Error(\"Line2DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n\nexport class Path1DPathEffectNode extends PathEffectDeclaration<Path1DPathEffectProps> {\n constructor(ctx: NodeContext, props: Path1DPathEffectProps) {\n super(ctx, NodeType.Path1DPathEffect, props);\n }\n\n decorate(ctx: DeclarationContext) {\n const { advance, phase, style } = this.props;\n const path = processPath(this.Skia, this.props.path);\n const pe = this.Skia.PathEffect.MakePath1D(\n path,\n advance,\n phase,\n Path1DEffectStyle[enumKey(style)]\n );\n if (pe === null) {\n throw new Error(\"Path1DPathEffectNode: could not create path effect\");\n }\n this.composeAndPush(ctx, pe);\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAGA;;AASA;;AACA;;AACA;;AAEA;;AAEA,MAAeA,qBAAf,SAAgDC,wBAAhD,CAAsE;EACpEC,WAAW,CAACC,GAAD,EAAmBC,IAAnB,EAAmCC,KAAnC,EAA6C;IACtD,MAAMF,GAAN,EAAWG,uBAAA,CAAgBC,UAA3B,EAAuCH,IAAvC,EAA6CC,KAA7C;EACD;;EAESG,cAAc,CAACL,GAAD,EAA0BM,GAA1B,EAA6C;IACnEN,GAAG,CAACO,IAAJ;IACA,KAAKC,gBAAL,CAAsBR,GAAtB;IACA,MAAMS,GAAG,GAAGT,GAAG,CAACU,WAAJ,CAAgBC,WAAhB,EAAZ;IACAX,GAAG,CAACY,OAAJ;IACA,MAAMC,EAAE,GAAGJ,GAAG,GAAG,KAAKK,IAAL,CAAUV,UAAV,CAAqBW,WAArB,CAAiCT,GAAjC,EAAsCG,GAAtC,CAAH,GAAgDH,GAA9D;IACAN,GAAG,CAACU,WAAJ,CAAgBM,IAAhB,CAAqBH,EAArB;EACD;;AAZmE;;AAe/D,MAAMI,sBAAN,SAAqCpB,qBAArC,CAAoF;EACzFE,WAAW,CAACC,GAAD,EAAmBE,KAAnB,EAAmD;IAC5D,MAAMF,GAAN,EAAWkB,gBAAA,CAASC,kBAApB,E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