@shopify/react-native-skia 0.1.225 → 0.1.228

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (326) hide show
  1. package/android/cpp/rnskia-android/SkiaOpenGLSurfaceFactory.h +3 -3
  2. package/cpp/api/JsiSkCanvas.h +2 -1
  3. package/cpp/api/JsiSkMatrix.h +35 -13
  4. package/cpp/api/JsiSkPictureRecorder.h +10 -3
  5. package/cpp/api/JsiSkTypeface.h +1 -0
  6. package/cpp/rnskia/dom/props/MatrixProp.h +19 -0
  7. package/cpp/rnskia/dom/props/TransformProp.h +76 -9
  8. package/lib/commonjs/animation/spring/runSpring.d.ts +3 -0
  9. package/lib/commonjs/animation/spring/runSpring.js +3 -0
  10. package/lib/commonjs/animation/spring/runSpring.js.map +1 -1
  11. package/lib/commonjs/animation/spring/useSpring.d.ts +3 -0
  12. package/lib/commonjs/animation/spring/useSpring.js +3 -0
  13. package/lib/commonjs/animation/spring/useSpring.js.map +1 -1
  14. package/lib/commonjs/animation/timing/runTiming.d.ts +3 -0
  15. package/lib/commonjs/animation/timing/runTiming.js +3 -0
  16. package/lib/commonjs/animation/timing/runTiming.js.map +1 -1
  17. package/lib/commonjs/animation/timing/useLoop.d.ts +3 -0
  18. package/lib/commonjs/animation/timing/useLoop.js +3 -0
  19. package/lib/commonjs/animation/timing/useLoop.js.map +1 -1
  20. package/lib/commonjs/animation/timing/useTiming.d.ts +3 -0
  21. package/lib/commonjs/animation/timing/useTiming.js +3 -0
  22. package/lib/commonjs/animation/timing/useTiming.js.map +1 -1
  23. package/lib/commonjs/dom/nodes/JsiSkDOM.js +2 -0
  24. package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
  25. package/lib/commonjs/dom/nodes/datatypes/Fitting.d.ts +5 -5
  26. package/lib/commonjs/dom/nodes/datatypes/Fitting.js.map +1 -1
  27. package/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +235 -75
  28. package/lib/commonjs/dom/nodes/datatypes/Gradient.js.map +1 -1
  29. package/lib/commonjs/dom/types/Common.d.ts +3 -3
  30. package/lib/commonjs/dom/types/Common.js.map +1 -1
  31. package/lib/commonjs/external/reanimated/interpolators.d.ts +1 -0
  32. package/lib/commonjs/external/reanimated/interpolators.js +24 -5
  33. package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
  34. package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +2 -1
  35. package/lib/commonjs/external/reanimated/moduleWrapper.js +9 -7
  36. package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
  37. package/lib/commonjs/renderer/Canvas.js +34 -28
  38. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  39. package/lib/commonjs/renderer/components/Drawing.d.ts +5 -0
  40. package/lib/commonjs/renderer/components/Drawing.js +5 -0
  41. package/lib/commonjs/renderer/components/Drawing.js.map +1 -1
  42. package/lib/commonjs/renderer/components/shapes/FitBox.d.ts +5 -5
  43. package/lib/commonjs/skia/core/Matrix.d.ts +2 -2
  44. package/lib/commonjs/skia/core/Matrix.js.map +1 -1
  45. package/lib/commonjs/skia/core/Picture.d.ts +2 -2
  46. package/lib/commonjs/skia/core/Picture.js +12 -2
  47. package/lib/commonjs/skia/core/Picture.js.map +1 -1
  48. package/lib/commonjs/skia/core/Vector.d.ts +0 -5
  49. package/lib/commonjs/skia/core/Vector.js +1 -17
  50. package/lib/commonjs/skia/core/Vector.js.map +1 -1
  51. package/lib/commonjs/skia/types/Canvas.d.ts +1 -1
  52. package/lib/commonjs/skia/types/Canvas.js.map +1 -1
  53. package/lib/commonjs/skia/types/Matrix.d.ts +4 -20
  54. package/lib/commonjs/skia/types/Matrix.js +4 -70
  55. package/lib/commonjs/skia/types/Matrix.js.map +1 -1
  56. package/lib/commonjs/skia/types/Matrix4.d.ts +90 -0
  57. package/lib/commonjs/skia/types/Matrix4.js +312 -0
  58. package/lib/commonjs/skia/types/Matrix4.js.map +1 -0
  59. package/lib/commonjs/skia/types/Path/Path.d.ts +1 -1
  60. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  61. package/lib/commonjs/skia/types/Picture/PictureRecorder.d.ts +1 -1
  62. package/lib/commonjs/skia/types/Picture/PictureRecorder.js.map +1 -1
  63. package/lib/commonjs/skia/types/Rect.d.ts +1 -0
  64. package/lib/commonjs/skia/types/Rect.js +18 -0
  65. package/lib/commonjs/skia/types/Rect.js.map +1 -1
  66. package/lib/commonjs/skia/types/index.d.ts +1 -0
  67. package/lib/commonjs/skia/types/index.js +13 -0
  68. package/lib/commonjs/skia/types/index.js.map +1 -1
  69. package/lib/commonjs/skia/web/Host.d.ts +2 -3
  70. package/lib/commonjs/skia/web/Host.js +4 -12
  71. package/lib/commonjs/skia/web/Host.js.map +1 -1
  72. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
  73. package/lib/commonjs/skia/web/JsiSkCanvas.js +13 -13
  74. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  75. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +1 -1
  76. package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  77. package/lib/commonjs/skia/web/JsiSkFont.js +2 -2
  78. package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
  79. package/lib/commonjs/skia/web/JsiSkImage.js +6 -6
  80. package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
  81. package/lib/commonjs/skia/web/JsiSkImageFactory.js +2 -2
  82. package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
  83. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +3 -3
  84. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  85. package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +1 -1
  86. package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
  87. package/lib/commonjs/skia/web/JsiSkMatrix.d.ts +2 -2
  88. package/lib/commonjs/skia/web/JsiSkMatrix.js +6 -1
  89. package/lib/commonjs/skia/web/JsiSkMatrix.js.map +1 -1
  90. package/lib/commonjs/skia/web/JsiSkPaint.js +3 -3
  91. package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
  92. package/lib/commonjs/skia/web/JsiSkPath.js +5 -5
  93. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  94. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +1 -1
  95. package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  96. package/lib/commonjs/skia/web/JsiSkPathFactory.js +1 -1
  97. package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
  98. package/lib/commonjs/skia/web/JsiSkPicture.js +1 -1
  99. package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
  100. package/lib/commonjs/skia/web/JsiSkPictureRecorder.d.ts +1 -1
  101. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js +1 -1
  102. package/lib/commonjs/skia/web/JsiSkPictureRecorder.js.map +1 -1
  103. package/lib/commonjs/skia/web/JsiSkShaderFactory.js +5 -5
  104. package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
  105. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +3 -3
  106. package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
  107. package/lib/commonjs/values/api.d.ts +23 -2
  108. package/lib/commonjs/values/api.js +44 -1
  109. package/lib/commonjs/values/api.js.map +1 -1
  110. package/lib/commonjs/values/hooks/useClockValue.d.ts +3 -0
  111. package/lib/commonjs/values/hooks/useClockValue.js +3 -0
  112. package/lib/commonjs/values/hooks/useClockValue.js.map +1 -1
  113. package/lib/commonjs/values/hooks/useComputedValue.d.ts +3 -0
  114. package/lib/commonjs/values/hooks/useComputedValue.js +3 -0
  115. package/lib/commonjs/values/hooks/useComputedValue.js.map +1 -1
  116. package/lib/commonjs/values/hooks/useValue.d.ts +3 -0
  117. package/lib/commonjs/values/hooks/useValue.js +3 -0
  118. package/lib/commonjs/values/hooks/useValue.js.map +1 -1
  119. package/lib/commonjs/values/hooks/useValueEffect.d.ts +3 -0
  120. package/lib/commonjs/values/hooks/useValueEffect.js +3 -0
  121. package/lib/commonjs/values/hooks/useValueEffect.js.map +1 -1
  122. package/lib/commonjs/values/types.d.ts +4 -4
  123. package/lib/commonjs/values/types.js.map +1 -1
  124. package/lib/commonjs/views/SkiaView.d.ts +5 -0
  125. package/lib/commonjs/views/SkiaView.js +9 -0
  126. package/lib/commonjs/views/SkiaView.js.map +1 -1
  127. package/lib/module/animation/spring/runSpring.d.ts +3 -0
  128. package/lib/module/animation/spring/runSpring.js +3 -0
  129. package/lib/module/animation/spring/runSpring.js.map +1 -1
  130. package/lib/module/animation/spring/useSpring.d.ts +3 -0
  131. package/lib/module/animation/spring/useSpring.js +3 -0
  132. package/lib/module/animation/spring/useSpring.js.map +1 -1
  133. package/lib/module/animation/timing/runTiming.d.ts +3 -0
  134. package/lib/module/animation/timing/runTiming.js +3 -0
  135. package/lib/module/animation/timing/runTiming.js.map +1 -1
  136. package/lib/module/animation/timing/useLoop.d.ts +3 -0
  137. package/lib/module/animation/timing/useLoop.js +3 -0
  138. package/lib/module/animation/timing/useLoop.js.map +1 -1
  139. package/lib/module/animation/timing/useTiming.d.ts +3 -0
  140. package/lib/module/animation/timing/useTiming.js +3 -0
  141. package/lib/module/animation/timing/useTiming.js.map +1 -1
  142. package/lib/module/dom/nodes/JsiSkDOM.js +2 -0
  143. package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
  144. package/lib/module/dom/nodes/datatypes/Fitting.d.ts +5 -5
  145. package/lib/module/dom/nodes/datatypes/Fitting.js.map +1 -1
  146. package/lib/module/dom/nodes/datatypes/Gradient.d.ts +235 -75
  147. package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
  148. package/lib/module/dom/types/Common.d.ts +3 -3
  149. package/lib/module/dom/types/Common.js.map +1 -1
  150. package/lib/module/external/reanimated/interpolators.d.ts +1 -0
  151. package/lib/module/external/reanimated/interpolators.js +22 -6
  152. package/lib/module/external/reanimated/interpolators.js.map +1 -1
  153. package/lib/module/external/reanimated/moduleWrapper.d.ts +2 -1
  154. package/lib/module/external/reanimated/moduleWrapper.js +7 -6
  155. package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
  156. package/lib/module/renderer/Canvas.js +35 -29
  157. package/lib/module/renderer/Canvas.js.map +1 -1
  158. package/lib/module/renderer/components/Drawing.d.ts +5 -0
  159. package/lib/module/renderer/components/Drawing.js +6 -0
  160. package/lib/module/renderer/components/Drawing.js.map +1 -1
  161. package/lib/module/renderer/components/shapes/FitBox.d.ts +5 -5
  162. package/lib/module/skia/core/Matrix.d.ts +2 -2
  163. package/lib/module/skia/core/Matrix.js.map +1 -1
  164. package/lib/module/skia/core/Picture.d.ts +2 -2
  165. package/lib/module/skia/core/Picture.js +12 -3
  166. package/lib/module/skia/core/Picture.js.map +1 -1
  167. package/lib/module/skia/core/Vector.d.ts +0 -5
  168. package/lib/module/skia/core/Vector.js +0 -13
  169. package/lib/module/skia/core/Vector.js.map +1 -1
  170. package/lib/module/skia/types/Canvas.d.ts +1 -1
  171. package/lib/module/skia/types/Canvas.js.map +1 -1
  172. package/lib/module/skia/types/Matrix.d.ts +4 -20
  173. package/lib/module/skia/types/Matrix.js +3 -71
  174. package/lib/module/skia/types/Matrix.js.map +1 -1
  175. package/lib/module/skia/types/Matrix4.d.ts +90 -0
  176. package/lib/module/skia/types/Matrix4.js +274 -0
  177. package/lib/module/skia/types/Matrix4.js.map +1 -0
  178. package/lib/module/skia/types/Path/Path.d.ts +1 -1
  179. package/lib/module/skia/types/Path/Path.js.map +1 -1
  180. package/lib/module/skia/types/Picture/PictureRecorder.d.ts +1 -1
  181. package/lib/module/skia/types/Picture/PictureRecorder.js.map +1 -1
  182. package/lib/module/skia/types/Rect.d.ts +1 -0
  183. package/lib/module/skia/types/Rect.js +9 -0
  184. package/lib/module/skia/types/Rect.js.map +1 -1
  185. package/lib/module/skia/types/index.d.ts +1 -0
  186. package/lib/module/skia/types/index.js +1 -0
  187. package/lib/module/skia/types/index.js.map +1 -1
  188. package/lib/module/skia/web/Host.d.ts +2 -3
  189. package/lib/module/skia/web/Host.js +2 -7
  190. package/lib/module/skia/web/Host.js.map +1 -1
  191. package/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
  192. package/lib/module/skia/web/JsiSkCanvas.js +14 -14
  193. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  194. package/lib/module/skia/web/JsiSkColorFilterFactory.js +2 -2
  195. package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
  196. package/lib/module/skia/web/JsiSkFont.js +3 -3
  197. package/lib/module/skia/web/JsiSkFont.js.map +1 -1
  198. package/lib/module/skia/web/JsiSkImage.js +7 -7
  199. package/lib/module/skia/web/JsiSkImage.js.map +1 -1
  200. package/lib/module/skia/web/JsiSkImageFactory.js +3 -3
  201. package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
  202. package/lib/module/skia/web/JsiSkImageFilterFactory.js +4 -4
  203. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  204. package/lib/module/skia/web/JsiSkMaskFilterFactory.js +2 -2
  205. package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
  206. package/lib/module/skia/web/JsiSkMatrix.d.ts +2 -2
  207. package/lib/module/skia/web/JsiSkMatrix.js +6 -1
  208. package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
  209. package/lib/module/skia/web/JsiSkPaint.js +4 -4
  210. package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
  211. package/lib/module/skia/web/JsiSkPath.js +6 -6
  212. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  213. package/lib/module/skia/web/JsiSkPathEffectFactory.js +2 -2
  214. package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
  215. package/lib/module/skia/web/JsiSkPathFactory.js +2 -2
  216. package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
  217. package/lib/module/skia/web/JsiSkPicture.js +2 -2
  218. package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
  219. package/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -1
  220. package/lib/module/skia/web/JsiSkPictureRecorder.js +1 -1
  221. package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
  222. package/lib/module/skia/web/JsiSkShaderFactory.js +6 -6
  223. package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
  224. package/lib/module/skia/web/JsiSkVerticesFactory.js +2 -2
  225. package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
  226. package/lib/module/values/api.d.ts +23 -2
  227. package/lib/module/values/api.js +44 -1
  228. package/lib/module/values/api.js.map +1 -1
  229. package/lib/module/values/hooks/useClockValue.d.ts +3 -0
  230. package/lib/module/values/hooks/useClockValue.js +3 -0
  231. package/lib/module/values/hooks/useClockValue.js.map +1 -1
  232. package/lib/module/values/hooks/useComputedValue.d.ts +3 -0
  233. package/lib/module/values/hooks/useComputedValue.js +3 -0
  234. package/lib/module/values/hooks/useComputedValue.js.map +1 -1
  235. package/lib/module/values/hooks/useValue.d.ts +3 -0
  236. package/lib/module/values/hooks/useValue.js +3 -0
  237. package/lib/module/values/hooks/useValue.js.map +1 -1
  238. package/lib/module/values/hooks/useValueEffect.d.ts +3 -0
  239. package/lib/module/values/hooks/useValueEffect.js +3 -0
  240. package/lib/module/values/hooks/useValueEffect.js.map +1 -1
  241. package/lib/module/values/types.d.ts +4 -4
  242. package/lib/module/values/types.js.map +1 -1
  243. package/lib/module/views/SkiaView.d.ts +5 -0
  244. package/lib/module/views/SkiaView.js +10 -0
  245. package/lib/module/views/SkiaView.js.map +1 -1
  246. package/lib/typescript/src/animation/spring/runSpring.d.ts +3 -0
  247. package/lib/typescript/src/animation/spring/useSpring.d.ts +3 -0
  248. package/lib/typescript/src/animation/timing/runTiming.d.ts +3 -0
  249. package/lib/typescript/src/animation/timing/useLoop.d.ts +3 -0
  250. package/lib/typescript/src/animation/timing/useTiming.d.ts +3 -0
  251. package/lib/typescript/src/dom/nodes/datatypes/Fitting.d.ts +5 -5
  252. package/lib/typescript/src/dom/nodes/datatypes/Gradient.d.ts +235 -75
  253. package/lib/typescript/src/dom/types/Common.d.ts +3 -3
  254. package/lib/typescript/src/external/reanimated/interpolators.d.ts +1 -0
  255. package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +2 -1
  256. package/lib/typescript/src/renderer/components/Drawing.d.ts +5 -0
  257. package/lib/typescript/src/renderer/components/shapes/FitBox.d.ts +5 -5
  258. package/lib/typescript/src/skia/core/Matrix.d.ts +2 -2
  259. package/lib/typescript/src/skia/core/Picture.d.ts +2 -2
  260. package/lib/typescript/src/skia/core/Vector.d.ts +0 -5
  261. package/lib/typescript/src/skia/types/Canvas.d.ts +1 -1
  262. package/lib/typescript/src/skia/types/Matrix.d.ts +4 -20
  263. package/lib/typescript/src/skia/types/Matrix4.d.ts +90 -0
  264. package/lib/typescript/src/skia/types/Path/Path.d.ts +1 -1
  265. package/lib/typescript/src/skia/types/Picture/PictureRecorder.d.ts +1 -1
  266. package/lib/typescript/src/skia/types/Rect.d.ts +1 -0
  267. package/lib/typescript/src/skia/types/index.d.ts +1 -0
  268. package/lib/typescript/src/skia/web/Host.d.ts +2 -3
  269. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +1 -1
  270. package/lib/typescript/src/skia/web/JsiSkMatrix.d.ts +2 -2
  271. package/lib/typescript/src/skia/web/JsiSkPictureRecorder.d.ts +1 -1
  272. package/lib/typescript/src/values/api.d.ts +23 -2
  273. package/lib/typescript/src/values/hooks/useClockValue.d.ts +3 -0
  274. package/lib/typescript/src/values/hooks/useComputedValue.d.ts +3 -0
  275. package/lib/typescript/src/values/hooks/useValue.d.ts +3 -0
  276. package/lib/typescript/src/values/hooks/useValueEffect.d.ts +3 -0
  277. package/lib/typescript/src/values/types.d.ts +4 -4
  278. package/lib/typescript/src/views/SkiaView.d.ts +5 -0
  279. package/package.json +2 -1
  280. package/src/animation/spring/runSpring.ts +3 -0
  281. package/src/animation/spring/useSpring.ts +3 -0
  282. package/src/animation/timing/runTiming.ts +3 -0
  283. package/src/animation/timing/useLoop.ts +3 -0
  284. package/src/animation/timing/useTiming.ts +3 -0
  285. package/src/dom/nodes/JsiSkDOM.ts +4 -0
  286. package/src/dom/nodes/datatypes/Fitting.ts +10 -2
  287. package/src/dom/nodes/datatypes/Gradient.ts +2 -2
  288. package/src/dom/types/Common.ts +5 -3
  289. package/src/external/reanimated/interpolators.ts +30 -7
  290. package/src/external/reanimated/moduleWrapper.ts +6 -0
  291. package/src/renderer/Canvas.tsx +41 -30
  292. package/src/renderer/components/Drawing.tsx +5 -0
  293. package/src/skia/core/Matrix.ts +2 -2
  294. package/src/skia/core/Picture.ts +11 -3
  295. package/src/skia/core/Vector.ts +0 -4
  296. package/src/skia/types/Canvas.ts +1 -1
  297. package/src/skia/types/Matrix.ts +7 -85
  298. package/src/skia/types/Matrix4.ts +344 -0
  299. package/src/skia/types/Path/Path.ts +1 -1
  300. package/src/skia/types/Picture/PictureRecorder.ts +1 -1
  301. package/src/skia/types/Rect.ts +14 -0
  302. package/src/skia/types/index.ts +1 -0
  303. package/src/skia/web/Host.ts +4 -3
  304. package/src/skia/web/JsiSkCanvas.ts +24 -17
  305. package/src/skia/web/JsiSkColorFilterFactory.ts +5 -2
  306. package/src/skia/web/JsiSkFont.ts +3 -3
  307. package/src/skia/web/JsiSkImage.ts +14 -11
  308. package/src/skia/web/JsiSkImageFactory.ts +3 -3
  309. package/src/skia/web/JsiSkImageFilterFactory.ts +5 -5
  310. package/src/skia/web/JsiSkMaskFilterFactory.ts +6 -2
  311. package/src/skia/web/JsiSkMatrix.ts +14 -3
  312. package/src/skia/web/JsiSkPaint.ts +4 -4
  313. package/src/skia/web/JsiSkPath.ts +9 -6
  314. package/src/skia/web/JsiSkPathEffectFactory.ts +2 -2
  315. package/src/skia/web/JsiSkPathFactory.ts +2 -2
  316. package/src/skia/web/JsiSkPicture.ts +4 -4
  317. package/src/skia/web/JsiSkPictureRecorder.ts +6 -2
  318. package/src/skia/web/JsiSkShaderFactory.ts +6 -6
  319. package/src/skia/web/JsiSkVerticesFactory.ts +2 -2
  320. package/src/values/api.ts +55 -2
  321. package/src/values/hooks/useClockValue.ts +3 -0
  322. package/src/values/hooks/useComputedValue.ts +3 -0
  323. package/src/values/hooks/useValue.ts +3 -0
  324. package/src/values/hooks/useValueEffect.ts +3 -0
  325. package/src/values/types.ts +6 -6
  326. package/src/views/SkiaView.tsx +11 -0
