@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 @@
1
+ {"version":3,"names":["deflate","enumKey","fitRects","inflate","NodeType","processCircle","processPath","processRect","processRRect","saturate","BlendMode","BlurStyle","ClipOp","FillType","isRRect","PointMode","VertexMode","materialize","drawLine","ctx","props","p1","p2","canvas","x","y","paint","drawOval","rect","Skia","drawBox","children","box","defaultBox","opacity","getAlphaf","RRectXY","shadows","map","node","type","BoxShadow","filter","n","shadow","inner","color","blur","spread","dx","dy","lPaint","Paint","setColor","Color","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","Intersect","outer","drawDRRect","restore","drawImage","image","_props$fit","fit","src","dst","width","height","drawImageRect","drawPoints","points","mode","drawVertices","textures","colors","indices","blendMode","vertexMode","Triangles","vertices","MakeVertices","c","undefined","defaultBlendMode","DstOver","SrcOver","blend","drawDiffRect","drawTextPath","path","font","initialOffset","text","ids","getGlyphIDs","widths","getGlyphWidths","rsx","meas","ContourMeasureIter","cont","next","dist","i","length","substring","p","t","getPosTan","adjustedX","adjustedY","push","RSXform","derived","TextBlob","MakeFromRSXform","drawTextBlob","drawText","drawPatch","texture","patch","pos","c2","c1","drawPath","start","trimStart","end","trimEnd","fillType","stroke","pathProps","hasStartOffset","hasEndOffset","hasStrokeOptions","hasFillType","willMutatePath","pristinePath","copy","setFillType","trim","drawRect","blob","drawGlyphs","glyphs","reduce","acc","glyph","id","positions","drawImageSVG","svg","translate","drawSvg","drawParagraph","paragraph","layout","drawPicture","picture","drawAtlas","sprites","transforms","drawCircle","r","drawFill","_props","drawPaint"],"sources":["Drawing.ts"],"sourcesContent":["import {\n deflate,\n enumKey,\n fitRects,\n inflate,\n NodeType,\n processCircle,\n processPath,\n processRect,\n processRRect,\n} from \"../../../dom/nodes\";\nimport type {\n AtlasProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n DiffRectProps,\n DrawingNodeProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n OvalProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n TextProps,\n VerticesProps,\n} from \"../../../dom/types\";\nimport { saturate } from \"../../../renderer/processors\";\nimport type { SkPoint, SkRSXform } from \"../../../skia/types\";\nimport {\n BlendMode,\n BlurStyle,\n ClipOp,\n FillType,\n isRRect,\n PointMode,\n VertexMode,\n} from \"../../../skia/types\";\nimport type { Node } from \"../../Node\";\nimport { materialize } from \"../../utils\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nexport const drawLine = (ctx: DrawingContext, props: LineProps) => {\n \"worklet\";\n const { p1, p2 } = props;\n ctx.canvas.drawLine(p1.x, p1.y, p2.x, p2.y, ctx.paint);\n};\n\nexport const drawOval = (ctx: DrawingContext, props: OvalProps) => {\n \"worklet\";\n const rect = processRect(ctx.Skia, props);\n ctx.canvas.drawOval(rect, ctx.paint);\n};\n\nexport const drawBox = (\n ctx: DrawingContext,\n props: BoxProps,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n children: Node<any>[]\n) => {\n \"worklet\";\n const { paint, Skia, canvas } = ctx;\n const { box: defaultBox } = props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);\n const shadows = children\n .map((node) => {\n if (node.type === NodeType.BoxShadow) {\n return materialize(node.props);\n }\n return null;\n })\n .filter((n): n is BoxShadowProps => n !== null);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(Skia, box, spread, spread, dx, dy);\n const outer = inflate(Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n};\n\nexport const drawImage = (ctx: DrawingContext, props: ImageProps) => {\n \"worklet\";\n const { image } = props;\n if (image) {\n const fit = props.fit ?? \"contain\";\n const rect = processRect(ctx.Skia, props);\n const { src, dst } = fitRects(\n fit,\n {\n x: 0,\n y: 0,\n width: image.width(),\n height: image.height(),\n },\n rect\n );\n ctx.canvas.drawImageRect(image, src, dst, ctx.paint);\n }\n};\n\nexport const drawPoints = (ctx: DrawingContext, props: PointsProps) => {\n \"worklet\";\n const { points, mode } = props;\n ctx.canvas.drawPoints(PointMode[enumKey(mode)], points, ctx.paint);\n};\n\nexport const drawVertices = (ctx: DrawingContext, props: VerticesProps) => {\n \"worklet\";\n const { mode, textures, colors, indices, blendMode } = props;\n const vertexMode = mode ? VertexMode[enumKey(mode)] : VertexMode.Triangles;\n const vertices = ctx.Skia.MakeVertices(\n vertexMode,\n props.vertices,\n textures,\n colors ? colors.map((c) => ctx.Skia.Color(c)) : undefined,\n indices\n );\n const defaultBlendMode = colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n\n ctx.canvas.drawVertices(vertices, blend, ctx.paint);\n};\n\nexport const drawDiffRect = (ctx: DrawingContext, props: DiffRectProps) => {\n \"worklet\";\n const { outer, inner } = props;\n ctx.canvas.drawDRRect(outer, inner, ctx.paint);\n};\n\nexport const drawTextPath = (ctx: DrawingContext, props: TextPathProps) => {\n \"worklet\";\n const path = processPath(ctx.Skia, props.path);\n const { font, initialOffset } = props;\n if (font) {\n let { text } = props;\n const ids = font.getGlyphIDs(text);\n const widths = font.getGlyphWidths(ids);\n const rsx: SkRSXform[] = [];\n const meas = ctx.Skia.ContourMeasureIter(path, false, 1);\n let cont = meas.next();\n let dist = initialOffset;\n for (let i = 0; i < text.length && cont; i++) {\n const width = widths[i];\n dist += width / 2;\n if (dist > cont.length()) {\n // jump to next contour\n cont = meas.next();\n if (!cont) {\n // We have come to the end of the path - terminate the string\n // right here.\n text = text.substring(0, i);\n break;\n }\n dist = width / 2;\n }\n // Gives us the (x, y) coordinates as well as the cos/sin of the tangent\n // line at that position.\n const [p, t] = cont.getPosTan(dist);\n const adjustedX = p.x - (width / 2) * t.x;\n const adjustedY = p.y - (width / 2) * t.y;\n rsx.push(ctx.Skia.RSXform(t.x, t.y, adjustedX, adjustedY));\n dist += width / 2;\n }\n const derived = ctx.Skia.TextBlob.MakeFromRSXform(text, rsx, font);\n ctx.canvas.drawTextBlob(derived, 0, 0, ctx.paint);\n }\n};\n\nexport const drawText = (ctx: DrawingContext, props: TextProps) => {\n \"worklet\";\n const { text, x, y, font } = props;\n if (font != null) {\n ctx.canvas.drawText(text, x, y, ctx.paint, font);\n }\n};\n\nexport const drawPatch = (ctx: DrawingContext, props: PatchProps) => {\n \"worklet\";\n const { texture, blendMode, patch } = props;\n const defaultBlendMode = props.colors ? BlendMode.DstOver : BlendMode.SrcOver;\n const mode = blendMode ? BlendMode[enumKey(blendMode)] : defaultBlendMode;\n // Patch requires a path with the following constraints:\n // M tl\n // C c1 c2 br\n // C c1 c2 bl\n // C c1 c2 tl (the redundant point in the last command is removed)\n\n const points = [\n patch[0].pos,\n patch[0].c2,\n patch[1].c1,\n patch[1].pos,\n patch[1].c2,\n patch[2].c1,\n patch[2].pos,\n patch[2].c2,\n patch[3].c1,\n patch[3].pos,\n patch[3].c2,\n patch[0].c1,\n ];\n const colors = props.colors\n ? props.colors.map((c) => ctx.Skia.Color(c))\n : undefined;\n ctx.canvas.drawPatch(points, colors, texture, mode, ctx.paint);\n};\n\nexport const drawPath = (ctx: DrawingContext, props: PathProps) => {\n \"worklet\";\n const {\n start: trimStart,\n end: trimEnd,\n fillType,\n stroke,\n ...pathProps\n } = props;\n const start = saturate(trimStart);\n const end = saturate(trimEnd);\n const hasStartOffset = start !== 0;\n const hasEndOffset = end !== 1;\n const hasStrokeOptions = stroke !== undefined;\n const hasFillType = !!fillType;\n const willMutatePath =\n hasStartOffset || hasEndOffset || hasStrokeOptions || hasFillType;\n const pristinePath = processPath(ctx.Skia, pathProps.path);\n const path = willMutatePath ? pristinePath.copy() : pristinePath;\n if (hasFillType) {\n path.setFillType(FillType[enumKey(fillType)]);\n }\n if (hasStrokeOptions) {\n path.stroke(stroke);\n }\n if (hasStartOffset || hasEndOffset) {\n path.trim(start, end, false);\n }\n ctx.canvas.drawPath(path, ctx.paint);\n};\n\nexport const drawRect = (ctx: DrawingContext, props: RectProps) => {\n \"worklet\";\n const derived = processRect(ctx.Skia, props);\n ctx.canvas.drawRect(derived, ctx.paint);\n};\n\nexport const drawRRect = (ctx: DrawingContext, props: RoundedRectProps) => {\n \"worklet\";\n const derived = processRRect(ctx.Skia, props);\n ctx.canvas.drawRRect(derived, ctx.paint);\n};\n\nexport const drawTextBlob = (ctx: DrawingContext, props: TextBlobProps) => {\n \"worklet\";\n const { blob, x, y } = props;\n ctx.canvas.drawTextBlob(blob, x, y, ctx.paint);\n};\n\ninterface ProcessedGlyphs {\n glyphs: number[];\n positions: SkPoint[];\n}\n\nexport const drawGlyphs = (ctx: DrawingContext, props: GlyphsProps) => {\n \"worklet\";\n const derived = props.glyphs.reduce<ProcessedGlyphs>(\n (acc, glyph) => {\n const { id, pos } = glyph;\n acc.glyphs.push(id);\n acc.positions.push(pos);\n return acc;\n },\n { glyphs: [], positions: [] }\n );\n const { glyphs, positions } = derived;\n const { x, y, font } = props;\n if (font) {\n ctx.canvas.drawGlyphs(glyphs, positions, x, y, font, ctx.paint);\n }\n};\n\nexport const drawImageSVG = (ctx: DrawingContext, props: ImageSVGProps) => {\n \"worklet\";\n const { canvas } = ctx;\n const { svg } = props;\n const { x, y, width, height } = props.rect\n ? props.rect\n : { x: props.x, y: props.y, width: props.width, height: props.height };\n if (svg === null) {\n return;\n }\n canvas.save();\n if (x && y) {\n canvas.translate(x, y);\n }\n canvas.drawSvg(svg, width, height);\n canvas.restore();\n};\n\nexport const drawParagraph = (ctx: DrawingContext, props: ParagraphProps) => {\n \"worklet\";\n const { paragraph, x, y, width } = props;\n if (paragraph) {\n paragraph.layout(width);\n paragraph.paint(ctx.canvas, x, y);\n }\n};\n\nexport const drawPicture = (ctx: DrawingContext, props: PictureProps) => {\n \"worklet\";\n const { picture } = props;\n ctx.canvas.drawPicture(picture);\n};\n\nexport const drawAtlas = (ctx: DrawingContext, props: AtlasProps) => {\n \"worklet\";\n const { image, sprites, transforms, colors, blendMode } = props;\n const blend = blendMode ? BlendMode[enumKey(blendMode)] : undefined;\n if (image) {\n ctx.canvas.drawAtlas(image, sprites, transforms, ctx.paint, blend, colors);\n }\n};\n\nexport const drawCircle = (ctx: DrawingContext, props: CircleProps) => {\n \"worklet\";\n const { c } = processCircle(props);\n const { r } = props;\n ctx.canvas.drawCircle(c.x, c.y, r, ctx.paint);\n};\n\nexport const drawFill = (ctx: DrawingContext, _props: DrawingNodeProps) => {\n \"worklet\";\n ctx.canvas.drawPaint(ctx.paint);\n};\n"],"mappings":"AAAA,SACEA,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,YAAY,QACP,oBAAoB;AAyB3B,SAASC,QAAQ,QAAQ,8BAA8B;AAEvD,SACEC,SAAS,EACTC,SAAS,EACTC,MAAM,EACNC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,UAAU,QACL,qBAAqB;AAE5B,SAASC,WAAW,QAAQ,aAAa;AAGzC,OAAO,MAAMC,QAAQ,GAAGA,CAACC,GAAmB,EAAEC,KAAgB,KAAK;EACjE,SAAS;;EACT,MAAM;IAAEC,EAAE;IAAEC;EAAG,CAAC,GAAGF,KAAK;EACxBD,GAAG,CAACI,MAAM,CAACL,QAAQ,CAACG,EAAE,CAACG,CAAC,EAAEH,EAAE,CAACI,CAAC,EAAEH,EAAE,CAACE,CAAC,EAAEF,EAAE,CAACG,CAAC,EAAEN,GAAG,CAACO,KAAK,CAAC;AACxD,CAAC;AAED,OAAO,MAAMC,QAAQ,GAAGA,CAACR,GAAmB,EAAEC,KAAgB,KAAK;EACjE,SAAS;;EACT,MAAMQ,IAAI,GAAGrB,W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;EACzE,SAAS;;EACT7J,GAAG,CAACI,MAAM,CAAC0J,SAAS,CAAC9J,GAAG,CAACO,KAAK,CAAC;AACjC,CAAC","ignoreList":[]}
@@ -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;
@@ -1,6 +1,8 @@
1
- import { enumKey, processRadius } from "../../dom/nodes";
2
- import { BlendMode, BlurStyle, ColorChannel, processUniforms, TileMode } from "../../skia/types";
3
- import { composeDeclarations } from "../DeclarationContext";
1
+ import { enumKey, processRadius } from "../../../dom/nodes";
2
+ import { NodeType } from "../../../dom/types";
3
+ import { BlendMode, BlurStyle, ColorChannel, processUniforms, TileMode } from "../../../skia/types";
4
+ import { composeDeclarations } from "../../utils";
5
+ import { CommandType } from "../Core";
4
6
  export let MorphologyOperator = /*#__PURE__*/function (MorphologyOperator) {
5
7
  MorphologyOperator[MorphologyOperator["Erode"] = 0] = "Erode";
6
8
  MorphologyOperator[MorphologyOperator["Dilate"] = 1] = "Dilate";
@@ -21,89 +23,43 @@ const MakeInnerShadow = (Skia, shadowOnly, dx, dy, sigmaX, sigmaY, color, input)
21
23
  }
