@shopify/react-native-skia 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/cpp/api/JsiSkPaint.h +8 -1
  2. package/lib/commonjs/dom/types/Common.d.ts +6 -4
  3. package/lib/commonjs/dom/types/Common.js.map +1 -1
  4. package/lib/commonjs/dom/types/ImageFilters.d.ts +1 -1
  5. package/lib/commonjs/dom/types/ImageFilters.js.map +1 -1
  6. package/lib/commonjs/dom/types/Node.d.ts +0 -2
  7. package/lib/commonjs/dom/types/Node.js.map +1 -1
  8. package/lib/commonjs/external/reanimated/index.d.ts +0 -1
  9. package/lib/commonjs/external/reanimated/index.js +0 -11
  10. package/lib/commonjs/external/reanimated/index.js.map +1 -1
  11. package/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -1
  12. package/lib/commonjs/external/reanimated/renderHelpers.js +5 -43
  13. package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
  14. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +1 -8
  15. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
  16. package/lib/commonjs/skia/core/AnimatedImage.d.ts +1 -1
  17. package/lib/commonjs/skia/core/AnimatedImage.js +1 -1
  18. package/lib/commonjs/skia/core/AnimatedImage.js.map +1 -1
  19. package/lib/commonjs/skia/core/Data.d.ts +1 -1
  20. package/lib/commonjs/skia/core/Data.js +2 -8
  21. package/lib/commonjs/skia/core/Data.js.map +1 -1
  22. package/lib/commonjs/skia/types/Paint/Paint.d.ts +1 -0
  23. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  24. package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  25. package/lib/commonjs/skia/web/JsiSkPaint.js +3 -0
  26. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  27. package/lib/commonjs/sksg/Container.d.ts +3 -2
  28. package/lib/commonjs/sksg/Container.js +32 -26
  29. package/lib/commonjs/sksg/Container.js.map +1 -1
  30. package/lib/commonjs/sksg/HostConfig.d.ts +2 -2
  31. package/lib/commonjs/sksg/HostConfig.js +7 -25
  32. package/lib/commonjs/sksg/HostConfig.js.map +1 -1
  33. package/lib/commonjs/sksg/Node.d.ts +19 -0
  34. package/lib/commonjs/sksg/Node.js +78 -0
  35. package/lib/commonjs/sksg/Node.js.map +1 -0
  36. package/lib/commonjs/sksg/Reconciler.d.ts +1 -1
  37. package/lib/commonjs/sksg/Recorder/Core.d.ts +79 -0
  38. package/lib/commonjs/sksg/Recorder/Core.js +110 -0
  39. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -0
  40. package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +18 -0
  41. package/lib/commonjs/sksg/Recorder/DrawingContext.js +105 -0
  42. package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -0
  43. package/lib/commonjs/sksg/Recorder/Player.d.ts +3 -0
  44. package/lib/commonjs/sksg/Recorder/Player.js +127 -0
  45. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -0
  46. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +50 -0
  47. package/lib/commonjs/sksg/Recorder/Recorder.js +288 -0
  48. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -0
  49. package/lib/commonjs/sksg/Recorder/Recording.d.ts +7 -0
  50. package/lib/commonjs/sksg/Recorder/Recording.js +12 -0
  51. package/lib/commonjs/sksg/Recorder/Recording.js.map +1 -0
  52. package/lib/commonjs/sksg/Recorder/Visitor.d.ts +5 -0
  53. package/lib/commonjs/sksg/Recorder/Visitor.js +293 -0
  54. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -0
  55. package/lib/commonjs/sksg/Recorder/commands/Box.d.ts +13 -0
  56. package/lib/commonjs/sksg/Recorder/commands/Box.js +71 -0
  57. package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -0
  58. package/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +3 -0
  59. package/lib/commonjs/sksg/Recorder/commands/CTM.js +79 -0
  60. package/lib/commonjs/sksg/Recorder/commands/CTM.js.map +1 -0
  61. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  62. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js +76 -0
  63. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js.map +1 -0
  64. package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +24 -0
  65. package/lib/commonjs/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
  66. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -0
  67. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  68. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +183 -0
  69. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -0
  70. package/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +4 -0
  71. package/lib/commonjs/sksg/Recorder/commands/Paint.js +70 -0
  72. package/lib/commonjs/sksg/Recorder/commands/Paint.js.map +1 -0
  73. package/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  74. package/lib/commonjs/sksg/Recorder/commands/PathEffects.js +137 -0
  75. package/lib/commonjs/sksg/Recorder/commands/PathEffects.js.map +1 -0
  76. package/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +5 -0
  77. package/lib/commonjs/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +58 -15
  78. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -0
  79. package/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  80. package/lib/commonjs/sksg/{nodes/utils.js → utils.js} +12 -2
  81. package/lib/commonjs/sksg/utils.js.map +1 -0
  82. package/lib/module/dom/types/Common.d.ts +6 -4
  83. package/lib/module/dom/types/Common.js.map +1 -1
  84. package/lib/module/dom/types/ImageFilters.d.ts +1 -1
  85. package/lib/module/dom/types/ImageFilters.js.map +1 -1
  86. package/lib/module/dom/types/Node.d.ts +0 -2
  87. package/lib/module/dom/types/Node.js.map +1 -1
  88. package/lib/module/external/reanimated/index.d.ts +0 -1
  89. package/lib/module/external/reanimated/index.js +0 -1
  90. package/lib/module/external/reanimated/index.js.map +1 -1
  91. package/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
  92. package/lib/module/external/reanimated/renderHelpers.js +4 -42
  93. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  94. package/lib/module/external/reanimated/useAnimatedImageValue.js +1 -8
  95. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
  96. package/lib/module/skia/core/AnimatedImage.d.ts +1 -1
  97. package/lib/module/skia/core/AnimatedImage.js +1 -1
  98. package/lib/module/skia/core/AnimatedImage.js.map +1 -1
  99. package/lib/module/skia/core/Data.d.ts +1 -1
  100. package/lib/module/skia/core/Data.js +2 -8
  101. package/lib/module/skia/core/Data.js.map +1 -1
  102. package/lib/module/skia/types/Paint/Paint.d.ts +1 -0
  103. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  104. package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  105. package/lib/module/skia/web/JsiSkPaint.js +3 -0
  106. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  107. package/lib/module/sksg/Container.d.ts +3 -2
  108. package/lib/module/sksg/Container.js +30 -24
  109. package/lib/module/sksg/Container.js.map +1 -1
  110. package/lib/module/sksg/HostConfig.d.ts +2 -2
  111. package/lib/module/sksg/HostConfig.js +7 -25
  112. package/lib/module/sksg/HostConfig.js.map +1 -1
  113. package/lib/module/sksg/Node.d.ts +19 -0
  114. package/lib/module/sksg/Node.js +67 -0
  115. package/lib/module/sksg/Node.js.map +1 -0
  116. package/lib/module/sksg/Reconciler.d.ts +1 -1
  117. package/lib/module/sksg/Recorder/Core.d.ts +79 -0
  118. package/lib/module/sksg/Recorder/Core.js +101 -0
  119. package/lib/module/sksg/Recorder/Core.js.map +1 -0
  120. package/lib/module/sksg/Recorder/DrawingContext.d.ts +18 -0
  121. package/lib/module/sksg/Recorder/DrawingContext.js +98 -0
  122. package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -0
  123. package/lib/module/sksg/Recorder/Player.d.ts +3 -0
  124. package/lib/module/sksg/Recorder/Player.js +120 -0
  125. package/lib/module/sksg/Recorder/Player.js.map +1 -0
  126. package/lib/module/sksg/Recorder/Recorder.d.ts +50 -0
  127. package/lib/module/sksg/Recorder/Recorder.js +281 -0
  128. package/lib/module/sksg/Recorder/Recorder.js.map +1 -0
  129. package/lib/module/sksg/Recorder/Recording.d.ts +7 -0
  130. package/lib/module/sksg/Recorder/Recording.js +5 -0
  131. package/lib/module/sksg/Recorder/Recording.js.map +1 -0
  132. package/lib/module/sksg/Recorder/Visitor.d.ts +5 -0
  133. package/lib/module/sksg/Recorder/Visitor.js +285 -0
  134. package/lib/module/sksg/Recorder/Visitor.js.map +1 -0
  135. package/lib/module/sksg/Recorder/commands/Box.d.ts +13 -0
  136. package/lib/module/sksg/Recorder/commands/Box.js +63 -0
  137. package/lib/module/sksg/Recorder/commands/Box.js.map +1 -0
  138. package/lib/module/sksg/Recorder/commands/CTM.d.ts +3 -0
  139. package/lib/module/sksg/Recorder/commands/CTM.js +72 -0
  140. package/lib/module/sksg/Recorder/commands/CTM.js.map +1 -0
  141. package/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  142. package/lib/module/sksg/Recorder/commands/ColorFilters.js +67 -0
  143. package/lib/module/sksg/Recorder/commands/ColorFilters.js.map +1 -0
  144. package/lib/module/sksg/Recorder/commands/Drawing.d.ts +24 -0
  145. package/lib/module/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
  146. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -0
  147. package/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  148. package/lib/module/sksg/{nodes/imageFilters.js → Recorder/commands/ImageFilters.js} +87 -95
  149. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -0
  150. package/lib/module/sksg/Recorder/commands/Paint.d.ts +4 -0
  151. package/lib/module/sksg/Recorder/commands/Paint.js +62 -0
  152. package/lib/module/sksg/Recorder/commands/Paint.js.map +1 -0
  153. package/lib/module/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  154. package/lib/module/sksg/Recorder/commands/PathEffects.js +128 -0
  155. package/lib/module/sksg/Recorder/commands/PathEffects.js.map +1 -0
  156. package/lib/module/sksg/Recorder/commands/Shaders.d.ts +5 -0
  157. package/lib/module/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +63 -13
  158. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -0
  159. package/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  160. package/lib/module/sksg/{nodes/utils.js → utils.js} +10 -1
  161. package/lib/module/sksg/utils.js.map +1 -0
  162. package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -1
  163. package/lib/typescript/lib/commonjs/skia/core/AnimatedImage.d.ts +1 -1
  164. package/lib/typescript/lib/commonjs/skia/core/Data.d.ts +1 -1
  165. package/lib/typescript/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  166. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +4 -0
  167. package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +1 -3
  168. package/lib/typescript/lib/commonjs/sksg/Node.d.ts +14 -0
  169. package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +5 -0
  170. package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +17 -0
  171. package/lib/typescript/lib/commonjs/sksg/Recorder/Player.d.ts +2 -0
  172. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +45 -0
  173. package/lib/typescript/lib/commonjs/sksg/Recorder/Recording.d.ts +5 -0
  174. package/lib/typescript/lib/commonjs/sksg/Recorder/Visitor.d.ts +27 -0
  175. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Box.d.ts +3 -0
  176. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +2 -0
  177. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +4 -0
  178. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +6 -0
  179. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +14 -0
  180. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +4 -0
  181. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +3 -0
  182. package/lib/typescript/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
  183. package/lib/typescript/lib/module/external/reanimated/index.d.ts +0 -1
  184. package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
  185. package/lib/typescript/lib/module/mock/index.d.ts +1 -1
  186. package/lib/typescript/lib/module/skia/core/AnimatedImage.d.ts +1 -1
  187. package/lib/typescript/lib/module/skia/core/Data.d.ts +1 -1
  188. package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  189. package/lib/typescript/lib/module/sksg/Container.d.ts +4 -0
  190. package/lib/typescript/lib/module/sksg/HostConfig.d.ts +1 -3
  191. package/lib/typescript/lib/module/sksg/Node.d.ts +13 -0
  192. package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +4 -0
  193. package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +16 -0
  194. package/lib/typescript/lib/module/sksg/Recorder/Player.d.ts +1 -0
  195. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +44 -0
  196. package/lib/typescript/lib/module/sksg/Recorder/Recording.d.ts +4 -0
  197. package/lib/typescript/lib/module/sksg/Recorder/Visitor.d.ts +26 -0
  198. package/lib/typescript/lib/module/sksg/Recorder/commands/Box.d.ts +2 -0
  199. package/lib/typescript/lib/module/sksg/Recorder/commands/CTM.d.ts +1 -0
  200. package/lib/typescript/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +3 -0
  201. package/lib/typescript/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +5 -0
  202. package/lib/typescript/lib/module/sksg/Recorder/commands/Paint.d.ts +13 -0
  203. package/lib/typescript/lib/module/sksg/Recorder/commands/PathEffects.d.ts +3 -0
  204. package/lib/typescript/lib/module/sksg/Recorder/commands/Shaders.d.ts +2 -0
  205. package/lib/typescript/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
  206. package/lib/typescript/src/dom/types/Common.d.ts +6 -4
  207. package/lib/typescript/src/dom/types/ImageFilters.d.ts +1 -1
  208. package/lib/typescript/src/dom/types/Node.d.ts +0 -2
  209. package/lib/typescript/src/external/reanimated/index.d.ts +0 -1
  210. package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +0 -1
  211. package/lib/typescript/src/skia/core/AnimatedImage.d.ts +1 -1
  212. package/lib/typescript/src/skia/core/Data.d.ts +1 -1
  213. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +1 -0
  214. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  215. package/lib/typescript/src/sksg/Container.d.ts +3 -2
  216. package/lib/typescript/src/sksg/HostConfig.d.ts +2 -2
  217. package/lib/typescript/src/sksg/Node.d.ts +19 -0
  218. package/lib/typescript/src/sksg/Reconciler.d.ts +1 -1
  219. package/lib/typescript/src/sksg/Recorder/Core.d.ts +79 -0
  220. package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +18 -0
  221. package/lib/typescript/src/sksg/Recorder/Player.d.ts +3 -0
  222. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +50 -0
  223. package/lib/typescript/src/sksg/Recorder/Recording.d.ts +7 -0
  224. package/lib/typescript/src/sksg/Recorder/Visitor.d.ts +5 -0
  225. package/lib/typescript/src/sksg/Recorder/commands/Box.d.ts +13 -0
  226. package/lib/typescript/src/sksg/Recorder/commands/CTM.d.ts +3 -0
  227. package/lib/typescript/src/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  228. package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +24 -0
  229. package/lib/typescript/src/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  230. package/lib/typescript/src/sksg/Recorder/commands/Paint.d.ts +4 -0
  231. package/lib/typescript/src/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  232. package/lib/typescript/src/sksg/Recorder/commands/Shaders.d.ts +5 -0
  233. package/lib/typescript/src/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  234. package/package.json +1 -1
  235. package/src/__tests__/snapshots/image-filter/test-shadow.png +0 -0
  236. package/src/dom/types/Common.ts +7 -5
  237. package/src/dom/types/ImageFilters.ts +2 -1
  238. package/src/dom/types/Node.ts +0 -4
  239. package/src/external/reanimated/index.ts +0 -1
  240. package/src/external/reanimated/renderHelpers.ts +4 -44
  241. package/src/external/reanimated/useAnimatedImageValue.ts +4 -15
  242. package/src/renderer/__tests__/e2e/ColorFilters.spec.tsx +15 -0
  243. package/src/renderer/__tests__/e2e/Composition/ColorFilterComposition.spec.tsx +23 -2
  244. package/src/renderer/__tests__/e2e/ImageFilters.spec.tsx +91 -2
  245. package/src/renderer/__tests__/setup.tsx +1 -1
  246. package/src/skia/core/AnimatedImage.ts +2 -3
  247. package/src/skia/core/Data.ts +3 -9
  248. package/src/skia/types/Paint/Paint.ts +2 -0
  249. package/src/skia/web/JsiSkPaint.ts +4 -0
  250. package/src/sksg/Container.ts +35 -29
  251. package/src/sksg/HostConfig.ts +5 -50
  252. package/src/sksg/Node.ts +105 -0
  253. package/src/sksg/Recorder/Core.ts +171 -0
  254. package/src/sksg/Recorder/DrawingContext.ts +130 -0
  255. package/src/sksg/Recorder/Player.ts +160 -0
  256. package/src/sksg/Recorder/Recorder.ts +259 -0
  257. package/src/sksg/Recorder/Recording.ts +13 -0
  258. package/src/sksg/Recorder/Visitor.ts +324 -0
  259. package/src/sksg/Recorder/commands/Box.ts +63 -0
  260. package/src/sksg/Recorder/commands/CTM.ts +72 -0
  261. package/src/sksg/Recorder/commands/ColorFilters.ts +87 -0
  262. package/src/sksg/{nodes/drawings.ts → Recorder/commands/Drawing.ts} +29 -65
  263. package/src/sksg/Recorder/commands/ImageFilters.ts +255 -0
  264. package/src/sksg/Recorder/commands/Paint.ts +77 -0
  265. package/src/sksg/Recorder/commands/PathEffects.ts +169 -0
  266. package/src/sksg/{nodes/shaders.ts → Recorder/commands/Shaders.ts} +100 -26
  267. package/src/sksg/{nodes/utils.ts → utils.ts} +14 -1
  268. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  269. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +0 -24
  270. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +0 -1
  271. package/lib/commonjs/sksg/DeclarationContext.d.ts +0 -56
  272. package/lib/commonjs/sksg/DeclarationContext.js +0 -77
  273. package/lib/commonjs/sksg/DeclarationContext.js.map +0 -1
  274. package/lib/commonjs/sksg/DrawingContext.d.ts +0 -13
  275. package/lib/commonjs/sksg/DrawingContext.js +0 -172
  276. package/lib/commonjs/sksg/DrawingContext.js.map +0 -1
  277. package/lib/commonjs/sksg/__tests__/Declarations.spec.d.ts +0 -1
  278. package/lib/commonjs/sksg/__tests__/MockDeclaration.d.ts +0 -57
  279. package/lib/commonjs/sksg/nodes/Node.d.ts +0 -7
  280. package/lib/commonjs/sksg/nodes/Node.js +0 -6
  281. package/lib/commonjs/sksg/nodes/Node.js.map +0 -1
  282. package/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -10
  283. package/lib/commonjs/sksg/nodes/colorFilters.js +0 -79
  284. package/lib/commonjs/sksg/nodes/colorFilters.js.map +0 -1
  285. package/lib/commonjs/sksg/nodes/context.d.ts +0 -3
  286. package/lib/commonjs/sksg/nodes/context.js +0 -394
  287. package/lib/commonjs/sksg/nodes/context.js.map +0 -1
  288. package/lib/commonjs/sksg/nodes/drawings.d.ts +0 -30
  289. package/lib/commonjs/sksg/nodes/drawings.js.map +0 -1
  290. package/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -17
  291. package/lib/commonjs/sksg/nodes/imageFilters.js +0 -197
  292. package/lib/commonjs/sksg/nodes/imageFilters.js.map +0 -1
  293. package/lib/commonjs/sksg/nodes/index.d.ts +0 -3
  294. package/lib/commonjs/sksg/nodes/index.js +0 -39
  295. package/lib/commonjs/sksg/nodes/index.js.map +0 -1
  296. package/lib/commonjs/sksg/nodes/paint.d.ts +0 -3
  297. package/lib/commonjs/sksg/nodes/paint.js +0 -81
  298. package/lib/commonjs/sksg/nodes/paint.js.map +0 -1
  299. package/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -11
  300. package/lib/commonjs/sksg/nodes/pathEffects.js +0 -111
  301. package/lib/commonjs/sksg/nodes/pathEffects.js.map +0 -1
  302. package/lib/commonjs/sksg/nodes/shaders.d.ts +0 -11
  303. package/lib/commonjs/sksg/nodes/shaders.js.map +0 -1
  304. package/lib/commonjs/sksg/nodes/utils.js.map +0 -1
  305. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  306. package/lib/module/external/reanimated/useDerivedValueOnJS.js +0 -16
  307. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +0 -1
  308. package/lib/module/sksg/DeclarationContext.d.ts +0 -56
  309. package/lib/module/sksg/DeclarationContext.js +0 -69
  310. package/lib/module/sksg/DeclarationContext.js.map +0 -1
  311. package/lib/module/sksg/DrawingContext.d.ts +0 -13
  312. package/lib/module/sksg/DrawingContext.js +0 -165
  313. package/lib/module/sksg/DrawingContext.js.map +0 -1
  314. package/lib/module/sksg/__tests__/Declarations.spec.d.ts +0 -1
  315. package/lib/module/sksg/__tests__/MockDeclaration.d.ts +0 -57
  316. package/lib/module/sksg/nodes/Node.d.ts +0 -7
  317. package/lib/module/sksg/nodes/Node.js +0 -2
  318. package/lib/module/sksg/nodes/Node.js.map +0 -1
  319. package/lib/module/sksg/nodes/colorFilters.d.ts +0 -10
  320. package/lib/module/sksg/nodes/colorFilters.js +0 -66
  321. package/lib/module/sksg/nodes/colorFilters.js.map +0 -1
  322. package/lib/module/sksg/nodes/context.d.ts +0 -3
  323. package/lib/module/sksg/nodes/context.js +0 -387
  324. package/lib/module/sksg/nodes/context.js.map +0 -1
  325. package/lib/module/sksg/nodes/drawings.d.ts +0 -30
  326. package/lib/module/sksg/nodes/drawings.js.map +0 -1
  327. package/lib/module/sksg/nodes/imageFilters.d.ts +0 -17
  328. package/lib/module/sksg/nodes/imageFilters.js.map +0 -1
  329. package/lib/module/sksg/nodes/index.d.ts +0 -3
  330. package/lib/module/sksg/nodes/index.js +0 -4
  331. package/lib/module/sksg/nodes/index.js.map +0 -1
  332. package/lib/module/sksg/nodes/paint.d.ts +0 -3
  333. package/lib/module/sksg/nodes/paint.js +0 -74
  334. package/lib/module/sksg/nodes/paint.js.map +0 -1
  335. package/lib/module/sksg/nodes/pathEffects.d.ts +0 -11
  336. package/lib/module/sksg/nodes/pathEffects.js +0 -97
  337. package/lib/module/sksg/nodes/pathEffects.js.map +0 -1
  338. package/lib/module/sksg/nodes/shaders.d.ts +0 -11
  339. package/lib/module/sksg/nodes/shaders.js.map +0 -1
  340. package/lib/module/sksg/nodes/utils.js.map +0 -1
  341. package/lib/typescript/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -2
  342. package/lib/typescript/lib/commonjs/sksg/DeclarationContext.d.ts +0 -53
  343. package/lib/typescript/lib/commonjs/sksg/DrawingContext.d.ts +0 -22
  344. package/lib/typescript/lib/commonjs/sksg/nodes/Node.d.ts +0 -1
  345. package/lib/typescript/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -8
  346. package/lib/typescript/lib/commonjs/sksg/nodes/context.d.ts +0 -2
  347. package/lib/typescript/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -12
  348. package/lib/typescript/lib/commonjs/sksg/nodes/index.d.ts +0 -1
  349. package/lib/typescript/lib/commonjs/sksg/nodes/paint.d.ts +0 -2
  350. package/lib/typescript/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -9
  351. package/lib/typescript/lib/commonjs/sksg/nodes/shaders.d.ts +0 -10
  352. package/lib/typescript/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  353. package/lib/typescript/lib/module/sksg/DeclarationContext.d.ts +0 -52
  354. package/lib/typescript/lib/module/sksg/DrawingContext.d.ts +0 -21
  355. package/lib/typescript/lib/module/sksg/nodes/Node.d.ts +0 -1
  356. package/lib/typescript/lib/module/sksg/nodes/colorFilters.d.ts +0 -7
  357. package/lib/typescript/lib/module/sksg/nodes/context.d.ts +0 -1
  358. package/lib/typescript/lib/module/sksg/nodes/imageFilters.d.ts +0 -11
  359. package/lib/typescript/lib/module/sksg/nodes/index.d.ts +0 -3
  360. package/lib/typescript/lib/module/sksg/nodes/paint.d.ts +0 -1
  361. package/lib/typescript/lib/module/sksg/nodes/pathEffects.d.ts +0 -8
  362. package/lib/typescript/lib/module/sksg/nodes/shaders.d.ts +0 -9
  363. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  364. package/lib/typescript/src/sksg/DeclarationContext.d.ts +0 -56
  365. package/lib/typescript/src/sksg/DrawingContext.d.ts +0 -13
  366. package/lib/typescript/src/sksg/__tests__/Declarations.spec.d.ts +0 -1
  367. package/lib/typescript/src/sksg/__tests__/MockDeclaration.d.ts +0 -57
  368. package/lib/typescript/src/sksg/nodes/Node.d.ts +0 -7
  369. package/lib/typescript/src/sksg/nodes/colorFilters.d.ts +0 -10
  370. package/lib/typescript/src/sksg/nodes/context.d.ts +0 -3
  371. package/lib/typescript/src/sksg/nodes/drawings.d.ts +0 -30
  372. package/lib/typescript/src/sksg/nodes/imageFilters.d.ts +0 -17
  373. package/lib/typescript/src/sksg/nodes/index.d.ts +0 -3
  374. package/lib/typescript/src/sksg/nodes/paint.d.ts +0 -3
  375. package/lib/typescript/src/sksg/nodes/pathEffects.d.ts +0 -11
  376. package/lib/typescript/src/sksg/nodes/shaders.d.ts +0 -11
  377. package/src/external/reanimated/useDerivedValueOnJS.ts +0 -20
  378. package/src/sksg/DeclarationContext.ts +0 -85
  379. package/src/sksg/DrawingContext.ts +0 -226
  380. package/src/sksg/__tests__/Declarations.spec.tsx +0 -235
  381. package/src/sksg/__tests__/MockDeclaration.ts +0 -138
  382. package/src/sksg/nodes/Node.ts +0 -8
  383. package/src/sksg/nodes/colorFilters.ts +0 -79
  384. package/src/sksg/nodes/context.ts +0 -412
  385. package/src/sksg/nodes/imageFilters.ts +0 -235
  386. package/src/sksg/nodes/index.ts +0 -3
  387. package/src/sksg/nodes/paint.ts +0 -75
  388. package/src/sksg/nodes/pathEffects.ts +0 -118
  389. /package/lib/typescript/lib/commonjs/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
  390. /package/lib/typescript/lib/module/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