@@ -41,10 +41,11 @@ export abstract class HostObject<T, N extends string> extends BaseHostObject<
41
41
  }
42
42
  }
43
43
 
44
- export const getCkEnum = (e: EmbindEnum, v: number): EmbindEnumEntity =>
44
+ export const getEnum = (e: EmbindEnum, v: number): EmbindEnumEntity =>
45
45
  Object.values(e).find(({ value }) => value === v);
46
- export const ckEnum = (value: number): EmbindEnumEntity => ({ value });
46
+
47
47
  export const optEnum = (
48
+ e: EmbindEnum,
48
49
  value: number | undefined
49
50
  ): EmbindEnumEntity | undefined =>
50
- value === undefined ? undefined : { value };
51
+ value === undefined ? undefined : getEnum(e, value);
@@ -25,7 +25,7 @@ import type {
25
25
  SkVertices,
26
26
  } from "../types";
27
27
 
28
- import { ckEnum, getCkEnum, HostObject } from "./Host";
28
+ import { getEnum, HostObject } from "./Host";
29
29
  import { JsiSkPaint } from "./JsiSkPaint";
30
30
  import { JsiSkRect } from "./JsiSkRect";
31
31
  import { JsiSkRRect } from "./JsiSkRRect";
@@ -113,8 +113,8 @@ export class JsiSkCanvas
113
113
  JsiSkImage.fromValue(img),