22
24
  return Skia.ImageFilter.MakeCompose(input, Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4));
23
25
  };
24
- export const declareBlend = (ctx, props) => {
26
+ const declareBlurImageFilter = (ctx, props) => {
25
27
  "worklet";
26
28
 
27
29
  const {
28
- Skia
29
- } = ctx;
30
- const blend = BlendMode[enumKey(props.mode)];
31
- // Blend ImageFilters
32
- const imageFilters = ctx.imageFilters.popAll();
33
- if (imageFilters.length > 0) {
34
- const composer = Skia.ImageFilter.MakeBlend.bind(Skia.ImageFilter, blend);
35
- ctx.imageFilters.push(composeDeclarations(imageFilters, composer));
36
- }
37
- // Blend Shaders
38
- const shaders = ctx.shaders.popAll();
39
- if (shaders.length > 0) {
40
- const composer = Skia.Shader.MakeBlend.bind(Skia.Shader, blend);
41
- ctx.shaders.push(composeDeclarations(shaders, composer));
42
- }
30
+ mode,
31
+ blur
32
+ } = props;
33
+ const sigma = processRadius(ctx.Skia, blur);
34
+ const imgf = ctx.Skia.ImageFilter.MakeBlur(sigma.x, sigma.y, TileMode[enumKey(mode)], null);
35
+ ctx.imageFilters.push(imgf);
43
36
  };
