@shopify/react-native-skia 1.8.0 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (364) 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/skia/types/Paint/Paint.d.ts +1 -0
  15. package/lib/commonjs/skia/types/Paint/Paint.js.map +1 -1
  16. package/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  17. package/lib/commonjs/skia/web/JsiSkPaint.js +3 -0
  18. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  19. package/lib/commonjs/sksg/Container.d.ts +3 -2
  20. package/lib/commonjs/sksg/Container.js +32 -26
  21. package/lib/commonjs/sksg/Container.js.map +1 -1
  22. package/lib/commonjs/sksg/HostConfig.d.ts +2 -2
  23. package/lib/commonjs/sksg/HostConfig.js +7 -25
  24. package/lib/commonjs/sksg/HostConfig.js.map +1 -1
  25. package/lib/commonjs/sksg/Node.d.ts +19 -0
  26. package/lib/commonjs/sksg/Node.js +78 -0
  27. package/lib/commonjs/sksg/Node.js.map +1 -0
  28. package/lib/commonjs/sksg/Reconciler.d.ts +1 -1
  29. package/lib/commonjs/sksg/Recorder/Core.d.ts +79 -0
  30. package/lib/commonjs/sksg/Recorder/Core.js +110 -0
  31. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -0
  32. package/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +18 -0
  33. package/lib/commonjs/sksg/Recorder/DrawingContext.js +105 -0
  34. package/lib/commonjs/sksg/Recorder/DrawingContext.js.map +1 -0
  35. package/lib/commonjs/sksg/Recorder/Player.d.ts +3 -0
  36. package/lib/commonjs/sksg/Recorder/Player.js +127 -0
  37. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -0
  38. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +50 -0
  39. package/lib/commonjs/sksg/Recorder/Recorder.js +288 -0
  40. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -0
  41. package/lib/commonjs/sksg/Recorder/Recording.d.ts +7 -0
  42. package/lib/commonjs/sksg/Recorder/Recording.js +12 -0
  43. package/lib/commonjs/sksg/Recorder/Recording.js.map +1 -0
  44. package/lib/commonjs/sksg/Recorder/Visitor.d.ts +5 -0
  45. package/lib/commonjs/sksg/Recorder/Visitor.js +293 -0
  46. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -0
  47. package/lib/commonjs/sksg/Recorder/commands/Box.d.ts +13 -0
  48. package/lib/commonjs/sksg/Recorder/commands/Box.js +71 -0
  49. package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -0
  50. package/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +3 -0
  51. package/lib/commonjs/sksg/Recorder/commands/CTM.js +79 -0
  52. package/lib/commonjs/sksg/Recorder/commands/CTM.js.map +1 -0
  53. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  54. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js +76 -0
  55. package/lib/commonjs/sksg/Recorder/commands/ColorFilters.js.map +1 -0
  56. package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +24 -0
  57. package/lib/commonjs/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
  58. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -0
  59. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  60. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +183 -0
  61. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -0
  62. package/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +4 -0
  63. package/lib/commonjs/sksg/Recorder/commands/Paint.js +70 -0
  64. package/lib/commonjs/sksg/Recorder/commands/Paint.js.map +1 -0
  65. package/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  66. package/lib/commonjs/sksg/Recorder/commands/PathEffects.js +137 -0
  67. package/lib/commonjs/sksg/Recorder/commands/PathEffects.js.map +1 -0
  68. package/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +5 -0
  69. package/lib/commonjs/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +58 -15
  70. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -0
  71. package/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  72. package/lib/commonjs/sksg/{nodes/utils.js → utils.js} +12 -2
  73. package/lib/commonjs/sksg/utils.js.map +1 -0
  74. package/lib/module/dom/types/Common.d.ts +6 -4
  75. package/lib/module/dom/types/Common.js.map +1 -1
  76. package/lib/module/dom/types/ImageFilters.d.ts +1 -1
  77. package/lib/module/dom/types/ImageFilters.js.map +1 -1
  78. package/lib/module/dom/types/Node.d.ts +0 -2
  79. package/lib/module/dom/types/Node.js.map +1 -1
  80. package/lib/module/external/reanimated/index.d.ts +0 -1
  81. package/lib/module/external/reanimated/index.js +0 -1
  82. package/lib/module/external/reanimated/index.js.map +1 -1
  83. package/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
  84. package/lib/module/external/reanimated/renderHelpers.js +4 -42
  85. package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
  86. package/lib/module/skia/types/Paint/Paint.d.ts +1 -0
  87. package/lib/module/skia/types/Paint/Paint.js.map +1 -1
  88. package/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  89. package/lib/module/skia/web/JsiSkPaint.js +3 -0
  90. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  91. package/lib/module/sksg/Container.d.ts +3 -2
  92. package/lib/module/sksg/Container.js +30 -24
  93. package/lib/module/sksg/Container.js.map +1 -1
  94. package/lib/module/sksg/HostConfig.d.ts +2 -2
  95. package/lib/module/sksg/HostConfig.js +7 -25
  96. package/lib/module/sksg/HostConfig.js.map +1 -1
  97. package/lib/module/sksg/Node.d.ts +19 -0
  98. package/lib/module/sksg/Node.js +67 -0
  99. package/lib/module/sksg/Node.js.map +1 -0
  100. package/lib/module/sksg/Reconciler.d.ts +1 -1
  101. package/lib/module/sksg/Recorder/Core.d.ts +79 -0
  102. package/lib/module/sksg/Recorder/Core.js +101 -0
  103. package/lib/module/sksg/Recorder/Core.js.map +1 -0
  104. package/lib/module/sksg/Recorder/DrawingContext.d.ts +18 -0
  105. package/lib/module/sksg/Recorder/DrawingContext.js +98 -0
  106. package/lib/module/sksg/Recorder/DrawingContext.js.map +1 -0
  107. package/lib/module/sksg/Recorder/Player.d.ts +3 -0
  108. package/lib/module/sksg/Recorder/Player.js +120 -0
  109. package/lib/module/sksg/Recorder/Player.js.map +1 -0
  110. package/lib/module/sksg/Recorder/Recorder.d.ts +50 -0
  111. package/lib/module/sksg/Recorder/Recorder.js +281 -0
  112. package/lib/module/sksg/Recorder/Recorder.js.map +1 -0
  113. package/lib/module/sksg/Recorder/Recording.d.ts +7 -0
  114. package/lib/module/sksg/Recorder/Recording.js +5 -0
  115. package/lib/module/sksg/Recorder/Recording.js.map +1 -0
  116. package/lib/module/sksg/Recorder/Visitor.d.ts +5 -0
  117. package/lib/module/sksg/Recorder/Visitor.js +285 -0
  118. package/lib/module/sksg/Recorder/Visitor.js.map +1 -0
  119. package/lib/module/sksg/Recorder/commands/Box.d.ts +13 -0
  120. package/lib/module/sksg/Recorder/commands/Box.js +63 -0
  121. package/lib/module/sksg/Recorder/commands/Box.js.map +1 -0
  122. package/lib/module/sksg/Recorder/commands/CTM.d.ts +3 -0
  123. package/lib/module/sksg/Recorder/commands/CTM.js +72 -0
  124. package/lib/module/sksg/Recorder/commands/CTM.js.map +1 -0
  125. package/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  126. package/lib/module/sksg/Recorder/commands/ColorFilters.js +67 -0
  127. package/lib/module/sksg/Recorder/commands/ColorFilters.js.map +1 -0
  128. package/lib/module/sksg/Recorder/commands/Drawing.d.ts +24 -0
  129. package/lib/module/sksg/{nodes/drawings.js → Recorder/commands/Drawing.js} +5 -5
  130. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -0
  131. package/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  132. package/lib/module/sksg/{nodes/imageFilters.js → Recorder/commands/ImageFilters.js} +87 -95
  133. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -0
  134. package/lib/module/sksg/Recorder/commands/Paint.d.ts +4 -0
  135. package/lib/module/sksg/Recorder/commands/Paint.js +62 -0
  136. package/lib/module/sksg/Recorder/commands/Paint.js.map +1 -0
  137. package/lib/module/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  138. package/lib/module/sksg/Recorder/commands/PathEffects.js +128 -0
  139. package/lib/module/sksg/Recorder/commands/PathEffects.js.map +1 -0
  140. package/lib/module/sksg/Recorder/commands/Shaders.d.ts +5 -0
  141. package/lib/module/sksg/{nodes/shaders.js → Recorder/commands/Shaders.js} +63 -13
  142. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -0
  143. package/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  144. package/lib/module/sksg/{nodes/utils.js → utils.js} +10 -1
  145. package/lib/module/sksg/utils.js.map +1 -0
  146. package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +0 -1
  147. package/lib/typescript/lib/commonjs/skia/web/JsiSkPaint.d.ts +1 -0
  148. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +4 -0
  149. package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +1 -3
  150. package/lib/typescript/lib/commonjs/sksg/Node.d.ts +14 -0
  151. package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +5 -0
  152. package/lib/typescript/lib/commonjs/sksg/Recorder/DrawingContext.d.ts +17 -0
  153. package/lib/typescript/lib/commonjs/sksg/Recorder/Player.d.ts +2 -0
  154. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +45 -0
  155. package/lib/typescript/lib/commonjs/sksg/Recorder/Recording.d.ts +5 -0
  156. package/lib/typescript/lib/commonjs/sksg/Recorder/Visitor.d.ts +27 -0
  157. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Box.d.ts +3 -0
  158. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/CTM.d.ts +2 -0
  159. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ColorFilters.d.ts +4 -0
  160. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/ImageFilters.d.ts +6 -0
  161. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Paint.d.ts +14 -0
  162. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/PathEffects.d.ts +4 -0
  163. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Shaders.d.ts +3 -0
  164. package/lib/typescript/lib/commonjs/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
  165. package/lib/typescript/lib/module/external/reanimated/index.d.ts +0 -1
  166. package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +0 -1
  167. package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
  168. package/lib/typescript/lib/module/sksg/Container.d.ts +4 -0
  169. package/lib/typescript/lib/module/sksg/HostConfig.d.ts +1 -3
  170. package/lib/typescript/lib/module/sksg/Node.d.ts +13 -0
  171. package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +4 -0
  172. package/lib/typescript/lib/module/sksg/Recorder/DrawingContext.d.ts +16 -0
  173. package/lib/typescript/lib/module/sksg/Recorder/Player.d.ts +1 -0
  174. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +44 -0
  175. package/lib/typescript/lib/module/sksg/Recorder/Recording.d.ts +4 -0
  176. package/lib/typescript/lib/module/sksg/Recorder/Visitor.d.ts +26 -0
  177. package/lib/typescript/lib/module/sksg/Recorder/commands/Box.d.ts +2 -0
  178. package/lib/typescript/lib/module/sksg/Recorder/commands/CTM.d.ts +1 -0
  179. package/lib/typescript/lib/module/sksg/Recorder/commands/ColorFilters.d.ts +3 -0
  180. package/lib/typescript/lib/module/sksg/Recorder/commands/ImageFilters.d.ts +5 -0
  181. package/lib/typescript/lib/module/sksg/Recorder/commands/Paint.d.ts +13 -0
  182. package/lib/typescript/lib/module/sksg/Recorder/commands/PathEffects.d.ts +3 -0
  183. package/lib/typescript/lib/module/sksg/Recorder/commands/Shaders.d.ts +2 -0
  184. package/lib/typescript/lib/module/sksg/{nodes/utils.d.ts → utils.d.ts} +1 -0
  185. package/lib/typescript/src/dom/types/Common.d.ts +6 -4
  186. package/lib/typescript/src/dom/types/ImageFilters.d.ts +1 -1
  187. package/lib/typescript/src/dom/types/Node.d.ts +0 -2
  188. package/lib/typescript/src/external/reanimated/index.d.ts +0 -1
  189. package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +0 -1
  190. package/lib/typescript/src/skia/types/Paint/Paint.d.ts +1 -0
  191. package/lib/typescript/src/skia/web/JsiSkPaint.d.ts +1 -0
  192. package/lib/typescript/src/sksg/Container.d.ts +3 -2
  193. package/lib/typescript/src/sksg/HostConfig.d.ts +2 -2
  194. package/lib/typescript/src/sksg/Node.d.ts +19 -0
  195. package/lib/typescript/src/sksg/Reconciler.d.ts +1 -1
  196. package/lib/typescript/src/sksg/Recorder/Core.d.ts +79 -0
  197. package/lib/typescript/src/sksg/Recorder/DrawingContext.d.ts +18 -0
  198. package/lib/typescript/src/sksg/Recorder/Player.d.ts +3 -0
  199. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +50 -0
  200. package/lib/typescript/src/sksg/Recorder/Recording.d.ts +7 -0
  201. package/lib/typescript/src/sksg/Recorder/Visitor.d.ts +5 -0
  202. package/lib/typescript/src/sksg/Recorder/commands/Box.d.ts +13 -0
  203. package/lib/typescript/src/sksg/Recorder/commands/CTM.d.ts +3 -0
  204. package/lib/typescript/src/sksg/Recorder/commands/ColorFilters.d.ts +6 -0
  205. package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +24 -0
  206. package/lib/typescript/src/sksg/Recorder/commands/ImageFilters.d.ts +12 -0
  207. package/lib/typescript/src/sksg/Recorder/commands/Paint.d.ts +4 -0
  208. package/lib/typescript/src/sksg/Recorder/commands/PathEffects.d.ts +6 -0
  209. package/lib/typescript/src/sksg/Recorder/commands/Shaders.d.ts +5 -0
  210. package/lib/typescript/src/sksg/{nodes/utils.d.ts → utils.d.ts} +3 -0
  211. package/package.json +1 -1
  212. package/src/__tests__/snapshots/image-filter/test-shadow.png +0 -0
  213. package/src/dom/types/Common.ts +7 -5
  214. package/src/dom/types/ImageFilters.ts +2 -1
  215. package/src/dom/types/Node.ts +0 -4
  216. package/src/external/reanimated/index.ts +0 -1
  217. package/src/external/reanimated/renderHelpers.ts +4 -44
  218. package/src/renderer/__tests__/e2e/ColorFilters.spec.tsx +15 -0
  219. package/src/renderer/__tests__/e2e/Composition/ColorFilterComposition.spec.tsx +23 -2
  220. package/src/renderer/__tests__/e2e/ImageFilters.spec.tsx +91 -2
  221. package/src/renderer/__tests__/setup.tsx +1 -1
  222. package/src/skia/types/Paint/Paint.ts +2 -0
  223. package/src/skia/web/JsiSkPaint.ts +4 -0
  224. package/src/sksg/Container.ts +35 -29
  225. package/src/sksg/HostConfig.ts +5 -50
  226. package/src/sksg/Node.ts +105 -0
  227. package/src/sksg/Recorder/Core.ts +171 -0
  228. package/src/sksg/Recorder/DrawingContext.ts +130 -0
  229. package/src/sksg/Recorder/Player.ts +160 -0
  230. package/src/sksg/Recorder/Recorder.ts +259 -0
  231. package/src/sksg/Recorder/Recording.ts +13 -0
  232. package/src/sksg/Recorder/Visitor.ts +324 -0
  233. package/src/sksg/Recorder/commands/Box.ts +63 -0
  234. package/src/sksg/Recorder/commands/CTM.ts +72 -0
  235. package/src/sksg/Recorder/commands/ColorFilters.ts +87 -0
  236. package/src/sksg/{nodes/drawings.ts → Recorder/commands/Drawing.ts} +29 -65
  237. package/src/sksg/Recorder/commands/ImageFilters.ts +255 -0
  238. package/src/sksg/Recorder/commands/Paint.ts +77 -0
  239. package/src/sksg/Recorder/commands/PathEffects.ts +169 -0
  240. package/src/sksg/{nodes/shaders.ts → Recorder/commands/Shaders.ts} +100 -26
  241. package/src/sksg/{nodes/utils.ts → utils.ts} +14 -1
  242. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  243. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +0 -24
  244. package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +0 -1
  245. package/lib/commonjs/sksg/DeclarationContext.d.ts +0 -56
  246. package/lib/commonjs/sksg/DeclarationContext.js +0 -77
  247. package/lib/commonjs/sksg/DeclarationContext.js.map +0 -1
  248. package/lib/commonjs/sksg/DrawingContext.d.ts +0 -13
  249. package/lib/commonjs/sksg/DrawingContext.js +0 -172
  250. package/lib/commonjs/sksg/DrawingContext.js.map +0 -1
  251. package/lib/commonjs/sksg/__tests__/Declarations.spec.d.ts +0 -1
  252. package/lib/commonjs/sksg/__tests__/MockDeclaration.d.ts +0 -57
  253. package/lib/commonjs/sksg/nodes/Node.d.ts +0 -7
  254. package/lib/commonjs/sksg/nodes/Node.js +0 -6
  255. package/lib/commonjs/sksg/nodes/Node.js.map +0 -1
  256. package/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -10
  257. package/lib/commonjs/sksg/nodes/colorFilters.js +0 -79
  258. package/lib/commonjs/sksg/nodes/colorFilters.js.map +0 -1
  259. package/lib/commonjs/sksg/nodes/context.d.ts +0 -3
  260. package/lib/commonjs/sksg/nodes/context.js +0 -394
  261. package/lib/commonjs/sksg/nodes/context.js.map +0 -1
  262. package/lib/commonjs/sksg/nodes/drawings.d.ts +0 -30
  263. package/lib/commonjs/sksg/nodes/drawings.js.map +0 -1
  264. package/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -17
  265. package/lib/commonjs/sksg/nodes/imageFilters.js +0 -197
  266. package/lib/commonjs/sksg/nodes/imageFilters.js.map +0 -1
  267. package/lib/commonjs/sksg/nodes/index.d.ts +0 -3
  268. package/lib/commonjs/sksg/nodes/index.js +0 -39
  269. package/lib/commonjs/sksg/nodes/index.js.map +0 -1
  270. package/lib/commonjs/sksg/nodes/paint.d.ts +0 -3
  271. package/lib/commonjs/sksg/nodes/paint.js +0 -81
  272. package/lib/commonjs/sksg/nodes/paint.js.map +0 -1
  273. package/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -11
  274. package/lib/commonjs/sksg/nodes/pathEffects.js +0 -111
  275. package/lib/commonjs/sksg/nodes/pathEffects.js.map +0 -1
  276. package/lib/commonjs/sksg/nodes/shaders.d.ts +0 -11
  277. package/lib/commonjs/sksg/nodes/shaders.js.map +0 -1
  278. package/lib/commonjs/sksg/nodes/utils.js.map +0 -1
  279. package/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  280. package/lib/module/external/reanimated/useDerivedValueOnJS.js +0 -16
  281. package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +0 -1
  282. package/lib/module/sksg/DeclarationContext.d.ts +0 -56
  283. package/lib/module/sksg/DeclarationContext.js +0 -69
  284. package/lib/module/sksg/DeclarationContext.js.map +0 -1
  285. package/lib/module/sksg/DrawingContext.d.ts +0 -13
  286. package/lib/module/sksg/DrawingContext.js +0 -165
  287. package/lib/module/sksg/DrawingContext.js.map +0 -1
  288. package/lib/module/sksg/__tests__/Declarations.spec.d.ts +0 -1
  289. package/lib/module/sksg/__tests__/MockDeclaration.d.ts +0 -57
  290. package/lib/module/sksg/nodes/Node.d.ts +0 -7
  291. package/lib/module/sksg/nodes/Node.js +0 -2
  292. package/lib/module/sksg/nodes/Node.js.map +0 -1
  293. package/lib/module/sksg/nodes/colorFilters.d.ts +0 -10
  294. package/lib/module/sksg/nodes/colorFilters.js +0 -66
  295. package/lib/module/sksg/nodes/colorFilters.js.map +0 -1
  296. package/lib/module/sksg/nodes/context.d.ts +0 -3
  297. package/lib/module/sksg/nodes/context.js +0 -387
  298. package/lib/module/sksg/nodes/context.js.map +0 -1
  299. package/lib/module/sksg/nodes/drawings.d.ts +0 -30
  300. package/lib/module/sksg/nodes/drawings.js.map +0 -1
  301. package/lib/module/sksg/nodes/imageFilters.d.ts +0 -17
  302. package/lib/module/sksg/nodes/imageFilters.js.map +0 -1
  303. package/lib/module/sksg/nodes/index.d.ts +0 -3
  304. package/lib/module/sksg/nodes/index.js +0 -4
  305. package/lib/module/sksg/nodes/index.js.map +0 -1
  306. package/lib/module/sksg/nodes/paint.d.ts +0 -3
  307. package/lib/module/sksg/nodes/paint.js +0 -74
  308. package/lib/module/sksg/nodes/paint.js.map +0 -1
  309. package/lib/module/sksg/nodes/pathEffects.d.ts +0 -11
  310. package/lib/module/sksg/nodes/pathEffects.js +0 -97
  311. package/lib/module/sksg/nodes/pathEffects.js.map +0 -1
  312. package/lib/module/sksg/nodes/shaders.d.ts +0 -11
  313. package/lib/module/sksg/nodes/shaders.js.map +0 -1
  314. package/lib/module/sksg/nodes/utils.js.map +0 -1
  315. package/lib/typescript/lib/commonjs/external/reanimated/useDerivedValueOnJS.d.ts +0 -2
  316. package/lib/typescript/lib/commonjs/sksg/DeclarationContext.d.ts +0 -53
  317. package/lib/typescript/lib/commonjs/sksg/DrawingContext.d.ts +0 -22
  318. package/lib/typescript/lib/commonjs/sksg/nodes/Node.d.ts +0 -1
  319. package/lib/typescript/lib/commonjs/sksg/nodes/colorFilters.d.ts +0 -8
  320. package/lib/typescript/lib/commonjs/sksg/nodes/context.d.ts +0 -2
  321. package/lib/typescript/lib/commonjs/sksg/nodes/imageFilters.d.ts +0 -12
  322. package/lib/typescript/lib/commonjs/sksg/nodes/index.d.ts +0 -1
  323. package/lib/typescript/lib/commonjs/sksg/nodes/paint.d.ts +0 -2
  324. package/lib/typescript/lib/commonjs/sksg/nodes/pathEffects.d.ts +0 -9
  325. package/lib/typescript/lib/commonjs/sksg/nodes/shaders.d.ts +0 -10
  326. package/lib/typescript/lib/module/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  327. package/lib/typescript/lib/module/sksg/DeclarationContext.d.ts +0 -52
  328. package/lib/typescript/lib/module/sksg/DrawingContext.d.ts +0 -21
  329. package/lib/typescript/lib/module/sksg/nodes/Node.d.ts +0 -1
  330. package/lib/typescript/lib/module/sksg/nodes/colorFilters.d.ts +0 -7
  331. package/lib/typescript/lib/module/sksg/nodes/context.d.ts +0 -1
  332. package/lib/typescript/lib/module/sksg/nodes/imageFilters.d.ts +0 -11
  333. package/lib/typescript/lib/module/sksg/nodes/index.d.ts +0 -3
  334. package/lib/typescript/lib/module/sksg/nodes/paint.d.ts +0 -1
  335. package/lib/typescript/lib/module/sksg/nodes/pathEffects.d.ts +0 -8
  336. package/lib/typescript/lib/module/sksg/nodes/shaders.d.ts +0 -9
  337. package/lib/typescript/src/external/reanimated/useDerivedValueOnJS.d.ts +0 -1
  338. package/lib/typescript/src/sksg/DeclarationContext.d.ts +0 -56
  339. package/lib/typescript/src/sksg/DrawingContext.d.ts +0 -13
  340. package/lib/typescript/src/sksg/__tests__/Declarations.spec.d.ts +0 -1
  341. package/lib/typescript/src/sksg/__tests__/MockDeclaration.d.ts +0 -57
  342. package/lib/typescript/src/sksg/nodes/Node.d.ts +0 -7
  343. package/lib/typescript/src/sksg/nodes/colorFilters.d.ts +0 -10
  344. package/lib/typescript/src/sksg/nodes/context.d.ts +0 -3
  345. package/lib/typescript/src/sksg/nodes/drawings.d.ts +0 -30
  346. package/lib/typescript/src/sksg/nodes/imageFilters.d.ts +0 -17
  347. package/lib/typescript/src/sksg/nodes/index.d.ts +0 -3
  348. package/lib/typescript/src/sksg/nodes/paint.d.ts +0 -3
  349. package/lib/typescript/src/sksg/nodes/pathEffects.d.ts +0 -11
  350. package/lib/typescript/src/sksg/nodes/shaders.d.ts +0 -11
  351. package/src/external/reanimated/useDerivedValueOnJS.ts +0 -20
  352. package/src/sksg/DeclarationContext.ts +0 -85
  353. package/src/sksg/DrawingContext.ts +0 -226
  354. package/src/sksg/__tests__/Declarations.spec.tsx +0 -235
  355. package/src/sksg/__tests__/MockDeclaration.ts +0 -138
  356. package/src/sksg/nodes/Node.ts +0 -8
  357. package/src/sksg/nodes/colorFilters.ts +0 -79
  358. package/src/sksg/nodes/context.ts +0 -412
  359. package/src/sksg/nodes/imageFilters.ts +0 -235
  360. package/src/sksg/nodes/index.ts +0 -3
  361. package/src/sksg/nodes/paint.ts +0 -75
  362. package/src/sksg/nodes/pathEffects.ts +0 -118
  363. /package/lib/typescript/lib/commonjs/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
  364. /package/lib/typescript/lib/module/sksg/{nodes/drawings.d.ts → Recorder/commands/Drawing.d.ts} +0 -0