114
114
  left,
115
115
  top,
116
- ckEnum(fm),
117
- ckEnum(mm),
116
+ getEnum(this.CanvasKit.FilterMode, fm),
117
+ getEnum(this.CanvasKit.MipmapMode, mm),
118
118
  paint ? JsiSkPaint.fromValue(paint) : paint
119
119
  );
120
120
  }
@@ -130,7 +130,7 @@ export class JsiSkCanvas
130
130
  JsiSkImage.fromValue(img),
131
131
  Array.from(JsiSkRect.fromValue(this.CanvasKit, center)),
132
132
  JsiSkRect.fromValue(this.CanvasKit, dest),
133
- ckEnum(filter),
133
+ getEnum(this.CanvasKit.FilterMode, filter),
134
134
  paint ? JsiSkPaint.fromValue(paint) : paint
135
135
  );
136
136
  }
@@ -165,8 +165,8 @@ export class JsiSkCanvas
165
165
  JsiSkImage.fromValue(img),
166
166
  JsiSkRect.fromValue(this.CanvasKit, src),
167
167
  JsiSkRect.fromValue(this.CanvasKit, dest),
168
- ckEnum(fm),
169
- ckEnum(mm),
168
+ getEnum(this.CanvasKit.FilterMode, fm),
169
+ getEnum(this.CanvasKit.MipmapMode, mm),
170
170
  paint ? JsiSkPaint.fromValue(paint) : paint
