@shopify/react-native-skia 0.1.163 → 0.1.165

Sign up to get free protection for your applications and to get access to all the features.
Files changed (303) hide show
  1. package/cpp/api/JsiSkPaint.h +6 -0
  2. package/cpp/api/JsiSkRuntimeEffect.h +7 -2
  3. package/cpp/jsi/JsiHostObject.h +25 -25
  4. package/cpp/rnskia/RNSkDomView.cpp +1 -1
  5. package/cpp/rnskia/RNSkPlatformContext.h +2 -6
  6. package/cpp/rnskia/dom/base/DrawingContext.cpp +23 -41
  7. package/cpp/rnskia/dom/base/DrawingContext.h +6 -19
  8. package/cpp/rnskia/dom/base/JsiDomDeclarationNode.h +12 -2
  9. package/cpp/rnskia/dom/base/JsiDomDrawingNode.h +4 -4
  10. package/cpp/rnskia/dom/base/JsiDomNode.h +68 -10
  11. package/cpp/rnskia/dom/base/JsiDomRenderNode.h +26 -61
  12. package/cpp/rnskia/dom/base/NodeProp.h +2 -1
  13. package/cpp/rnskia/dom/base/NodePropsContainer.h +10 -0
  14. package/cpp/rnskia/dom/nodes/JsiBlendNode.h +1 -2
  15. package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +3 -6
  16. package/cpp/rnskia/dom/nodes/JsiBoxNode.h +2 -4
  17. package/cpp/rnskia/dom/nodes/JsiBoxShadowNode.h +1 -2
  18. package/cpp/rnskia/dom/nodes/JsiCircleNode.h +2 -5
  19. package/cpp/rnskia/dom/nodes/JsiColorFilterNodes.h +4 -8
  20. package/cpp/rnskia/dom/nodes/JsiCustomDrawingNode.h +2 -5
  21. package/cpp/rnskia/dom/nodes/JsiDiffRectNode.h +2 -7
  22. package/cpp/rnskia/dom/nodes/JsiGlyphsNode.h +4 -8
  23. package/cpp/rnskia/dom/nodes/JsiImageFilterNodes.h +20 -38
  24. package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -1
  25. package/cpp/rnskia/dom/nodes/JsiImageSvgNode.h +2 -4
  26. package/cpp/rnskia/dom/nodes/JsiLineNode.h +2 -7
  27. package/cpp/rnskia/dom/nodes/JsiOvalNode.h +1 -3
  28. package/cpp/rnskia/dom/nodes/JsiPaintNode.h +2 -3
  29. package/cpp/rnskia/dom/nodes/JsiPatchNode.h +4 -8
  30. package/cpp/rnskia/dom/nodes/JsiPathEffectNodes.h +14 -28
  31. package/cpp/rnskia/dom/nodes/JsiPathNode.h +6 -16
  32. package/cpp/rnskia/dom/nodes/JsiPictureNode.h +1 -2
  33. package/cpp/rnskia/dom/nodes/JsiPointsNode.h +2 -5
  34. package/cpp/rnskia/dom/nodes/JsiRRectNode.h +1 -2
  35. package/cpp/rnskia/dom/nodes/JsiRectNode.h +1 -2
  36. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +37 -69
  37. package/cpp/rnskia/dom/nodes/JsiTextBlobNode.h +3 -6
  38. package/cpp/rnskia/dom/nodes/JsiTextNode.h +4 -8
  39. package/cpp/rnskia/dom/nodes/JsiTextPathNode.h +1 -2
  40. package/cpp/rnskia/dom/nodes/JsiVerticesNode.h +2 -4
  41. package/cpp/rnskia/dom/props/CircleProp.h +2 -0
  42. package/cpp/rnskia/dom/props/ColorProp.h +9 -4
  43. package/cpp/rnskia/dom/props/ImageProps.h +3 -2
  44. package/cpp/rnskia/dom/props/PaintProps.h +15 -7
  45. package/cpp/rnskia/dom/props/RectProp.h +11 -4
  46. package/cpp/rnskia/dom/props/TransformProp.h +0 -2
  47. package/cpp/rnskia/dom/props/UniformsProp.h +86 -123
  48. package/cpp/rnskia/values/RNSkReadonlyValue.h +2 -6
  49. package/cpp/utils/RNSkLog.h +1 -1
  50. package/lib/commonjs/dom/nodes/RenderNode.js +12 -16
  51. package/lib/commonjs/dom/nodes/RenderNode.js.map +1 -1
  52. package/lib/commonjs/dom/nodes/datatypes/Circle.js +6 -1
  53. package/lib/commonjs/dom/nodes/datatypes/Circle.js.map +1 -1
  54. package/lib/commonjs/dom/nodes/datatypes/Rect.js +3 -3
  55. package/lib/commonjs/dom/nodes/datatypes/Rect.js.map +1 -1
  56. package/lib/commonjs/dom/nodes/datatypes/index.js +0 -13
  57. package/lib/commonjs/dom/nodes/datatypes/index.js.map +1 -1
  58. package/lib/commonjs/dom/nodes/drawings/Box.js +6 -6
  59. package/lib/commonjs/dom/nodes/drawings/Box.js.map +1 -1
  60. package/lib/commonjs/dom/nodes/drawings/ImageNode.js +2 -2
  61. package/lib/commonjs/dom/nodes/drawings/ImageNode.js.map +1 -1
  62. package/lib/commonjs/dom/nodes/drawings/PatchNode.js +3 -7
  63. package/lib/commonjs/dom/nodes/drawings/PatchNode.js.map +1 -1
  64. package/lib/commonjs/dom/nodes/drawings/VerticesNode.js +1 -1
  65. package/lib/commonjs/dom/nodes/drawings/VerticesNode.js.map +1 -1
  66. package/lib/commonjs/dom/nodes/paint/ColorFilters.js +1 -3
  67. package/lib/commonjs/dom/nodes/paint/ColorFilters.js.map +1 -1
  68. package/lib/commonjs/dom/nodes/paint/ImageFilters.js +1 -1
  69. package/lib/commonjs/dom/nodes/paint/ImageFilters.js.map +1 -1
  70. package/lib/commonjs/dom/nodes/paint/Shaders.js +1 -3
  71. package/lib/commonjs/dom/nodes/paint/Shaders.js.map +1 -1
  72. package/lib/commonjs/dom/types/Common.js.map +1 -1
  73. package/lib/commonjs/dom/types/DrawingContext.js.map +1 -1
  74. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  75. package/lib/commonjs/renderer/DrawingContext.js.map +1 -1
  76. package/lib/commonjs/renderer/components/Mask.js +2 -6
  77. package/lib/commonjs/renderer/components/Mask.js.map +1 -1
  78. package/lib/commonjs/renderer/components/image/Image.js +0 -5
  79. package/lib/commonjs/renderer/components/image/Image.js.map +1 -1
  80. package/lib/commonjs/renderer/components/image/ImageShader.js +20 -10
  81. package/lib/commonjs/renderer/components/image/ImageShader.js.map +1 -1
  82. package/lib/commonjs/renderer/components/imageFilters/Blur.js +10 -5
  83. package/lib/commonjs/renderer/components/imageFilters/Blur.js.map +1 -1
  84. package/lib/commonjs/renderer/components/imageFilters/Morphology.js +10 -5
  85. package/lib/commonjs/renderer/components/imageFilters/Morphology.js.map +1 -1
  86. package/lib/commonjs/renderer/components/imageFilters/Offset.js +12 -6
  87. package/lib/commonjs/renderer/components/imageFilters/Offset.js.map +1 -1
  88. package/lib/commonjs/renderer/components/maskFilters/Blur.js +12 -6
  89. package/lib/commonjs/renderer/components/maskFilters/Blur.js.map +1 -1
  90. package/lib/commonjs/renderer/components/pathEffects/Discrete.js +10 -5
  91. package/lib/commonjs/renderer/components/pathEffects/Discrete.js.map +1 -1
  92. package/lib/commonjs/renderer/components/shaders/FractalNoise.js +14 -7
  93. package/lib/commonjs/renderer/components/shaders/FractalNoise.js.map +1 -1
  94. package/lib/commonjs/renderer/components/shaders/Shader.js +10 -5
  95. package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
  96. package/lib/commonjs/renderer/components/shaders/Turbulence.js +14 -7
  97. package/lib/commonjs/renderer/components/shaders/Turbulence.js.map +1 -1
  98. package/lib/commonjs/renderer/components/shapes/Circle.js +0 -6
  99. package/lib/commonjs/renderer/components/shapes/Circle.js.map +1 -1
  100. package/lib/commonjs/renderer/components/shapes/FitBox.js +1 -4
  101. package/lib/commonjs/renderer/components/shapes/FitBox.js.map +1 -1
  102. package/lib/commonjs/renderer/components/shapes/Oval.js +0 -4
  103. package/lib/commonjs/renderer/components/shapes/Oval.js.map +1 -1
  104. package/lib/commonjs/renderer/components/shapes/Path.js +12 -6
  105. package/lib/commonjs/renderer/components/shapes/Path.js.map +1 -1
  106. package/lib/commonjs/renderer/components/shapes/Points.js +10 -5
  107. package/lib/commonjs/renderer/components/shapes/Points.js.map +1 -1
  108. package/lib/commonjs/renderer/components/shapes/RoundedRect.js +0 -3
  109. package/lib/commonjs/renderer/components/shapes/RoundedRect.js.map +1 -1
  110. package/lib/commonjs/renderer/components/shapes/Vertices.js +10 -5
  111. package/lib/commonjs/renderer/components/shapes/Vertices.js.map +1 -1
  112. package/lib/commonjs/renderer/components/text/Glyphs.js +12 -6
  113. package/lib/commonjs/renderer/components/text/Glyphs.js.map +1 -1
  114. package/lib/commonjs/renderer/components/text/Text.js +12 -6
  115. package/lib/commonjs/renderer/components/text/Text.js.map +1 -1
  116. package/lib/commonjs/renderer/components/text/TextBlob.js +12 -6
  117. package/lib/commonjs/renderer/components/text/TextBlob.js.map +1 -1
  118. package/lib/commonjs/renderer/components/text/TextPath.js +10 -5
  119. package/lib/commonjs/renderer/components/text/TextPath.js.map +1 -1
  120. package/lib/commonjs/renderer/processors/Animations/Animations.js.map +1 -1
  121. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  122. package/lib/commonjs/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
  123. package/lib/commonjs/skia/types/Shader/Shader.js +3 -2
  124. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  125. package/lib/commonjs/skia/web/JsiSkPaint.js +4 -0
  126. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  127. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js +6 -1
  128. package/lib/commonjs/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  129. package/lib/commonjs/skia/web/JsiSkRuntimeEffectFactory.js +1 -1
  130. package/lib/commonjs/skia/web/JsiSkRuntimeEffectFactory.js.map +1 -1
  131. package/lib/commonjs/web/LoadSkiaWeb.js +1 -1
  132. package/lib/commonjs/web/LoadSkiaWeb.js.map +1 -1
  133. package/lib/module/dom/nodes/RenderNode.js +12 -16
  134. package/lib/module/dom/nodes/RenderNode.js.map +1 -1
  135. package/lib/module/dom/nodes/datatypes/Circle.js +8 -1
  136. package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
  137. package/lib/module/dom/nodes/datatypes/Rect.js +7 -3
  138. package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
  139. package/lib/module/dom/nodes/datatypes/index.js +0 -1
  140. package/lib/module/dom/nodes/datatypes/index.js.map +1 -1
  141. package/lib/module/dom/nodes/drawings/Box.js +6 -5
  142. package/lib/module/dom/nodes/drawings/Box.js.map +1 -1
  143. package/lib/module/dom/nodes/drawings/ImageNode.js +4 -2
  144. package/lib/module/dom/nodes/drawings/ImageNode.js.map +1 -1
  145. package/lib/module/dom/nodes/drawings/PatchNode.js +4 -8
  146. package/lib/module/dom/nodes/drawings/PatchNode.js.map +1 -1
  147. package/lib/module/dom/nodes/drawings/VerticesNode.js +2 -2
  148. package/lib/module/dom/nodes/drawings/VerticesNode.js.map +1 -1
  149. package/lib/module/dom/nodes/paint/ColorFilters.js +1 -2
  150. package/lib/module/dom/nodes/paint/ColorFilters.js.map +1 -1
  151. package/lib/module/dom/nodes/paint/ImageFilters.js +2 -2
  152. package/lib/module/dom/nodes/paint/ImageFilters.js.map +1 -1
  153. package/lib/module/dom/nodes/paint/Shaders.js +1 -2
  154. package/lib/module/dom/nodes/paint/Shaders.js.map +1 -1
  155. package/lib/module/dom/types/Common.js.map +1 -1
  156. package/lib/module/dom/types/DrawingContext.js.map +1 -1
  157. package/lib/module/dom/types/Drawings.js.map +1 -1
  158. package/lib/module/renderer/DrawingContext.js.map +1 -1
  159. package/lib/module/renderer/components/Mask.js +2 -6
  160. package/lib/module/renderer/components/Mask.js.map +1 -1
  161. package/lib/module/renderer/components/image/Image.js +0 -5
  162. package/lib/module/renderer/components/image/Image.js.map +1 -1
  163. package/lib/module/renderer/components/image/ImageShader.js +20 -10
  164. package/lib/module/renderer/components/image/ImageShader.js.map +1 -1
  165. package/lib/module/renderer/components/imageFilters/Blur.js +10 -5
  166. package/lib/module/renderer/components/imageFilters/Blur.js.map +1 -1
  167. package/lib/module/renderer/components/imageFilters/Morphology.js +10 -5
  168. package/lib/module/renderer/components/imageFilters/Morphology.js.map +1 -1
  169. package/lib/module/renderer/components/imageFilters/Offset.js +12 -6
  170. package/lib/module/renderer/components/imageFilters/Offset.js.map +1 -1
  171. package/lib/module/renderer/components/maskFilters/Blur.js +12 -6
  172. package/lib/module/renderer/components/maskFilters/Blur.js.map +1 -1
  173. package/lib/module/renderer/components/pathEffects/Discrete.js +10 -5
  174. package/lib/module/renderer/components/pathEffects/Discrete.js.map +1 -1
  175. package/lib/module/renderer/components/shaders/FractalNoise.js +14 -7
  176. package/lib/module/renderer/components/shaders/FractalNoise.js.map +1 -1
  177. package/lib/module/renderer/components/shaders/Shader.js +10 -5
  178. package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
  179. package/lib/module/renderer/components/shaders/Turbulence.js +14 -7
  180. package/lib/module/renderer/components/shaders/Turbulence.js.map +1 -1
  181. package/lib/module/renderer/components/shapes/Circle.js +0 -6
  182. package/lib/module/renderer/components/shapes/Circle.js.map +1 -1
  183. package/lib/module/renderer/components/shapes/FitBox.js +1 -4
  184. package/lib/module/renderer/components/shapes/FitBox.js.map +1 -1
  185. package/lib/module/renderer/components/shapes/Oval.js +0 -4
  186. package/lib/module/renderer/components/shapes/Oval.js.map +1 -1
  187. package/lib/module/renderer/components/shapes/Path.js +12 -6
  188. package/lib/module/renderer/components/shapes/Path.js.map +1 -1
  189. package/lib/module/renderer/components/shapes/Points.js +10 -5
  190. package/lib/module/renderer/components/shapes/Points.js.map +1 -1
  191. package/lib/module/renderer/components/shapes/RoundedRect.js +0 -3
  192. package/lib/module/renderer/components/shapes/RoundedRect.js.map +1 -1
  193. package/lib/module/renderer/components/shapes/Vertices.js +10 -5
  194. package/lib/module/renderer/components/shapes/Vertices.js.map +1 -1
  195. package/lib/module/renderer/components/text/Glyphs.js +12 -6
  196. package/lib/module/renderer/components/text/Glyphs.js.map +1 -1
  197. package/lib/module/renderer/components/text/Text.js +12 -6
  198. package/lib/module/renderer/components/text/Text.js.map +1 -1
  199. package/lib/module/renderer/components/text/TextBlob.js +12 -6
  200. package/lib/module/renderer/components/text/TextBlob.js.map +1 -1
  201. package/lib/module/renderer/components/text/TextPath.js +10 -5
  202. package/lib/module/renderer/components/text/TextPath.js.map +1 -1
  203. package/lib/module/renderer/processors/Animations/Animations.js.map +1 -1
  204. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  205. package/lib/module/skia/types/RuntimeEffect/RuntimeEffect.js.map +1 -1
  206. package/lib/module/skia/types/Shader/Shader.js +3 -2
  207. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  208. package/lib/module/skia/web/JsiSkPaint.js +4 -0
  209. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  210. package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -1
  211. package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
  212. package/lib/module/skia/web/JsiSkRuntimeEffectFactory.js +1 -1
  213. package/lib/module/skia/web/JsiSkRuntimeEffectFactory.js.map +1 -1
  214. package/lib/module/web/LoadSkiaWeb.js +1 -1
  215. package/lib/module/web/LoadSkiaWeb.js.map +1 -1
  216. package/lib/typescript/src/dom/nodes/datatypes/Circle.d.ts +4 -1
  217. package/lib/typescript/src/dom/nodes/datatypes/index.d.ts +0 -1
  218. package/lib/typescript/src/dom/nodes/drawings/Box.d.ts +1 -1
  219. package/lib/typescript/src/dom/nodes/drawings/PatchNode.d.ts +1 -1
  220. package/lib/typescript/src/dom/types/Common.d.ts +4 -4
  221. package/lib/typescript/src/dom/types/DrawingContext.d.ts +0 -1
  222. package/lib/typescript/src/dom/types/Drawings.d.ts +1 -1
  223. package/lib/typescript/src/renderer/DrawingContext.d.ts +3 -5
  224. package/lib/typescript/src/renderer/components/Mask.d.ts +3 -9
  225. package/lib/typescript/src/renderer/components/image/Image.d.ts +1 -8
  226. package/lib/typescript/src/renderer/components/image/ImageShader.d.ts +2 -12
  227. package/lib/typescript/src/renderer/components/imageFilters/Blur.d.ts +2 -7
  228. package/lib/typescript/src/renderer/components/imageFilters/Morphology.d.ts +2 -7
  229. package/lib/typescript/src/renderer/components/imageFilters/Offset.d.ts +2 -8
  230. package/lib/typescript/src/renderer/components/maskFilters/Blur.d.ts +2 -8
  231. package/lib/typescript/src/renderer/components/pathEffects/Discrete.d.ts +2 -7
  232. package/lib/typescript/src/renderer/components/shaders/FractalNoise.d.ts +2 -9
  233. package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -7
  234. package/lib/typescript/src/renderer/components/shaders/Turbulence.d.ts +2 -9
  235. package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +1 -9
  236. package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +2 -7
  237. package/lib/typescript/src/renderer/components/shapes/Oval.d.ts +1 -7
  238. package/lib/typescript/src/renderer/components/shapes/Path.d.ts +2 -8
  239. package/lib/typescript/src/renderer/components/shapes/Points.d.ts +2 -7
  240. package/lib/typescript/src/renderer/components/shapes/RoundedRect.d.ts +1 -6
  241. package/lib/typescript/src/renderer/components/shapes/Vertices.d.ts +2 -7
  242. package/lib/typescript/src/renderer/components/text/Glyphs.d.ts +2 -8
  243. package/lib/typescript/src/renderer/components/text/Text.d.ts +2 -8
  244. package/lib/typescript/src/renderer/components/text/TextBlob.d.ts +2 -8
  245. package/lib/typescript/src/renderer/components/text/TextPath.d.ts +2 -7
  246. package/lib/typescript/src/renderer/processors/Animations/Animations.d.ts +5 -0
  247. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +4 -0
  248. package/lib/typescript/src/skia/types/RuntimeEffect/RuntimeEffect.d.ts +4 -0
  249. package/lib/typescript/src/skia/types/Shader/Shader.d.ts +1 -1
  250. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  251. package/lib/typescript/src/skia/web/JsiSkRuntimeEffect.d.ts +3 -1
  252. package/package.json +1 -1
  253. package/src/dom/nodes/RenderNode.ts +11 -21
  254. package/src/dom/nodes/datatypes/Circle.ts +1 -1
  255. package/src/dom/nodes/datatypes/Rect.ts +3 -3
  256. package/src/dom/nodes/datatypes/index.ts +0 -1
  257. package/src/dom/nodes/drawings/Box.ts +7 -4
  258. package/src/dom/nodes/drawings/ImageNode.ts +2 -1
  259. package/src/dom/nodes/drawings/PatchNode.ts +4 -18
  260. package/src/dom/nodes/drawings/VerticesNode.ts +2 -2
  261. package/src/dom/nodes/paint/ColorFilters.ts +1 -2
  262. package/src/dom/nodes/paint/ImageFilters.ts +2 -2
  263. package/src/dom/nodes/paint/Shaders.ts +1 -2
  264. package/src/dom/types/Common.ts +4 -4
  265. package/src/dom/types/DrawingContext.ts +0 -1
  266. package/src/dom/types/Drawings.ts +1 -1
  267. package/src/renderer/DrawingContext.ts +5 -5
  268. package/src/renderer/components/Mask.tsx +8 -8
  269. package/src/renderer/components/image/Image.tsx +0 -6
  270. package/src/renderer/components/image/ImageShader.tsx +24 -12
  271. package/src/renderer/components/imageFilters/Blur.tsx +6 -7
  272. package/src/renderer/components/imageFilters/Morphology.tsx +6 -7
  273. package/src/renderer/components/imageFilters/Offset.tsx +7 -8
  274. package/src/renderer/components/maskFilters/Blur.tsx +7 -8
  275. package/src/renderer/components/pathEffects/Discrete.tsx +6 -9
  276. package/src/renderer/components/shaders/FractalNoise.tsx +18 -9
  277. package/src/renderer/components/shaders/Shader.tsx +6 -7
  278. package/src/renderer/components/shaders/Turbulence.tsx +15 -9
  279. package/src/renderer/components/shapes/Circle.tsx +0 -4
  280. package/src/renderer/components/shapes/FitBox.tsx +2 -6
  281. package/src/renderer/components/shapes/Oval.tsx +0 -5
  282. package/src/renderer/components/shapes/Path.tsx +7 -8
  283. package/src/renderer/components/shapes/Points.tsx +6 -7
  284. package/src/renderer/components/shapes/RoundedRect.tsx +0 -4
  285. package/src/renderer/components/shapes/Vertices.tsx +6 -7
  286. package/src/renderer/components/text/Glyphs.tsx +7 -8
  287. package/src/renderer/components/text/Text.tsx +7 -8
  288. package/src/renderer/components/text/TextBlob.tsx +7 -8
  289. package/src/renderer/components/text/TextPath.tsx +6 -7
  290. package/src/renderer/processors/Animations/Animations.ts +9 -3
  291. package/src/skia/types/Paint/Paint.ts +5 -0
  292. package/src/skia/types/RuntimeEffect/RuntimeEffect.ts +5 -0
  293. package/src/skia/types/Shader/Shader.ts +5 -3
  294. package/src/skia/web/JsiSkPaint.ts +4 -0
  295. package/src/skia/web/JsiSkRuntimeEffect.ts +5 -1
  296. package/src/skia/web/JsiSkRuntimeEffectFactory.ts +1 -1
  297. package/src/web/LoadSkiaWeb.tsx +1 -1
  298. package/lib/commonjs/dom/nodes/datatypes/Color.js +0 -27
  299. package/lib/commonjs/dom/nodes/datatypes/Color.js.map +0 -1
  300. package/lib/module/dom/nodes/datatypes/Color.js +0 -11
  301. package/lib/module/dom/nodes/datatypes/Color.js.map +0 -1
  302. package/lib/typescript/src/dom/nodes/datatypes/Color.d.ts +0 -7
  303. package/src/dom/nodes/datatypes/Color.ts +0 -15