@@ -0,0 +1,50 @@
1
+ import type { SharedValue } from "react-native-reanimated";
2
+ import { NodeType } from "../../dom/types";
3
+ import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PaintProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, BoxProps, BoxShadowProps } from "../../dom/types";
4
+ import type { AnimatedProps } from "../../renderer";
5
+ import type { Command } from "./Core";
6
+ export declare class Recorder {
7
+ commands: Command[];
8
+ private processProps;
9
+ private add;
10
+ savePaint(props: AnimatedProps<PaintProps>): void;
11
+ restorePaint(): void;
12
+ restorePaintDeclaration(): void;
13
+ materializePaint(): void;
14
+ pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;
15
+ pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>): void;
16
+ pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>): void;
17
+ pushShader(shaderType: NodeType, props: AnimatedProps<unknown>): void;
18
+ pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;
19
+ composePathEffect(): void;
20
+ composeColorFilter(): void;
21
+ composeImageFilter(): void;
22
+ saveCTM(props: AnimatedProps<CTMProps>): void;
23
+ restoreCTM(): void;
24
+ drawPaint(): void;
25
+ saveLayer(): void;
26
+ saveBackdropFilter(): void;
27
+ drawBox(boxProps: AnimatedProps<BoxProps>, shadows: {
28
+ props: BoxShadowProps;
29
+ animatedProps?: Record<string, SharedValue<unknown>>;
30
+ }[]): void;
31
+ drawImage(props: AnimatedProps<ImageProps>): void;
32
+ drawCircle(props: AnimatedProps<CircleProps>): void;
33
+ drawPoints(props: AnimatedProps<PointsProps>): void;
34
+ drawPath(props: AnimatedProps<PathProps>): void;
35
+ drawRect(props: AnimatedProps<RectProps>): void;
36
+ drawRRect(props: AnimatedProps<RoundedRectProps>): void;
37
+ drawOval(props: AnimatedProps<OvalProps>): void;
38
+ drawLine(props: AnimatedProps<LineProps>): void;
39
+ drawPatch(props: AnimatedProps<PatchProps>): void;
40
+ drawVertices(props: AnimatedProps<VerticesProps>): void;
41
+ drawDiffRect(props: AnimatedProps<DiffRectProps>): void;
42
+ drawText(props: AnimatedProps<TextProps>): void;
43
+ drawTextPath(props: AnimatedProps<TextPathProps>): void;
44
+ drawTextBlob(props: AnimatedProps<TextBlobProps>): void;
45
+ drawGlyphs(props: AnimatedProps<GlyphsProps>): void;
46
+ drawPicture(props: AnimatedProps<PictureProps>): void;
47
+ drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;
48
+ drawParagraph(props: AnimatedProps<ParagraphProps>): void;
49
+ drawAtlas(props: AnimatedProps<AtlasProps>): void;
50
+ }
@@ -0,0 +1,7 @@
1
+ import type { SkPaint } from "../../skia/types";
2
+ import type { Command } from "./Core";
3
+ export interface Recording {
4
+ commands: Command[];
5
+ paintPool: SkPaint[];
6
+ }
7
+ export declare const createRecording: (commands: Command[]) => Recording;
@@ -0,0 +1,5 @@
1
+ import type { DrawingNodeProps } from "../../dom/types";
2
+ import type { Node } from "../Node";
3
+ import type { Recorder } from "./Recorder";
4
+ export declare const processPaint: ({ opacity, color, strokeWidth, blendMode, style, strokeJoin, strokeCap, strokeMiter, antiAlias, dither, paint: paintRef, }: DrawingNodeProps) => DrawingNodeProps | null;
5
+ export declare const visit: (recorder: Recorder, root: Node[]) => void;
@@ -0,0 +1,13 @@
1
+ import type { BoxProps, BoxShadowProps } from "../../../dom/types";
2
+ import type { Command } from "../Core";
3
+ import { CommandType } from "../Core";
4
+ import type { DrawingContext } from "../DrawingContext";
5
+ interface BoxCommand extends Command<CommandType.DrawBox> {
6
+ props: BoxProps;
7
+ shadows: {
8
+ props: BoxShadowProps;
9
+ }[];
10
+ }
11
+ export declare const isBoxCommand: (command: Command) => command is BoxCommand;
12
+ export declare const drawBox: (ctx: DrawingContext, command: BoxCommand) => void;
13
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { CTMProps } from "../../../dom/types";
2
+ import type { DrawingContext } from "../DrawingContext";
3
+ export declare const saveCTM: (ctx: DrawingContext, props: CTMProps) => void;
@@ -0,0 +1,6 @@
1
+ import { CommandType } from "../Core";
2
+ import type { Command } from "../Core";
3
+ import type { DrawingContext } from "../DrawingContext";
4
+ export declare const isPushColorFilter: (command: Command) => command is Command<CommandType.PushColorFilter>;
5
+ export declare const composeColorFilters: (ctx: DrawingContext) => void;
6
+ export declare const pushColorFilter: (ctx: DrawingContext, command: Command<CommandType.PushColorFilter>) => void;
@@ -0,0 +1,24 @@
1
+ import type { AtlasProps, BoxProps, CircleProps, DiffRectProps, DrawingNodeProps, GlyphsProps, ImageProps, ImageSVGProps, LineProps, OvalProps, ParagraphProps, PatchProps, PathProps, PictureProps, PointsProps, RectProps, RoundedRectProps, TextBlobProps, TextPathProps, TextProps, VerticesProps } from "../../../dom/types";
2
+ import type { Node } from "../../Node";
3
+ import type { DrawingContext } from "../DrawingContext";
4
+ export declare const drawLine: (ctx: DrawingContext, props: LineProps) => void;
5
+ export declare const drawOval: (ctx: DrawingContext, props: OvalProps) => void;
6
+ export declare const drawBox: (ctx: DrawingContext, props: BoxProps, children: Node<any>[]) => void;
7
+ export declare const drawImage: (ctx: DrawingContext, props: ImageProps) => void;
8
+ export declare const drawPoints: (ctx: DrawingContext, props: PointsProps) => void;
9
+ export declare const drawVertices: (ctx: DrawingContext, props: VerticesProps) => void;
10
+ export declare const drawDiffRect: (ctx: DrawingContext, props: DiffRectProps) => void;
11
+ export declare const drawTextPath: (ctx: DrawingContext, props: TextPathProps) => void;
12
+ export declare const drawText: (ctx: DrawingContext, props: TextProps) => void;
13
+ export declare const drawPatch: (ctx: DrawingContext, props: PatchProps) => void;
14
+ export declare const drawPath: (ctx: DrawingContext, props: PathProps) => void;
15
+ export declare const drawRect: (ctx: DrawingContext, props: RectProps) => void;
16
+ export declare const drawRRect: (ctx: DrawingContext, props: RoundedRectProps) => void;
17
+ export declare const drawTextBlob: (ctx: DrawingContext, props: TextBlobProps) => void;
18
+ export declare const drawGlyphs: (ctx: DrawingContext, props: GlyphsProps) => void;
19
+ export declare const drawImageSVG: (ctx: DrawingContext, props: ImageSVGProps) => void;
20
+ export declare const drawParagraph: (ctx: DrawingContext, props: ParagraphProps) => void;
21
+ export declare const drawPicture: (ctx: DrawingContext, props: PictureProps) => void;
22
+ export declare const drawAtlas: (ctx: DrawingContext, props: AtlasProps) => void;
23
+ export declare const drawCircle: (ctx: DrawingContext, props: CircleProps) => void;
24
+ export declare const drawFill: (ctx: DrawingContext, _props: DrawingNodeProps) => void;
@@ -0,0 +1,12 @@
1
+ import type { BlurMaskFilterProps } from "../../../dom/types";
2
+ import type { Command } from "../Core";
3
+ import { CommandType } from "../Core";
4
+ import type { DrawingContext } from "../DrawingContext";
5
+ export declare enum MorphologyOperator {
6
+ Erode = 0,
7
+ Dilate = 1
8
+ }
9
+ export declare const composeImageFilters: (ctx: DrawingContext) => void;
10
+ export declare const setBlurMaskFilter: (ctx: DrawingContext, props: BlurMaskFilterProps) => void;
11
+ export declare const isPushImageFilter: (command: Command) => command is Command<CommandType.PushImageFilter>;
12
+ export declare const pushImageFilter: (ctx: DrawingContext, command: Command<CommandType.PushImageFilter>) => void;
@@ -0,0 +1,4 @@
1
+ import type { PaintProps } from "../../../dom/types";
2
+ import type { SkPaint, Skia } from "../../../skia/types";
3
+ export declare const processColor: (Skia: Skia, color: number | string | Float32Array | number[]) => Float32Array;
4
+ export declare const setPaintProperties: (Skia: Skia, paint: SkPaint, { opacity, color, blendMode, strokeWidth, style, strokeJoin, strokeCap, strokeMiter, antiAlias, dither, }: PaintProps) => void;
@@ -0,0 +1,6 @@
1
+ import type { Command } from "../Core";
2
+ import { CommandType } from "../Core";
3
+ import type { DrawingContext } from "../DrawingContext";
4
+ export declare const isPushPathEffect: (command: Command) => command is Command<CommandType.PushPathEffect>;
5
+ export declare const composePathEffects: (ctx: DrawingContext) => void;
6
+ export declare const pushPathEffect: (ctx: DrawingContext, command: Command<CommandType.PushPathEffect>) => void;
@@ -0,0 +1,5 @@
1
+ import type { Command } from "../Core";
2
+ import { CommandType } from "../Core";
3
+ import type { DrawingContext } from "../DrawingContext";
4
+ export declare const isPushShader: (command: Command) => command is Command<CommandType.PushShader>;
5
+ export declare const pushShader: (ctx: DrawingContext, command: Command<CommandType.PushShader>) => void;
@@ -1,3 +1,6 @@
1
1
  import type { SharedValue } from "react-native-reanimated";