171
171
  );
172
172
  }
@@ -186,7 +186,7 @@ export class JsiSkCanvas
186
186
  drawVertices(verts: SkVertices, mode: BlendMode, paint: SkPaint) {
187
187
  this.ref.drawVertices(
188
188
  JsiSkVertices.fromValue(verts),
189
- ckEnum(mode),
189
+ getEnum(this.CanvasKit.BlendMode, mode),
190
190
  JsiSkPaint.fromValue(paint)
191
191
  );
192
192
  }
@@ -202,7 +202,7 @@ export class JsiSkCanvas
202
202
  cubics.map(({ x, y }) => [x, y]).flat(),
203
203
  colors,
204
204
  texs ? texs.flatMap((p) => Array.from(JsiSkPoint.fromValue(p))) : texs,
205
- mode ? ckEnum(mode) : null,
205
+ mode ? getEnum(this.CanvasKit.BlendMode, mode) : null,
206
206
  paint ? JsiSkPaint.fromValue(paint) : undefined
207
207
  );
208
208
  }
@@ -213,7 +213,7 @@ export class JsiSkCanvas
213
213
 
214
214
  drawPoints(mode: PointMode, points: SkPoint[], paint: SkPaint) {
215
215
  this.ref.drawPoints(
216
- ckEnum(mode),
216
+ getEnum(this.CanvasKit.PointMode, mode),
217
217
  points.map(({ x, y }) => [x, y]).flat(),
218
218
  JsiSkPaint.fromValue(paint)
219
219
  );
@@ -341,7 +341,10 @@ export class JsiSkCanvas
341
341
  }
342
342
 
343
343
  drawColor(color: SkColor, blendMode?: BlendMode) {
344
- this.ref.drawColor(color, blendMode ? ckEnum(blendMode) : undefined);
344
+ this.ref.drawColor(
345
+ color,
346
+ blendMode ? getEnum(this.CanvasKit.BlendMode, blendMode) : undefined
347
+ );
345
348
  }
346
349
 