@@ -63,6 +63,11 @@ public:
63
63
  return static_cast<double>(getObject()->getStrokeWidth());
64
64
  }
65
65
 
66
+ JSI_HOST_FUNCTION(getAlphaf) {
67
+ float alphaf = getObject()->getAlphaf();
68
+ return jsi::Value(SkScalarToDouble(alphaf));
69
+ }
70
+
66
71
  JSI_HOST_FUNCTION(setColor) {
67
72
  SkColor color = JsiSkColor::fromValue(runtime, arguments[0]);
68
73
  getObject()->setColor(color);
@@ -159,6 +164,7 @@ public:
159
164
 
160
165
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPaint, copy),
161
166
  JSI_EXPORT_FUNC(JsiSkPaint, reset),
167
+ JSI_EXPORT_FUNC(JsiSkPaint, getAlphaf),
162
168
  JSI_EXPORT_FUNC(JsiSkPaint, getColor),
163
169
  JSI_EXPORT_FUNC(JsiSkPaint, getStrokeCap),
164
170
  JSI_EXPORT_FUNC(JsiSkPaint, getStrokeJoin),
@@ -117,6 +117,10 @@ public:
117
117
  return result;
118
118
  }
119
119
 
120
+ JSI_HOST_FUNCTION(source) {
121
+ return jsi::String::createFromAscii(runtime, getObject()->source());
122
+ }
123
+
120
124
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkRuntimeEffect, makeShader),
121
125
  JSI_EXPORT_FUNC(JsiSkRuntimeEffect,
122
126
  makeShaderWithChildren),