44
- export const composeImageFilters = (ctx, imgf1, processChildren) => {
37
+ const declareMorphologyImageFilter = (ctx, props) => {
45
38
  "worklet";
46
39
 
47
40
  const {
48
- Skia
49
- } = ctx;
50
- ctx.imageFilters.save();
51
- ctx.colorFilters.save();
52
- processChildren();
53
- let imgf2 = ctx.imageFilters.popAllAsOne();
54
- const cf = ctx.colorFilters.popAllAsOne();
55
- ctx.imageFilters.restore();
56
- ctx.colorFilters.restore();
57
- if (cf) {
58
- var _imgf;
59
- imgf2 = Skia.ImageFilter.MakeCompose((_imgf = imgf2) !== null && _imgf !== void 0 ? _imgf : null, Skia.ImageFilter.MakeColorFilter(cf, null));
41
+ operator
42
+ } = props;
43
+ const r = processRadius(ctx.Skia, props.radius);
44
+ let imgf;
45
+ if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {
46
+ imgf = ctx.Skia.ImageFilter.MakeErode(r.x, r.y, null);
47
+ } else {
48
+ imgf = ctx.Skia.ImageFilter.MakeDilate(r.x, r.y, null);
60
49
  }
61
- const imgf = imgf2 ? Skia.ImageFilter.MakeCompose(imgf1, imgf2) : imgf1;
62
50
  ctx.imageFilters.push(imgf);
63
51
  };
64
- const input = ctx => {
65
- "worklet";
66
-
67
- var _ctx$imageFilters$pop;
68
- return (_ctx$imageFilters$pop = ctx.imageFilters.pop()) !== null && _ctx$imageFilters$pop !== void 0 ? _ctx$imageFilters$pop : null;
69
- };
70
- export const makeOffsetImageFilter = (ctx, props) => {
52
+ const declareOffsetImageFilter = (ctx, props) => {
71
53
  "worklet";
72
54
 
73
55
  const {
74
56
  x,
75
57
  y
76
58
  } = props;
77
- return ctx.Skia.ImageFilter.MakeOffset(x, y, null);
78
- };
79
- export const declareDisplacementMapImageFilter = (ctx, props) => {
80
- "worklet";
81
-
82
- const {
83
- channelX,
84
- channelY,
85
- scale
86
- } = props;
87
- const shader = ctx.shaders.pop();
88
- if (!shader) {
89
- throw new Error("DisplacementMap expects a shader as child");
90
- }
91
- const map = ctx.Skia.ImageFilter.MakeShader(shader, null);
92
- const imgf = ctx.Skia.ImageFilter.MakeDisplacementMap(ColorChannel[enumKey(channelX)], ColorChannel[enumKey(channelY)], scale, map, input(ctx));
59
+ const imgf = ctx.Skia.ImageFilter.MakeOffset(x, y, null);
93
60
  ctx.imageFilters.push(imgf);
94
61
  };
95
- export const makeBlurImageFilter = (ctx, props) => {
96
- "worklet";
97
-
98
- const {
99
- mode,
100
- blur
101
- } = props;
102
- const sigma = processRadius(ctx.Skia, blur);
103
- const imgf = ctx.Skia.ImageFilter.MakeBlur(sigma.x, sigma.y, TileMode[enumKey(mode)], input(ctx));
104
- return imgf;
105
- };
106
- export const makeDropShadowImageFilter = (ctx, props) => {
62
+ const declareDropShadowImageFilter = (ctx, props) => {
107
63
  "worklet";
108
64
 
109
65
  const {
@@ -121,25 +77,35 @@ export const makeDropShadowImageFilter = (ctx, props) => {
121
77
  } else {
122
78
  factory = shadowOnly ? ctx.Skia.ImageFilter.MakeDropShadowOnly.bind(ctx.Skia.ImageFilter) : ctx.Skia.ImageFilter.MakeDropShadow.bind(ctx.Skia.ImageFilter);
123
79
  }
124
- const imgf = factory(dx, dy, blur, blur, color, input(ctx));
125
- return imgf;
80
+ const imgf = factory(dx, dy, blur, blur, color, null);
81
+ ctx.imageFilters.push(imgf);
126
82
  };
127
- export const makeMorphologyImageFilter = (ctx, props) => {
83
+ const declareBlendImageFilter = (ctx, props) => {
84
+ "worklet";
85
+
86
+ const blend = BlendMode[enumKey(props.mode)];
87
+ // Blend ImageFilters
88
+ const imageFilters = ctx.imageFilters.splice(0, ctx.imageFilters.length);
89
+ const composer = ctx.Skia.ImageFilter.MakeBlend.bind(ctx.Skia.ImageFilter, blend);
90
+ ctx.imageFilters.push(composeDeclarations(imageFilters, composer));
91
+ };
92
+ const declareDisplacementMapImageFilter = (ctx, props) => {
128
93
  "worklet";
129
94
 
130
95
  const {
131
- operator
96
+ channelX,
97
+ channelY,
98
+ scale
132
99
  } = props;
133
- const r = processRadius(ctx.Skia, props.radius);
134
- let imgf;
135
- if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {
136
- imgf = ctx.Skia.ImageFilter.MakeErode(r.x, r.y, input(ctx));
137
- } else {
138
- imgf = ctx.Skia.ImageFilter.MakeDilate(r.x, r.y, input(ctx));
100
+ const shader = ctx.shaders.pop();
101
+ if (!shader) {
102
+ throw new Error("DisplacementMap expects a shader as child");
139
103
  }
140
- return imgf;
104
+ const map = ctx.Skia.ImageFilter.MakeShader(shader, null);
105
+ const imgf = ctx.Skia.ImageFilter.MakeDisplacementMap(ColorChannel[enumKey(channelX)], ColorChannel[enumKey(channelY)], scale, map, null);
106
+ ctx.imageFilters.push(imgf);
141
107
  };
142
- export const makeRuntimeShaderImageFilter = (ctx, props) => {
108
+ const declareRuntimeShaderImageFilter = (ctx, props) => {
143
109
  "worklet";
144
110
 
145
111
  const {
@@ -150,24 +116,19 @@ export const makeRuntimeShaderImageFilter = (ctx, props) => {
150
116
  if (uniforms) {
151
117
  processUniforms(source, uniforms, rtb);
152
118
  }
153
- const imgf = ctx.Skia.ImageFilter.MakeRuntimeShader(rtb, null, input(ctx));
154
- return imgf;
119
+ const imgf = ctx.Skia.ImageFilter.MakeRuntimeShader(rtb, null, null);
120
+ ctx.imageFilters.push(imgf);
155
121
  };
156
- export const declareBlendImageFilter = (ctx, props) => {
122
+ export const composeImageFilters = ctx => {
157
123
  "worklet";
158
124
 
159
- const {
160
- mode
161
- } = props;
162
- const a = ctx.imageFilters.pop();
163
- const b = ctx.imageFilters.pop();
164
- if (!a || !b) {
165
- throw new Error("BlendImageFilter requires two image filters");
125
+ if (ctx.imageFilters.length > 1) {
126
+ const outer = ctx.imageFilters.pop();
127
+ const inner = ctx.imageFilters.pop();
128
+ ctx.imageFilters.push(ctx.Skia.ImageFilter.MakeCompose(outer, inner));
166
129
  }
167
- const imgf = ctx.Skia.ImageFilter.MakeBlend(mode, a, b);
168
- ctx.imageFilters.push(imgf);
169
130
  };
170
- export const declareBlurMaskFilter = (ctx, props) => {
131
+ export const setBlurMaskFilter = (ctx, props) => {
171
132
  "worklet";
172
133
 
173
134
  const {
@@ -176,6 +137,37 @@ export const declareBlurMaskFilter = (ctx, props) => {
176
137
  respectCTM
177
138
  } = props;
178
139
  const mf = ctx.Skia.MaskFilter.MakeBlur(BlurStyle[enumKey(style)], blur, respectCTM);
179
- ctx.maskFilters.push(mf);
140
+ ctx.paint.setMaskFilter(mf);
141
+ };
142
+ export const isPushImageFilter = command => {
143
+ "worklet";
144
+
145
+ return command.type === CommandType.PushImageFilter;
146
+ };
147
+ const isImageFilter = (command, type) => {
148
+ "worklet";
149
+
150
+ return command.imageFilterType === type;
151
+ };
152
+ export const pushImageFilter = (ctx, command) => {
153
+ "worklet";
154
+
155
+ if (isImageFilter(command, NodeType.BlurImageFilter)) {
156
+ declareBlurImageFilter(ctx, command.props);
157
+ } else if (isImageFilter(command, NodeType.MorphologyImageFilter)) {
158
+ declareMorphologyImageFilter(ctx, command.props);
159
+ } else if (isImageFilter(command, NodeType.BlendImageFilter)) {
160
+ declareBlendImageFilter(ctx, command.props);
161
+ } else if (isImageFilter(command, NodeType.DisplacementMapImageFilter)) {
162
+ declareDisplacementMapImageFilter(ctx, command.props);
163
+ } else if (isImageFilter(command, NodeType.DropShadowImageFilter)) {
164
+ declareDropShadowImageFilter(ctx, command.props);
165
+ } else if (isImageFilter(command, NodeType.OffsetImageFilter)) {
166
+ declareOffsetImageFilter(ctx, command.props);
167
+ } else if (isImageFilter(command, NodeType.RuntimeShaderImageFilter)) {
168
+ declareRuntimeShaderImageFilter(ctx, command.props);
169
+ } else {
170
+ throw new Error("Invalid image filter type: " + command.imageFilterType);
171
+ }
180
172
  };
181
- //# sourceMappingURL=imageFilters.js.map
173
+ //# sourceMappingURL=ImageFilters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["enumKey","processRadius","NodeType","BlendMode","BlurStyle","ColorChannel","processUniforms","TileMode","composeDeclarations","CommandType","MorphologyOperator","Black","Float32Array","of","MakeInnerShadow","Skia","shadowOnly","dx","dy","sigmaX","sigmaY","color","input","sourceGraphic","ImageFilter","MakeColorFilter","ColorFilter","MakeBlend","Dst","sourceAlpha","SrcIn","f1","SrcOut","f2","MakeOffset","f3","MakeBlur","Decal","f4","MakeCompose","SrcOver","declareBlurImageFilter","ctx","props","mode","blur","sigma","imgf","x","y","imageFilters","push","declareMorphologyImageFilter","operator","r","radius","Erode","MakeErode","MakeDilate","declareOffsetImageFilter","declareDropShadowImageFilter","cl","inner","Color","factory","bind","MakeDropShadowOnly","MakeDropShadow","declareBlendImageFilter","blend","splice","length","composer","declareDisplacementMapImageFilter","channelX","channelY","scale","shader","shaders","pop","Error","map","MakeShader","MakeDisplacementMap","declareRuntimeShaderImageFilter","source","uniforms","rtb","RuntimeShaderBuilder","MakeRuntimeShader","composeImageFilters","outer","setBlurMaskFilter","style","respectCTM","mf","MaskFilter","paint","setMaskFilter","isPushImageFilter","command","type","PushImageFilter","isImageFilter","imageFilterType","pushImageFilter","BlurImageFilter","MorphologyImageFilter","BlendImageFilter","DisplacementMapImageFilter","DropShadowImageFilter","OffsetImageFilter","RuntimeShaderImageFilter"],"sources":["ImageFilters.ts"],"sourcesContent":["import { enumKey, processRadius } from \"../../../dom/nodes\";\nimport type {\n BlendImageFilterProps,\n BlurImageFilterProps,\n BlurMaskFilterProps,\n DisplacementMapImageFilterProps,\n DropShadowImageFilterProps,\n MorphologyImageFilterProps,\n OffsetImageFilterProps,\n RuntimeShaderImageFilterProps,\n} from \"../../../dom/types\";\nimport { NodeType } from \"../../../dom/types\";\nimport type { SkColor, SkImageFilter, Skia } from \"../../../skia/types\";\nimport {\n BlendMode,\n BlurStyle,\n ColorChannel,\n processUniforms,\n TileMode,\n} from \"../../../skia/types\";\nimport { composeDeclarations } from \"../../utils\";\nimport type { Command } from \"../Core\";\nimport { CommandType } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nexport enum MorphologyOperator {\n Erode,\n Dilate,\n}\n\nconst Black = Float32Array.of(0, 0, 0, 1);\n\nconst MakeInnerShadow = (\n Skia: Skia,\n shadowOnly: boolean | undefined,\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null\n) => {\n \"worklet\";\n const sourceGraphic = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.Dst),\n null\n );\n const sourceAlpha = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(Black, BlendMode.SrcIn),\n null\n );\n const f1 = Skia.ImageFilter.MakeColorFilter(\n Skia.ColorFilter.MakeBlend(color, BlendMode.SrcOut),\n null\n );\n const f2 = Skia.ImageFilter.MakeOffset(dx, dy, f1);\n const f3 = Skia.ImageFilter.MakeBlur(sigmaX, sigmaY, TileMode.Decal, f2);\n const f4 = Skia.ImageFilter.MakeBlend(BlendMode.SrcIn, sourceAlpha, f3);\n if (shadowOnly) {\n return f4;\n }\n return Skia.ImageFilter.MakeCompose(\n input,\n Skia.ImageFilter.MakeBlend(BlendMode.SrcOver, sourceGraphic, f4)\n );\n};\n\nconst declareBlurImageFilter = (\n ctx: DrawingContext,\n props: BlurImageFilterProps\n) => {\n \"worklet\";\n const { mode, blur } = props;\n const sigma = processRadius(ctx.Skia, blur);\n const imgf = ctx.Skia.ImageFilter.MakeBlur(\n sigma.x,\n sigma.y,\n TileMode[enumKey(mode)],\n null\n );\n ctx.imageFilters.push(imgf);\n};\n\nconst declareMorphologyImageFilter = (\n ctx: DrawingContext,\n props: MorphologyImageFilterProps\n) => {\n \"worklet\";\n const { operator } = props;\n const r = processRadius(ctx.Skia, props.radius);\n let imgf;\n if (MorphologyOperator[enumKey(operator)] === MorphologyOperator.Erode) {\n imgf = ctx.Skia.ImageFilter.MakeErode(r.x, r.y, null);\n } else {\n imgf = ctx.Skia.ImageFilter.MakeDilate(r.x, r.y, null);\n }\n ctx.imageFilters.push(imgf);\n};\n\nconst declareOffsetImageFilter = (\n ctx: DrawingContext,\n props: OffsetImageFilterProps\n) => {\n \"worklet\";\n const { x, y } = props;\n const imgf = ctx.Skia.ImageFilter.MakeOffset(x, y, null);\n ctx.imageFilters.push(imgf);\n};\n\nconst declareDropShadowImageFilter = (\n ctx: DrawingContext,\n props: DropShadowImageFilterProps\n) => {\n \"worklet\";\n const { dx, dy, blur, shadowOnly, color: cl, inner } = props;\n const color = ctx.Skia.Color(cl);\n let factory;\n if (inner) {\n factory = MakeInnerShadow.bind(null, ctx.Skia, shadowOnly);\n } else {\n factory = shadowOnly\n ? ctx.Skia.ImageFilter.MakeDropShadowOnly.bind(ctx.Skia.ImageFilter)\n : ctx.Skia.ImageFilter.MakeDropShadow.bind(ctx.Skia.ImageFilter);\n }\n const imgf = factory(dx, dy, blur, blur, color, null);\n ctx.imageFilters.push(imgf);\n};\n\nconst declareBlendImageFilter = (\n ctx: DrawingContext,\n props: BlendImageFilterProps\n) => {\n \"worklet\";\n const blend = BlendMode[enumKey(props.mode)];\n // Blend ImageFilters\n const imageFilters = ctx.imageFilters.splice(0, ctx.imageFilters.length);\n const composer = ctx.Skia.ImageFilter.MakeBlend.bind(\n ctx.Skia.ImageFilter,\n blend\n );\n ctx.imageFilters.push(composeDeclarations(imageFilters, composer));\n};\n\nconst declareDisplacementMapImageFilter = (\n ctx: DrawingContext,\n props: DisplacementMapImageFilterProps\n) => {\n \"worklet\";\n const { channelX, channelY, scale } = props;\n const shader = ctx.shaders.pop();\n if (!shader) {\n throw new Error(\"DisplacementMap expects a shader as child\");\n }\n const map = ctx.Skia.ImageFilter.MakeShader(shader, null);\n const imgf = ctx.Skia.ImageFilter.MakeDisplacementMap(\n ColorChannel[enumKey(channelX)],\n ColorChannel[enumKey(channelY)],\n scale,\n map,\n null\n );\n ctx.imageFilters.push(imgf);\n};\n\nconst declareRuntimeShaderImageFilter = (\n ctx: DrawingContext,\n props: RuntimeShaderImageFilterProps\n) => {\n \"worklet\";\n const { source, uniforms } = props;\n const rtb = ctx.Skia.RuntimeShaderBuilder(source);\n if (uniforms) {\n processUniforms(source, uniforms, rtb);\n }\n const imgf = ctx.Skia.ImageFilter.MakeRuntimeShader(rtb, null, null);\n ctx.imageFilters.push(imgf);\n};\n\nexport const composeImageFilters = (ctx: DrawingContext) => {\n \"worklet\";\n if (ctx.imageFilters.length > 1) {\n const outer = ctx.imageFilters.pop()!;\n const inner = ctx.imageFilters.pop()!;\n ctx.imageFilters.push(ctx.Skia.ImageFilter.MakeCompose(outer, inner));\n }\n};\n\nexport const setBlurMaskFilter = (\n ctx: DrawingContext,\n props: BlurMaskFilterProps\n) => {\n \"worklet\";\n const { blur, style, respectCTM } = props;\n const mf = ctx.Skia.MaskFilter.MakeBlur(\n BlurStyle[enumKey(style)],\n blur,\n respectCTM\n );\n ctx.paint.setMaskFilter(mf);\n};\n\nexport const isPushImageFilter = (\n command: Command\n): command is Command<CommandType.PushImageFilter> => {\n \"worklet\";\n return command.type === CommandType.PushImageFilter;\n};\n\ntype Props = {\n [NodeType.OffsetImageFilter]: OffsetImageFilterProps;\n [NodeType.DisplacementMapImageFilter]: DisplacementMapImageFilterProps;\n [NodeType.BlurImageFilter]: BlurImageFilterProps;\n [NodeType.DropShadowImageFilter]: DropShadowImageFilterProps;\n [NodeType.MorphologyImageFilter]: MorphologyImageFilterProps;\n [NodeType.BlendImageFilter]: BlendImageFilterProps;\n [NodeType.RuntimeShaderImageFilter]: RuntimeShaderImageFilterProps;\n};\n\ninterface PushImageFilter<T extends keyof Props>\n extends Command<CommandType.PushImageFilter> {\n imageFilterType: T;\n props: Props[T];\n}\n\nconst isImageFilter = <T extends keyof Props>(\n command: Command<CommandType.PushImageFilter>,\n type: T\n): command is PushImageFilter<T> => {\n \"worklet\";\n return command.imageFilterType === type;\n};\n\nexport const pushImageFilter = (\n ctx: DrawingContext,\n command: Command<CommandType.PushImageFilter>\n) => {\n \"worklet\";\n if (isImageFilter(command, NodeType.BlurImageFilter)) {\n declareBlurImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.MorphologyImageFilter)) {\n declareMorphologyImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.BlendImageFilter)) {\n declareBlendImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.DisplacementMapImageFilter)) {\n declareDisplacementMapImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.DropShadowImageFilter)) {\n declareDropShadowImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.OffsetImageFilter)) {\n declareOffsetImageFilter(ctx, command.props);\n } else if (isImageFilter(command, NodeType.RuntimeShaderImageFilter)) {\n declareRuntimeShaderImageFilter(ctx, command.props);\n } else {\n throw new Error(\"Invalid image filter type: \" + command.imageFilterType);\n }\n};\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,aAAa,QAAQ,oBAAoB;AAW3D,SAASC,QAAQ,QAAQ,oBAAoB;AAE7C,SACEC,SAAS,EACTC,SAAS,EACTC,YAAY,EACZC,eAAe,EACfC,QAAQ,QACH,qBAAqB;AAC5B,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,SAASC,WAAW,QAAQ,SAAS;AAGrC,WAAYC,kBAAkB,0B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BAA4B,CAAClB,GAAG,EAAE0D,OAAO,CAACzD,KAAK,CAAC;EAClD,CAAC,MAAM,IAAI4D,aAAa,CAACH,OAAO,EAAElG,QAAQ,CAAC6G,iBAAiB,CAAC,EAAE;IAC7DpD,wBAAwB,CAACjB,GAAG,EAAE0D,OAAO,CAACzD,KAAK,CAAC;EAC9C,CAAC,MAAM,IAAI4D,aAAa,CAACH,OAAO,EAAElG,QAAQ,CAAC8G,wBAAwB,CAAC,EAAE;IACpE5B,+BAA+B,CAAC1C,GAAG,EAAE0D,OAAO,CAACzD,KAAK,CAAC;EACrD,CAAC,MAAM;IACL,MAAM,IAAIqC,KAAK,CAAC,6BAA6B,GAAGoB,OAAO,CAACI,eAAe,CAAC;EAC1E;AACF,CAAC","ignoreList":[]}
@@ -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,62 @@
1
+ import { enumKey } from "../../../dom/nodes";
2
+ import { BlendMode, PaintStyle, StrokeCap, StrokeJoin } from "../../../skia/types";
3
+ export const processColor = (Skia, color) => {
4
+ "worklet";
5
+
6
+ if (typeof color === "string" || typeof color === "number") {
7
+ return Skia.Color(color);
8
+ } else if (Array.isArray(color) || color instanceof Float32Array) {
9
+ return color instanceof Float32Array ? color : new Float32Array(color);
10
+ } else {
11
+ throw new Error(`Invalid color type: ${typeof color}. Expected number, string, or array.`);
12
+ }
13
+ };
14
+ export const setPaintProperties = (Skia, paint, {
15
+ opacity,
16
+ color,
17
+ blendMode,
18
+ strokeWidth,
19
+ style,
20
+ strokeJoin,
21
+ strokeCap,
22
+ strokeMiter,
23
+ antiAlias,
24
+ dither
25
+ }) => {
26
+ "worklet";
27
+
28
+ if (opacity !== undefined) {
29
+ paint.setAlphaf(paint.getAlphaf() * opacity);
30
+ }
31
+ if (color !== undefined) {
32
+ const currentOpacity = paint.getAlphaf();
33
+ paint.setShader(null);
34
+ paint.setColor(processColor(Skia, color));
35
+ paint.setAlphaf(currentOpacity * paint.getAlphaf());
36
+ }
37
+ if (blendMode !== undefined) {
38
+ paint.setBlendMode(BlendMode[enumKey(blendMode)]);
39
+ }
40
+ if (strokeWidth !== undefined) {
41
+ paint.setStrokeWidth(strokeWidth);
42
+ }
43
+ if (style !== undefined) {
44
+ paint.setStyle(PaintStyle[enumKey(style)]);
45
+ }
46
+ if (strokeJoin !== undefined) {
47
+ paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);
48
+ }
49
+ if (strokeCap !== undefined) {
50
+ paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);
51
+ }
52
+ if (strokeMiter !== undefined) {
53
+ paint.setStrokeMiter(strokeMiter);
54
+ }
55
+ if (antiAlias !== undefined) {
56
+ paint.setAntiAlias(antiAlias);
57
+ }
58
+ if (dither !== undefined) {
59
+ paint.setDither(dither);
60
+ }
61
+ };
62
+ //# sourceMappingURL=Paint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["enumKey","BlendMode","PaintStyle","StrokeCap","StrokeJoin","processColor","Skia","color","Color","Array","isArray","Float32Array","Error","setPaintProperties","paint","opacity","blendMode","strokeWidth","style","strokeJoin","strokeCap","strokeMiter","antiAlias","dither","undefined","setAlphaf","getAlphaf","currentOpacity","setShader","setColor","setBlendMode","setStrokeWidth","setStyle","setStrokeJoin","setStrokeCap","setStrokeMiter","setAntiAlias","setDither"],"sources":["Paint.ts"],"sourcesContent":["import { enumKey } from \"../../../dom/nodes\";\nimport type { PaintProps } from \"../../../dom/types\";\nimport {\n BlendMode,\n PaintStyle,\n StrokeCap,\n StrokeJoin,\n} from \"../../../skia/types\";\nimport type { SkPaint, Skia } from \"../../../skia/types\";\n\nexport const processColor = (\n Skia: Skia,\n color: number | string | Float32Array | number[]\n) => {\n \"worklet\";\n if (typeof color === \"string\" || typeof color === \"number\") {\n return Skia.Color(color);\n } else if (Array.isArray(color) || color instanceof Float32Array) {\n return color instanceof Float32Array ? color : new Float32Array(color);\n } else {\n throw new Error(\n `Invalid color type: ${typeof color}. Expected number, string, or array.`\n );\n }\n};\n\nexport const setPaintProperties = (\n Skia: Skia,\n paint: SkPaint,\n {\n opacity,\n color,\n blendMode,\n strokeWidth,\n style,\n strokeJoin,\n strokeCap,\n strokeMiter,\n antiAlias,\n dither,\n }: PaintProps\n) => {\n \"worklet\";\n if (opacity !== undefined) {\n paint.setAlphaf(paint.getAlphaf() * opacity);\n }\n if (color !== undefined) {\n const currentOpacity = paint.getAlphaf();\n paint.setShader(null);\n paint.setColor(processColor(Skia, color));\n paint.setAlphaf(currentOpacity * paint.getAlphaf());\n }\n if (blendMode !== undefined) {\n paint.setBlendMode(BlendMode[enumKey(blendMode)]);\n }\n if (strokeWidth !== undefined) {\n paint.setStrokeWidth(strokeWidth);\n }\n if (style !== undefined) {\n paint.setStyle(PaintStyle[enumKey(style)]);\n }\n if (strokeJoin !== undefined) {\n paint.setStrokeJoin(StrokeJoin[enumKey(strokeJoin)]);\n }\n if (strokeCap !== undefined) {\n paint.setStrokeCap(StrokeCap[enumKey(strokeCap)]);\n }\n if (strokeMiter !== undefined) {\n paint.setStrokeMiter(strokeMiter);\n }\n if (antiAlias !== undefined) {\n paint.setAntiAlias(antiAlias);\n }\n if (dither !== undefined) {\n paint.setDither(dither);\n }\n};\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,oBAAoB;AAE5C,SACEC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,UAAU,QACL,qBAAqB;AAG5B,OAAO,MAAMC,YAAY,GAAGA,CAC1BC,IAAU,EACVC,KAAgD,KAC7C;EACH,SAAS;;EACT,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAA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AK,CAACkB,QAAQ,CAAC9B,UAAU,CAACF,OAAO,CAACkB,KAAK,CAAC,CAAC,CAAC;EAC5C;EACA,IAAIC,UAAU,KAAKK,SAAS,EAAE;IAC5BV,KAAK,CAACmB,aAAa,CAAC7B,UAAU,CAACJ,OAAO,CAACmB,UAAU,CAAC,CAAC,CAAC;EACtD;EACA,IAAIC,SAAS,KAAKI,SAAS,EAAE;IAC3BV,KAAK,CAACoB,YAAY,CAAC/B,SAAS,CAACH,OAAO,CAACoB,SAAS,CAAC,CAAC,CAAC;EACnD;EACA,IAAIC,WAAW,KAAKG,SAAS,EAAE;IAC7BV,KAAK,CAACqB,cAAc,CAACd,WAAW,CAAC;EACnC;EACA,IAAIC,SAAS,KAAKE,SAAS,EAAE;IAC3BV,KAAK,CAACsB,YAAY,CAACd,SAAS,CAAC;EAC/B;EACA,IAAIC,MAAM,KAAKC,SAAS,EAAE;IACxBV,KAAK,CAACuB,SAAS,CAACd,MAAM,CAAC;EACzB;AACF,CAAC","ignoreList":[]}
@@ -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,128 @@
1
+ import { enumKey, processPath } from "../../../dom/nodes";
2
+ import { NodeType } from "../../../dom/types";
3
+ import { Path1DEffectStyle } from "../../../skia/types";
4
+ import { composeDeclarations } from "../../utils";
5
+ import { CommandType } from "../Core";
6
+ const declareDiscretePathEffect = (ctx, props) => {
7
+ "worklet";
8
+
9
+ const {
10
+ length,
11
+ deviation,
12
+ seed
13
+ } = props;
14
+ const pe = ctx.Skia.PathEffect.MakeDiscrete(length, deviation, seed);
15
+ ctx.pathEffects.push(pe);
16
+ };
17
+ const declarePath2DPathEffect = (ctx, props) => {
18
+ "worklet";
19
+
20
+ const {
21
+ matrix
22
+ } = props;
23
+ const path = processPath(ctx.Skia, props.path);
24
+ const pe = ctx.Skia.PathEffect.MakePath2D(matrix, path);
25
+ if (pe === null) {
26
+ throw new Error("Path2DPathEffect: invalid path");
27
+ }
28
+ ctx.pathEffects.push(pe);
29
+ };
30
+ const declareDashPathEffect = (ctx, props) => {
31
+ "worklet";
32
+
33
+ const {
34
+ intervals,
35
+ phase
36
+ } = props;
37
+ const pe = ctx.Skia.PathEffect.MakeDash(intervals, phase);
38
+ ctx.pathEffects.push(pe);
39
+ };
40
+ const declareCornerPathEffect = (ctx, props) => {
41
+ "worklet";
42
+
43
+ const {
44
+ r
45
+ } = props;
46
+ const pe = ctx.Skia.PathEffect.MakeCorner(r);
47
+ if (pe === null) {
48
+ throw new Error("CornerPathEffect: couldn't create path effect");
49
+ }
50
+ ctx.pathEffects.push(pe);
51
+ };
52
+ const declareSumPathEffect = ctx => {
53
+ "worklet";
54
+
55
+ // Note: decorateChildren functionality needs to be handled differently
56
+ const pes = ctx.pathEffects.splice(0, ctx.pathEffects.length);
57
+ const pe = composeDeclarations(pes, ctx.Skia.PathEffect.MakeSum.bind(ctx.Skia.PathEffect));
58
+ ctx.pathEffects.push(pe);
59
+ };
60
+ const declareLine2DPathEffect = (ctx, props) => {
61
+ "worklet";
62
+
63
+ const {
64
+ width,
65
+ matrix
66
+ } = props;
67
+ const pe = ctx.Skia.PathEffect.MakeLine2D(width, matrix);
68
+ if (pe === null) {
69
+ throw new Error("Line2DPathEffect: could not create path effect");
70
+ }
71
+ ctx.pathEffects.push(pe);
72
+ };
73
+ const declarePath1DPathEffect = (ctx, props) => {
74
+ "worklet";
75
+
76
+ const {
77
+ advance,
78
+ phase,
79
+ style
80
+ } = props;
81
+ const path = processPath(ctx.Skia, props.path);
82
+ const pe = ctx.Skia.PathEffect.MakePath1D(path, advance, phase, Path1DEffectStyle[enumKey(style)]);
83
+ if (pe === null) {
84
+ throw new Error("Path1DPathEffect: could not create path effect");
85
+ }
86
+ ctx.pathEffects.push(pe);
87
+ };
88
+ export const isPushPathEffect = command => {
89
+ "worklet";
90
+
91
+ return command.type === CommandType.PushPathEffect;
92
+ };
93
+ const isPathEffect = (command, type) => {
94
+ "worklet";
95
+
96
+ return command.pathEffectType === type;
97
+ };
98
+ export const composePathEffects = ctx => {
99
+ "worklet";
100
+
101
+ if (ctx.pathEffects.length > 1) {
102
+ const outer = ctx.pathEffects.pop();
103
+ const inner = ctx.pathEffects.pop();
104
+ ctx.pathEffects.push(ctx.Skia.PathEffect.MakeCompose(outer, inner));
105
+ }
106
+ };
107
+ export const pushPathEffect = (ctx, command) => {
108
+ "worklet";
109
+
110
+ if (isPathEffect(command, NodeType.DiscretePathEffect)) {
111
+ declareDiscretePathEffect(ctx, command.props);
112
+ } else if (isPathEffect(command, NodeType.DashPathEffect)) {
113
+ declareDashPathEffect(ctx, command.props);
114
+ } else if (isPathEffect(command, NodeType.Path1DPathEffect)) {
115
+ declarePath1DPathEffect(ctx, command.props);
116
+ } else if (isPathEffect(command, NodeType.Path2DPathEffect)) {
117
+ declarePath2DPathEffect(ctx, command.props);
118
+ } else if (isPathEffect(command, NodeType.CornerPathEffect)) {
119
+ declareCornerPathEffect(ctx, command.props);
120
+ } else if (isPathEffect(command, NodeType.SumPathEffect)) {
121
+ declareSumPathEffect(ctx);
122
+ } else if (isPathEffect(command, NodeType.Line2DPathEffect)) {
123
+ declareLine2DPathEffect(ctx, command.props);
124
+ } else {
125
+ throw new Error("Invalid image filter type: " + command.imageFilterType);
126
+ }
127
+ };
128
+ //# sourceMappingURL=PathEffects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["enumKey","processPath","NodeType","Path1DEffectStyle","composeDeclarations","CommandType","declareDiscretePathEffect","ctx","props","length","deviation","seed","pe","Skia","PathEffect","MakeDiscrete","pathEffects","push","declarePath2DPathEffect","matrix","path","MakePath2D","Error","declareDashPathEffect","intervals","phase","MakeDash","declareCornerPathEffect","r","MakeCorner","declareSumPathEffect","pes","splice","MakeSum","bind","declareLine2DPathEffect","width","MakeLine2D","declarePath1DPathEffect","advance","style","MakePath1D","isPushPathEffect","command","type","PushPathEffect","isPathEffect","pathEffectType","composePathEffects","outer","pop","inner","MakeCompose","pushPathEffect","DiscretePathEffect","DashPathEffect","Path1DPathEffect","Path2DPathEffect","CornerPathEffect","SumPathEffect","Line2DPathEffect","imageFilterType"],"sources":["PathEffects.ts"],"sourcesContent":["import { enumKey, processPath } from \"../../../dom/nodes\";\nimport { NodeType } from \"../../../dom/types\";\nimport type {\n CornerPathEffectProps,\n DashPathEffectProps,\n DiscretePathEffectProps,\n Line2DPathEffectProps,\n Path1DPathEffectProps,\n Path2DPathEffectProps,\n} from \"../../../dom/types\";\nimport { Path1DEffectStyle } from \"../../../skia/types\";\nimport { composeDeclarations } from \"../../utils\";\nimport type { Command } from \"../Core\";\nimport { CommandType } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\nconst declareDiscretePathEffect = (\n ctx: DrawingContext,\n props: DiscretePathEffectProps\n) => {\n \"worklet\";\n const { length, deviation, seed } = props;\n const pe = ctx.Skia.PathEffect.MakeDiscrete(length, deviation, seed);\n ctx.pathEffects.push(pe);\n};\n\nconst declarePath2DPathEffect = (\n ctx: DrawingContext,\n props: Path2DPathEffectProps\n) => {\n \"worklet\";\n const { matrix } = props;\n const path = processPath(ctx.Skia, props.path);\n const pe = ctx.Skia.PathEffect.MakePath2D(matrix, path);\n if (pe === null) {\n throw new Error(\"Path2DPathEffect: invalid path\");\n }\n ctx.pathEffects.push(pe);\n};\n\nconst declareDashPathEffect = (\n ctx: DrawingContext,\n props: DashPathEffectProps\n) => {\n \"worklet\";\n const { intervals, phase } = props;\n const pe = ctx.Skia.PathEffect.MakeDash(intervals, phase);\n ctx.pathEffects.push(pe);\n};\n\nconst declareCornerPathEffect = (\n ctx: DrawingContext,\n props: CornerPathEffectProps\n) => {\n \"worklet\";\n const { r } = props;\n const pe = ctx.Skia.PathEffect.MakeCorner(r);\n if (pe === null) {\n throw new Error(\"CornerPathEffect: couldn't create path effect\");\n }\n ctx.pathEffects.push(pe);\n};\n\nconst declareSumPathEffect = (ctx: DrawingContext) => {\n \"worklet\";\n // Note: decorateChildren functionality needs to be handled differently\n const pes = ctx.pathEffects.splice(0, ctx.pathEffects.length);\n const pe = composeDeclarations(\n pes,\n ctx.Skia.PathEffect.MakeSum.bind(ctx.Skia.PathEffect)\n );\n ctx.pathEffects.push(pe);\n};\n\nconst declareLine2DPathEffect = (\n ctx: DrawingContext,\n props: Line2DPathEffectProps\n) => {\n \"worklet\";\n const { width, matrix } = props;\n const pe = ctx.Skia.PathEffect.MakeLine2D(width, matrix);\n if (pe === null) {\n throw new Error(\"Line2DPathEffect: could not create path effect\");\n }\n ctx.pathEffects.push(pe);\n};\n\nconst declarePath1DPathEffect = (\n ctx: DrawingContext,\n props: Path1DPathEffectProps\n) => {\n \"worklet\";\n const { advance, phase, style } = props;\n const path = processPath(ctx.Skia, props.path);\n const pe = ctx.Skia.PathEffect.MakePath1D(\n path,\n advance,\n phase,\n Path1DEffectStyle[enumKey(style)]\n );\n if (pe === null) {\n throw new Error(\"Path1DPathEffect: could not create path effect\");\n }\n ctx.pathEffects.push(pe);\n};\n\nexport const isPushPathEffect = (\n command: Command\n): command is Command<CommandType.PushPathEffect> => {\n \"worklet\";\n return command.type === CommandType.PushPathEffect;\n};\n\ntype Props = {\n [NodeType.DiscretePathEffect]: DiscretePathEffectProps;\n [NodeType.DashPathEffect]: DashPathEffectProps;\n [NodeType.Path1DPathEffect]: Path1DPathEffectProps;\n [NodeType.Path2DPathEffect]: Path2DPathEffectProps;\n [NodeType.CornerPathEffect]: CornerPathEffectProps;\n [NodeType.SumPathEffect]: Record<string, never>;\n [NodeType.Line2DPathEffect]: Line2DPathEffectProps;\n};\n\ninterface PushPathEffect<T extends keyof Props>\n extends Command<CommandType.PushPathEffect> {\n pathEffectType: T;\n props: Props[T];\n}\n\nconst isPathEffect = <T extends keyof Props>(\n command: Command<CommandType.PushPathEffect>,\n type: T\n): command is PushPathEffect<T> => {\n \"worklet\";\n return command.pathEffectType === type;\n};\n\nexport const composePathEffects = (ctx: DrawingContext) => {\n \"worklet\";\n if (ctx.pathEffects.length > 1) {\n const outer = ctx.pathEffects.pop()!;\n const inner = ctx.pathEffects.pop()!;\n ctx.pathEffects.push(ctx.Skia.PathEffect.MakeCompose(outer, inner));\n }\n};\n\nexport const pushPathEffect = (\n ctx: DrawingContext,\n command: Command<CommandType.PushPathEffect>\n) => {\n \"worklet\";\n if (isPathEffect(command, NodeType.DiscretePathEffect)) {\n declareDiscretePathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.DashPathEffect)) {\n declareDashPathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.Path1DPathEffect)) {\n declarePath1DPathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.Path2DPathEffect)) {\n declarePath2DPathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.CornerPathEffect)) {\n declareCornerPathEffect(ctx, command.props);\n } else if (isPathEffect(command, NodeType.SumPathEffect)) {\n declareSumPathEffect(ctx);\n } else if (isPathEffect(command, NodeType.Line2DPathEffect)) {\n declareLine2DPathEffect(ctx, command.props);\n } else {\n throw new Error(\"Invalid image filter type: \" + command.imageFilterType);\n }\n};\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACzD,SAASC,QAAQ,QAAQ,oBAAoB;AAS7C,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,mBAAmB,QAAQ,aAAa;AAEjD,SAASC,WAAW,QAAQ,SAAS;AAGrC,MAAMC,yBAAyB,GAAGA,CAChCC,GAAmB,EACnBC,KAA8B,KAC3B;EACH,SAAS;;EACT,MAAM;IAAEC,MAAM;IAAEC,SAAS;IAAEC;EAAK,CAAC,GAAGH,KAAK;EACzC,MAAMI,EAAE,GAAGL,GAAG,CAACM,IAA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CAAC,MAAM,IAAIsC,YAAY,CAACH,OAAO,EAAEzC,QAAQ,CAACsD,gBAAgB,CAAC,EAAE;IAC3DlB,uBAAuB,CAAC/B,GAAG,EAAEoC,OAAO,CAACnC,KAAK,CAAC;EAC7C,CAAC,MAAM,IAAIsC,YAAY,CAACH,OAAO,EAAEzC,QAAQ,CAACuD,gBAAgB,CAAC,EAAE;IAC3DvC,uBAAuB,CAACX,GAAG,EAAEoC,OAAO,CAACnC,KAAK,CAAC;EAC7C,CAAC,MAAM,IAAIsC,YAAY,CAACH,OAAO,EAAEzC,QAAQ,CAACwD,gBAAgB,CAAC,EAAE;IAC3D/B,uBAAuB,CAACpB,GAAG,EAAEoC,OAAO,CAACnC,KAAK,CAAC;EAC7C,CAAC,MAAM,IAAIsC,YAAY,CAACH,OAAO,EAAEzC,QAAQ,CAACyD,aAAa,CAAC,EAAE;IACxD7B,oBAAoB,CAACvB,GAAG,CAAC;EAC3B,CAAC,MAAM,IAAIuC,YAAY,CAACH,OAAO,EAAEzC,QAAQ,CAAC0D,gBAAgB,CAAC,EAAE;IAC3DzB,uBAAuB,CAAC5B,GAAG,EAAEoC,OAAO,CAACnC,KAAK,CAAC;EAC7C,CAAC,MAAM;IACL,MAAM,IAAIc,KAAK,CAAC,6BAA6B,GAAGqB,OAAO,CAACkB,eAAe,CAAC;EAC1E;AACF,CAAC","ignoreList":[]}
@@ -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;