347
350
  clear(color: SkColor) {
@@ -349,13 +352,17 @@ export class JsiSkCanvas
349
352
  }
350
353
 
351
354
  clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {
352
- this.ref.clipPath(JsiSkPath.fromValue(path), ckEnum(op), doAntiAlias);
355
+ this.ref.clipPath(
356
+ JsiSkPath.fromValue(path),
357
+ getEnum(this.CanvasKit.PathOp, op),
358
+ doAntiAlias
359
+ );
353
360
  }
354
361
 
355
362
  clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {
356
363
  this.ref.clipRect(
357
364
  JsiSkRect.fromValue(this.CanvasKit, rect),
358
- ckEnum(op),
365
+ getEnum(this.CanvasKit.PathOp, op),
359
366
  doAntiAlias
360
367
  );
361
368
  }
@@ -363,13 +370,13 @@ export class JsiSkCanvas
363
370
  clipRRect(rrect: SkRRect, op: ClipOp, doAntiAlias: boolean) {
364
371
  this.ref.clipRRect(
365
372
  JsiSkRRect.fromValue(this.CanvasKit, rrect),
366
- ckEnum(op),
373
+ getEnum(this.CanvasKit.PathOp, op),
367
374
  doAntiAlias
368
375
  );
369
376
  }
370
377
 
371
- concat(m: SkMatrix) {
372
- this.ref.concat(JsiSkMatrix.fromValue(m));
378
+ concat(m: SkMatrix | number[]) {
379
+ this.ref.concat(Array.isArray(m) ? m : JsiSkMatrix.fromValue(m));
373
380
  }
374
381
 
375
382
  drawPicture(skp: SkPicture) {
@@ -381,8 +388,8 @@ export class JsiSkCanvas
381
388
  width: imageInfo.width,
382
389
  height: imageInfo.height,
383
390
  colorSpace: this.CanvasKit.ColorSpace.SRGB,
384
- alphaType: getCkEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),
385
- colorType: getCkEnum(this.CanvasKit.ColorType, imageInfo.colorType),
391
+ alphaType: getEnum(this.CanvasKit.AlphaType, imageInfo.alphaType),
392
+ colorType: getEnum(this.CanvasKit.ColorType, imageInfo.colorType),
386
393
  };
387
394
  return this.ref.readPixels(srcX, srcY, pxInfo);
388
395
  }
@@ -8,7 +8,7 @@ import type {
8
8
  BlendMode,
9
9
  } from "../types";
10
10
 
11
- import { ckEnum, Host } from "./Host";
11
+ import { getEnum, Host } from "./Host";
12
12
  import { JsiSkColorFilter } from "./JsiSkColorFilter";
13
13
 
14
14
  export class JsiSkColorFilterFactory
@@ -29,7 +29,10 @@ export class JsiSkColorFilterFactory
29
29
  MakeBlend(color: SkColor, mode: BlendMode) {
30
30
  return new JsiSkColorFilter(
31
31
  this.CanvasKit,
32
- this.CanvasKit.ColorFilter.MakeBlend(color, ckEnum(mode))
32
+ this.CanvasKit.ColorFilter.MakeBlend(
33
+ color,
34
+ getEnum(this.CanvasKit.BlendMode, mode)
35
+ )
33
36
  );
34
37
  }
35
38
 
@@ -10,7 +10,7 @@ import type {
10
10
  SkTypeface,
11
11
  } from "../types";
12
12
 
13
- import { HostObject, NotImplementedOnRNWeb, ckEnum } from "./Host";
13
+ import { HostObject, NotImplementedOnRNWeb, getEnum } from "./Host";
14
14
  import { JsiSkPaint } from "./JsiSkPaint";
15
15
  import { JsiSkPoint } from "./JsiSkPoint";
16
16
  import { JsiSkRect } from "./JsiSkRect";
@@ -100,7 +100,7 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
100
100
  }
101
101
 
102
102
  setEdging(edging: FontEdging) {
103
- this.ref.setEdging(ckEnum(edging));
103
+ this.ref.setEdging(getEnum(this.CanvasKit.FontEdging, edging));
104
104
  }
105
105
 