@@ -124,7 +128,8 @@ public:
124
128
  JSI_EXPORT_FUNC(JsiSkRuntimeEffect,
125
129
  getUniformFloatCount),
126
130
  JSI_EXPORT_FUNC(JsiSkRuntimeEffect, getUniformName),
127
- JSI_EXPORT_FUNC(JsiSkRuntimeEffect, getUniform))
131
+ JSI_EXPORT_FUNC(JsiSkRuntimeEffect, getUniform),
132
+ JSI_EXPORT_FUNC(JsiSkRuntimeEffect, source))
128
133
 
129
134
  JsiSkRuntimeEffect(std::shared_ptr<RNSkPlatformContext> context,
130
135
  sk_sp<SkRuntimeEffect> rt)
@@ -206,7 +211,7 @@ private:
206
211
  const std::size_t offset = reu.slot + j;
207
212
  float fValue = jsiUniforms.getValueAtIndex(runtime, offset).asNumber();
208
213
  int iValue = static_cast<int>(fValue);
209
- auto value = reu.isInteger ? iValue : fValue;
214
+ auto value = reu.isInteger ? SkBits2Float(iValue) : fValue;
210
215
  memcpy(SkTAddOffset<void>(uniforms->writable_data(),
211
216
  offset * sizeof(value)),
212
217
  &value, sizeof(value));