@@ -0,0 +1,130 @@
1
+ import type {
2
+ Skia,
3
+ SkCanvas,
4
+ SkColorFilter,
5
+ SkPaint,
6
+ SkShader,
7
+ SkImageFilter,
8
+ SkPathEffect,
9
+ } from "../../skia/types";
10
+
11
+ export const createDrawingContext = (
12
+ Skia: Skia,
13
+ paintPool: SkPaint[],
14
+ canvas: SkCanvas
15
+ ) => {
16
+ "worklet";
17
+
18
+ // State (formerly class fields)
19
+ const paints: SkPaint[] = [];
20
+ const colorFilters: SkColorFilter[] = [];
21
+ const shaders: SkShader[] = [];
22
+ const imageFilters: SkImageFilter[] = [];
23
+ const pathEffects: SkPathEffect[] = [];
24
+ const paintDeclarations: SkPaint[] = [];
25
+
26
+ let nextPaintIndex = 1;
27
+
28
+ // Initialize first paint
29
+ paintPool[0] = Skia.Paint();
30
+ paints.push(paintPool[0]);
31
+
32
+ // Methods (formerly class methods)
33
+ const savePaint = () => {
34
+ // Get next available paint from pool or create new one if needed
35
+ if (nextPaintIndex >= paintPool.length) {
36
+ paintPool.push(Skia.Paint());
37
+ }
38
+
39
+ const nextPaint = paintPool[nextPaintIndex];
40
+ nextPaint.assign(getCurrentPaint()); // Reuse allocation by copying properties
41
+ paints.push(nextPaint);
42
+ nextPaintIndex++;
43
+ };
44
+
45
+ const saveBackdropFilter = () => {
46
+ let imageFilter: SkImageFilter | null = null;
47
+ const imgf = imageFilters.pop();
48
+ if (imgf) {
49
+ imageFilter = imgf;
50
+ } else {
51
+ const cf = colorFilters.pop();
52
+ if (cf) {
53
+ imageFilter = Skia.ImageFilter.MakeColorFilter(cf, null);
54
+ }
55
+ }
56
+ canvas.saveLayer(undefined, null, imageFilter);
57
+ canvas.restore();
58
+ };
59
+
60
+ // Equivalent to the `get paint()` getter in the original class
61
+ const getCurrentPaint = () => {
62
+ return paints[paints.length - 1];
63
+ };
64
+
65
+ const restorePaint = () => {
66
+ return paints.pop();
67
+ };
68
+
69
+ const materializePaint = () => {
70
+ // Color Filters
71
+ if (colorFilters.length > 0) {
72
+ getCurrentPaint().setColorFilter(
73
+ colorFilters.reduceRight((inner, outer) =>
74
+ inner ? Skia.ColorFilter.MakeCompose(outer, inner) : outer
75
+ )
76
+ );
77
+ }
78
+ // Shaders
79
+ if (shaders.length > 0) {
80
+ getCurrentPaint().setShader(shaders[shaders.length - 1]);
81
+ }
82
+ // Image Filters
83
+ if (imageFilters.length > 0) {
84
+ getCurrentPaint().setImageFilter(
85
+ imageFilters.reduceRight((inner, outer) =>
86
+ inner ? Skia.ImageFilter.MakeCompose(outer, inner) : outer
87
+ )
88
+ );
89
+ }
90
+ // Path Effects
91
+ if (pathEffects.length > 0) {
92
+ getCurrentPaint().setPathEffect(
93
+ pathEffects.reduceRight((inner, outer) =>
94
+ inner ? Skia.PathEffect.MakeCompose(outer, inner) : outer
95
+ )
96
+ );
97
+ }
98
+
99
+ // Clear arrays
100
+ colorFilters.length = 0;
101
+ shaders.length = 0;
102
+ imageFilters.length = 0;
103
+ pathEffects.length = 0;
104
+ };
105
+
106
+ // Return an object containing the Skia reference, the canvas, and the methods
107
+ return {
108
+ // Public fields
109
+ Skia,
110
+ canvas,
111
+ paints,
112
+ colorFilters,
113
+ shaders,
114
+ imageFilters,
115
+ pathEffects,
116
+ paintDeclarations,
117
+ paintPool,
118
+
119
+ // Public methods
120
+ savePaint,
121
+ saveBackdropFilter,
122
+ get paint() {
123
+ return paints[paints.length - 1];
124
+ }, // the "getter" for the current paint
125
+ restorePaint,
126
+ materializePaint,
127
+ };
128
+ };
129
+
130
+ export type DrawingContext = ReturnType<typeof createDrawingContext>;
@@ -0,0 +1,160 @@
1
+ import {
2
+ drawCircle,
3
+ drawImage,
4
+ drawOval,
5
+ drawPath,
6
+ drawPoints,
7
+ drawRect,
8
+ drawRRect,
9
+ drawLine,
10
+ drawAtlas,
11
+ drawParagraph,
12
+ drawImageSVG,
13
+ drawPicture,
14
+ drawGlyphs,
15
+ drawTextBlob,
16
+ drawTextPath,
17
+ drawText,
18
+ drawDiffRect,
19
+ drawVertices,
20
+ drawPatch,
21
+ } from "./commands/Drawing";
22
+ import { drawBox, isBoxCommand } from "./commands/Box";
23
+ import {
24
+ composeColorFilters,
25
+ isPushColorFilter,
26
+ pushColorFilter,
27
+ } from "./commands/ColorFilters";
28
+ import { saveCTM } from "./commands/CTM";
29
+ import {
30
+ setBlurMaskFilter,
31
+ isPushImageFilter,
32
+ pushImageFilter,
33
+ composeImageFilters,
34
+ } from "./commands/ImageFilters";
35
+ import { setPaintProperties } from "./commands/Paint";
36
+ import {
37
+ composePathEffects,
38
+ isPushPathEffect,
39
+ pushPathEffect,
40
+ } from "./commands/PathEffects";
41
+ import { isPushShader, pushShader } from "./commands/Shaders";
42
+ import {
43
+ CommandType,
44
+ isCommand,
45
+ isDrawCommand,
46
+ materializeProps,
47
+ type Command,
48
+ } from "./Core";
49
+ import type { DrawingContext } from "./DrawingContext";
50
+
51
+ const play = (ctx: DrawingContext, command: Command) => {
52
+ "worklet";
53
+
54
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
55
+ materializeProps(command as any);
56
+ if (isCommand(command, CommandType.SaveBackdropFilter)) {
57
+ ctx.saveBackdropFilter();
58
+ } else if (isCommand(command, CommandType.SaveLayer)) {
59
+ ctx.materializePaint();
60
+ const paint = ctx.paintDeclarations.pop();
61
+ ctx.canvas.saveLayer(paint);
62
+ } else if (isDrawCommand(command, CommandType.SavePaint)) {
63
+ if (command.props.paint) {
64
+ ctx.paints.push(command.props.paint);
65
+ } else {
66
+ ctx.savePaint();
67
+ setPaintProperties(ctx.Skia, ctx.paint, command.props);
68
+ }
69
+ } else if (isCommand(command, CommandType.RestorePaint)) {
70
+ ctx.restorePaint();
71
+ } else if (isCommand(command, CommandType.ComposeColorFilter)) {
72
+ composeColorFilters(ctx);
73
+ } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {
74
+ ctx.materializePaint();
75
+ const paint = ctx.restorePaint();
76
+ if (!paint) {
77
+ throw new Error("No paint declaration to push");
78
+ }
79
+ ctx.paintDeclarations.push(paint);
80
+ } else if (isCommand(command, CommandType.MaterializePaint)) {
81
+ ctx.materializePaint();
82
+ } else if (isPushColorFilter(command)) {
83
+ pushColorFilter(ctx, command);
84
+ } else if (isPushShader(command)) {
85
+ pushShader(ctx, command);
86
+ } else if (isPushImageFilter(command)) {
87
+ pushImageFilter(ctx, command);
88
+ } else if (isPushPathEffect(command)) {
89
+ pushPathEffect(ctx, command);
90
+ } else if (isCommand(command, CommandType.ComposePathEffect)) {
91
+ composePathEffects(ctx);
92
+ } else if (isCommand(command, CommandType.ComposeImageFilter)) {
93
+ composeImageFilters(ctx);
94
+ } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {
95
+ setBlurMaskFilter(ctx, command.props);
96
+ } else if (isDrawCommand(command, CommandType.SaveCTM)) {
97
+ saveCTM(ctx, command.props);
98
+ } else if (isCommand(command, CommandType.RestoreCTM)) {
99
+ ctx.canvas.restore();
100
+ } else {
101
+ const paints = [ctx.paint, ...ctx.paintDeclarations];
102
+ ctx.paintDeclarations = [];
103
+ paints.forEach((p) => {
104
+ ctx.paints.push(p);
105
+ if (isBoxCommand(command)) {
106
+ drawBox(ctx, command);
107
+ } else if (isCommand(command, CommandType.DrawPaint)) {
108
+ ctx.canvas.drawPaint(ctx.paint);
109
+ } else if (isDrawCommand(command, CommandType.DrawImage)) {
110
+ drawImage(ctx, command.props);
111
+ } else if (isDrawCommand(command, CommandType.DrawCircle)) {
112
+ drawCircle(ctx, command.props);
113
+ } else if (isDrawCommand(command, CommandType.DrawPoints)) {
114
+ drawPoints(ctx, command.props);
115
+ } else if (isDrawCommand(command, CommandType.DrawPath)) {
116
+ drawPath(ctx, command.props);
117
+ } else if (isDrawCommand(command, CommandType.DrawRect)) {
118
+ drawRect(ctx, command.props);
119
+ } else if (isDrawCommand(command, CommandType.DrawRRect)) {
120
+ drawRRect(ctx, command.props);
121
+ } else if (isDrawCommand(command, CommandType.DrawOval)) {
122
+ drawOval(ctx, command.props);
123
+ } else if (isDrawCommand(command, CommandType.DrawLine)) {
124
+ drawLine(ctx, command.props);
125
+ } else if (isDrawCommand(command, CommandType.DrawPatch)) {
126
+ drawPatch(ctx, command.props);
127
+ } else if (isDrawCommand(command, CommandType.DrawVertices)) {
128
+ drawVertices(ctx, command.props);
129
+ } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {
130
+ drawDiffRect(ctx, command.props);
131
+ } else if (isDrawCommand(command, CommandType.DrawText)) {
132
+ drawText(ctx, command.props);
133
+ } else if (isDrawCommand(command, CommandType.DrawTextPath)) {
134
+ drawTextPath(ctx, command.props);
135
+ } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {
136
+ drawTextBlob(ctx, command.props);
137
+ } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {
138
+ drawGlyphs(ctx, command.props);
139
+ } else if (isDrawCommand(command, CommandType.DrawPicture)) {
140
+ drawPicture(ctx, command.props);
141
+ } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {
142
+ drawImageSVG(ctx, command.props);
143
+ } else if (isDrawCommand(command, CommandType.DrawParagraph)) {
144
+ drawParagraph(ctx, command.props);
145
+ } else if (isDrawCommand(command, CommandType.DrawAtlas)) {
146
+ drawAtlas(ctx, command.props);
147
+ } else {
148
+ console.warn(`Unknown command: ${command.type}`);
149
+ }
150
+ ctx.paints.pop();
151
+ });
152
+ }
153
+ };
154
+
155
+ export const replay = (ctx: DrawingContext, commands: Command[]) => {
156
+ "worklet";
157
+ commands.forEach((command) => {
158
+ play(ctx, command);
159
+ });
160
+ };
@@ -0,0 +1,259 @@
1
+ import type { SharedValue } from "react-native-reanimated";
2
+
3
+ import { NodeType } from "../../dom/types";
4
+ import type {
5
+ BlurMaskFilterProps,
6
+ CircleProps,
7
+ CTMProps,
8
+ ImageProps,
9
+ PaintProps,
10
+ PointsProps,
11
+ PathProps,
12
+ RectProps,
13
+ RoundedRectProps,
14
+ OvalProps,
15
+ LineProps,
16
+ PatchProps,
17
+ VerticesProps,
18
+ DiffRectProps,
19
+ TextProps,
20
+ TextPathProps,
21
+ TextBlobProps,
22
+ GlyphsProps,
23
+ PictureProps,
24
+ ImageSVGProps,
25
+ ParagraphProps,
26
+ AtlasProps,
27
+ BoxProps,
28
+ BoxShadowProps,
29
+ } from "../../dom/types";
30
+ import type { AnimatedProps } from "../../renderer";
31
+ import { isSharedValue } from "../utils";
32
+ import { isColorFilter, isImageFilter, isPathEffect, isShader } from "../Node";
33
+
34
+ import { CommandType } from "./Core";
35
+ import type { Command } from "./Core";
36
+
37
+ export class Recorder {
38
+ commands: Command[] = [];
39
+
40
+ private processProps(props: Record<string, unknown>) {
41
+ const animatedProps: Record<string, SharedValue<unknown>> = {};
42
+ let hasAnimatedProps = false;
43
+
44
+ for (const key in props) {
45
+ const prop = props[key];
46
+ if (isSharedValue(prop)) {
47
+ props[key] = prop.value;
48
+ animatedProps[key] = prop;
49
+ hasAnimatedProps = true;
50
+ }
51
+ }
52
+
53
+ return {
54
+ props,
55
+ animatedProps: hasAnimatedProps ? animatedProps : undefined,
56
+ };
57
+ }
58
+
59
+ private add(command: Command) {
60
+ if (command.props) {
61
+ const { animatedProps } = this.processProps(
62
+ command.props as Record<string, unknown>
63
+ );
64
+ if (animatedProps) {
65
+ command.animatedProps = animatedProps;
66
+ }
67
+ }
68
+ this.commands.push(command);
69
+ }
70
+
71
+ savePaint(props: AnimatedProps<PaintProps>) {
72
+ this.add({ type: CommandType.SavePaint, props });
73
+ }
74
+
75
+ restorePaint() {
76
+ this.add({ type: CommandType.RestorePaint });
77
+ }
78
+
79
+ restorePaintDeclaration() {
80
+ this.add({ type: CommandType.RestorePaintDeclaration });
81
+ }
82
+
83
+ materializePaint() {
84
+ this.add({ type: CommandType.MaterializePaint });
85
+ }
86
+
87
+ pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>) {
88
+ if (!isPathEffect(pathEffectType)) {
89
+ throw new Error("Invalid color filter type: " + pathEffectType);
90
+ }
91
+ this.add({
92
+ type: CommandType.PushPathEffect,
93
+ pathEffectType,
94
+ props,
95
+ });
96
+ }
97
+
98
+ pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>) {
99
+ if (!isImageFilter(imageFilterType)) {
100
+ throw new Error("Invalid color filter type: " + imageFilterType);
101
+ }
102
+ this.add({
103
+ type: CommandType.PushImageFilter,
104
+ imageFilterType,
105
+ props,
106
+ });
107
+ }
108
+
109
+ pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>) {
110
+ if (!isColorFilter(colorFilterType)) {
111
+ throw new Error("Invalid color filter type: " + colorFilterType);
112
+ }
113
+ this.add({
114
+ type: CommandType.PushColorFilter,
115
+ colorFilterType,
116
+ props,
117
+ });
118
+ }
119
+
120
+ pushShader(shaderType: NodeType, props: AnimatedProps<unknown>) {
121
+ if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {
122
+ throw new Error("Invalid color filter type: " + shaderType);
123
+ }
124
+ this.add({ type: CommandType.PushShader, shaderType, props });
125
+ }
126
+
127
+ pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>) {
128
+ this.add({ type: CommandType.PushBlurMaskFilter, props });
129
+ }
130
+
131
+ composePathEffect() {
132
+ this.add({ type: CommandType.ComposePathEffect });
133
+ }
134
+
135
+ composeColorFilter() {
136
+ this.add({ type: CommandType.ComposeColorFilter });
137
+ }
138
+
139
+ composeImageFilter() {
140
+ this.add({ type: CommandType.ComposeImageFilter });
141
+ }
142
+
143
+ saveCTM(props: AnimatedProps<CTMProps>) {
144
+ this.add({ type: CommandType.SaveCTM, props });
145
+ }
146
+
147
+ restoreCTM() {
148
+ this.add({ type: CommandType.RestoreCTM });
149
+ }
150
+
151
+ drawPaint() {
152
+ this.add({ type: CommandType.DrawPaint });
153
+ }
154
+
155
+ saveLayer() {
156
+ this.add({ type: CommandType.SaveLayer });
157
+ }
158
+
159
+ saveBackdropFilter() {
160
+ this.add({ type: CommandType.SaveBackdropFilter });
161
+ }
162
+
163
+ drawBox(
164
+ boxProps: AnimatedProps<BoxProps>,
165
+ shadows: {
166
+ props: BoxShadowProps;
167
+ animatedProps?: Record<string, SharedValue<unknown>>;
168
+ }[]
169
+ ) {
170
+ shadows.forEach((shadow) => {
171
+ if (shadow.props) {
172
+ if (shadow.props) {
173
+ const { animatedProps } = this.processProps(
174
+ shadow.props as unknown as Record<string, unknown>
175
+ );
176
+ if (animatedProps) {
177
+ shadow.animatedProps = animatedProps;
178
+ }
179
+ }
180
+ }
181
+ });
182
+ this.add({ type: CommandType.DrawBox, props: boxProps, shadows });
183
+ }
184
+
185
+ drawImage(props: AnimatedProps<ImageProps>) {
186
+ this.add({ type: CommandType.DrawImage, props });
187
+ }
188
+
189
+ drawCircle(props: AnimatedProps<CircleProps>) {
190
+ this.add({ type: CommandType.DrawCircle, props });
191
+ }
192
+ drawPoints(props: AnimatedProps<PointsProps>) {
193
+ this.add({ type: CommandType.DrawPoints, props });
194
+ }
195
+
196
+ drawPath(props: AnimatedProps<PathProps>) {
197
+ this.add({ type: CommandType.DrawPath, props });
198
+ }
199
+
200
+ drawRect(props: AnimatedProps<RectProps>) {
201
+ this.add({ type: CommandType.DrawRect, props });
202
+ }
203
+
204
+ drawRRect(props: AnimatedProps<RoundedRectProps>) {
205
+ this.add({ type: CommandType.DrawRRect, props });
206
+ }
207
+
208
+ drawOval(props: AnimatedProps<OvalProps>) {
209
+ this.add({ type: CommandType.DrawOval, props });
210
+ }
211
+
212
+ drawLine(props: AnimatedProps<LineProps>) {
213
+ this.add({ type: CommandType.DrawLine, props });
214
+ }
215
+
216
+ drawPatch(props: AnimatedProps<PatchProps>) {
217
+ this.add({ type: CommandType.DrawPatch, props });
218
+ }
219
+
220
+ drawVertices(props: AnimatedProps<VerticesProps>) {
221
+ this.add({ type: CommandType.DrawVertices, props });
222
+ }
223
+
224
+ drawDiffRect(props: AnimatedProps<DiffRectProps>) {
225
+ this.add({ type: CommandType.DrawDiffRect, props });
226
+ }
227
+
228
+ drawText(props: AnimatedProps<TextProps>) {
229
+ this.add({ type: CommandType.DrawText, props });
230
+ }
231
+
232
+ drawTextPath(props: AnimatedProps<TextPathProps>) {
233
+ this.add({ type: CommandType.DrawTextPath, props });
234
+ }
235
+
236
+ drawTextBlob(props: AnimatedProps<TextBlobProps>) {
237
+ this.add({ type: CommandType.DrawTextBlob, props });
238
+ }
239
+
240
+ drawGlyphs(props: AnimatedProps<GlyphsProps>) {
241
+ this.add({ type: CommandType.DrawGlyphs, props });
242
+ }
243
+
244
+ drawPicture(props: AnimatedProps<PictureProps>) {
245
+ this.add({ type: CommandType.DrawPicture, props });
246
+ }
247
+
248
+ drawImageSVG(props: AnimatedProps<ImageSVGProps>) {
249
+ this.add({ type: CommandType.DrawImageSVG, props });
250
+ }
251
+
252
+ drawParagraph(props: AnimatedProps<ParagraphProps>) {
253
+ this.add({ type: CommandType.DrawParagraph, props });
254
+ }
255
+
256
+ drawAtlas(props: AnimatedProps<AtlasProps>) {
257
+ this.add({ type: CommandType.DrawAtlas, props });
258
+ }
259
+ }
@@ -0,0 +1,13 @@
1
+ import type { SkPaint } from "../../skia/types";
2
+
3
+ import type { Command } from "./Core";
4
+
5
+ export interface Recording {
6
+ commands: Command[];
7
+ paintPool: SkPaint[];
8
+ }
9
+
10
+ export const createRecording = (commands: Command[]): Recording => ({
11
+ commands,
12
+ paintPool: [],
13
+ });