106
106
  setEmbeddedBitmaps(embeddedBitmaps: boolean) {
@@ -108,7 +108,7 @@ export class JsiSkFont extends HostObject<Font, "Font"> implements SkFont {
108
108
  }
109
109
 
110
110
  setHinting(hinting: FontHinting) {
111
- this.ref.setHinting(ckEnum(hinting));
111
+ this.ref.setHinting(getEnum(this.CanvasKit.FontHinting, hinting));
112
112
  }
113
113
 
114
114
  setLinearMetrics(linearMetrics: boolean) {
@@ -15,7 +15,7 @@ import type {
15
15
  ImageInfo,
16
16
  } from "../types";
17
17
 
18
- import { ckEnum, getCkEnum, HostObject } from "./Host";
18
+ import { getEnum, HostObject } from "./Host";
19
19
  import { JsiSkMatrix } from "./JsiSkMatrix";
20
20
  import { JsiSkShader } from "./JsiSkShader";
21
21
 
@@ -77,10 +77,10 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
77
77
  return new JsiSkShader(
78
78
  this.CanvasKit,
79
79
  this.ref.makeShaderOptions(
80
- ckEnum(tx),
81
- ckEnum(ty),
82
- ckEnum(fm),
83
- ckEnum(mm),
80
+ getEnum(this.CanvasKit.TileMode, tx),
81
+ getEnum(this.CanvasKit.TileMode, ty),
82
+ getEnum(this.CanvasKit.FilterMode, fm),
83
+ getEnum(this.CanvasKit.MipmapMode, mm),
84
84
  localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined
85
85
  )
86
86
  );
@@ -96,8 +96,8 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
96
96
  return new JsiSkShader(
97
97
  this.CanvasKit,
98
98
  this.ref.makeShaderCubic(
99
- ckEnum(tx),
100
- ckEnum(ty),
99
+ getEnum(this.CanvasKit.TileMode, tx),
100
+ getEnum(this.CanvasKit.TileMode, ty),
101
101
  B,
102
102
  C,
103
103
  localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined
@@ -108,9 +108,12 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
108
108
  encodeToBytes(fmt?: ImageFormat, quality?: number) {
109
109
  let result: Uint8Array | null;
110
110
  if (fmt && quality) {
111
- result = this.ref.encodeToBytes(ckEnum(fmt), quality);
111
+ result = this.ref.encodeToBytes(
112
+ getEnum(this.CanvasKit.ImageFormat, fmt),
113
+ quality
114
+ );
112
115
  } else if (fmt) {
113
- result = this.ref.encodeToBytes(ckEnum(fmt));
116
+ result = this.ref.encodeToBytes(getEnum(this.CanvasKit.ImageFormat, fmt));
114
117
  } else {
115
118
  result = this.ref.encodeToBytes();
116
119
  }
@@ -131,11 +134,11 @@ export class JsiSkImage extends HostObject<Image, "Image"> implements SkImage {
131
134
  colorSpace: this.CanvasKit.ColorSpace.SRGB,
132
135
  width: imageInfo?.width ?? info.width,
133
136
  height: imageInfo?.height ?? info.height,
134
- alphaType: getCkEnum(
137
+ alphaType: getEnum(
135
138
  this.CanvasKit.AlphaType,
136
139
  (imageInfo ?? info).alphaType
137
140
  ),
138
- colorType: getCkEnum(
141
+ colorType: getEnum(
139
142
  this.CanvasKit.ColorType,
140
143
  (imageInfo ?? info).colorType
141
144
  ),
@@ -3,7 +3,7 @@ import type { CanvasKit } from "canvaskit-wasm";
3
3
  import type { SkData, ImageInfo, SkImage } from "../types";
4
4
  import type { ImageFactory } from "../types/Image/ImageFactory";
5
5
 
6
- import { Host, ckEnum } from "./Host";
6
+ import { Host, getEnum } from "./Host";
7
7
  import { JsiSkImage } from "./JsiSkImage";
8
8
  import { JsiSkData } from "./JsiSkData";
9
9
 
@@ -33,9 +33,9 @@ export class JsiSkImageFactory extends Host implements ImageFactory {
33
33
  // see toSkImageInfo() from canvaskit
34
34
  const image = this.CanvasKit.MakeImage(
35
35
  {
36
- alphaType: ckEnum(info.alphaType),
36
+ alphaType: getEnum(this.CanvasKit.AlphaType, info.alphaType),
37
37
  colorSpace: this.CanvasKit.ColorSpace.SRGB,
38
- colorType: ckEnum(info.colorType),
38
+ colorType: getEnum(this.CanvasKit.ColorType, info.colorType),
39
39
  height: info.height,
40
40
  width: info.width,
41
41
  },
@@ -13,7 +13,7 @@ import type {
13
13
  TileMode,
14
14
  } from "../types";
15
15
 
16
- import { Host, NotImplementedOnRNWeb, ckEnum } from "./Host";
16
+ import { Host, NotImplementedOnRNWeb, getEnum } from "./Host";
17
17
  import { JsiSkImageFilter } from "./JsiSkImageFilter";
18
18
  import { JsiSkColorFilter } from "./JsiSkColorFilter";
19
19
 
@@ -42,8 +42,8 @@ export class JsiSkImageFilterFactory
42
42
  const inputFilter =
43
43
  input === null ? null : JsiSkImageFilter.fromValue<ImageFilter>(input);
44
44
  const filter = this.CanvasKit.ImageFilter.MakeDisplacementMap(
45
- ckEnum(channelX),
46
- ckEnum(channelY),
45
+ getEnum(this.CanvasKit.ColorChannel, channelX),
46
+ getEnum(this.CanvasKit.ColorChannel, channelY),
47
47
  scale,
48
48
  JsiSkImageFilter.fromValue(in1),
49
49
  inputFilter
@@ -69,7 +69,7 @@ export class JsiSkImageFilterFactory
69
69
  this.CanvasKit.ImageFilter.MakeBlur(
70
70
  sigmaX,
71
71
  sigmaY,
72
- ckEnum(mode),
72
+ getEnum(this.CanvasKit.TileMode, mode),
73
73
  input === null ? null : JsiSkImageFilter.fromValue(input)
74
74
  )
75
75
  );
@@ -199,7 +199,7 @@ export class JsiSkImageFilterFactory
199
199
  );
200
200
  }
201
201
  const filter = this.CanvasKit.ImageFilter.MakeBlend(
202
- ckEnum(mode),
202
+ getEnum(this.CanvasKit.BlendMode, mode),
203
203
  JsiSkImageFilter.fromValue(background),
204
204
  inputFilter
205
205
  );
@@ -3,7 +3,7 @@ import type { CanvasKit } from "canvaskit-wasm";
3
3
  import type { BlurStyle } from "../types";
4
4
  import type { MaskFilterFactory } from "../types/MaskFilter";
5
5
 
6
- import { Host, ckEnum } from "./Host";
6
+ import { Host, getEnum } from "./Host";
7
7
  import { JsiSkMaskFilter } from "./JsiSkMaskFilter";
8
8
 
9
9
  export class JsiSkMaskFilterFactory extends Host implements MaskFilterFactory {
@@ -14,7 +14,11 @@ export class JsiSkMaskFilterFactory extends Host implements MaskFilterFactory {
14
14
  MakeBlur(style: BlurStyle, sigma: number, respectCTM: boolean) {
15
15
  return new JsiSkMaskFilter(
16
16
  this.CanvasKit,
17
- this.CanvasKit.MaskFilter.MakeBlur(ckEnum(style), sigma, respectCTM)
17
+ this.CanvasKit.MaskFilter.MakeBlur(
18
+ getEnum(this.CanvasKit.BlurStyle, style),
19
+ sigma,
20
+ respectCTM
21
+ )
18
22
  );
19
23
  }
20
24
  }
@@ -1,9 +1,13 @@
1
1
  import type { CanvasKit, Matrix3x3 } from "canvaskit-wasm";
2
2
 
3
- import type { SkMatrix } from "../types";
3
+ import { toMatrix3, type Matrix3, type Matrix4, type SkMatrix } from "../types";
4
4
 
5
5
  import { HostObject } from "./Host";
6
6
 
7
+ const isMatrixHostObject = (
8
+ obj: SkMatrix | number[] | Matrix4 | Matrix3
9
+ ): obj is SkMatrix => !Array.isArray(obj);
10
+
7
11
  export class JsiSkMatrix
8
12
  extends HostObject<Matrix3x3, "Matrix">
9
13
  implements SkMatrix
@@ -24,8 +28,15 @@ export class JsiSkMatrix
24
28
  // Do nothing - the matrix is represenetd by a Float32Array
25
29
  };
26
30
 
27
- concat(matrix: SkMatrix) {
28
- this.preMultiply(JsiSkMatrix.fromValue(matrix));
31
+ concat(matrix: SkMatrix | number[] | Matrix4 | Matrix3) {
32
+ this.preMultiply(
33
+ // eslint-disable-next-line no-nested-ternary
34
+ isMatrixHostObject(matrix)
35
+ ? JsiSkMatrix.fromValue(matrix)
36
+ : matrix.length === 16
37
+ ? toMatrix3(matrix as Matrix4)
38
+ : [...matrix]
39
+ );
29
40
  return this;
30
41
  }
31
42
 
@@ -14,7 +14,7 @@ import type {
14
14
  SkPathEffect,
15
15
  } from "../types";
16
16
 
17
- import { HostObject, ckEnum } from "./Host";
17
+ import { HostObject, getEnum } from "./Host";
18
18
  import { JsiSkColorFilter } from "./JsiSkColorFilter";
19
19
  import { JsiSkImageFilter } from "./JsiSkImageFilter";
20
20
  import { JsiSkMaskFilter } from "./JsiSkMaskFilter";
@@ -75,7 +75,7 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
75
75
  }
76
76
 
77
77
  setBlendMode(blendMode: BlendMode) {
78
- this.ref.setBlendMode(ckEnum(blendMode));
78
+ this.ref.setBlendMode(getEnum(this.CanvasKit.BlendMode, blendMode));
79
79
  }
80
80
 
81
81
  setColor(color: SkColor) {
@@ -103,11 +103,11 @@ export class JsiSkPaint extends HostObject<Paint, "Paint"> implements SkPaint {
103
103
  }
104
104
 
105
105
  setStrokeCap(cap: StrokeCap) {
106
- this.ref.setStrokeCap(ckEnum(cap));
106
+ this.ref.setStrokeCap(getEnum(this.CanvasKit.StrokeCap, cap));
107
107
  }
108
108
 
109
109
  setStrokeJoin(join: StrokeJoin) {
110
- this.ref.setStrokeJoin(ckEnum(join));
110
+ this.ref.setStrokeJoin(getEnum(this.CanvasKit.StrokeJoin, join));
111
111
  }
112
112
 
113
113
  setStrokeMiter(limit: number) {
@@ -13,7 +13,7 @@ import type {
13
13
  StrokeOpts,
14
14
  } from "../types";
15
15
 
16
- import { ckEnum, HostObject, optEnum } from "./Host";
16
+ import { getEnum, HostObject, optEnum } from "./Host";
17
17
  import { JsiSkPoint } from "./JsiSkPoint";
18
18
  import { JsiSkRect } from "./JsiSkRect";
19
19
  import { JsiSkRRect } from "./JsiSkRRect";
@@ -149,7 +149,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
149
149
  }
150
150
 
151
151
  setFillType(fill: FillType) {
152
- this.ref.setFillType(ckEnum(fill));
152
+ this.ref.setFillType(getEnum(this.CanvasKit.FillType, fill));
153
153
  return this;
154
154
  }
155
155
 
@@ -167,8 +167,8 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
167
167
  // eslint-disable-next-line camelcase
168
168
  miter_limit: opts.width,
169
169
  precision: opts.width,
170
- join: optEnum(opts.join),
171
- cap: optEnum(opts.cap),
170
+ join: optEnum(this.CanvasKit.StrokeJoin, opts.join),
171
+ cap: optEnum(this.CanvasKit.StrokeCap, opts.cap),
172
172
  }
173
173
  );
174
174
  return result === null ? result : this;
@@ -315,7 +315,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
315
315
  }
316
316
 
317
317
  op(path: SkPath, op: PathOp) {
318
- return this.ref.op(JsiSkPath.fromValue(path), ckEnum(op));
318
+ return this.ref.op(
319
+ JsiSkPath.fromValue(path),
320
+ getEnum(this.CanvasKit.PathOp, op)
321
+ );
319
322
  }
320
323
 
321
324
  simplify() {
@@ -337,7 +340,7 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
337
340
  }
338
341
 
339
342
  transform(m3: SkMatrix) {
340
- this.ref.transform(JsiSkMatrix.fromValue(m3));
343
+ this.ref.transform(Array.isArray(m3) ? m3 : JsiSkMatrix.fromValue(m3));
341
344
  return this;
342
345
  }
343
346
 
@@ -8,7 +8,7 @@ import type {
8
8
  SkPathEffect,
9
9
  } from "../types";
10
10
 
11
- import { ckEnum, Host, NotImplementedOnRNWeb } from "./Host";
11
+ import { getEnum, Host, NotImplementedOnRNWeb } from "./Host";
12
12
  import { JsiSkMatrix } from "./JsiSkMatrix";
13
13
  import { JsiSkPath } from "./JsiSkPath";
14
14
  import { JsiSkPathEffect } from "./JsiSkPathEffect";
@@ -69,7 +69,7 @@ export class JsiSkPathEffectFactory extends Host implements PathEffectFactory {
69
69
  JsiSkPath.fromValue(path),
70
70
  advance,
71
71
  phase,
72
- ckEnum(style)
72
+ getEnum(this.CanvasKit.Path1DEffect, style)
73
73
  );
74
74
  if (pe === null) {
75
75
  return null;
@@ -3,7 +3,7 @@ import type { CanvasKit } from "canvaskit-wasm";
3
3
  import type { PathCommand, PathOp, SkFont, SkPath } from "../types";
4
4
  import type { PathFactory } from "../types/Path/PathFactory";
5
5
 
6
- import { Host, ckEnum, NotImplementedOnRNWeb } from "./Host";
6
+ import { Host, getEnum, NotImplementedOnRNWeb } from "./Host";
7
7
  import { JsiSkPath } from "./JsiSkPath";
8
8
 
9
9
  export class JsiSkPathFactory extends Host implements PathFactory {
@@ -27,7 +27,7 @@ export class JsiSkPathFactory extends Host implements PathFactory {
27
27
  const path = this.CanvasKit.Path.MakeFromOp(
28
28
  JsiSkPath.fromValue(one),
29
29
  JsiSkPath.fromValue(two),
30
- ckEnum(op)
30
+ getEnum(this.CanvasKit.PathOp, op)
31
31
  );
32
32
  if (path === null) {
33
33
  return null;
@@ -9,7 +9,7 @@ import type {
9
9
  SkMatrix,
10
10
  } from "../types";
11
11
 
12
- import { HostObject, ckEnum } from "./Host";
12
+ import { HostObject, getEnum } from "./Host";
13
13
  import { JsiSkShader } from "./JsiSkShader";
14
14
  import { JsiSkMatrix } from "./JsiSkMatrix";
15
15
  import { JsiSkRect } from "./JsiSkRect";
@@ -36,9 +36,9 @@ export class JsiSkPicture
36
36
  return new JsiSkShader(
37
37
  this.CanvasKit,
38
38
  this.ref.makeShader(
39
- ckEnum(tmx),
40
- ckEnum(tmy),
41
- ckEnum(mode),
39
+ getEnum(this.CanvasKit.TileMode, tmx),
40
+ getEnum(this.CanvasKit.TileMode, tmy),
41
+ getEnum(this.CanvasKit.FilterMode, mode),
42
42
  localMatrix ? JsiSkMatrix.fromValue(localMatrix) : undefined,
43
43
  tileRect ? JsiSkRect.fromValue(this.CanvasKit, tileRect) : undefined
44
44
  )
@@ -20,10 +20,14 @@ export class JsiSkPictureRecorder
20
20
  this.ref.delete();
21
21
  };
22
22
 
23
- beginRecording(bounds: SkRect) {
23
+ beginRecording(bounds?: SkRect) {
24
24
  return new JsiSkCanvas(
25
25
  this.CanvasKit,
26
- this.ref.beginRecording(JsiSkRect.fromValue(this.CanvasKit, bounds))
26
+ this.ref.beginRecording(
27
+ bounds
28
+ ? JsiSkRect.fromValue(this.CanvasKit, bounds)
29
+ : Float32Array.of(0, 0, 2_000_000, 2_000_000)
30
+ )
27
31
  );
28
32
  }
29
33
 
@@ -10,7 +10,7 @@ import type {
10
10
  } from "../types";
11
11
  import type { ShaderFactory } from "../types/Shader/ShaderFactory";
12
12
 
13
- import { Host, ckEnum } from "./Host";
13
+ import { Host, getEnum } from "./Host";
14
14
  import { JsiSkMatrix } from "./JsiSkMatrix";
15
15
  import { JsiSkPoint } from "./JsiSkPoint";
16
16
  import { JsiSkShader } from "./JsiSkShader";
@@ -36,7 +36,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
36
36
  JsiSkPoint.fromValue(end),
37
37
  colors,
38
38
  pos,
39
- ckEnum(mode),
39
+ getEnum(this.CanvasKit.TileMode, mode),
40
40
  localMatrix === undefined
41
41
  ? undefined
42
42
  : JsiSkMatrix.fromValue(localMatrix),
@@ -61,7 +61,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
61
61
  radius,
62
62
  colors,
63
63
  pos,
64
- ckEnum(mode),
64
+ getEnum(this.CanvasKit.TileMode, mode),
65
65
  localMatrix === undefined
66
66
  ? undefined
67
67
  : JsiSkMatrix.fromValue(localMatrix),
@@ -90,7 +90,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
90
90
  endRadius,
91
91
  colors,
92
92
  pos,
93
- ckEnum(mode),
93
+ getEnum(this.CanvasKit.TileMode, mode),
94
94
  localMatrix === undefined
95
95
  ? undefined
96
96
  : JsiSkMatrix.fromValue(localMatrix),
@@ -117,7 +117,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
117
117
  cy,
118
118
  colors,
119
119
  pos,
120
- ckEnum(mode),
120
+ getEnum(this.CanvasKit.TileMode, mode),
121
121
  localMatrix === undefined || localMatrix === null
122
122
  ? undefined
123
123
  : JsiSkMatrix.fromValue(localMatrix),
@@ -174,7 +174,7 @@ export class JsiSkShaderFactory extends Host implements ShaderFactory {
174
174
  return new JsiSkShader(
175
175
  this.CanvasKit,
176
176
  this.CanvasKit.Shader.MakeBlend(
177
- ckEnum(mode),
177
+ getEnum(this.CanvasKit.BlendMode, mode),
178
178
  JsiSkShader.fromValue(one),
179
179
  JsiSkShader.fromValue(two)
180
180
  )
@@ -2,8 +2,8 @@ import type { CanvasKit } from "canvaskit-wasm";
2
2
 
3
3
  import type { SkColor, SkPoint, VertexMode } from "../types";
4
4
 
5
- import { ckEnum } from "./Host";
6
5
  import { JsiSkVertices } from "./JsiSkVertices";
6
+ import { getEnum } from "./Host";
7
7
 
8
8
  const concat = (...arrays: Float32Array[]) => {
9
9
  let totalLength = 0;
@@ -31,7 +31,7 @@ export const MakeVertices = (
31
31
  new JsiSkVertices(
32
32
  CanvasKit,
33
33
  CanvasKit.MakeVertices(
34
- ckEnum(mode),
34
+ getEnum(CanvasKit.VertexMode, mode),
35
35
  positions.map(({ x, y }) => [x, y]).flat(),
36
36
  (textureCoordinates || []).map(({ x, y }) => [x, y]).flat(),
37
37
  !colors ? null : colors.reduce((a, c) => concat(a, c)),
package/src/values/api.ts CHANGED
@@ -1,8 +1,61 @@
1
- import type { ISkiaValueApi } from "./types";
1
+ import type {
2
+ AnimationState,
3
+ ISkiaValueApi,
4
+ SkiaAnimation,
5
+ SkiaClockValue,
6
+ SkiaMutableValue,
7
+ SkiaValue,
8
+ } from "./types";
2
9
 
3
10
  declare global {
4
11
  var SkiaValueApi: ISkiaValueApi;
5
12
  }
6
13
 
7
14
  const { SkiaValueApi } = global;
8
- export const ValueApi = SkiaValueApi;
15
+
16
+ const deprecatedWarning = () => {
17
+ console.warn(
18
+ `Skia values are deprecated and will be removed in the next Skia release.
19
+ Please use Reanimated instead: https://shopify.github.io/react-native-skia/docs/animations/animations`
20
+ );
21
+ };
22
+
23
+ export const ValueApi = {
24
+ /**
25
+ * @deprecated Use Reanimated 3
26
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
27
+ */
28
+ createValue<T>(initialValue: T): SkiaMutableValue<T> {
29
+ deprecatedWarning();
30
+ return SkiaValueApi.createValue(initialValue);
31
+ },
32
+ /**
33
+ * @deprecated Use Reanimated 3
34
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
35
+ */
36
+ createComputedValue<R>(
37
+ cb: () => R,
38
+ values: SkiaValue<unknown>[]
39
+ ): SkiaValue<R> {
40
+ deprecatedWarning();
41
+ return SkiaValueApi.createComputedValue(cb, values);
42
+ },
43
+ /**
44
+ * @deprecated Use Reanimated 3
45
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
46
+ */
47
+ createClockValue(): SkiaClockValue {
48
+ deprecatedWarning();
49
+ return SkiaValueApi.createClockValue();
50
+ },
51
+ /**
52
+ * @deprecated Use Reanimated 3
53
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
54
+ */
55
+ createAnimation<S extends AnimationState = AnimationState>(
56
+ cb: (t: number, state: S | undefined) => S
57
+ ): SkiaAnimation {
58
+ deprecatedWarning();
59
+ return SkiaValueApi.createAnimation(cb);
60
+ },
61
+ };
@@ -3,6 +3,9 @@ import { useEffect, useMemo } from "react";
3
3
  import { ValueApi } from "../api";
4
4
 
5
5
  /**
6
+ * @deprecated Use Reanimated 3
7
+ * for animating Skia: https://shopify.github.io/react-native-skia/docs/animations/animations
8
+ *
6
9
  * @returns A new value that will be updated on every frame redraw with the
7
10
  * number of milliseconds elapsed since the value was started.
8
11
  * The clock is created in the stopped state.