@@ -132,31 +132,6 @@ public:
132
132
  JsiHostObject();
133
133
  ~JsiHostObject();
134
134
 
135
- protected:
136
- /**
137
- Override to return map of name/functions
138
- */
139
- virtual const RNJsi::JsiFunctionMap &getExportedFunctionMap() {
140
- static const RNJsi::JsiFunctionMap empty;
141
- return empty;
142
- }
143
-
144
- /**
145
- Override to get property getters map of name/functions
146
- */
147
- virtual const JsiPropertyGettersMap &getExportedPropertyGettersMap() {
148
- static const JsiPropertyGettersMap empty;
149
- return empty;
150
- }
151
-
152
- /**
153
- Override to get property setters map of name/functions
154
- */
155
- virtual const JsiPropertySettersMap &getExportedPropertySettersMap() {
156
- static const JsiPropertySettersMap empty;
157
- return empty;
158
- }
159
-
160
135
  /**
161
136
  * Overridden jsi::HostObject set property method
162
137
  * @param rt Runtime
@@ -183,6 +158,31 @@ protected:
183
158
  */
184
159
  std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime &runtime) override;
185
160
 
161
+ protected:
162
+ /**
163
+ Override to return map of name/functions
164
+ */
165
+ virtual const RNJsi::JsiFunctionMap &getExportedFunctionMap() {
166
+ static const RNJsi::JsiFunctionMap empty;
167
+ return empty;
168
+ }
169
+
170
+ /**
171
+ Override to get property getters map of name/functions
172
+ */
173
+ virtual const JsiPropertyGettersMap &getExportedPropertyGettersMap() {
174
+ static const JsiPropertyGettersMap empty;
175
+ return empty;
176
+ }
177
+
178
+ /**
179
+ Override to get property setters map of name/functions
180
+ */
181
+ virtual const JsiPropertySettersMap &getExportedPropertySettersMap() {
182
+ static const JsiPropertySettersMap empty;
183
+ return empty;
184
+ }
185
+
186
186
  /**
187
187
  * Installs a function into the function map
188
188
  */