2
2
  export declare const isSharedValue: <T = unknown>(value: unknown) => value is SharedValue<T>;
3
3
  export declare const materialize: <T extends object>(props: T) => T;
4
+ type Composer<T> = (outer: T, inner: T) => T;
5
+ export declare const composeDeclarations: <T>(filters: T[], composer: Composer<T>) => T;
6
+ export {};
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "setup-skia-web": "./scripts/setup-canvaskit.js"
8
8
  },
9
9
  "title": "React Native Skia",
10
- "version": "1.8.0",
10
+ "version": "1.8.2",
11
11
  "description": "High-performance React Native Graphics using Skia",
12
12
  "main": "lib/module/index.js",
13
13
  "react-native": "src/index.ts",
@@ -70,6 +70,12 @@ export interface TransformProps {
70
70
  matrix?: InputMatrix;
71
71
  }
72
72
 
73
+ export interface CTMProps extends TransformProps {
74
+ clip?: ClipDef;
75
+ invertClip?: boolean;
76
+ layer?: SkPaint | boolean;
77
+ }
78
+
73
79
  export interface PaintProps extends ChildrenProps {
74
80
  color?: Color;
75
81
  strokeWidth?: number;
@@ -83,8 +89,4 @@ export interface PaintProps extends ChildrenProps {
83
89
  dither?: boolean;
84
90
  }
85
91
 
86
- export interface GroupProps extends PaintProps, TransformProps {
87
- clip?: ClipDef;
88
- invertClip?: boolean;
89
- layer?: SkPaint | boolean;
90
- }
92
+ export interface GroupProps extends PaintProps, CTMProps {}
@@ -24,8 +24,9 @@ export interface RuntimeShaderImageFilterProps extends ChildrenProps {
24
24
  uniforms?: Uniforms;
25
25
  }
26
26
 
27
+ // TODO: delete
27
28
  export interface BlendImageFilterProps extends ChildrenProps {
28
- mode: BlendMode;
29
+ mode: SkEnum<typeof BlendMode>;
29
30
  }
30
31
 
31
32
  export interface MorphologyImageFilterProps extends ChildrenProps {
@@ -1,6 +1,5 @@
1
1
  import type { GroupProps } from "./Common";
2
2
  import type { NodeType } from "./NodeType";
3
- import type { DeclarationContext } from "../../sksg/DeclarationContext";
4
3
 
5
4
  export interface Node<P> {
6
5
  type: NodeType;
@@ -18,9 +17,6 @@ export interface Node<P> {
18
17
  export type Invalidate = () => void;
19
18
 
20
19
  export interface DeclarationNode<P> extends Node<P> {
21
- //declarationType: DeclarationType;
22
- decorate(ctx: DeclarationContext): void;
23
-
24
20
  setInvalidate(invalidate: Invalidate): void;
25
21
  }
26
22
 
@@ -1,5 +1,4 @@
1
1
  export * from "./useAnimatedImageValue";
2
- export * from "./useDerivedValueOnJS";
3
2
  export * from "./renderHelpers";
4
3
  export * from "./interpolators";
5
4
  export * from "./textures";
@@ -6,7 +6,6 @@ import type { Node } from "../../dom/types";
6
6
 
7
7
  import Rea from "./ReanimatedProxy";
8
8
 
9
- export let HAS_REANIMATED = false;
10
9
  export let HAS_REANIMATED_3 = false;
11
10
  try {
12
11
  // This logic is convoluted but necessary
@@ -16,7 +15,6 @@ try {
16
15
  const reanimatedVersion =
17
16
  require("react-native-reanimated/package.json").version;
18
17
  require("react-native-reanimated");
19
- HAS_REANIMATED = !!reanimatedVersion;
20
18
  if (
21
19
  reanimatedVersion &&
22
20
  (reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))
@@ -24,13 +22,13 @@ try {
24
22
  HAS_REANIMATED_3 = true;
25
23
  }
26
24
  } catch (e) {
27
- HAS_REANIMATED = false;
25
+ // do nothing
28
26
  }
29
27
 
30
28
  const _bindings = new WeakMap<Node<unknown>, unknown>();
31
29
 
32
30
  export const unbindReanimatedNode = (node: Node<unknown>) => {
33
- if (!HAS_REANIMATED) {
31
+ if (!HAS_REANIMATED_3) {
34
32
  return;
35
33
  }
36
34
  const previousMapperId = _bindings.get(node);
@@ -40,7 +38,7 @@ export const unbindReanimatedNode = (node: Node<unknown>) => {
40
38
  };
41
39
 
42
40
  export function extractReanimatedProps(props: AnimatedProps<any>) {
43
- if (!HAS_REANIMATED) {
41
+ if (!HAS_REANIMATED_3) {
44
42
  return [props, {}];
45
43
  }
46
44
  const reanimatedProps = {} as AnimatedProps<any>;
@@ -60,50 +58,12 @@ export function extractReanimatedProps(props: AnimatedProps<any>) {
60
58
  return [otherProps, reanimatedProps];
61
59
  }
62
60
 
63
- function bindReanimatedProps2(
64
- container: Container,
65
- node: Node<any>,
66
- reanimatedProps: AnimatedProps<any>
67
- ) {
68
- const sharedValues = Object.values(reanimatedProps);
69
- const previousMapperId = _bindings.get(node);
70
- if (previousMapperId !== undefined) {
71
- Rea.stopMapper(previousMapperId as number);
72
- }
73
- if (sharedValues.length > 0) {
74
- const viewId = container.getNativeId();
75
- const { SkiaViewApi } = global;
76
- const updateProps = () => {
77
- for (const propName in reanimatedProps) {
78
- node && node.setProp(propName, reanimatedProps[propName].value);
79
- }
80
- // On React Native we use the SkiaViewApi to redraw because it can
81
- // run on the worklet thread (container.redraw can't)
82
- // if SkiaViewApi is undefined, we are on web and container.redraw()
83
- // can safely be invoked
84
- if (SkiaViewApi) {
85
- SkiaViewApi.requestRedraw(viewId);
86
- } else {
87
- container.redraw();
88
- }
89
- };
90
- const mapperId = Rea.startMapper(() => {
91
- "worklet";
92
- Rea.runOnJS(updateProps)();
93
- }, sharedValues);
94
- _bindings.set(node, mapperId);
95
- }
96
- }
97
-
98
61
  export function bindReanimatedProps(
99
62
  container: Container,
100
63
  node: Node<any>,
101
64
  reanimatedProps: AnimatedProps<any>
102
65
  ) {
103
- if (HAS_REANIMATED && !HAS_REANIMATED_3) {
104
- return bindReanimatedProps2(container, node, reanimatedProps);
105
- }
106
- if (!HAS_REANIMATED) {
66
+ if (!HAS_REANIMATED_3) {
107
67
  return;
108
68
  }
109
69
  const sharedValues = Object.values(reanimatedProps);
@@ -1,4 +1,3 @@
1
- import { useEffect } from "react";
2
1
  import type { FrameInfo, SharedValue } from "react-native-reanimated";
3
2
 
4
3
  import { useAnimatedImage } from "../../skia/core/AnimatedImage";
@@ -16,14 +15,10 @@ export const useAnimatedImageValue = (
16
15
  const isPaused = paused ?? defaultPaused;
17
16
  const currentFrame = Rea.useSharedValue<null | SkImage>(null);
18
17
  const lastTimestamp = Rea.useSharedValue(-1);
19
- const animatedImage = useAnimatedImage(
20
- source,
21
- (err) => {
22
- console.error(err);
23
- throw new Error(`Could not load animated image - got '${err.message}'`);
24
- },
25
- false
26
- );
18
+ const animatedImage = useAnimatedImage(source, (err) => {
19
+ console.error(err);
20
+ throw new Error(`Could not load animated image - got '${err.message}'`);
21
+ });
27
22
  const frameDuration =
28
23
  animatedImage?.currentFrameDuration() || DEFAULT_FRAME_DURATION;
29
24
 
@@ -53,11 +48,5 @@ export const useAnimatedImageValue = (
53
48
  // Update the last timestamp
54
49
  lastTimestamp.value = timestamp;
55
50
  });
56
- useEffect(() => {
57
- return () => {
58
- animatedImage?.dispose();
59
- };
60
- // eslint-disable-next-line react-hooks/exhaustive-deps
61
- }, []);
62
51
  return currentFrame;
63
52
  };
@@ -14,6 +14,7 @@ import {
14
14
  import { docPath, checkImage, processResult } from "../../../__tests__/setup";
15
15
  import { setupSkia } from "../../../skia/__tests__/setup";
16
16
  import { fitRects } from "../../../dom/nodes";
17
+ import { BlendMode } from "../../../skia/types";
17
18
 
18
19
  const blackAndWhite = [
19
20
  0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0,
@@ -57,6 +58,20 @@ describe("Color Filters", () => {
57
58
  );
58
59
  checkImage(img, docPath("color-filters/color-blend.png"));
59
60
  });
61
+ it("should build the reference result for should use composition", async () => {
62
+ const { surface: ckSurface, Skia, canvas } = setupSkia(wWidth, wHeight);
63
+ const paint = Skia.Paint();
64
+ const outer = Skia.ColorFilter.MakeSRGBToLinearGamma();
65
+ const inner = Skia.ColorFilter.MakeBlend(
66
+ Skia.Color("lightblue"),
67
+ BlendMode.SrcIn
68
+ );
69
+ paint.setColorFilter(Skia.ColorFilter.MakeCompose(outer, inner));
70
+ const r = (surface.width * 3) / 2;
71
+ canvas.drawCircle(r, r, r, paint);
72
+ canvas.drawCircle(r * 2, r, r, paint);
73
+ processResult(ckSurface, docPath("color-filters/composition.png"));
74
+ });
60
75
  it("should use composition", async () => {
61
76
  const { width } = surface;
62
77
  const r = width / 2;
@@ -7,12 +7,20 @@ import {
7
7
  height as wHeight,
8
8
  } from "../../setup";
9
9
  import {
10
+ BlendColor,
11
+ Circle,
10
12
  ColorMatrix,
13
+ Group,
11
14
  Image,
12
15
  Lerp,
13
16
  LinearToSRGBGamma,
17
+ SRGBToLinearGamma,
14
18
  } from "../../../components";
15
- import { checkImage, processResult } from "../../../../__tests__/setup";
19
+ import {
20
+ checkImage,
21
+ docPath,
22
+ processResult,
23
+ } from "../../../../__tests__/setup";
16
24
  import { setupSkia } from "../../../../skia/__tests__/setup";
17
25
  import { fitRects } from "../../../../dom/nodes";
18
26
 
@@ -60,7 +68,6 @@ describe("Color Filter Composition", () => {
60
68
  "snapshots/color-filter/color-filter-composition.png"
61
69
  );
62
70
  });
63
- // TODO: a bug should be reported here
64
71
  it("should apply a color matrix to an image", async () => {
65
72
  const { oslo } = images;
66
73
  const { width, height } = surface;
@@ -78,4 +85,18 @@ describe("Color Filter Composition", () => {
78
85
  );
79
86
  checkImage(image, "snapshots/color-filter/color-filter-composition.png");
80
87
  });
88
+ it("should use composition", async () => {
89
+ const { width } = surface;
90
+ const r = width / 2;
91
+ const img = await surface.draw(
92
+ <Group>
93
+ <SRGBToLinearGamma>
94
+ <BlendColor color="lightblue" mode="srcIn" />
95
+ </SRGBToLinearGamma>
96
+ <Circle cx={r} cy={r} r={r} />
97
+ <Circle cx={2 * r} cy={r} r={r} color="red" />
98
+ </Group>
99
+ );
100
+ checkImage(img, docPath("color-filters/composition.png"));
101
+ });
81
102
  });
@@ -6,8 +6,15 @@ import {
6
6
  itRunsNodeOnly,
7
7
  itRunsE2eOnly,
8
8
  CI,
9
+ processResult,
9
10
  } from "../../../__tests__/setup";
10
- import { fonts, images, surface } from "../setup";
11
+ import {
12
+ fonts,
13
+ images,
14
+ surface,
15
+ width as wWidth,
16
+ height as wHeight,
17
+ } from "../setup";
11
18
  import {
12
19
  Fill,
13
20
  Image,
@@ -20,6 +27,51 @@ import {
20
27
  DisplacementMap,
21
28
  Turbulence,
22
29
  } from "../../components";
30
+ import { setupSkia } from "../../../skia/__tests__/setup";
31
+ import {
32
+ BlendMode,
33
+ TileMode,
34
+ type SkColor,
35
+ type Skia,
36
+ type SkImageFilter,
37
+ } from "../../../skia/types";
38
+
39
+ const Black = Float32Array.of(0, 0, 0, 1);
40
+
41
+ const MakeInnerShadow = (
42
+ Skia: Skia,
43
+ shadowOnly: boolean | undefined,
44
+ dx: number,
45
+ dy: number,
46
+ sigmaX: number,
47
+ sigmaY: number,
48
+ color: SkColor,
49
+ input: SkImageFilter | null
50
+ ) => {
51
+ "worklet";
52
+ const sourceGraphic = Skia.ImageFilter.MakeColorFilter(
53
+ Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),
54
+ null
55
+ );
56
+ const sourceAlpha = Skia.ImageFilter.MakeColorFilter(
57
+ Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),
58
+ null
59
+ );
60
+ const f1 = Skia.ImageFilter.MakeColorFilter(
61
+ Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),
62
+ null
63
+ );
64
+ const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);
65
+ const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);
66
+ const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);
67
+ if (shadowOnly) {
68
+ return f4;
69
+ }
70
+ return Skia.ImageFilter.MakeCompose(
71
+ input,
72
+ Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)
73
+ );
74
+ };
23
75
 
24
76
  describe("Test Image Filters", () => {
25
77
  itRunsNodeOnly(
@@ -191,6 +243,41 @@ describe("Test Image Filters", () => {
191
243
  threshold: 0.05,
192
244
  });
193
245
  });
246
+ it("should build reference result outer and inner shadows on text", () => {
247
+ const { surface: ckSurface, canvas, Skia } = setupSkia(wWidth, wHeight);
248
+ const path = Skia.Path.MakeFromSVGString(
249
+ // eslint-disable-next-line max-len
250
+ "M62.477 2.273V75h-8.522L14.324 17.898h-.71V75H4.807V2.273h8.522l39.773 57.244h.71V2.273h8.665ZM78.963 75V20.454h8.381V75h-8.38Zm4.262-63.636c-1.634 0-3.042-.557-4.226-1.67-1.16-1.112-1.74-2.45-1.74-4.012 0-1.563.58-2.9 1.74-4.013C80.183.556 81.59 0 83.225 0c1.633 0 3.03.556 4.19 1.669 1.184 1.113 1.776 2.45 1.776 4.013 0 1.562-.592 2.9-1.776 4.013-1.16 1.112-2.557 1.669-4.19 1.669ZM124.853 76.136c-5.114 0-9.517-1.207-13.21-3.622-3.693-2.415-6.534-5.74-8.523-9.978-1.989-4.238-2.983-9.08-2.983-14.525 0-5.54 1.018-10.428 3.054-14.666 2.06-4.261 4.924-7.587 8.594-9.979 3.693-2.414 8.002-3.622 12.926-3.622 3.835 0 7.292.71 10.369 2.131 3.078 1.42 5.599 3.41 7.564 5.966 1.965 2.557 3.184 5.54 3.658 8.949h-8.381c-.639-2.486-2.059-4.688-4.261-6.605-2.178-1.942-5.114-2.912-8.807-2.912-3.267 0-6.132.852-8.594 2.556-2.438 1.681-4.344 4.06-5.717 7.138-1.35 3.054-2.024 6.641-2.024 10.76 0 4.214.663 7.884 1.988 11.009 1.35 3.125 3.244 5.551 5.682 7.28 2.462 1.728 5.351 2.592 8.665 2.592 2.178 0 4.155-.379 5.93-1.136a12.23 12.23 0 0 0 4.51-3.267c1.231-1.42 2.107-3.125 2.628-5.114h8.381c-.474 3.22-1.646 6.12-3.516 8.7-1.846 2.557-4.297 4.593-7.351 6.108-3.03 1.492-6.557 2.237-10.582 2.237ZM181.423 76.136c-5.256 0-9.79-1.16-13.601-3.48-3.788-2.344-6.712-5.61-8.772-9.8-2.036-4.215-3.054-9.116-3.054-14.703s1.018-10.511 3.054-14.772c2.06-4.285 4.925-7.623 8.594-10.015 3.693-2.414 8.002-3.622 12.926-3.622 2.841 0 5.647.474 8.417 1.42 2.769.948 5.291 2.487 7.563 4.617 2.273 2.107 4.084 4.9 5.434 8.38 1.349 3.481 2.024 7.766 2.024 12.856v3.551h-42.046v-7.244h33.523c0-3.078-.615-5.824-1.847-8.239-1.207-2.415-2.935-4.32-5.184-5.717-2.226-1.397-4.853-2.095-7.884-2.095-3.338 0-6.226.828-8.664 2.486a16.35 16.35 0 0 0-5.576 6.392c-1.302 2.627-1.953 5.445-1.953 8.451v4.83c0 4.12.71 7.611 2.131 10.476 1.444 2.84 3.444 5.007 6.001 6.498 2.557 1.468 5.528 2.202 8.914 2.202 2.201 0 4.19-.308 5.965-.923 1.8-.64 3.35-1.587 4.652-2.841 1.303-1.279 2.309-2.865 3.019-4.759l8.097 2.273a17.965 17.965 0 0 1-4.297 7.244c-2.013 2.06-4.498 3.67-7.458 4.83-2.959 1.136-6.285 1.704-9.978 1.704ZM32.648 123.273h8.806v51.988c0 4.641-.852 8.582-2.556 11.826-1.705 3.243-4.108 5.705-7.21 7.386-3.1 1.681-6.758 2.521-10.972 2.521-3.977 0-7.517-.722-10.618-2.166-3.101-1.468-5.54-3.551-7.315-6.25-1.776-2.699-2.664-5.907-2.664-9.623h8.665c0 2.059.51 3.858 1.527 5.397 1.042 1.515 2.462 2.699 4.261 3.551 1.8.853 3.848 1.279 6.144 1.279 2.533 0 4.687-.533 6.463-1.598 1.776-1.066 3.125-2.628 4.048-4.688.947-2.083 1.42-4.628 1.42-7.635v-51.988ZM80.126 197.136c-4.924 0-9.244-1.172-12.961-3.515-3.693-2.344-6.582-5.623-8.665-9.837-2.06-4.214-3.09-9.138-3.09-14.773 0-5.681 1.03-10.641 3.09-14.879 2.083-4.238 4.972-7.528 8.665-9.872 3.717-2.344 8.037-3.516 12.961-3.516 4.925 0 9.233 1.172 12.927 3.516 3.716 2.344 6.605 5.634 8.664 9.872 2.084 4.238 3.125 9.198 3.125 14.879 0 5.635-1.041 10.559-3.125 14.773-2.06 4.214-4.948 7.493-8.664 9.837-3.694 2.343-8.002 3.515-12.927 3.515Zm0-7.528c3.741 0 6.819-.959 9.233-2.876 2.415-1.918 4.203-4.439 5.363-7.564 1.16-3.125 1.74-6.511 1.74-10.157 0-3.645-.58-7.043-1.74-10.191-1.16-3.149-2.948-5.694-5.363-7.635-2.414-1.942-5.492-2.912-9.233-2.912-3.74 0-6.818.97-9.233 2.912-2.414 1.941-4.202 4.486-5.362 7.635-1.16 3.148-1.74 6.546-1.74 10.191 0 3.646.58 7.032 1.74 10.157 1.16 3.125 2.948 5.646 5.362 7.564 2.415 1.917 5.493 2.876 9.233 2.876ZM118.772 196v-72.727h8.38v26.846h.711c.615-.947 1.467-2.154 2.556-3.622 1.113-1.491 2.699-2.817 4.759-3.977 2.083-1.184 4.9-1.776 8.452-1.776 4.592 0 8.641 1.149 12.145 3.445 3.503 2.296 6.238 5.552 8.203 9.766 1.965 4.214 2.947 9.185 2.947 14.914 0 5.777-.982 10.784-2.947 15.022-1.965 4.214-4.688 7.481-8.168 9.801-3.48 2.296-7.493 3.444-12.038 3.444-3.504 0-6.31-.58-8.417-1.74-2.107-1.183-3.728-2.521-4.865-4.012-1.136-1.516-2.012-2.77-2.627-3.765h-.995V196h-8.096Zm8.238-27.273c0 4.12.604 7.754 1.811 10.902 1.208 3.125 2.971 5.576 5.292 7.351 2.32 1.752 5.161 2.628 8.522 2.628 3.504 0 6.428-.923 8.772-2.77 2.367-1.87 4.143-4.38 5.326-7.528 1.208-3.173 1.811-6.7 1.811-10.583 0-3.835-.591-7.291-1.775-10.369-1.16-3.101-2.924-5.552-5.291-7.351-2.344-1.823-5.292-2.734-8.843-2.734-3.409 0-6.273.864-8.593 2.592-2.321 1.705-4.072 4.096-5.256 7.173-1.184 3.054-1.776 6.617-1.776 10.689ZM190.824 123.273l-.71 52.272h-8.239l-.71-52.272h9.659Zm-4.829 73.295c-1.752 0-3.256-.627-4.51-1.882-1.255-1.255-1.882-2.758-1.882-4.51 0-1.752.627-3.255 1.882-4.51 1.254-1.255 2.758-1.882 4.51-1.882 1.752 0 3.255.627 4.51 1.882 1.254 1.255 1.882 2.758 1.882 4.51a6.02 6.02 0 0 1-.888 3.196 6.634 6.634 0 0 1-2.308 2.344c-.947.568-2.013.852-3.196.852Z"
251
+ )!;
252
+
253
+ const paint = Skia.Paint();
254
+ paint.setColor(Skia.Color("#add8e6"));
255
+ canvas.drawPaint(paint);
256
+ paint.setColor(Skia.Color("red"));
257
+ const img1 = MakeInnerShadow(
258
+ Skia,
259
+ false,
260
+ 0,
261
+ 4,
262
+ 1,
263
+ 1,
264
+ Skia.Color("#00FF00"),
265
+ null
266
+ );
267
+ const img2 = Skia.ImageFilter.MakeDropShadow(
268
+ 0,
269
+ 4,
270
+ 0,
271
+ 0,
272
+ Skia.Color("#0000ff"),
273
+ null
274
+ );
275
+ paint.setImageFilter(Skia.ImageFilter.MakeCompose(img1, img2));
276
+ canvas.scale(3, 3);
277
+ canvas.drawPath(path, paint);
278
+ canvas.restore();
279
+ processResult(ckSurface, "snapshots/image-filter/test-shadow.png");
280
+ });
194
281
  it("should show outer and inner shadows on text", async () => {
195
282
  const path =
196
283
  // eslint-disable-next-line max-len
@@ -205,7 +292,9 @@ describe("Test Image Filters", () => {
205
292
  </Path>
206
293
  </>
207
294
  );
208
- checkImage(img, "snapshots/image-filter/test-shadow.png");
295
+ checkImage(img, "snapshots/image-filter/test-shadow.png", {
296
+ maxPixelDiff: 1500,
297
+ });
209
298
  });
210
299
  itRunsE2eOnly("use the displacement map as documented", async () => {
211
300
  const { oslo } = images;
@@ -14,7 +14,7 @@ import { isPath } from "../../skia/types";
14
14
  import { E2E } from "../../__tests__/setup";
15
15
  import { LoadSkiaWeb } from "../../web/LoadSkiaWeb";
16
16
  import { SkiaSGRoot } from "../../sksg/Reconciler";
17
- import type { Node } from "../../sksg/nodes";
17
+ import type { Node } from "../../sksg/Node";
18
18
 
19
19
  import { SkiaObject } from "./e2e/setup";
20
20
 
@@ -12,6 +12,5 @@ const animatedImgFactory = Skia.AnimatedImage.MakeAnimatedImageFromEncoded.bind(
12
12
  * */
13
13
  export const useAnimatedImage = (
14
14
  source: DataSourceParam,
15
- onError?: (err: Error) => void,
16
- managed = true
17
- ) => useRawData(source, animatedImgFactory, onError, managed);
15
+ onError?: (err: Error) => void
16
+ ) => useRawData(source, animatedImgFactory, onError);
@@ -40,8 +40,7 @@ export const loadData = <T>(
40
40
 
41
41
  const useLoading = <T extends SkJSIInstance<string>>(
42
42
  source: DataSourceParam,
43
- loader: () => Promise<T | null>,
44
- manage = true
43
+ loader: () => Promise<T | null>
45
44
  ) => {
46
45
  const mounted = useRef(false);
47
46
  const [data, setData] = useState<T | null>(null);
@@ -55,9 +54,6 @@ const useLoading = <T extends SkJSIInstance<string>>(
55
54
  }
56
55
  });
57
56
  return () => {
58
- if (manage) {
59
- dataRef.current?.dispose();
60
- }
61
57
  mounted.current = false;
62
58
  };
63
59
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -84,7 +80,6 @@ export const useCollectionLoading = <T extends SkJSIInstance<string>>(
84
80
  });
85
81
 
86
82
  return () => {
87
- dataRef.current?.forEach((instance) => instance?.dispose());
88
83
  mounted.current = false;
89
84
  };
90
85
 
@@ -97,9 +92,8 @@ export const useCollectionLoading = <T extends SkJSIInstance<string>>(
97
92
  export const useRawData = <T extends SkJSIInstance<string>>(
98
93
  source: DataSourceParam,
99
94
  factory: (data: SkData) => T | null,
100
- onError?: (err: Error) => void,
101
- manage = true
102
- ) => useLoading(source, () => loadData<T>(source, factory, onError), manage);
95
+ onError?: (err: Error) => void
96
+ ) => useLoading(source, () => loadData<T>(source, factory, onError));
103
97
 
104
98
  const identity = (data: SkData) => data;
105
99
 
@@ -45,6 +45,8 @@ export interface SkPaint extends SkJSIInstance<"Paint"> {
45
45
  */
46
46
  reset(): void;
47
47
 
48
+ assign(paint: SkPaint): void;
49
+
48
50
  /**
49
51
  * Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values
50
52
  * (sRGB gamut, and encoded with the sRGB transfer function).
@@ -34,6 +34,10 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
34
34
  return new JsiSkPaint(this.CanvasKit, this.ref.copy());
35
35
  }
36
36
 
37
+ assign(paint: JsiSkPaint) {
38
+ this.ref = paint.ref.copy();
39
+ }
40
+
37
41
  reset() {
38
42
  this.ref = new this.CanvasKit.Paint();
39
43
  }