@@ -86,7 +86,7 @@ void RNSkDomRenderer::renderCanvas(SkCanvas *canvas, float scaledWidth,
86
86
  if (_drawingContext == nullptr) {
87
87
  auto paint = std::make_shared<SkPaint>();
88
88
  paint->setAntiAlias(true);
89
- _drawingContext = std::make_shared<DrawingContext>(paint, 1.0f);
89
+ _drawingContext = std::make_shared<DrawingContext>(paint);
90
90
 
91
91
  _drawingContext->setRequestRedraw([weakSelf = weak_from_this()]() {
92
92
  auto self = weakSelf.lock();
@@ -178,12 +178,8 @@ public:
178
178
  if (!_isValid) {
179
179
  return;
180
180
  }
181
- std::unordered_map<size_t, std::function<void(bool)>> tmp;
182
- {
183
- std::lock_guard<std::mutex> lock(_drawCallbacksLock);
184
- tmp.insert(_drawCallbacks.cbegin(), _drawCallbacks.cend());
185
- }
186
- for (auto it = tmp.begin(); it != tmp.end(); it++) {
181
+ std::lock_guard<std::mutex> lock(_drawCallbacksLock);
182
+ for (auto it = _drawCallbacks.begin(); it != _drawCallbacks.end(); it++) {
187
183
  it->second(invalidated);
188
184
  }
189
185
  }
@@ -2,10 +2,9 @@
2
2
 
3
3
  namespace RNSkia {
4
4
 
5
- DrawingContext::DrawingContext(std::shared_ptr<SkPaint> paint, double opacity)
5
+ DrawingContext::DrawingContext(std::shared_ptr<SkPaint> paint)
6
6
  : DrawingContext("root") {
7
7
  _paint = paint;
8
- _opacity = opacity;
9
8
  }
10
9
 
11
10
  DrawingContext::DrawingContext(DrawingContext *parent, const char *source)
@@ -20,13 +19,6 @@ DrawingContext::inheritContext(const char *source) {
20
19
  return result;
21
20
  }
22
21
 
23
- size_t DrawingContext::getLevel() {
24
- if (_parent != nullptr) {
25
- return _parent->getLevel() + 1;
26
- }
27
- return 0;
28
- }
29
-
30
22
  std::string DrawingContext::getDebugDescription() {
31
23
  std::string v = "ctx for " + std::string(_source) + ":";
32
24
 
@@ -50,10 +42,29 @@ std::string DrawingContext::getDebugDescription() {
50
42
  v += " blendMode:" + std::to_string(static_cast<size_t>(blendMode));
51
43
  }
52
44
 
53
- v += " opacity:" + std::to_string(_opacity);
45
+ auto opacity = _paint->getAlphaf();
46
+ v += " opacity:" + std::to_string(opacity);
47
+
54
48
  if (_paint->getPathEffect() != nullptr) {
55
49
  v += " [PathEffect]";
56
50
  }
51
+
52
+ if (_paint->getShader() != nullptr) {
53
+ v += " [Shader]";
54
+ }
55
+
56
+ if (_paint->getImageFilter() != nullptr) {
57
+ v += " [ImageFilter]";
58
+ }
59
+
60
+ if (_paint->getMaskFilter() != nullptr) {
61
+ v += " [MaskFilter]";
62
+ }
63
+
64
+ if (_paint->getColorFilter() != nullptr) {
65
+ v += " [ColorFilter]";
66
+ }
67
+
57
68
  } else {
58
69
  v = v + "[inherited] " +
59
70
  (_parent != nullptr ? _parent->getDebugDescription() : "");
@@ -137,7 +148,6 @@ std::shared_ptr<SkPaint> DrawingContext::getMutablePaint() {
137
148
  if (_paint == nullptr) {
138
149
  auto parentPaint = _parent->getPaint();
139
150
  _paint = std::make_shared<SkPaint>(*parentPaint);
140
- _opacity = _parent->getOpacity();
141
151
  }
142
152
  // Calling the getMutablePaint accessor implies that the paint
143
153
  // is about to be mutatet and will therefore invalidate
@@ -154,36 +164,6 @@ void DrawingContext::setMutablePaint(std::shared_ptr<SkPaint> paint) {
154
164
  _paint = paint;
155
165
  }
156
166
 
157
- /**
158
- Getd the opacity value
159
- */
160
- double DrawingContext::getOpacity() {
161
- if (_paint == nullptr) {
162
- return _parent->getOpacity();
163
- }
164
- return _opacity;
165
- }
166
-
167
- /**
168
- Sets the opacity value
169
- */
170
- void DrawingContext::setOpacity(double opacity) {
171
- getMutablePaint()->setAlphaf(_opacity);
172
- _opacity = opacity;
173
- }
174
-
175
- /**
176
- Clears the opacity value
177
- */
178
- void DrawingContext::clearOpacity() {
179
- if (_parent != nullptr) {
180
- _opacity = _parent->getOpacity();
181
- } else {
182
- _opacity = 1.0;
183
- }
184
- markChildrenAsChanged();
185
- }
186
-
187
167
  float DrawingContext::getScaledWidth() {
188
168
  if (_parent != nullptr) {
189
169
  return _parent->getScaledWidth();
@@ -198,6 +178,8 @@ float DrawingContext::getScaledHeight() {
198
178
  return _scaledHeight;
199
179
  }
200
180
 
181
+ DrawingContext *DrawingContext::getParent() { return _parent; }
182
+
201
183
  void DrawingContext::setScaledWidth(float v) { _scaledWidth = v; }
202
184
  void DrawingContext::setScaledHeight(float v) { _scaledHeight = v; }
203
185
 
@@ -22,7 +22,7 @@ public:
22
22
  /**
23
23
  Creates a root drawing context with paint and opacity
24
24
  */
25
- DrawingContext(std::shared_ptr<SkPaint> paint, double opacity);
25
+ explicit DrawingContext(std::shared_ptr<SkPaint> paint);
26
26
 
27
27
  /**
28
28
  Initilalizes a new draw context.
@@ -34,8 +34,9 @@ public:
34
34
  */
35
35
  std::shared_ptr<DrawingContext> inheritContext(const char *source);
36
36
 
37
- size_t getLevel();
38
-
37
+ /**
38
+ Returns the debug description for the context
39
+ */
39
40
  std::string getDebugDescription();
40
41
 
41
42
  /**
@@ -86,21 +87,6 @@ public:
86
87
  */
87
88
  void setMutablePaint(std::shared_ptr<SkPaint> paint);
88
89
 
89
- /**
90
- Getd the opacity value
91
- */
92
- double getOpacity();
93
-
94
- /**
95
- Sets the opacity value
96
- */
97
- void setOpacity(double opacity);
98
-
99
- /**
100
- Clears the opacity
101
- */
102
- void clearOpacity();
103
-
104
90
  float getScaledWidth();
105
91
 
106
92
  float getScaledHeight();
@@ -111,6 +97,8 @@ public:
111
97
  void setRequestRedraw(std::function<void()> &&requestRedraw);
112
98
  const std::function<void()> &getRequestRedraw();
113
99
 
100
+ DrawingContext *getParent();
101
+
114
102
  private:
115
103
  explicit DrawingContext(const char *source);
116
104
 
@@ -119,7 +107,6 @@ private:
119
107
  bool _isChanged = true;
120
108
 
121
109
  std::shared_ptr<SkPaint> _paint;
122
- double _opacity = 1.0f;
123
110
 
124
111
  SkCanvas *_canvas = nullptr;
125
112
  const char *_source;
@@ -36,7 +36,7 @@ public:
36
36
  */
37
37
  virtual void decorateContext(DrawingContext *context) {
38
38
  #if SKIA_DOM_DEBUG
39
- printDebugInfo(context, "Begin Materialize");
39
+ printDebugInfo("Begin Materialize " + std::string(getType()));
40
40
  #endif
41
41
  // Materialize children first so that any inner nodes get the opportunity
42
42
  // to calculate their state before this node continues.
@@ -51,11 +51,21 @@ public:
51
51
  decorate(context);
52
52
 
53
53
  #if SKIA_DOM_DEBUG
54
- printDebugInfo(context, "End Materialize");
54
+ printDebugInfo("End / Commit Materialize " + std::string(getType()));
55
55
  #endif
56
56
  }
57
57
 
58
58
  protected:
59
+ /**
60
+ Invalidates and marks then context as changed. The implementation in the
61
+ declaration node is to pass the call upwards to the parent node
62
+ */
63
+ void invalidateContext() override {
64
+ if (getParent() != nullptr) {
65
+ getParent()->invalidateContext();
66
+ }
67
+ }
68
+
59
69
  /**
60
70
  Override to implement materialization
61
71
  */
@@ -16,7 +16,7 @@ public:
16
16
  protected:
17
17
  void defineProperties(NodePropsContainer *container) override {
18
18
  JsiDomRenderNode::defineProperties(container);
19
- container->defineProperty(std::make_shared<PaintProp>());
19
+ container->defineProperty<PaintProp>();
20
20
  }
21
21
 
22
22
  /**
@@ -26,11 +26,11 @@ protected:
26
26
 
27
27
  void renderNode(DrawingContext *context) override {
28
28
  #if SKIA_DOM_DEBUG
29
- printDebugInfo(context, "Begin Draw", 1);
29
+ printDebugInfo("Begin Draw", 1);
30
30
  #endif
31
31
 
32
32
  #if SKIA_DOM_DEBUG
33
- printDebugInfo(context, context->getDebugDescription(), 2);
33
+ printDebugInfo(context->getDebugDescription(), 2);
34
34
  #endif
35
35
  draw(context);
36
36
 
@@ -42,7 +42,7 @@ protected:
42
42
  }
43
43
  }
44
44
  #if SKIA_DOM_DEBUG
45
- printDebugInfo(context, "End Draw", 1);
45
+ printDebugInfo("End Draw", 1);
46
46
  #endif
47
47
  }
48
48
  };
@@ -168,6 +168,12 @@ public:
168
168
  _disposeCallback = disposeCallback;
169
169
  }
170
170
 
171
+ /**
172
+ Invalidates and marks then context as changed. The default behaviour is an
173
+ empty implementation
174
+ */
175
+ virtual void invalidateContext() = 0;
176
+
171
177
  /**
172
178
  Updates any pending property changes in all nodes and child nodes. This
173
179
  function will swap any pending property changes in this and children with any
@@ -188,6 +194,11 @@ public:
188
194
  op();
189
195
  }
190
196
 
197
+ // If there are any ops here we should invalidate the cached context
198
+ if (_queuedNodeOps.size() > 0) {
199
+ invalidateContext();
200
+ }
201
+
191
202
  _queuedNodeOps.clear();
192
203
  }
193
204
 
@@ -209,7 +220,11 @@ public:
209
220
  }
210
221
 
211
222
  // Now let's dispose if needed
212
- if (_isDisposed) {
223
+ if (_isDisposing && !_isDisposed) {
224
+ _isDisposed = true;
225
+
226
+ this->setParent(nullptr);
227
+
213
228
  // Callback signaling that we're done
214
229
  if (_disposeCallback != nullptr) {
215
230
  _disposeCallback();
@@ -266,6 +281,9 @@ protected:
266
281
  always call the onPropsSet method as a signal that things have changed.
267
282
  */
268
283
  void setProps(jsi::Runtime &runtime, jsi::Object &&props) {
284
+ #if SKIA_DOM_DEBUG
285
+ printDebugInfo("JS:setProps(nodeId: " + std::to_string(_nodeId) + ")");
286
+ #endif
269
287
  if (_propsContainer == nullptr) {
270
288
 
271
289
  // Initialize properties container
@@ -276,12 +294,18 @@ protected:
276
294
  }
277
295
  // Update properties container
278
296
  _propsContainer->setProps(runtime, std::move(props));
297
+
298
+ // Invalidate context
299
+ invalidateContext();
279
300
  }
280
301
 
281
302
  /**
282
303
  Called for components that has no properties
283
304
  */
284
305
  void setEmptyProps() {
306
+ #if SKIA_DOM_DEBUG
307
+ printDebugInfo("JS:setEmptyProps(nodeId: " + std::to_string(_nodeId) + ")");
308
+ #endif
285
309
  if (_propsContainer == nullptr) {
286
310
 
287
311
  // Initialize properties container
@@ -304,8 +328,15 @@ protected:
304
328
  Adds a child node to the array of children for this node
305
329
  */
306
330
  virtual void addChild(std::shared_ptr<JsiDomNode> child) {
331
+ #if SKIA_DOM_DEBUG
332
+ printDebugInfo("JS:addChild(childId: " + std::to_string(child->_nodeId) +
333
+ ")");
334
+ #endif
307
335
  std::lock_guard<std::mutex> lock(_childrenLock);
308
- _queuedNodeOps.push_back([child, this]() { _children.push_back(child); });
336
+ _queuedNodeOps.push_back([child, this]() {
337
+ _children.push_back(child);
338
+ child->setParent(this);
339
+ });
309
340
  }
310
341
 
311
342
  /**
@@ -314,10 +345,16 @@ protected:
314
345
  */
315
346
  virtual void insertChildBefore(std::shared_ptr<JsiDomNode> child,
316
347
  std::shared_ptr<JsiDomNode> before) {
348
+ #if SKIA_DOM_DEBUG
349
+ printDebugInfo(
350
+ "JS:insertChildBefore(childId: " + std::to_string(child->_nodeId) +
351
+ ", beforeId: " + std::to_string(before->_nodeId) + ")");
352
+ #endif
317
353
  std::lock_guard<std::mutex> lock(_childrenLock);
318
354
  _queuedNodeOps.push_back([child, before, this]() {
319
355
  auto position = std::find(_children.begin(), _children.end(), before);
320
356
  _children.insert(position, child);
357
+ child->setParent(this);
321
358
  });
322
359
  }
323
360
 
@@ -326,6 +363,10 @@ protected:
326
363
  children and call dispose on the child node.
327
364
  */
328
365
  virtual void removeChild(std::shared_ptr<JsiDomNode> child) {
366
+ #if SKIA_DOM_DEBUG
367
+ printDebugInfo("JS:removeChild(childId: " + std::to_string(child->_nodeId) +
368
+ ")");
369
+ #endif
329
370
  std::lock_guard<std::mutex> lock(_childrenLock);
330
371
  _queuedNodeOps.push_back([child, this]() {
331
372
  // Delete child itself
@@ -343,26 +384,40 @@ protected:
343
384
  up.
344
385
  */
345
386
  virtual void dispose() {
346
- if (_isDisposed) {
387
+ if (_isDisposing) {
347
388
  return;
348
389
  }
349
390
 
350
- _isDisposed = true;
391
+ _isDisposing = true;
351
392
  }
352
393
 
353
394
  #if SKIA_DOM_DEBUG
354
- std::string getLevelIndentation(DrawingContext *ctx, size_t indentation = 0) {
355
- return std::string((ctx->getLevel() + indentation), ' ');
395
+ std::string getLevelIndentation(size_t indentation = 0) {
396
+ JsiDomNode *curParent = _parent;
397
+ while (curParent != nullptr) {
398
+ indentation++;
399
+ curParent = curParent->getParent();
400
+ }
401
+ return std::string(indentation * 2, ' ');
356
402
  }
357
403
 
358
- void printDebugInfo(DrawingContext *context, const std::string &message,
359
- size_t indentation = 0) {
404
+ void printDebugInfo(const std::string &message, size_t indentation = 0) {
360
405
  RNSkLogger::logToConsole("%s%s %lu: %s",
361
- getLevelIndentation(context, indentation).c_str(),
406
+ getLevelIndentation(indentation).c_str(),
362
407
  getType(), getNodeId(), message.c_str());
363
408
  }
364
409
  #endif
365
410
 
411
+ /**
412
+ Sets the parent node
413
+ */
414
+ void setParent(JsiDomNode *parent) { _parent = parent; }
415
+
416
+ /**
417
+ Returns the parent node if set.
418
+ */
419
+ JsiDomNode *getParent() { return _parent; }
420
+
366
421
  private:
367
422
  const char *_type;
368
423
  std::shared_ptr<RNSkPlatformContext> _context;
@@ -374,11 +429,14 @@ private:
374
429
  std::vector<std::shared_ptr<JsiDomNode>> _children;
375
430
  std::mutex _childrenLock;
376
431
 
377
- std::atomic<bool> _isDisposed = {false};
432
+ std::atomic<bool> _isDisposing = {false};
433
+ bool _isDisposed = false;
378
434
 
379
435
  size_t _nodeId;
380
436
 
381
437
  std::vector<std::function<void()>> _queuedNodeOps;
438
+
439
+ JsiDomNode *_parent = nullptr;
382
440
  };
383
441
 
384
442
  } // namespace RNSkia