@shopify/react-native-skia 0.1.123 → 0.1.126

Sign up to get free protection for your applications and to get access to all the features.
Files changed (423) hide show
  1. package/android/CMakeLists.txt +3 -0
  2. package/android/build.gradle +1 -1
  3. package/android/cpp/rnskia-android/RNSkDrawViewImpl.cpp +5 -5
  4. package/android/cpp/rnskia-android/RNSkDrawViewImpl.h +4 -4
  5. package/cpp/api/JsiSkApi.h +3 -1
  6. package/cpp/api/JsiSkCanvas.h +1 -1
  7. package/cpp/api/JsiSkColor.h +41 -7
  8. package/cpp/api/JsiSkColorFilterFactory.h +2 -1
  9. package/cpp/api/JsiSkImageFilter.h +0 -2
  10. package/cpp/api/JsiSkImageFilterFactory.h +37 -17
  11. package/cpp/api/JsiSkMatrix.h +44 -2
  12. package/cpp/api/JsiSkPaint.h +4 -7
  13. package/cpp/api/JsiSkRuntimeEffect.h +7 -0
  14. package/cpp/api/JsiSkRuntimeEffectFactory.h +3 -2
  15. package/cpp/api/JsiSkRuntimeShaderBuilder.h +70 -0
  16. package/cpp/api/JsiSkShaderFactory.h +2 -2
  17. package/cpp/api/JsiSkVertices.h +1 -1
  18. package/cpp/api/third_party/CSSColorParser.cpp +194 -0
  19. package/cpp/api/third_party/CSSColorParser.h +1 -191
  20. package/cpp/jsi/JsiSimpleValueWrapper.h +108 -0
  21. package/cpp/rnskia/RNSkAnimation.h +0 -2
  22. package/cpp/rnskia/RNSkDrawView.cpp +10 -13
  23. package/cpp/rnskia/RNSkDrawView.h +2 -2
  24. package/cpp/rnskia/RNSkValueApi.h +6 -2
  25. package/cpp/rnskia/values/RNSkClockValue.h +2 -2
  26. package/cpp/rnskia/values/RNSkDerivedValue.h +12 -5
  27. package/cpp/rnskia/values/RNSkReadonlyValue.h +14 -12
  28. package/cpp/rnskia/values/RNSkValue.h +8 -3
  29. package/ios/RNSkia-iOS/PlatformContext.h +30 -4
  30. package/ios/RNSkia-iOS/RNSkDrawViewImpl.h +4 -4
  31. package/ios/RNSkia-iOS/SkiaDrawView.mm +9 -13
  32. package/lib/commonjs/{values/animation → animation}/decay/decay.js +0 -0
  33. package/lib/commonjs/{values/animation → animation}/decay/decay.js.map +0 -0
  34. package/lib/commonjs/{values/animation → animation}/decay/index.js +0 -0
  35. package/lib/commonjs/{values/animation → animation}/decay/index.js.map +0 -0
  36. package/lib/commonjs/{values/animation → animation}/decay/runDecay.js +1 -1
  37. package/lib/commonjs/animation/decay/runDecay.js.map +1 -0
  38. package/lib/commonjs/{values/animation → animation}/decay/types.js +0 -0
  39. package/lib/commonjs/{values/animation → animation}/decay/types.js.map +0 -0
  40. package/lib/commonjs/{values/animation → animation}/functions/index.js +0 -0
  41. package/lib/commonjs/{values/animation → animation}/functions/index.js.map +0 -0
  42. package/lib/commonjs/animation/functions/interpolate.js +141 -0
  43. package/lib/commonjs/animation/functions/interpolate.js.map +1 -0
  44. package/lib/commonjs/animation/functions/interpolateColors.js +39 -0
  45. package/lib/commonjs/animation/functions/interpolateColors.js.map +1 -0
  46. package/lib/commonjs/{values/animation → animation}/index.js +0 -0
  47. package/lib/commonjs/{values/animation → animation}/index.js.map +0 -0
  48. package/lib/commonjs/{values/animation → animation}/spring/Spring.js +0 -0
  49. package/lib/commonjs/{values/animation → animation}/spring/Spring.js.map +0 -0
  50. package/lib/commonjs/{values/animation → animation}/spring/functions/index.js +0 -0
  51. package/lib/commonjs/{values/animation → animation}/spring/functions/index.js.map +0 -0
  52. package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js +0 -0
  53. package/lib/commonjs/{values/animation → animation}/spring/functions/spring.js.map +0 -0
  54. package/lib/commonjs/{values/animation → animation}/spring/index.js +0 -0
  55. package/lib/commonjs/{values/animation → animation}/spring/index.js.map +0 -0
  56. package/lib/commonjs/{values/animation → animation}/spring/runSpring.js +0 -0
  57. package/lib/commonjs/animation/spring/runSpring.js.map +1 -0
  58. package/lib/commonjs/{values/animation → animation}/spring/types.js +0 -0
  59. package/lib/commonjs/{values/animation → animation}/spring/types.js.map +0 -0
  60. package/lib/commonjs/{values/animation → animation}/spring/useSpring.js +0 -0
  61. package/lib/commonjs/animation/spring/useSpring.js.map +1 -0
  62. package/lib/commonjs/{values/animation → animation}/timing/Easing.js +0 -0
  63. package/lib/commonjs/{values/animation → animation}/timing/Easing.js.map +0 -0
  64. package/lib/commonjs/{values/animation → animation}/timing/createTiming.js +1 -1
  65. package/lib/commonjs/animation/timing/createTiming.js.map +1 -0
  66. package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js +0 -0
  67. package/lib/commonjs/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
  68. package/lib/commonjs/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
  69. package/lib/commonjs/animation/timing/functions/getResolvedParams.js.map +1 -0
  70. package/lib/commonjs/{values/animation → animation}/timing/functions/index.js +0 -0
  71. package/lib/commonjs/{values/animation → animation}/timing/functions/index.js.map +0 -0
  72. package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js +0 -0
  73. package/lib/commonjs/{values/animation → animation}/timing/functions/timing.js.map +1 -1
  74. package/lib/commonjs/{values/animation → animation}/timing/functions/types.js +0 -0
  75. package/lib/commonjs/{values/animation → animation}/timing/functions/types.js.map +0 -0
  76. package/lib/commonjs/{values/animation → animation}/timing/index.js +0 -0
  77. package/lib/commonjs/{values/animation → animation}/timing/index.js.map +0 -0
  78. package/lib/commonjs/{values/animation → animation}/timing/runTiming.js +0 -0
  79. package/lib/commonjs/animation/timing/runTiming.js.map +1 -0
  80. package/lib/commonjs/{values/animation → animation}/timing/useLoop.js +0 -0
  81. package/lib/commonjs/{values/animation → animation}/timing/useLoop.js.map +0 -0
  82. package/lib/commonjs/{values/animation → animation}/timing/useTiming.js +1 -1
  83. package/lib/commonjs/animation/timing/useTiming.js.map +1 -0
  84. package/lib/commonjs/{values/animation → animation}/types.js +0 -0
  85. package/lib/commonjs/{values/animation → animation}/types.js.map +0 -0
  86. package/lib/commonjs/index.js +13 -0
  87. package/lib/commonjs/index.js.map +1 -1
  88. package/lib/commonjs/renderer/Canvas.js +14 -5
  89. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  90. package/lib/commonjs/renderer/components/colorFilters/BlendColor.js.map +1 -1
  91. package/lib/commonjs/renderer/components/colorFilters/Lerp.js +1 -1
  92. package/lib/commonjs/renderer/components/colorFilters/Lerp.js.map +1 -1
  93. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js +4 -2
  94. package/lib/commonjs/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  95. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js +37 -0
  96. package/lib/commonjs/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
  97. package/lib/commonjs/renderer/components/imageFilters/index.js +13 -0
  98. package/lib/commonjs/renderer/components/imageFilters/index.js.map +1 -1
  99. package/lib/commonjs/renderer/components/shaders/Gradient.js +1 -1
  100. package/lib/commonjs/renderer/components/shaders/Gradient.js.map +1 -1
  101. package/lib/commonjs/renderer/components/shaders/Shader.js +2 -2
  102. package/lib/commonjs/renderer/components/shaders/Shader.js.map +1 -1
  103. package/lib/commonjs/renderer/processors/Circles.js +3 -2
  104. package/lib/commonjs/renderer/processors/Circles.js.map +1 -1
  105. package/lib/commonjs/renderer/processors/Font.js +1 -1
  106. package/lib/commonjs/renderer/processors/Font.js.map +1 -1
  107. package/lib/commonjs/renderer/processors/Rects.js +11 -21
  108. package/lib/commonjs/renderer/processors/Rects.js.map +1 -1
  109. package/lib/commonjs/renderer/processors/math/Matrix3.js +42 -63
  110. package/lib/commonjs/renderer/processors/math/Matrix3.js.map +1 -1
  111. package/lib/commonjs/renderer/processors/math/Vector.js +4 -5
  112. package/lib/commonjs/renderer/processors/math/Vector.js.map +1 -1
  113. package/lib/commonjs/skia/Color.js +14 -38
  114. package/lib/commonjs/skia/Color.js.map +1 -1
  115. package/lib/commonjs/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
  116. package/lib/commonjs/skia/Matrix.js.map +1 -1
  117. package/lib/commonjs/skia/Shader/useShader.js +4 -1
  118. package/lib/commonjs/skia/Shader/useShader.js.map +1 -1
  119. package/lib/commonjs/skia/Skia.js +3 -45
  120. package/lib/commonjs/skia/Skia.js.map +1 -1
  121. package/lib/commonjs/skia/SkiaApi.js +4 -0
  122. package/lib/commonjs/skia/SkiaApi.js.map +1 -0
  123. package/lib/commonjs/values/api.js +4 -6
  124. package/lib/commonjs/values/api.js.map +1 -1
  125. package/lib/commonjs/values/api.web.js +18 -0
  126. package/lib/commonjs/values/api.web.js.map +1 -0
  127. package/lib/commonjs/values/index.js +0 -13
  128. package/lib/commonjs/values/index.js.map +1 -1
  129. package/lib/commonjs/values/web/RNSkAnimation.js +46 -0
  130. package/lib/commonjs/values/web/RNSkAnimation.js.map +1 -0
  131. package/lib/commonjs/values/web/RNSkClockValue.js +75 -0
  132. package/lib/commonjs/values/web/RNSkClockValue.js.map +1 -0
  133. package/lib/commonjs/values/web/RNSkDerivedValue.js +51 -0
  134. package/lib/commonjs/values/web/RNSkDerivedValue.js.map +1 -0
  135. package/lib/commonjs/values/web/RNSkReadonlyValue.js +45 -0
  136. package/lib/commonjs/values/web/RNSkReadonlyValue.js.map +1 -0
  137. package/lib/commonjs/values/web/RNSkValue.js +73 -0
  138. package/lib/commonjs/values/web/RNSkValue.js.map +1 -0
  139. package/lib/commonjs/values/web/api.js +31 -0
  140. package/lib/commonjs/values/web/api.js.map +1 -0
  141. package/lib/commonjs/values/web/index.js +19 -0
  142. package/lib/commonjs/values/web/index.js.map +1 -0
  143. package/lib/commonjs/views/SkiaView.js +13 -10
  144. package/lib/commonjs/views/SkiaView.js.map +1 -1
  145. package/lib/commonjs/views/api.js +11 -0
  146. package/lib/commonjs/views/api.js.map +1 -0
  147. package/lib/commonjs/views/types.js.map +1 -1
  148. package/lib/module/{values/animation → animation}/decay/decay.js +0 -0
  149. package/lib/module/{values/animation → animation}/decay/decay.js.map +0 -0
  150. package/lib/module/{values/animation → animation}/decay/index.js +0 -0
  151. package/lib/module/{values/animation → animation}/decay/index.js.map +0 -0
  152. package/lib/module/{values/animation → animation}/decay/runDecay.js +1 -1
  153. package/lib/module/animation/decay/runDecay.js.map +1 -0
  154. package/lib/module/{values/animation → animation}/decay/types.js +0 -0
  155. package/lib/module/{values/animation → animation}/decay/types.js.map +0 -0
  156. package/lib/module/{values/animation → animation}/functions/index.js +0 -0
  157. package/lib/module/{values/animation → animation}/functions/index.js.map +0 -0
  158. package/lib/module/animation/functions/interpolate.js +132 -0
  159. package/lib/module/animation/functions/interpolate.js.map +1 -0
  160. package/lib/module/animation/functions/interpolateColors.js +23 -0
  161. package/lib/module/animation/functions/interpolateColors.js.map +1 -0
  162. package/lib/module/{values/animation → animation}/index.js +0 -0
  163. package/lib/module/{values/animation → animation}/index.js.map +0 -0
  164. package/lib/module/{values/animation → animation}/spring/Spring.js +0 -0
  165. package/lib/module/{values/animation → animation}/spring/Spring.js.map +0 -0
  166. package/lib/module/{values/animation → animation}/spring/functions/index.js +0 -0
  167. package/lib/module/{values/animation → animation}/spring/functions/index.js.map +0 -0
  168. package/lib/module/{values/animation → animation}/spring/functions/spring.js +0 -0
  169. package/lib/module/{values/animation → animation}/spring/functions/spring.js.map +0 -0
  170. package/lib/module/{values/animation → animation}/spring/index.js +0 -0
  171. package/lib/module/{values/animation → animation}/spring/index.js.map +0 -0
  172. package/lib/module/{values/animation → animation}/spring/runSpring.js +0 -0
  173. package/lib/module/animation/spring/runSpring.js.map +1 -0
  174. package/lib/module/{values/animation → animation}/spring/types.js +0 -0
  175. package/lib/module/{values/animation → animation}/spring/types.js.map +0 -0
  176. package/lib/module/{values/animation → animation}/spring/useSpring.js +0 -0
  177. package/lib/module/animation/spring/useSpring.js.map +1 -0
  178. package/lib/module/{values/animation → animation}/timing/Easing.js +0 -0
  179. package/lib/module/{values/animation → animation}/timing/Easing.js.map +0 -0
  180. package/lib/module/{values/animation → animation}/timing/createTiming.js +1 -1
  181. package/lib/module/animation/timing/createTiming.js.map +1 -0
  182. package/lib/module/{values/animation → animation}/timing/functions/bezier.js +0 -0
  183. package/lib/module/{values/animation → animation}/timing/functions/bezier.js.map +0 -0
  184. package/lib/module/{values/animation → animation}/timing/functions/getResolvedParams.js +3 -3
  185. package/lib/module/animation/timing/functions/getResolvedParams.js.map +1 -0
  186. package/lib/module/{values/animation → animation}/timing/functions/index.js +0 -0
  187. package/lib/module/{values/animation → animation}/timing/functions/index.js.map +0 -0
  188. package/lib/module/{values/animation → animation}/timing/functions/timing.js +0 -0
  189. package/lib/module/{values/animation → animation}/timing/functions/timing.js.map +1 -1
  190. package/lib/module/{values/animation → animation}/timing/functions/types.js +0 -0
  191. package/lib/module/{values/animation → animation}/timing/functions/types.js.map +0 -0
  192. package/lib/module/{values/animation → animation}/timing/index.js +0 -0
  193. package/lib/module/{values/animation → animation}/timing/index.js.map +0 -0
  194. package/lib/module/{values/animation → animation}/timing/runTiming.js +0 -0
  195. package/lib/module/animation/timing/runTiming.js.map +1 -0
  196. package/lib/module/{values/animation → animation}/timing/useLoop.js +0 -0
  197. package/lib/module/{values/animation → animation}/timing/useLoop.js.map +0 -0
  198. package/lib/module/{values/animation → animation}/timing/useTiming.js +1 -1
  199. package/lib/module/animation/timing/useTiming.js.map +1 -0
  200. package/lib/module/{values/animation → animation}/types.js +0 -0
  201. package/lib/module/{values/animation → animation}/types.js.map +0 -0
  202. package/lib/module/index.js +1 -0
  203. package/lib/module/index.js.map +1 -1
  204. package/lib/module/renderer/Canvas.js +10 -4
  205. package/lib/module/renderer/Canvas.js.map +1 -1
  206. package/lib/module/renderer/components/colorFilters/BlendColor.js.map +1 -1
  207. package/lib/module/renderer/components/colorFilters/Lerp.js +1 -1
  208. package/lib/module/renderer/components/colorFilters/Lerp.js.map +1 -1
  209. package/lib/module/renderer/components/imageFilters/InnerShadow.js +3 -2
  210. package/lib/module/renderer/components/imageFilters/InnerShadow.js.map +1 -1
  211. package/lib/module/renderer/components/imageFilters/RuntimeShader.js +19 -0
  212. package/lib/module/renderer/components/imageFilters/RuntimeShader.js.map +1 -0
  213. package/lib/module/renderer/components/imageFilters/index.js +1 -0
  214. package/lib/module/renderer/components/imageFilters/index.js.map +1 -1
  215. package/lib/module/renderer/components/shaders/Gradient.js +2 -2
  216. package/lib/module/renderer/components/shaders/Gradient.js.map +1 -1
  217. package/lib/module/renderer/components/shaders/Shader.js +3 -2
  218. package/lib/module/renderer/components/shaders/Shader.js.map +1 -1
  219. package/lib/module/renderer/processors/Circles.js +3 -2
  220. package/lib/module/renderer/processors/Circles.js.map +1 -1
  221. package/lib/module/renderer/processors/Font.js +1 -1
  222. package/lib/module/renderer/processors/Font.js.map +1 -1
  223. package/lib/module/renderer/processors/Rects.js +9 -21
  224. package/lib/module/renderer/processors/Rects.js.map +1 -1
  225. package/lib/module/renderer/processors/math/Matrix3.js +52 -72
  226. package/lib/module/renderer/processors/math/Matrix3.js.map +1 -1
  227. package/lib/module/renderer/processors/math/Vector.js +3 -5
  228. package/lib/module/renderer/processors/math/Vector.js.map +1 -1
  229. package/lib/module/skia/Color.js +9 -25
  230. package/lib/module/skia/Color.js.map +1 -1
  231. package/lib/module/skia/ImageFilter/ImageFilterFactory.js.map +1 -1
  232. package/lib/module/skia/Matrix.js.map +1 -1
  233. package/lib/module/skia/Shader/useShader.js +4 -1
  234. package/lib/module/skia/Shader/useShader.js.map +1 -1
  235. package/lib/module/skia/Skia.js +2 -46
  236. package/lib/module/skia/Skia.js.map +1 -1
  237. package/lib/module/skia/SkiaApi.js +2 -0
  238. package/lib/module/skia/SkiaApi.js.map +1 -0
  239. package/lib/module/values/api.js +4 -6
  240. package/lib/module/values/api.js.map +1 -1
  241. package/lib/module/values/api.web.js +7 -0
  242. package/lib/module/values/api.web.js.map +1 -0
  243. package/lib/module/values/index.js +0 -1
  244. package/lib/module/values/index.js.map +1 -1
  245. package/lib/module/values/web/RNSkAnimation.js +36 -0
  246. package/lib/module/values/web/RNSkAnimation.js.map +1 -0
  247. package/lib/module/values/web/RNSkClockValue.js +65 -0
  248. package/lib/module/values/web/RNSkClockValue.js.map +1 -0
  249. package/lib/module/values/web/RNSkDerivedValue.js +41 -0
  250. package/lib/module/values/web/RNSkDerivedValue.js.map +1 -0
  251. package/lib/module/values/web/RNSkReadonlyValue.js +36 -0
  252. package/lib/module/values/web/RNSkReadonlyValue.js.map +1 -0
  253. package/lib/module/values/web/RNSkValue.js +63 -0
  254. package/lib/module/values/web/RNSkValue.js.map +1 -0
  255. package/lib/module/values/web/api.js +19 -0
  256. package/lib/module/values/web/api.js.map +1 -0
  257. package/lib/module/values/web/index.js +2 -0
  258. package/lib/module/values/web/index.js.map +1 -0
  259. package/lib/module/views/SkiaView.js +1 -3
  260. package/lib/module/views/SkiaView.js.map +1 -1
  261. package/lib/module/views/api.js +4 -0
  262. package/lib/module/views/api.js.map +1 -0
  263. package/lib/module/views/types.js.map +1 -1
  264. package/lib/typescript/src/{values/animation → animation}/decay/decay.d.ts +0 -0
  265. package/lib/typescript/src/{values/animation → animation}/decay/index.d.ts +0 -0
  266. package/lib/typescript/src/{values/animation → animation}/decay/runDecay.d.ts +2 -2
  267. package/lib/typescript/src/{values/animation → animation}/decay/types.d.ts +1 -1
  268. package/lib/typescript/src/{values/animation → animation}/functions/index.d.ts +0 -0
  269. package/lib/typescript/src/animation/functions/interpolate.d.ts +11 -0
  270. package/lib/typescript/src/animation/functions/interpolateColors.d.ts +3 -0
  271. package/lib/typescript/src/{values/animation → animation}/index.d.ts +0 -0
  272. package/lib/typescript/src/{values/animation → animation}/spring/Spring.d.ts +0 -0
  273. package/lib/typescript/src/{values/animation → animation}/spring/functions/index.d.ts +0 -0
  274. package/lib/typescript/src/{values/animation → animation}/spring/functions/spring.d.ts +0 -0
  275. package/lib/typescript/src/{values/animation → animation}/spring/index.d.ts +0 -0
  276. package/lib/typescript/src/{values/animation → animation}/spring/runSpring.d.ts +1 -1
  277. package/lib/typescript/src/{values/animation → animation}/spring/types.d.ts +0 -0
  278. package/lib/typescript/src/{values/animation → animation}/spring/useSpring.d.ts +1 -1
  279. package/lib/typescript/src/{values/animation → animation}/timing/Easing.d.ts +0 -0
  280. package/lib/typescript/src/{values/animation → animation}/timing/createTiming.d.ts +2 -2
  281. package/lib/typescript/src/{values/animation → animation}/timing/functions/bezier.d.ts +0 -0
  282. package/lib/typescript/src/{values/animation → animation}/timing/functions/getResolvedParams.d.ts +0 -0
  283. package/lib/typescript/src/{values/animation → animation}/timing/functions/index.d.ts +0 -0
  284. package/lib/typescript/src/{values/animation → animation}/timing/functions/timing.d.ts +1 -1
  285. package/lib/typescript/src/{values/animation → animation}/timing/functions/types.d.ts +0 -0
  286. package/lib/typescript/src/{values/animation → animation}/timing/index.d.ts +0 -0
  287. package/lib/typescript/src/{values/animation → animation}/timing/runTiming.d.ts +1 -1
  288. package/lib/typescript/src/{values/animation → animation}/timing/useLoop.d.ts +0 -0
  289. package/lib/typescript/src/{values/animation → animation}/timing/useTiming.d.ts +1 -1
  290. package/lib/typescript/src/{values/animation → animation}/types.d.ts +5 -5
  291. package/lib/typescript/src/index.d.ts +1 -0
  292. package/lib/typescript/src/renderer/Canvas.d.ts +6 -0
  293. package/lib/typescript/src/renderer/components/colorFilters/BlendColor.d.ts +1 -1
  294. package/lib/typescript/src/renderer/components/imageFilters/RuntimeShader.d.ts +7 -0
  295. package/lib/typescript/src/renderer/components/imageFilters/index.d.ts +1 -0
  296. package/lib/typescript/src/renderer/components/shaders/Gradient.d.ts +1 -1
  297. package/lib/typescript/src/renderer/components/shaders/Shader.d.ts +2 -2
  298. package/lib/typescript/src/renderer/components/shapes/Circle.d.ts +1 -4
  299. package/lib/typescript/src/renderer/processors/Rects.d.ts +9 -41
  300. package/lib/typescript/src/renderer/processors/math/Matrix3.d.ts +1 -5
  301. package/lib/typescript/src/renderer/processors/math/Vector.d.ts +5 -17
  302. package/lib/typescript/src/skia/Color.d.ts +8 -9
  303. package/lib/typescript/src/skia/ImageFilter/ImageFilterFactory.d.ts +16 -0
  304. package/lib/typescript/src/skia/Matrix.d.ts +7 -1
  305. package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffect.d.ts +2 -1
  306. package/lib/typescript/src/skia/RuntimeEffect/RuntimeEffectFactory.d.ts +2 -2
  307. package/lib/typescript/src/skia/Shader/useShader.d.ts +1 -1
  308. package/lib/typescript/src/skia/Skia.d.ts +28 -95
  309. package/lib/typescript/src/skia/SkiaApi.d.ts +71 -0
  310. package/lib/typescript/src/skia/Surface/Surface.d.ts +1 -1
  311. package/lib/typescript/src/skia/Surface/SurfaceFactory.d.ts +2 -2
  312. package/lib/typescript/src/values/api.d.ts +2 -25
  313. package/lib/typescript/src/values/api.web.d.ts +2 -0
  314. package/lib/typescript/src/values/index.d.ts +0 -1
  315. package/lib/typescript/src/values/types.d.ts +24 -1
  316. package/lib/typescript/src/values/web/RNSkAnimation.d.ts +9 -0
  317. package/lib/typescript/src/values/web/RNSkClockValue.d.ts +13 -0
  318. package/lib/typescript/src/values/web/RNSkDerivedValue.d.ts +9 -0
  319. package/lib/typescript/src/values/web/RNSkReadonlyValue.d.ts +11 -0
  320. package/lib/typescript/src/values/web/RNSkValue.d.ts +14 -0
  321. package/lib/typescript/src/values/web/api.d.ts +2 -0
  322. package/lib/typescript/src/values/web/index.d.ts +1 -0
  323. package/lib/typescript/src/views/SkiaView.d.ts +3 -36
  324. package/lib/typescript/src/views/api.d.ts +5 -0
  325. package/lib/typescript/src/views/types.d.ts +32 -0
  326. package/package.json +2 -2
  327. package/src/{values/animation → animation}/decay/decay.ts +0 -0
  328. package/src/{values/animation → animation}/decay/index.ts +0 -0
  329. package/src/{values/animation → animation}/decay/runDecay.ts +2 -2
  330. package/src/{values/animation → animation}/decay/types.ts +1 -1
  331. package/src/{values/animation → animation}/functions/index.ts +0 -0
  332. package/src/animation/functions/interpolate.ts +182 -0
  333. package/src/animation/functions/interpolateColors.ts +58 -0
  334. package/src/{values/animation → animation}/index.ts +0 -0
  335. package/src/{values/animation → animation}/spring/Spring.ts +0 -0
  336. package/src/{values/animation → animation}/spring/functions/index.ts +0 -0
  337. package/src/{values/animation → animation}/spring/functions/spring.ts +0 -0
  338. package/src/{values/animation → animation}/spring/index.ts +0 -0
  339. package/src/{values/animation → animation}/spring/runSpring.ts +1 -1
  340. package/src/{values/animation → animation}/spring/types.ts +0 -0
  341. package/src/{values/animation → animation}/spring/useSpring.ts +1 -1
  342. package/src/{values/animation → animation}/timing/Easing.ts +0 -0
  343. package/src/{values/animation → animation}/timing/createTiming.ts +2 -2
  344. package/src/{values/animation → animation}/timing/functions/__tests__/timing.spec.ts +0 -0
  345. package/src/{values/animation → animation}/timing/functions/bezier.ts +0 -0
  346. package/src/{values/animation → animation}/timing/functions/getResolvedParams.ts +2 -2
  347. package/src/{values/animation → animation}/timing/functions/index.ts +0 -0
  348. package/src/{values/animation → animation}/timing/functions/timing.ts +1 -1
  349. package/src/{values/animation → animation}/timing/functions/types.ts +0 -0
  350. package/src/{values/animation → animation}/timing/index.ts +0 -0
  351. package/src/{values/animation → animation}/timing/runTiming.ts +1 -1
  352. package/src/{values/animation → animation}/timing/useLoop.ts +0 -0
  353. package/src/{values/animation → animation}/timing/useTiming.ts +2 -2
  354. package/src/{values/animation → animation}/types.ts +5 -5
  355. package/src/index.ts +1 -0
  356. package/src/renderer/Canvas.tsx +11 -4
  357. package/src/renderer/components/colorFilters/BlendColor.tsx +1 -1
  358. package/src/renderer/components/colorFilters/Lerp.tsx +1 -1
  359. package/src/renderer/components/imageFilters/InnerShadow.tsx +4 -2
  360. package/src/renderer/components/imageFilters/RuntimeShader.tsx +23 -0
  361. package/src/renderer/components/imageFilters/index.ts +1 -0
  362. package/src/renderer/components/shaders/Gradient.ts +2 -4
  363. package/src/renderer/components/shaders/Shader.tsx +3 -3
  364. package/src/renderer/processors/Circles.ts +2 -1
  365. package/src/renderer/processors/Font.ts +1 -1
  366. package/src/renderer/processors/Rects.ts +9 -14
  367. package/src/renderer/processors/math/Matrix3.ts +24 -105
  368. package/src/renderer/processors/math/Vector.ts +3 -2
  369. package/src/skia/Color.ts +13 -27
  370. package/src/skia/ImageFilter/ImageFilterFactory.ts +20 -0
  371. package/src/skia/Matrix.ts +8 -1
  372. package/src/skia/RuntimeEffect/RuntimeEffect.ts +3 -1
  373. package/src/skia/RuntimeEffect/RuntimeEffectFactory.ts +2 -2
  374. package/src/skia/Shader/useShader.ts +4 -1
  375. package/src/skia/Skia.ts +4 -126
  376. package/src/skia/SkiaApi.ts +86 -0
  377. package/src/skia/Surface/Surface.ts +1 -1
  378. package/src/skia/Surface/SurfaceFactory.ts +2 -2
  379. package/src/values/api.ts +3 -42
  380. package/src/values/api.web.ts +5 -0
  381. package/src/values/index.ts +0 -1
  382. package/src/values/types.ts +30 -1
  383. package/src/values/web/RNSkAnimation.ts +33 -0
  384. package/src/values/web/RNSkClockValue.ts +58 -0
  385. package/src/values/web/RNSkDerivedValue.ts +38 -0
  386. package/src/values/web/RNSkReadonlyValue.ts +32 -0
  387. package/src/values/web/RNSkValue.ts +57 -0
  388. package/src/values/web/__tests__/RNSkAnimation.spec.ts +21 -0
  389. package/src/values/web/__tests__/RNSkDerivedValue.spec.ts +15 -0
  390. package/src/values/web/__tests__/RNSkReadonlyValue.spec.ts +8 -0
  391. package/src/values/web/__tests__/RNSkValue.spec.ts +11 -0
  392. package/src/values/web/api.ts +33 -0
  393. package/src/values/web/index.ts +1 -0
  394. package/src/views/SkiaView.tsx +3 -49
  395. package/src/views/api.ts +7 -0
  396. package/src/views/types.ts +40 -0
  397. package/lib/commonjs/values/animation/decay/runDecay.js.map +0 -1
  398. package/lib/commonjs/values/animation/functions/interpolate.js +0 -139
  399. package/lib/commonjs/values/animation/functions/interpolate.js.map +0 -1
  400. package/lib/commonjs/values/animation/functions/interpolateColors.js +0 -47
  401. package/lib/commonjs/values/animation/functions/interpolateColors.js.map +0 -1
  402. package/lib/commonjs/values/animation/spring/runSpring.js.map +0 -1
  403. package/lib/commonjs/values/animation/spring/useSpring.js.map +0 -1
  404. package/lib/commonjs/values/animation/timing/createTiming.js.map +0 -1
  405. package/lib/commonjs/values/animation/timing/functions/getResolvedParams.js.map +0 -1
  406. package/lib/commonjs/values/animation/timing/runTiming.js.map +0 -1
  407. package/lib/commonjs/values/animation/timing/useTiming.js.map +0 -1
  408. package/lib/module/values/animation/decay/runDecay.js.map +0 -1
  409. package/lib/module/values/animation/functions/interpolate.js +0 -132
  410. package/lib/module/values/animation/functions/interpolate.js.map +0 -1
  411. package/lib/module/values/animation/functions/interpolateColors.js +0 -32
  412. package/lib/module/values/animation/functions/interpolateColors.js.map +0 -1
  413. package/lib/module/values/animation/spring/runSpring.js.map +0 -1
  414. package/lib/module/values/animation/spring/useSpring.js.map +0 -1
  415. package/lib/module/values/animation/timing/createTiming.js.map +0 -1
  416. package/lib/module/values/animation/timing/functions/getResolvedParams.js.map +0 -1
  417. package/lib/module/values/animation/timing/runTiming.js.map +0 -1
  418. package/lib/module/values/animation/timing/useTiming.js.map +0 -1
  419. package/lib/typescript/scripts/install-npm.d.ts +0 -1
  420. package/lib/typescript/src/values/animation/functions/interpolate.d.ts +0 -7
  421. package/lib/typescript/src/values/animation/functions/interpolateColors.d.ts +0 -3
  422. package/src/values/animation/functions/interpolate.ts +0 -169
  423. package/src/values/animation/functions/interpolateColors.ts +0 -62
@@ -1,75 +1,55 @@
1
1
  import { exhaustiveCheck } from "../../typeddash";
2
- const identityMatrix = [[1, 0, 0], [0, 1, 0], [0, 0, 1]];
3
-
4
- const translateXMatrix = x => [[1, 0, x], [0, 1, 0], [0, 0, 1]];
5
-
6
- const translateYMatrix = y => [[1, 0, 0], [0, 1, y], [0, 0, 1]];
7
-
8
- const scaleMatrix = s => [[s, 0, 0], [0, s, 0], [0, 0, 1]];
9
-
10
- const scaleXMatrix = s => [[s, 0, 0], [0, 1, 0], [0, 0, 1]];
11
-
12
- const scaleYMatrix = s => [[1, 0, 0], [0, s, 0], [0, 0, 1]];
13
-
14
- const skewXMatrix = s => [[1, Math.tan(s), 0], [0, 1, 0], [0, 0, 1]];
15
-
16
- const skewYMatrix = s => [[1, 0, 0], [Math.tan(s), 1, 0], [0, 0, 1]];
17
-
18
- const rotateZMatrix = r => [[Math.cos(r), -1 * Math.sin(r), 0], [Math.sin(r), Math.cos(r), 0], [0, 0, 1]];
19
-
20
- const dot3 = (row, col) => row[0] * col[0] + row[1] * col[1] + row[2] * col[2];
21
-
22
- const multiply3 = (m1, m2) => {
23
- const col0 = [m2[0][0], m2[1][0], m2[2][0]];
24
- const col1 = [m2[0][1], m2[1][1], m2[2][1]];
25
- const col2 = [m2[0][2], m2[1][2], m2[2][2]];
26
- return [[dot3(m1[0], col0), dot3(m1[0], col1), dot3(m1[0], col2)], [dot3(m1[1], col0), dot3(m1[1], col1), dot3(m1[1], col2)], [dot3(m1[2], col0), dot3(m1[2], col1), dot3(m1[2], col2)]];
27
- };
28
-
29
- export const matrixVecMul3 = (m, v) => [dot3(m[0], v), dot3(m[1], v), dot3(m[2], v)];
30
-
31
- const skiaMatrix3 = m => {
32
- return [m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2], m[2][0], m[2][1], m[2][2]];
2
+ import { Skia } from "../../../skia";
3
+ export const processTransform2d = transforms => {
4
+ const m = Skia.Matrix();
5
+
6
+ for (const transform of transforms) {
7
+ const key = Object.keys(transform)[0];
8
+ const value = transform[key];
9
+
10
+ if (key === "translateX") {
11
+ m.preTranslate(value, 0);
12
+ continue;
13
+ }
14
+
15
+ if (key === "translateY") {
16
+ m.preTranslate(0, value);
17
+ continue;
18
+ }
19
+
20
+ if (key === "scale") {
21
+ m.preScale(value, value);
22
+ continue;
23
+ }
24
+
25
+ if (key === "scaleX") {
26
+ m.preScale(value, 0);
27
+ continue;
28
+ }
29
+
30
+ if (key === "scaleY") {
31
+ m.preScale(0, value);
32
+ continue;
33
+ }
34
+
35
+ if (key === "skewX") {
36
+ m.preSkew(value, 0);
37
+ continue;
38
+ }
39
+
40
+ if (key === "skewY") {
41
+ m.preSkew(0, value);
42
+ continue;
43
+ }
44
+
45
+ if (key === "rotate" || key === "rotateZ") {
46
+ m.preRotate(value * 180 / Math.PI);
47
+ continue;
48
+ }
49
+
50
+ exhaustiveCheck(key);
51
+ }
52
+
53
+ return m;
33
54
  };
34
-
35
- export const processTransform2d = transforms => skiaMatrix3(processTransform(transforms));
36
-
37
- const processTransform = transforms => transforms.reduce((acc, transform) => {
38
- const key = Object.keys(transform)[0];
39
- const value = transform[key];
40
-
41
- if (key === "translateX") {
42
- return multiply3(acc, translateXMatrix(value));
43
- }
44
-
45
- if (key === "translateY") {
46
- return multiply3(acc, translateYMatrix(value));
47
- }
48
-
49
- if (key === "scale") {
50
- return multiply3(acc, scaleMatrix(value));
51
- }
52
-
53
- if (key === "scaleX") {
54
- return multiply3(acc, scaleXMatrix(value));
55
- }
56
-
57
- if (key === "scaleY") {
58
- return multiply3(acc, scaleYMatrix(value));
59
- }
60
-
61
- if (key === "skewX") {
62
- return multiply3(acc, skewXMatrix(value));
63
- }
64
-
65
- if (key === "skewY") {
66
- return multiply3(acc, skewYMatrix(value));
67
- }
68
-
69
- if (key === "rotate" || key === "rotateZ") {
70
- return multiply3(acc, rotateZMatrix(value));
71
- }
72
-
73
- return exhaustiveCheck(key);
74
- }, identityMatrix);
75
55
  //# sourceMappingURL=Matrix3.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Matrix3.ts"],"names":["exhaustiveCheck","identityMatrix","translateXMatrix","x","translateYMatrix","y","scaleMatrix","s","scaleXMatrix","scaleYMatrix","skewXMatrix","Math","tan","skewYMatrix","rotateZMatrix","r","cos","sin","dot3","row","col","multiply3","m1","m2","col0","col1","col2","matrixVecMul3","m","v","skiaMatrix3","processTransform2d","transforms","processTransform","reduce","acc","transform","key","Object","keys","value"],"mappings":"AAAA,SAASA,eAAT,QAAgC,iBAAhC;AAoCA,MAAMC,cAAuB,GAAG,CAC9B,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAD8B,EAE9B,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAF8B,EAG9B,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAH8B,CAAh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AAsB;AACpB,WAAOhB,SAAS,CAACc,GAAD,EAAM1B,YAAY,CAAC+B,KAAD,CAAlB,CAAhB;AACD;;AACD,MAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnB,WAAOhB,SAAS,CAACc,GAAD,EAAMzB,WAAW,CAAC8B,KAAD,CAAjB,CAAhB;AACD;;AACD,MAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnB,WAAOhB,SAAS,CAACc,GAAD,EAAMtB,WAAW,CAAC2B,KAAD,CAAjB,CAAhB;AACD;;AACD,MAAIH,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,SAAhC,EAA2C;AACzC,WAAOhB,SAAS,CAACc,GAAD,EAAMrB,aAAa,CAAC0B,KAAD,CAAnB,CAAhB;AACD;;AACD,SAAOxC,eAAe,CAACqC,GAAD,CAAtB;AACD,CA5BD,EA4BGpC,cA5BH,CADF","sourcesContent":["import { exhaustiveCheck } from \"../../typeddash\";\nimport type { SkMatrix } from \"../../../skia/Matrix\";\n\nexport type Vec3 = readonly [number, number, number];\n\nexport type Matrix3 = readonly [Vec3, Vec3, Vec3];\n\ntype Transform2dName =\n | \"translateX\"\n | \"translateY\"\n | \"scale\"\n | \"skewX\"\n | \"skewY\"\n | \"scaleX\"\n | \"scaleY\"\n | \"rotateZ\"\n | \"rotate\";\n\nexport interface TransformProp {\n transform?: Transforms2d;\n}\n\ntype Transformations = {\n readonly [Name in Transform2dName]: number;\n};\nexport type Transforms2d = readonly (\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"rotate\">\n)[];\n\nconst identityMatrix: Matrix3 = [\n [1, 0, 0],\n [0, 1, 0],\n [0, 0, 1],\n];\n\nconst translateXMatrix = (x: number): Matrix3 => [\n [1, 0, x],\n [0, 1, 0],\n [0, 0, 1],\n];\n\nconst translateYMatrix = (y: number): Matrix3 => [\n [1, 0, 0],\n [0, 1, y],\n [0, 0, 1],\n];\n\nconst scaleMatrix = (s: number): Matrix3 => [\n [s, 0, 0],\n [0, s, 0],\n [0, 0, 1],\n];\n\nconst scaleXMatrix = (s: number): Matrix3 => [\n [s, 0, 0],\n [0, 1, 0],\n [0, 0, 1],\n];\n\nconst scaleYMatrix = (s: number): Matrix3 => [\n [1, 0, 0],\n [0, s, 0],\n [0, 0, 1],\n];\n\nconst skewXMatrix = (s: number): Matrix3 => [\n [1, Math.tan(s), 0],\n [0, 1, 0],\n [0, 0, 1],\n];\n\nconst skewYMatrix = (s: number): Matrix3 => [\n [1, 0, 0],\n [Math.tan(s), 1, 0],\n [0, 0, 1],\n];\n\nconst rotateZMatrix = (r: number): Matrix3 => [\n [Math.cos(r), -1 * Math.sin(r), 0],\n [Math.sin(r), Math.cos(r), 0],\n [0, 0, 1],\n];\n\nconst dot3 = (row: Vec3, col: Vec3) =>\n row[0] * col[0] + row[1] * col[1] + row[2] * col[2];\n\nconst multiply3 = (m1: Matrix3, m2: Matrix3) => {\n const col0 = [m2[0][0], m2[1][0], m2[2][0]] as const;\n const col1 = [m2[0][1], m2[1][1], m2[2][1]] as const;\n const col2 = [m2[0][2], m2[1][2], m2[2][2]] as const;\n return [\n [dot3(m1[0], col0), dot3(m1[0], col1), dot3(m1[0], col2)],\n [dot3(m1[1], col0), dot3(m1[1], col1), dot3(m1[1], col2)],\n [dot3(m1[2], col0), dot3(m1[2], col1), dot3(m1[2], col2)],\n ] as const;\n};\n\nexport const matrixVecMul3 = (m: Matrix3, v: Vec3) =>\n [dot3(m[0], v), dot3(m[1], v), dot3(m[2], v)] as const;\n\nconst skiaMatrix3 = (m: Matrix3): SkMatrix => {\n return [\n m[0][0],\n m[0][1],\n m[0][2],\n m[1][0],\n m[1][1],\n m[1][2],\n m[2][0],\n m[2][1],\n m[2][2],\n ];\n};\n\nexport const processTransform2d = (transforms: Transforms2d) =>\n skiaMatrix3(processTransform(transforms));\n\nconst processTransform = (transforms: Transforms2d) =>\n transforms.reduce((acc, transform) => {\n const key = Object.keys(transform)[0] as Transform2dName;\n const value = (transform as Pick<Transformations, typeof key>)[key];\n if (key === \"translateX\") {\n return multiply3(acc, translateXMatrix(value));\n }\n if (key === \"translateY\") {\n return multiply3(acc, translateYMatrix(value));\n }\n if (key === \"scale\") {\n return multiply3(acc, scaleMatrix(value));\n }\n if (key === \"scaleX\") {\n return multiply3(acc, scaleXMatrix(value));\n }\n if (key === \"scaleY\") {\n return multiply3(acc, scaleYMatrix(value));\n }\n if (key === \"skewX\") {\n return multiply3(acc, skewXMatrix(value));\n }\n if (key === \"skewY\") {\n return multiply3(acc, skewYMatrix(value));\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n return multiply3(acc, rotateZMatrix(value));\n }\n return exhaustiveCheck(key);\n }, identityMatrix);\n"]}
1
+ {"version":3,"sources":["Matrix3.ts"],"names":["exhaustiveCheck","Skia","processTransform2d","transforms","m","Matrix","transform","key","Object","keys","value","preTranslate","preScale","preSkew","preRotate","Math","PI"],"mappings":"AAAA,SAASA,eAAT,QAAgC,iBAAhC;AACA,SAASC,IAAT,QAAqB,eAArB;AA+BA,OAAO,MAAMC,kBAAkB,GAAIC,UAAD,IAA8B;AAC9D,QAAMC,CAAC,GAAGH,IAAI,CAACI,MAAL,EAAV;;AACA,OAAK,MAAMC,SAAX,IAAwBH,UAAxB,EAAoC;AAClC,UAAMI,GAAG,GAAGC,MAAM,CAACC,IAAP,CAAYH,SAAZ,EAAuB,CAAvB,CAAZ;AACA,UAAMI,KAAK,GAAIJ,SAAD,CAAiDC,GAAjD,CAAd;;AACA,QAAIA,GAAG,KAAK,YAAZ,EAA0B;AACxBH,MAAAA,CAAC,CAACO,YAAF,CAAeD,KAAf,EAAsB,CAAtB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,YAAZ,EAA0B;AACxBH,MAAAA,CAAC,CAACO,YAAF,CAAe,CAAf,EAAkBD,KAAlB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBH,MAAAA,CAAC,CAACQ,QAAF,CAAWF,KAAX,EAAkBA,KAAlB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAZ,EAAsB;AACpBH,MAAAA,CAAC,CAACQ,QAAF,CAAWF,KAAX,EAAkB,CAAlB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAZ,EAAsB;AACpBH,MAAAA,CAAC,CAACQ,QAAF,CAAW,CAAX,EAAcF,KAAd;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBH,MAAAA,CAAC,CAACS,OAAF,CAAUH,KAAV,EAAiB,CAAjB;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,OAAZ,EAAqB;AACnBH,MAAAA,CAAC,CAACS,OAAF,CAAU,CAAV,EAAaH,KAAb;AACA;AACD;;AACD,QAAIH,GAAG,KAAK,QAAR,IAAoBA,GAAG,KAAK,SAAhC,EAA2C;AACzCH,MAAAA,CAAC,CAACU,SAAF,CAAaJ,KAAK,GAAG,GAAT,GAAgBK,IAAI,CAACC,EAAjC;AACA;AACD;;AACDhB,IAAAA,eAAe,CAACO,GAAD,CAAf;AACD;;AACD,SAAOH,CAAP;AACD,CAxCM","sourcesContent":["import { exhaustiveCheck } from \"../../typeddash\";\nimport { Skia } from \"../../../skia\";\n\ntype Transform2dName =\n | \"translateX\"\n | \"translateY\"\n | \"scale\"\n | \"skewX\"\n | \"skewY\"\n | \"scaleX\"\n | \"scaleY\"\n | \"rotateZ\"\n | \"rotate\";\n\nexport interface TransformProp {\n transform?: Transforms2d;\n}\n\ntype Transformations = {\n readonly [Name in Transform2dName]: number;\n};\nexport type Transforms2d = readonly (\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"rotate\">\n)[];\n\nexport const processTransform2d = (transforms: Transforms2d) => {\n const m = Skia.Matrix();\n for (const transform of transforms) {\n const key = Object.keys(transform)[0] as Transform2dName;\n const value = (transform as Pick<Transformations, typeof key>)[key];\n if (key === \"translateX\") {\n m.preTranslate(value, 0);\n continue;\n }\n if (key === \"translateY\") {\n m.preTranslate(0, value);\n continue;\n }\n if (key === \"scale\") {\n m.preScale(value, value);\n continue;\n }\n if (key === \"scaleX\") {\n m.preScale(value, 0);\n continue;\n }\n if (key === \"scaleY\") {\n m.preScale(0, value);\n continue;\n }\n if (key === \"skewX\") {\n m.preSkew(value, 0);\n continue;\n }\n if (key === \"skewY\") {\n m.preSkew(0, value);\n continue;\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n m.preRotate((value * 180) / Math.PI);\n continue;\n }\n exhaustiveCheck(key);\n }\n return m;\n};\n"]}
@@ -1,11 +1,9 @@
1
- import { interpolate } from "../../../values/animation/functions/interpolate";
1
+ import { interpolate } from "../../../animation/functions/interpolate";
2
+ import { Skia } from "../../../skia";
2
3
  export const vec = function () {
3
4
  let x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
4
5
  let y = arguments.length > 1 ? arguments[1] : undefined;
5
- return {
6
- x,
7
- y: y !== null && y !== void 0 ? y : x
8
- };
6
+ return Skia.Point(x, y !== null && y !== void 0 ? y : x);
9
7
  };
10
8
  export const neg = a => vec(-a.x, -a.y);
11
9
  export const add = (a, b) => vec(a.x + b.x, a.y + b.y);
@@ -1 +1 @@
1
- {"version":3,"sources":["Vector.ts"],"names":["interpolate","vec","x","y","neg","a","add","b","sub","dist","Math","hypot","translate","translateX","translateY","interpolateVector","value","inputRange","outputRange","options","map","v","mixVector","from","to"],"mappings":"AAAA,SAASA,WAAT,QAA4B,iDAA5B;AAOA,OAAO,MAAMC,GAAG,GAAG;AAAA,MAACC,CAAD,uEAAK,CAAL;AAAA,MAAQC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,CAAC,CAACnB,CAAzB,CAHY,EAIZiB,OAJY,CADV;AAOJhB,EAAAA,CAAC,EAAEH,WAAW,CACZgB,KADY,EAEZC,UAFY,EAGZC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAAClB,CAAzB,CAHY,EAIZgB,OAJY;AAPV,CAL2B,CAA1B;AAoBP,OAAO,MAAMG,SAAS,GAAG,CAACN,KAAD,EAAgBO,IAAhB,EAA8BC,EAA9B,KACvBT,iBAAiB,CAACC,KAAD,EAAQ,CAAC,CAAD,EAAI,CAAJ,CAAR,EAAgB,CAACO,IAAD,EAAOC,EAAP,CAAhB,CADZ","sourcesContent":["import { interpolate } from \"../../../values/animation/functions/interpolate\";\n\nexport interface Vector {\n x: number;\n y: number;\n}\n\nexport const vec = (x = 0, y?: number) => ({ x, y: y ?? x });\nexport const neg = (a: Vector) => vec(-a.x, -a.y);\nexport const add = (a: Vector, b: Vector) => vec(a.x + b.x, a.y + b.y);\nexport const sub = (a: Vector, b: Vector) => vec(a.x - b.x, a.y - b.y);\nexport const dist = (a: Vector, b: Vector) => Math.hypot(a.x - b.x, a.y - b.y);\nexport const translate = ({ x, y }: Vector) =>\n [{ translateX: x }, { translateY: y }] as const;\n\nexport const interpolateVector = (\n value: number,\n inputRange: readonly number[],\n outputRange: readonly Vector[],\n options?: Parameters<typeof interpolate>[3]\n) => ({\n x: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.x),\n options\n ),\n y: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.y),\n options\n ),\n});\n\nexport const mixVector = (value: number, from: Vector, to: Vector) =>\n interpolateVector(value, [0, 1], [from, to]);\n"]}
1
+ {"version":3,"sources":["Vector.ts"],"names":["interpolate","Skia","vec","x","y","Point","neg","a","add","b","sub","dist","Math","hypot","translate","translateX","translateY","interpolateVector","value","inputRange","outputRange","options","map","v","mixVector","from","to"],"mappings":"AAAA,SAASA,WAAT,QAA4B,0CAA5B;AACA,SAASC,IAAT,QAAq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EH,WAAW,CACZkB,KADY,EAEZC,UAFY,EAGZC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACpB,CAAzB,CAHY,EAIZkB,OAJY,CADV;AAOJjB,EAAAA,CAAC,EAAEJ,WAAW,CACZkB,KADY,EAEZC,UAFY,EAGZC,WAAW,CAACE,GAAZ,CAAiBC,CAAD,IAAOA,CAAC,CAACnB,CAAzB,CAHY,EAIZiB,OAJY;AAPV,CAL2B,CAA1B;AAoBP,OAAO,MAAMG,SAAS,GAAG,CAACN,KAAD,EAAgBO,IAAhB,EAA8BC,EAA9B,KACvBT,iBAAiB,CAACC,KAAD,EAAQ,CAAC,CAAD,EAAI,CAAJ,CAAR,EAAgB,CAACO,IAAD,EAAOC,EAAP,CAAhB,CADZ","sourcesContent":["import { interpolate } from \"../../../animation/functions/interpolate\";\nimport { Skia } from \"../../../skia\";\n\nexport interface Vector {\n x: number;\n y: number;\n}\n\nexport const vec = (x = 0, y?: number) => Skia.Point(x, y ?? x);\nexport const neg = (a: Vector) => vec(-a.x, -a.y);\nexport const add = (a: Vector, b: Vector) => vec(a.x + b.x, a.y + b.y);\nexport const sub = (a: Vector, b: Vector) => vec(a.x - b.x, a.y - b.y);\nexport const dist = (a: Vector, b: Vector) => Math.hypot(a.x - b.x, a.y - b.y);\nexport const translate = ({ x, y }: Vector) =>\n [{ translateX: x }, { translateY: y }] as const;\n\nexport const interpolateVector = (\n value: number,\n inputRange: readonly number[],\n outputRange: readonly Vector[],\n options?: Parameters<typeof interpolate>[3]\n) => ({\n x: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.x),\n options\n ),\n y: interpolate(\n value,\n inputRange,\n outputRange.map((v) => v.y),\n options\n ),\n});\n\nexport const mixVector = (value: number, from: Vector, to: Vector) =>\n interpolateVector(value, [0, 1], [from, to]);\n"]}
@@ -1,29 +1,13 @@
1
- import { Skia } from "./Skia"; // This is the JSI color. Currently a number. This may change.
2
-
3
- export const alphaf = c => (c >> 24 & 255) / 255;
4
- export const red = c => c >> 16 & 255;
5
- export const green = c => c >> 8 & 255;
6
- export const blue = c => c & 255;
7
- export const rgbaColor = (r, g, b, af) => {
8
- const a = Math.round(af * 255);
9
- return (a << 24 | r << 16 | g << 8 | b) >>> 0;
10
- };
11
-
12
- const processColorAsArray = cl => {
13
- const icl = typeof cl === "string" ? Skia.Color(cl) : cl;
14
- const r = red(icl);
15
- const g = green(icl);
16
- const b = blue(icl);
17
- const a = alphaf(icl);
18
- return [r, g, b, a];
19
- };
1
+ import { Skia } from "./Skia"; // This is the JSI color
20
2
 
3
+ export const RED = 0;
4
+ export const GREEN = 1;
5
+ export const BLUE = 2;
6
+ export const ALPHA = 3;
7
+ export const rgbaColor = (r, g, b, a) => new Float32Array([r, g, b, a]);
21
8
  export const processColor = (cl, currentOpacity) => {
22
- const [r, g, b, a] = processColorAsArray(cl);
23
- return rgbaColor(r, g, b, a * currentOpacity);
24
- };
25
- export const processColorAsUnitArray = (cl, currentOpacity) => {
26
- const [r, g, b, a] = processColorAsArray(cl);
27
- return [r / 255, g / 255, b / 255, a * currentOpacity];
9
+ const color = Skia.Color(cl);
10
+ color[ALPHA] *= currentOpacity;
11
+ return color;
28
12
  };
29
13
  //# sourceMappingURL=Color.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Color.ts"],"names":["Skia","alphaf","c","red","green","blue","rgbaColor","r","g","b","af","a","Math","round","processColorAsArray","cl","icl","Color","processColor","currentOpacity","processColorAsUnitArray"],"mappings":"AAAA,SAASA,IAAT,QAAqB,QAArB,C,CAEA;;AAKA,OAAO,MAAMC,MAAM,GAAIC,CAAD,IAAe,CAAEA,CAAC,IAAI,EAAN,GAAY,GAAb,IAAoB,GAAlD;AACP,OAAO,MAAMC,GAAG,GAAID,CAAD,IAAgBA,CAAC,IAAI,EAAN,GAAY,GAAvC;AACP,OAAO,MAAME,KAAK,GAAIF,CAAD,IAAgBA,CAAC,IAAI,CAAN,GAAW,GAAxC;AACP,OAAO,MAAMG,I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AO,CAACR,CAAC,GAAG,GAAL,EAAUC,CAAC,GAAG,GAAd,EAAmBC,CAAC,GAAG,GAAvB,EAA4BE,CAAC,GAAGQ,cAAhC,CAAP;AACD,CAHM","sourcesContent":["import { Skia } from \"./Skia\";\n\n// This is the JSI color. Currently a number. This may change.\nexport type SkColor = number;\n// Input colors can be string or number\nexport type Color = string | number;\n\nexport const alphaf = (c: number) => ((c >> 24) & 255) / 255;\nexport const red = (c: number) => (c >> 16) & 255;\nexport const green = (c: number) => (c >> 8) & 255;\nexport const blue = (c: number) => c & 255;\nexport const rgbaColor = (r: number, g: number, b: number, af: number) => {\n const a = Math.round(af * 255);\n return ((a << 24) | (r << 16) | (g << 8) | b) >>> 0;\n};\n\nconst processColorAsArray = (cl: Color) => {\n const icl = typeof cl === \"string\" ? Skia.Color(cl) : cl;\n const r = red(icl);\n const g = green(icl);\n const b = blue(icl);\n const a = alphaf(icl);\n return [r, g, b, a] as const;\n};\n\nexport const processColor = (cl: Color, currentOpacity: number) => {\n const [r, g, b, a] = processColorAsArray(cl);\n return rgbaColor(r, g, b, a * currentOpacity);\n};\n\nexport const processColorAsUnitArray = (cl: Color, currentOpacity: number) => {\n const [r, g, b, a] = processColorAsArray(cl);\n return [r / 255, g / 255, b / 255, a * currentOpacity] as const;\n};\n"]}
1
+ {"version":3,"sources":["Color.ts"],"names":["Skia","RED","GREEN","BLUE","ALPHA","rgbaColor","r","g","b","a","Float32Array","processColor","cl","currentOpacity","color","Color"],"mappings":"AAAA,SAASA,IAAT,QAAqB,QAArB,C,CAEA;;AAKA,OAAO,MAAMC,GAAG,GAAG,CAAZ;AACP,OAAO,MAAMC,KAAK,GAAG,CAAd;AACP,OAAO,MAAMC,IAAI,GAAG,CAAb;AACP,OAAO,MAAMC,KAAK,GAAG,CAAd;AAEP,OAAO,MAAMC,SAAS,GAAG,CAACC,CAAD,EAAYC,CAAZ,EAAuBC,CAAvB,EAAkCC,CAAlC,KACvB,IAAIC,YAAJ,CAAiB,CAACJ,CAAD,EAAIC,CAAJ,EAAOC,CAAP,EAAUC,CAAV,CAAjB,CADK;AAGP,OAAO,MAAME,YAAY,GAAG,CAACC,EAAD,EAAYC,cAAZ,KAAuC;AACjE,QAAMC,KAAK,GAAGd,IAAI,CAACe,KAAL,CAAWH,EAAX,CAAd;AACAE,EAAAA,KAAK,CAACV,KAAD,CAAL,IAAgBS,cAAhB;AACA,SAAOC,KAAP;AACD,CAJM","sourcesContent":["import { Skia } from \"./Skia\";\n\n// This is the JSI color\nexport type SkColor = Float32Array;\n// Input colors can be string, number or Float32Array\nexport type Color = string | Float32Array | number;\n\nexport const RED = 0;\nexport const GREEN = 1;\nexport const BLUE = 2;\nexport const ALPHA = 3;\n\nexport const rgbaColor = (r: number, g: number, b: number, a: number) =>\n new Float32Array([r, g, b, a]);\n\nexport const processColor = (cl: Color, currentOpacity: number) => {\n const color = Skia.Color(cl);\n color[ALPHA] *= currentOpacity;\n return color;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["ImageFilterFactory.ts"],"names":["ColorChannel"],"mappings":"AAQA,WAAYA,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;GAAAA,Y,KAAAA,Y","sourcesContent":["import type { SkColor } from \"../Color\";\nimport type { SkColorFilter } from \"../ColorFilter/ColorFilter\";\nimport type { SkShader } from \"../Shader/Shader\";\nimport type { SkRect } from \"../Rect\";\nimport type { BlendMode } from \"../Paint/BlendMode\";\n\nimport type { SkImageFilter, TileMode } from \"./ImageFilter\";\n\nexport enum ColorChannel {\n R,\n G,\n B,\n A,\n}\n\nexport interface ImageFilterFactory {\n /**\n * Offsets the input image\n *\n * @param dx - Offset along the X axis\n * @param dy - Offset along the X axis\n * @param input - if null, it will use the dynamic source image\n */\n MakeOffset(\n dx: number,\n dy: number,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Spatially displace pixel values of the filtered image\n *\n * @param channelX - Color channel to be used along the X axis\n * @param channelY - Color channel to be used along the Y axis\n * @param scale - Scale factor to be used in the displacement\n * @param in1 - Source image filter to use for the displacement\n * @param input - if null, it will use the dynamic source image\n */\n MakeDisplacementMap(\n channelX: ColorChannel,\n channelY: ColorChannel,\n scale: number,\n in1: SkImageFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Transforms a shader into an impage filter\n *\n * @param shader - The Shader to be transformed\n * @param input - if null, it will use the dynamic source image\n */\n MakeShader(shader: SkShader, input: SkImageFilter | null): SkImageFilter;\n /**\n * Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode\n * is used when the blur kernel goes outside the input image.\n *\n * @param sigmaX - The Gaussian sigma value for blurring along the X axis.\n * @param sigmaY - The Gaussian sigma value for blurring along the Y axis.\n * @param mode\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that applies the color filter to the input filter results.\n * @param cf\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeColorFilter(\n cf: SkColorFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that composes 'inner' with 'outer', such that the results of 'inner' are\n * treated as the source bitmap passed to 'outer'.\n * If either param is null, the other param will be returned.\n * @param outer\n * @param inner - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeCompose(\n outer: SkImageFilter | null,\n inner: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that draws a drop shadow under the input content.\n * This filter produces an image that includes the inputs' content.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadow: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that renders a drop shadow, in exactly the same manner as ::DropShadow, except\n * that the resulting image does not include the input content.\n * This allows the shadow and input to be composed by a filter DAG in a more flexible manner.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadowOnly: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that erodes each input pixel's channel values to the minimum channel value\n * within the given radii along the x and y axes.\n * @param radiusX The distance to erode along the x axis to either side of each pixel.\n * @param radiusY The distance to erode along the y axis to either side of each pixel.\n * @param input The image filter that is eroded, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeErode: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that dilates each input pixel's channel values to the max value within the\n * given radii along the x and y axes.\n * @param radiusX The distance to dilate along the x axis to either side of each pixel.\n * @param radiusY The distance to dilate along the y axis to either side of each pixel.\n * @param input The image filter that is dilated, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeDilate: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * This filter takes an SkBlendMode and uses it to composite the two filters together.\n * @param mode The blend mode that defines the compositing operation\n * @param background The Dst pixels used in blending, if null the source bitmap is used.\n * @param foreground The Src pixels used in blending, if null the source bitmap is used.\n * @cropRect Optional rectangle to crop input and output.\n */\n MakeBlend: (\n mode: BlendMode,\n background: SkImageFilter,\n foreground: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n}\n"]}
1
+ {"version":3,"sources":["ImageFilterFactory.ts"],"names":["ColorChannel"],"mappings":"AASA,WAAYA,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;AAAAA,EAAAA,Y,CAAAA,Y;GAAAA,Y,KAAAA,Y","sourcesContent":["import type { SkColor } from \"../Color\";\nimport type { SkColorFilter } from \"../ColorFilter/ColorFilter\";\nimport type { SkShader } from \"../Shader/Shader\";\nimport type { SkRect } from \"../Rect\";\nimport type { BlendMode } from \"../Paint/BlendMode\";\nimport type { SkRuntimeShaderBuilder } from \"../RuntimeEffect\";\n\nimport type { SkImageFilter, TileMode } from \"./ImageFilter\";\n\nexport enum ColorChannel {\n R,\n G,\n B,\n A,\n}\n\nexport interface ImageFilterFactory {\n /**\n * Offsets the input image\n *\n * @param dx - Offset along the X axis\n * @param dy - Offset along the X axis\n * @param input - if null, it will use the dynamic source image\n */\n MakeOffset(\n dx: number,\n dy: number,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Spatially displace pixel values of the filtered image\n *\n * @param channelX - Color channel to be used along the X axis\n * @param channelY - Color channel to be used along the Y axis\n * @param scale - Scale factor to be used in the displacement\n * @param in1 - Source image filter to use for the displacement\n * @param input - if null, it will use the dynamic source image\n */\n MakeDisplacementMap(\n channelX: ColorChannel,\n channelY: ColorChannel,\n scale: number,\n in1: SkImageFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n /**\n * Transforms a shader into an impage filter\n *\n * @param shader - The Shader to be transformed\n * @param input - if null, it will use the dynamic source image\n */\n MakeShader(shader: SkShader, input: SkImageFilter | null): SkImageFilter;\n /**\n * Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode\n * is used when the blur kernel goes outside the input image.\n *\n * @param sigmaX - The Gaussian sigma value for blurring along the X axis.\n * @param sigmaY - The Gaussian sigma value for blurring along the Y axis.\n * @param mode\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeBlur(\n sigmaX: number,\n sigmaY: number,\n mode: TileMode,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that applies the color filter to the input filter results.\n * @param cf\n * @param input - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeColorFilter(\n cf: SkColorFilter,\n input: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that composes 'inner' with 'outer', such that the results of 'inner' are\n * treated as the source bitmap passed to 'outer'.\n * If either param is null, the other param will be returned.\n * @param outer\n * @param inner - if null, it will use the dynamic source image (e.g. a saved layer)\n */\n MakeCompose(\n outer: SkImageFilter | null,\n inner: SkImageFilter | null\n ): SkImageFilter;\n\n /**\n * Create a filter that draws a drop shadow under the input content.\n * This filter produces an image that includes the inputs' content.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadow: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that renders a drop shadow, in exactly the same manner as ::DropShadow, except\n * that the resulting image does not include the input content.\n * This allows the shadow and input to be composed by a filter DAG in a more flexible manner.\n * @param dx The X offset of the shadow.\n * @param dy\tThe Y offset of the shadow.\n * @param sigmaX\tThe blur radius for the shadow, along the X axis.\n * @param sigmaY\tThe blur radius for the shadow, along the Y axis.\n * @param color\tThe color of the drop shadow.\n * @param input\tThe input filter, or will use the source bitmap if this is null.\n * @param cropRect\tOptional rectangle that crops the input and output.\n */\n MakeDropShadowOnly: (\n dx: number,\n dy: number,\n sigmaX: number,\n sigmaY: number,\n color: SkColor,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that erodes each input pixel's channel values to the minimum channel value\n * within the given radii along the x and y axes.\n * @param radiusX The distance to erode along the x axis to either side of each pixel.\n * @param radiusY The distance to erode along the y axis to either side of each pixel.\n * @param input The image filter that is eroded, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeErode: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that dilates each input pixel's channel values to the max value within the\n * given radii along the x and y axes.\n * @param radiusX The distance to dilate along the x axis to either side of each pixel.\n * @param radiusY The distance to dilate along the y axis to either side of each pixel.\n * @param input The image filter that is dilated, using source bitmap if this is null.\n * @param cropRect Optional rectangle that crops the input and output.\n */\n MakeDilate: (\n rx: number,\n ry: number,\n input: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * This filter takes an SkBlendMode and uses it to composite the two filters together.\n * @param mode The blend mode that defines the compositing operation\n * @param background The Dst pixels used in blending, if null the source bitmap is used.\n * @param foreground The Src pixels used in blending, if null the source bitmap is used.\n * @cropRect Optional rectangle to crop input and output.\n */\n MakeBlend: (\n mode: BlendMode,\n background: SkImageFilter,\n foreground: SkImageFilter | null,\n cropRect?: SkRect\n ) => SkImageFilter;\n /**\n * Create a filter that fills the output with the per-pixel evaluation of the SkShader produced\n * by the SkRuntimeShaderBuilder. The shader is defined in the image filter's local coordinate\n * system, so it will automatically be affected by SkCanvas' transform.\n *\n * @param builder The builder used to produce the runtime shader, that will in turn\n * fill the result image\n * @param childShaderName The name of the child shader defined in the builder that will be\n * bound to the input param (or the source image if the input param\n * is null). If null the builder can have exactly one child shader,\n * which automatically binds the input param.\n * @param input The image filter that will be provided as input to the runtime\n * shader. If null the implicit source image is used instead\n */\n MakeRuntimeShader: (\n builder: SkRuntimeShaderBuilder,\n childShaderName: string | null,\n input: SkImageFilter | null\n ) => SkImageFilter;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex"],"mappings":"AAAA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["export enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n persp2 = 8,\n}\n\nexport interface SkMatrix {\n 0: number;\n 1: number;\n 2: number;\n 3: number;\n 4: number;\n 5: number;\n 6: number;\n 7: number;\n 8: number;\n}\n"]}
1
+ {"version":3,"sources":["Matrix.ts"],"names":["MatrixIndex"],"mappings":"AACA,WAAYA,WAAZ;;WAAYA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;AAAAA,EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W","sourcesContent":["import type { SkJSIInstance } from \"./JsiInstance\";\nexport enum MatrixIndex {\n ScaleX = 0,\n SkewX = 1,\n TransX = 2,\n SkewY = 3,\n ScaleY = 4,\n TransY = 5,\n Persp0 = 6,\n Persp1 = 7,\n persp2 = 8,\n}\n\nexport interface SkMatrix extends SkJSIInstance<\"Matrix\"> {\n 0: number;\n 1: number;\n 2: number;\n 3: number;\n 4: number;\n 5: number;\n 6: number;\n 7: number;\n 8: number;\n\n preConcat: (matrix: SkMatrix) => void;\n preTranslate: (x: number, y: number) => void;\n preScale: (x: number, y: number) => void;\n preSkew: (x: number, y: number) => void;\n preRotate: (theta: number) => void;\n}\n"]}
@@ -1,4 +1,7 @@
1
1
  import { useMemo } from "react";
2
2
  import { Skia } from "../Skia";
3
- export const useShader = sksl => useMemo(() => Skia.RuntimeEffect.Make(sksl), [sksl]);
3
+ export const useShader = sksl => useMemo(() => {
4
+ console.warn("Use shader will be deprecated.");
5
+ return Skia.RuntimeEffect.Make(sksl);
6
+ }, [sksl]);
4
7
  //# sourceMappingURL=useShader.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["useShader.ts"],"names":["useMemo","Skia","useShader","sksl","RuntimeEffect","Make"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,IAAT,QAAqB,SAArB;AAEA,OAAO,MAAMC,SAAS,GAAIC,IAAD,IACvBH,OAAO,CAAC,MAAMC,IAAI,CAACG,aAAL,CAAmBC,IAAnB,CAAwBF,IAAxB,CAAP,EAAsC,CAACA,IAAD,CAAtC,CADF","sourcesContent":["import { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\n\nexport const useShader = (sksl: string) =>\n useMemo(() => Skia.RuntimeEffect.Make(sksl), [sksl]);\n"]}
1
+ {"version":3,"sources":["useShader.ts"],"names":["useMemo","Skia","useShader","sksl","console","warn","RuntimeEffect","Make"],"mappings":"AAAA,SAASA,OAAT,QAAwB,OAAxB;AAEA,SAASC,IAAT,QAAqB,SAArB;AAEA,OAAO,MAAMC,SAAS,GAAIC,IAAD,IACvBH,OAAO,CAAC,MAAM;AACZI,EAAAA,OAAO,CAACC,IAAR,CAAa,gCAAb;AACA,SAAOJ,IAAI,CAACK,aAAL,CAAmBC,IAAnB,CAAwBJ,IAAxB,CAAP;AACD,CAHM,EAGJ,CAACA,IAAD,CAHI,CADF","sourcesContent":["import { useMemo } from \"react\";\n\nimport { Skia } from \"../Skia\";\n\nexport const useShader = (sksl: string) =>\n useMemo(() => {\n console.warn(\"Use shader will be deprecated.\");\n return Skia.RuntimeEffect.Make(sksl);\n }, [sksl]);\n"]}
@@ -1,48 +1,6 @@
1
- import { Platform, processColor } from "react-native";
2
1
  /*global SkiaApi*/
3
-
4
2
  import "./NativeSetup";
5
3
 
6
- /*
7
- * Parse CSS colors
8
- */
9
- const SkiaColor = cl => {
10
- if (typeof cl === "number") {
11
- return cl;
12
- }
13
-
14
- const color = Skia.parseColorString(cl);
15
-
16
- if (color !== undefined) {
17
- return color;
18
- } else {
19
- // If the color is not recognized, we fallback to React Native
20
- let rnColor = processColor(cl); // 1. Neither Skia or RN could parse the color
21
-
22
- if (typeof rnColor !== "number") {
23
- console.warn("Skia couldn't parse the following color " + cl);
24
- return BLACK; // 2. The color is recognized by RN but not by Skia
25
- } else {
26
- console.warn("Skia couldn't parse the following color " + cl + ". The color parsing was delegated to React Native. Please file on issue with that color."); // On android we need to move the alpha byte to the start of the structure
27
-
28
- if (Platform.OS === "android") {
29
- rnColor = rnColor >>> 0;
30
- const a = rnColor >> 24 & 0xff;
31
- const r = rnColor >> 16 & 0xff;
32
- const g = rnColor >> 8 & 0xff;
33
- const b = rnColor & 0xff;
34
- rnColor = (a << 24 | r << 16 | g << 8 | b) >>> 0;
35
- }
36
-
37
- return rnColor;
38
- }
39
- }
40
- };
41
- /**
42
- * Declares the interface for the native Skia API
43
- */
44
-
45
-
46
4
  /**
47
5
  * Declares the implemented API with overrides.
48
6
  */
@@ -64,15 +22,14 @@ export const Skia = {
64
22
  Point: SkiaApi.Point,
65
23
  XYWHRect: SkiaApi.XYWHRect,
66
24
  RRectXY: SkiaApi.RRectXY,
25
+ RuntimeShaderBuilder: SkiaApi.RuntimeShaderBuilder,
67
26
  Paint: SkiaApi.Paint,
68
27
  PictureRecorder: SkiaApi.PictureRecorder,
69
28
  Picture: SkiaApi.Picture,
70
29
  Path: SkiaApi.Path,
71
30
  ColorFilter: SkiaApi.ColorFilter,
72
31
  ContourMeasureIter: SkiaApi.ContourMeasureIter,
73
- // Here are constructors for data types which are represented as typed arrays in CanvasKit
74
- Color: SkiaColor,
75
- parseColorString: SkiaApi.parseColorString,
32
+ Color: SkiaApi.Color,
76
33
  RSXform: SkiaApi.RSXform,
77
34
  // For the following methods the factory symmetry is broken to be comptatible with CanvasKit
78
35
  MakeSurface: SkiaApi.Surface.Make,
@@ -80,5 +37,4 @@ export const Skia = {
80
37
  MakeImage: SkiaApi.Image.MakeImage,
81
38
  MakeVertices: SkiaApi.MakeVertices
82
39
  };
83
- const BLACK = Skia.parseColorString("black");
84
40
  //# sourceMappingURL=Skia.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["Skia.ts"],"names":["Platform","processColor","SkiaColor","cl","color","Skia","parseColorString","undefined","rnColor","console","warn","BLACK","OS","a","r","g","b","Typeface","SkiaApi","MaskFilter","RuntimeEffect","Shader","ImageFilter","PathEffect","Data","SVG","FontMgr","TextBlob","Matrix","Font","Point","XYWHRect","RRectXY","Paint","PictureRecorder","Picture","Path","ColorFilter","ContourMeasureIter","Color","RSXform","MakeSurface","Surface","Make","MakeImageFromEncoded","Image","MakeImage","MakeVertices"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,YAAnB,QAAuC,cAAvC;AAEA;;AAsBA,OAAO,eAAP;;AAOA;AACA;AACA;AACA,MAAMC,SAAS,GAAIC,EAAD,IAAe;AAC/B,MAAI,OAAOA,EAAP,KAAc,QAAlB,EAA4B;AAC1B,WAAOA,EAAP;AACD;;AACD,QAAMC,KAAK,GAAGC,IAAI,CAACC,gBAAL,CAAsBH,EAAtB,CAAd;;AACA,MAAIC,KAAK,KAAKG,SAAd,EAAyB;AACvB,WAAOH,KAAP;AACD,GAFD,MAEO;AACL;AACA,QAAII,OAAO,GAAGP,YAAY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O,CAACQ,OAVC;AAWlBC,EAAAA,QAAQ,EAAET,OAAO,CAACS,QAXA;AAYlB;AACAC,EAAAA,MAAM,EAAEV,OAAO,CAACU,MAbE;AAclBC,EAAAA,IAAI,EAAEX,OAAO,CAACW,IAdI;AAelBC,EAAAA,KAAK,EAAEZ,OAAO,CAACY,KAfG;AAgBlBC,EAAAA,QAAQ,EAAEb,OAAO,CAACa,QAhBA;AAiBlBC,EAAAA,OAAO,EAAEd,OAAO,CAACc,OAjBC;AAkBlBC,EAAAA,KAAK,EAAEf,OAAO,CAACe,KAlBG;AAmBlBC,EAAAA,eAAe,EAAEhB,OAAO,CAACgB,eAnBP;AAoBlBC,EAAAA,OAAO,EAAEjB,OAAO,CAACiB,OApBC;AAqBlBC,EAAAA,IAAI,EAAElB,OAAO,CAACkB,IArBI;AAsBlBC,EAAAA,WAAW,EAAEnB,OAAO,CAACmB,WAtBH;AAuBlBC,EAAAA,kBAAkB,EAAEpB,OAAO,CAACoB,kBAvBV;AAwBlB;AACAC,EAAAA,KAAK,EAAErC,SAzBW;AA0BlBI,EAAAA,gBAAgB,EAAEY,OAAO,CAACZ,gBA1BR;AA2BlBkC,EAAAA,OAAO,EAAEtB,OAAO,CAACsB,OA3BC;AA4BlB;AACAC,EAAAA,WAAW,EAAEvB,OAAO,CAACwB,OAAR,CAAgBC,IA7BX;AA8BlBC,EAAAA,oBAAoB,EAAE1B,OAAO,CAAC2B,KAAR,CAAcD,oBA9BlB;AA+BlBE,EAAAA,SAAS,EAAE5B,OAAO,CAAC2B,KAAR,CAAcC,SA/BP;AAgClBC,EAAAA,YAAY,EAAE7B,OAAO,CAAC6B;AAhCJ,CAAb;AAmCP,MAAMpC,KAAK,GAAGN,IAAI,CAACC,gBAAL,CAAsB,OAAtB,CAAd","sourcesContent":["import { Platform, processColor } from \"react-native\";\n\n/*global SkiaApi*/\nimport type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type { RuntimeEffectFactory } from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { FontMgrFactory } from \"./FontMgr/FontMgrFactory\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport \"./NativeSetup\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\n\n/*\n * Parse CSS colors\n */\nconst SkiaColor = (cl: Color) => {\n if (typeof cl === \"number\") {\n return cl;\n }\n const color = Skia.parseColorString(cl);\n if (color !== undefined) {\n return color;\n } else {\n // If the color is not recognized, we fallback to React Native\n let rnColor = processColor(cl);\n // 1. Neither Skia or RN could parse the color\n if (typeof rnColor !== \"number\") {\n console.warn(\"Skia couldn't parse the following color \" + cl);\n return BLACK;\n // 2. The color is recognized by RN but not by Skia\n } else {\n console.warn(\n \"Skia couldn't parse the following color \" +\n cl +\n \". The color parsing was delegated to React Native. Please file on issue with that color.\"\n );\n // On android we need to move the alpha byte to the start of the structure\n if (Platform.OS === \"android\") {\n rnColor = rnColor >>> 0;\n const a = (rnColor >> 24) & 0xff;\n const r = (rnColor >> 16) & 0xff;\n const g = (rnColor >> 8) & 0xff;\n const b = rnColor & 0xff;\n rnColor = ((a << 24) | (r << 16) | (g << 8) | b) >>> 0;\n }\n return rnColor;\n }\n }\n};\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n parseColorString: (color: string) => SkColor | undefined;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: () => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n FontMgr: FontMgrFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n\n/**\n * Declares the SkiaApi as an available object in the global scope\n */\ndeclare global {\n var SkiaApi: Skia;\n}\n\n/**\n * Declares the implemented API with overrides.\n */\nexport const Skia = {\n // Factories\n Typeface: SkiaApi.Typeface,\n MaskFilter: SkiaApi.MaskFilter,\n RuntimeEffect: SkiaApi.RuntimeEffect,\n Shader: SkiaApi.Shader,\n ImageFilter: SkiaApi.ImageFilter,\n PathEffect: SkiaApi.PathEffect,\n Data: SkiaApi.Data,\n SVG: SkiaApi.SVG,\n FontMgr: SkiaApi.FontMgr,\n TextBlob: SkiaApi.TextBlob,\n // Constructors\n Matrix: SkiaApi.Matrix,\n Font: SkiaApi.Font,\n Point: SkiaApi.Point,\n XYWHRect: SkiaApi.XYWHRect,\n RRectXY: SkiaApi.RRectXY,\n Paint: SkiaApi.Paint,\n PictureRecorder: SkiaApi.PictureRecorder,\n Picture: SkiaApi.Picture,\n Path: SkiaApi.Path,\n ColorFilter: SkiaApi.ColorFilter,\n ContourMeasureIter: SkiaApi.ContourMeasureIter,\n // Here are constructors for data types which are represented as typed arrays in CanvasKit\n Color: SkiaColor,\n parseColorString: SkiaApi.parseColorString,\n RSXform: SkiaApi.RSXform,\n // For the following methods the factory symmetry is broken to be comptatible with CanvasKit\n MakeSurface: SkiaApi.Surface.Make,\n MakeImageFromEncoded: SkiaApi.Image.MakeImageFromEncoded,\n MakeImage: SkiaApi.Image.MakeImage,\n MakeVertices: SkiaApi.MakeVertices,\n};\n\nconst BLACK = Skia.parseColorString(\"black\")!;\n"]}
1
+ {"version":3,"sources":["Skia.ts"],"names":["Skia","Typeface","SkiaApi","MaskFilter","RuntimeEffect","Shader","ImageFilter","PathEffect","Data","SVG","FontMgr","TextBlob","Matrix","Font","Point","XYWHRect","RRectXY","RuntimeShaderBuilder","Paint","PictureRecorder","Picture","Path","ColorFilter","ContourMeasureIter","Color","RSXform","MakeSurface","Surface","Make","MakeImageFromEncoded","Image","MakeImage","MakeVertices"],"mappings":"AAAA;AACA,OAAO,eAAP;;AAUA;AACA;AACA;AACA,OAAO,MAAMA,IAAI,GAAG;AAClB;AACAC,EAAAA,QAAQ,EAAEC,OAAO,CAACD,QAFA;AAGlBE,EAAAA,UAAU,EAAED,OAAO,CAACC,UAHF;AAIlBC,EAAAA,aAAa,EAAEF,OAAO,CAACE,aAJL;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C,SA9BP;AA+BlBC,EAAAA,YAAY,EAAE9B,OAAO,CAAC8B;AA/BJ,CAAb","sourcesContent":["/*global SkiaApi*/\nimport \"./NativeSetup\";\nimport type { SkiaApi as SkSkiaApi } from \"./SkiaApi\";\n\n/**\n * Declares the SkiaApi as an available object in the global scope\n */\ndeclare global {\n var SkiaApi: SkSkiaApi;\n}\n\n/**\n * Declares the implemented API with overrides.\n */\nexport const Skia = {\n // Factories\n Typeface: SkiaApi.Typeface,\n MaskFilter: SkiaApi.MaskFilter,\n RuntimeEffect: SkiaApi.RuntimeEffect,\n Shader: SkiaApi.Shader,\n ImageFilter: SkiaApi.ImageFilter,\n PathEffect: SkiaApi.PathEffect,\n Data: SkiaApi.Data,\n SVG: SkiaApi.SVG,\n FontMgr: SkiaApi.FontMgr,\n TextBlob: SkiaApi.TextBlob,\n // Constructors\n Matrix: SkiaApi.Matrix,\n Font: SkiaApi.Font,\n Point: SkiaApi.Point,\n XYWHRect: SkiaApi.XYWHRect,\n RRectXY: SkiaApi.RRectXY,\n RuntimeShaderBuilder: SkiaApi.RuntimeShaderBuilder,\n Paint: SkiaApi.Paint,\n PictureRecorder: SkiaApi.PictureRecorder,\n Picture: SkiaApi.Picture,\n Path: SkiaApi.Path,\n ColorFilter: SkiaApi.ColorFilter,\n ContourMeasureIter: SkiaApi.ContourMeasureIter,\n Color: SkiaApi.Color,\n RSXform: SkiaApi.RSXform,\n // For the following methods the factory symmetry is broken to be comptatible with CanvasKit\n MakeSurface: SkiaApi.Surface.Make,\n MakeImageFromEncoded: SkiaApi.Image.MakeImageFromEncoded,\n MakeImage: SkiaApi.Image.MakeImage,\n MakeVertices: SkiaApi.MakeVertices,\n};\n"]}
@@ -0,0 +1,2 @@
1
+ import "./NativeSetup";
2
+ //# sourceMappingURL=SkiaApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["SkiaApi.ts"],"names":[],"mappings":"AAqBA,OAAO,eAAP","sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type { RuntimeEffectFactory } from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { FontMgrFactory } from \"./FontMgr/FontMgrFactory\";\nimport type { SurfaceFactory } from \"./Surface\";\nimport \"./NativeSetup\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type {\n SkRuntimeShaderBuilder,\n SkRuntimeEffect,\n} from \"./RuntimeEffect/RuntimeEffect\";\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface SkiaApi {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n Color: (color: Color) => SkColor;\n parseColorString: (color: string) => SkColor | undefined;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n Matrix: () => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n SVG: SVGFactory;\n FontMgr: FontMgrFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n}\n"]}
@@ -1,9 +1,7 @@
1
- export const ValueApi = {
2
- createValue: global.SkiaValueApi.createValue,
3
- createDerivedValue: global.SkiaValueApi.createDerivedValue,
4
- createClockValue: global.SkiaValueApi.createClockValue,
5
- createAnimation: global.SkiaValueApi.createAnimation
6
- };
1
+ const {
2
+ SkiaValueApi
3
+ } = global;
4
+ export const ValueApi = SkiaValueApi;
7
5
  export const {
8
6
  createValue,
9
7
  createDerivedValue
@@ -1 +1 @@
1
- {"version":3,"sources":["api.ts"],"names":["ValueApi","createValue","global","SkiaValueApi","createDerivedValue","createClockValue","createAnimation"],"mappings":"AAyCA,OAAO,MAAMA,QAAuB,GAAG;AACrCC,EAAAA,WAAW,EAAEC,MAAM,CAACC,YAAP,CAAoBF,WADI;AAErCG,EAAAA,kBAAkB,EAAEF,MAAM,CAACC,YAAP,CAAoBC,kBAFH;AAGrCC,EAAAA,gBAAgB,EAAEH,MAAM,CAACC,YAAP,CAAoBE,gBAHD;AAIrCC,EAAAA,eAAe,EAAEJ,MAAM,CAACC,YAAP,CAAoBG;AAJA,CAAhC;AAOP,OAAO,MAAM;AAAEL,EAAAA,WAAF;AAAeG,EAAAA;AAAf,IAAsCJ,QAA5C","sourcesContent":["import type {\n SkiaAnimation,\n AnimationState,\n SkiaReadonlyValue,\n SkiaClockValue,\n SkiaValue,\n} from \"./types\";\n\nexport interface ISkiaValueApi {\n /**\n * Creates a new value that holds the initial value and that\n * can be changed.\n */\n createValue: <T>(initialValue: T) => SkiaValue<T>;\n /**\n * Creates a derived value. This is a calculated value that returns the result of\n * a function that is called with the values of the dependencies.\n */\n createDerivedValue: <R>(\n cb: () => R,\n values: Array<SkiaReadonlyValue<unknown>>\n ) => SkiaReadonlyValue<R>;\n /**\n * Creates a clock value where the value is the number of milliseconds elapsed\n * since the clock was created\n */\n createClockValue: () => SkiaClockValue;\n /**\n * Creates an animation that is driven from a clock and updated every frame.\n * @param cb Callback to calculate next value from time.\n * @returns An animation object that can control a value.\n */\n createAnimation: <S extends AnimationState = AnimationState>(\n cb: (t: number, state: S | undefined) => S\n ) => SkiaAnimation;\n}\n\ndeclare global {\n var SkiaValueApi: ISkiaValueApi;\n}\n\nexport const ValueApi: ISkiaValueApi = {\n createValue: global.SkiaValueApi.createValue,\n createDerivedValue: global.SkiaValueApi.createDerivedValue,\n createClockValue: global.SkiaValueApi.createClockValue,\n createAnimation: global.SkiaValueApi.createAnimation,\n};\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
1
+ {"version":3,"sources":["api.ts"],"names":["SkiaValueApi","global","ValueApi","createValue","createDerivedValue"],"mappings":"AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAmBC,MAAzB;AACA,OAAO,MAAMC,QAAQ,GAAGF,YAAjB;AAEP,OAAO,MAAM;AAAEG,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAsCF,QAA5C","sourcesContent":["import type { ISkiaValueApi } from \"./types\";\n\ndeclare global {\n var SkiaValueApi: ISkiaValueApi;\n}\n\nconst { SkiaValueApi } = global;\nexport const ValueApi = SkiaValueApi;\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
@@ -0,0 +1,7 @@
1
+ import { ValueApi as ValueApiWeb } from "./web";
2
+ export const ValueApi = ValueApiWeb;
3
+ export const {
4
+ createValue,
5
+ createDerivedValue
6
+ } = ValueApi;
7
+ //# sourceMappingURL=api.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["api.web.ts"],"names":["ValueApi","ValueApiWeb","createValue","createDerivedValue"],"mappings":"AAAA,SAASA,QAAQ,IAAIC,WAArB,QAAwC,OAAxC;AAEA,OAAO,MAAMD,QAAQ,GAAGC,WAAjB;AAEP,OAAO,MAAM;AAAEC,EAAAA,WAAF;AAAeC,EAAAA;AAAf,IAAsCH,QAA5C","sourcesContent":["import { ValueApi as ValueApiWeb } from \"./web\";\n\nexport const ValueApi = ValueApiWeb;\n\nexport const { createValue, createDerivedValue } = ValueApi;\n"]}
@@ -1,5 +1,4 @@
1
1
  export * from "./types";
2
2
  export * from "./hooks";
3
- export * from "./animation";
4
3
  export * from "./api";
5
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAd;AACA,cAAc,SAAd;AACA,cAAc,aAAd;AACA,cAAc,OAAd","sourcesContent":["export * from \"./types\";\nexport * from \"./hooks\";\nexport * from \"./animation\";\nexport * from \"./api\";\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAd;AACA,cAAc,SAAd;AACA,cAAc,OAAd","sourcesContent":["export * from \"./types\";\nexport * from \"./hooks\";\nexport * from \"./api\";\n"]}
@@ -0,0 +1,36 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { RNSkClockValue } from "./RNSkClockValue";
4
+ export class RNSkAnimation extends RNSkClockValue {
5
+ constructor(callback, raf) {
6
+ super(raf);
7
+
8
+ _defineProperty(this, "_callback", void 0);
9
+
10
+ _defineProperty(this, "_animationState", undefined);
11
+
12
+ this._callback = callback;
13
+ }
14
+
15
+ cancel() {
16
+ this.stop();
17
+ }
18
+
19
+ update(nextValue) {
20
+ var _this$_animationState2, _this$_animationState3;
21
+
22
+ if (this._callback) {
23
+ var _this$_animationState;
24
+
25
+ this._animationState = this._callback(nextValue, this._animationState);
26
+
27
+ if ((_this$_animationState = this._animationState) !== null && _this$_animationState !== void 0 && _this$_animationState.finished) {
28
+ this.stop();
29
+ }
30
+ }
31
+
32
+ super.update((_this$_animationState2 = (_this$_animationState3 = this._animationState) === null || _this$_animationState3 === void 0 ? void 0 : _this$_animationState3.current) !== null && _this$_animationState2 !== void 0 ? _this$_animationState2 : nextValue);
33
+ }
34
+
35
+ }
36
+ //# sourceMappingURL=RNSkAnimation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RNSkAnimation.ts"],"names":["RNSkClockValue","RNSkAnimation","constructor","callback","raf","undefined","_callback","cancel","stop","update","nextValue","_animationState","finished","current"],"mappings":";;AAEA,SAASA,cAAT,QAA+B,kBAA/B;AAEA,OAAO,MAAMC,aAAN,SACGD,cADH,CAGP;AACEE,EAAAA,WAAW,CACTC,QADS,EAETC,GAFS,EAGT;AACA,UAAMA,GAAN;;AADA;;AAAA,6CAMuCC,SANvC;;AAEA,SAAKC,SAAL,GAAiBH,QAAjB;AACD;;AAKMI,EAAAA,MAAM,GAAG;AACd,SAAKC,IAAL;AACD;;AAESC,EAAAA,MAAM,CAACC,SAAD,EAA0B;AAAA;;AACxC,QAAI,KAAKJ,SAAT,EAAoB;AAAA;;AAClB,WAAKK,eAAL,GAAuB,KAAKL,SAAL,CAAeI,SAAf,EAA0B,KAAKC,eAA/B,CAAvB;;AACA,mCAAI,KAAKA,eAAT,kDAAI,sBAAsBC,QAA1B,EAAoC;AAClC,aAAKJ,IAAL;AACD;AACF;;AACD,UAAMC,MAAN,qDAAa,KAAKE,eAAlB,2DAAa,uBAAsBE,OAAnC,2EAA8CH,SAA9C;AACD;;AAxBH","sourcesContent":["import type { AnimationState, SkiaAnimation } from \"../types\";\n\nimport { RNSkClockValue } from \"./RNSkClockValue\";\n\nexport class RNSkAnimation<S extends AnimationState = AnimationState>\n extends RNSkClockValue\n implements SkiaAnimation\n{\n constructor(\n callback: (t: number, state: S | undefined) => S,\n raf: (callback: (time: number) => void) => number\n ) {\n super(raf);\n this._callback = callback;\n }\n\n private _callback: (t: number, state: S | undefined) => S;\n private _animationState: S | undefined = undefined;\n\n public cancel() {\n this.stop();\n }\n\n protected update(nextValue: number): void {\n if (this._callback) {\n this._animationState = this._callback(nextValue, this._animationState);\n if (this._animationState?.finished) {\n this.stop();\n }\n }\n super.update(this._animationState?.current ?? nextValue);\n }\n}\n"]}
@@ -0,0 +1,65 @@
1
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+
3
+ import { RNSkReadonlyValue } from "./RNSkReadonlyValue";
4
+ var RNSkClockState;
5
+
6
+ (function (RNSkClockState) {
7
+ RNSkClockState[RNSkClockState["NotStarted"] = 0] = "NotStarted";
8
+ RNSkClockState[RNSkClockState["Running"] = 1] = "Running";
9
+ RNSkClockState[RNSkClockState["Stopped"] = 2] = "Stopped";
10
+ })(RNSkClockState || (RNSkClockState = {}));
11
+
12
+ export class RNSkClockValue extends RNSkReadonlyValue {
13
+ constructor(raf) {
14
+ super(0);
15
+
16
+ _defineProperty(this, "_raf", void 0);
17
+
18
+ _defineProperty(this, "_start", void 0);
19
+
20
+ _defineProperty(this, "_stop", void 0);
21
+
22
+ _defineProperty(this, "_state", RNSkClockState.NotStarted);
23
+
24
+ _defineProperty(this, "notifyUpdate", _ => {
25
+ if (this._state === RNSkClockState.Running) {
26
+ const now = Date.now();
27
+ const deltaFromStart = now - this._start;
28
+ this.tick(deltaFromStart);
29
+
30
+ this._raf(this.notifyUpdate);
31
+ }
32
+ });
33
+
34
+ this._raf = raf;
35
+ this.update(0);
36
+ }
37
+
38
+ tick(value) {
39
+ this.update(value);
40
+ }
41
+
42
+ start() {
43
+ if (this._state === RNSkClockState.NotStarted) {
44
+ this._start = Date.now();
45
+ this._stop = this._start;
46
+ } // Subtract pause time from start
47
+
48
+
49
+ const timeSinceStop = Date.now() - this._stop;
50
+
51
+ this._start += timeSinceStop;
52
+ this._state = RNSkClockState.Running;
53
+
54
+ this._raf(this.notifyUpdate);
55
+ }
56
+
57
+ stop() {
58
+ if (this._state === RNSkClockState.Running) {
59
+ this._state = RNSkClockState.Stopped;
60
+ this._stop = Date.now();
61
+ }
62
+ }
63
+
64
+ }
65
+ //# sourceMappingURL=RNSkClockValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["RNSkClockValue.ts"],"names":["RNSkReadonlyValue","RNSkClockState","RNSkClockValue","constructor","raf","NotStarted","_","_state","Running","now","Date","deltaFromStart","_start","tick","_raf","notifyUpdate","update","value","start","_stop","timeSinceStop","stop","Stopped"],"mappings":";;AAEA,SAASA,iBAAT,QAAkC,qBAAlC;IAEKC,c;;WAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;AAAAA,EAAAA,c,CAAAA,c;GAAAA,c,KAAAA,c;;AAML,OAAO,MAAMC,cAAN,SACGF,iBADH,CAGP;AACEG,EAAAA,WAAW,CAACC,GAAD,EAAoD;AAC7D,UAAM,CAAN;;AAD6D;;AAAA;;AAAA;;AAAA,oCAS9BH,cAAc,CAACI,UATe;;AAAA,0CAWvCC,CAAD,IAAe;AACpC,UAAI,KAAKC,MAAL,KAAgBN,cAAc,CAACO,OAAnC,EAA4C;AAC1C,cAAMC,GAAG,GAAGC,IAAI,CAACD,GAAL,EAAZ;AACA,cAAME,cAAc,GAAGF,GAAG,GAAG,KAAKG,MAAlC;AACA,aAAKC,IAAL,CAAUF,cAAV;;AACA,aAAKG,IAAL,CAAU,KAAKC,YAAf;AACD;AACF,KAlB8D;;AAE7D,SAAKD,IAAL,GAAYV,GAAZ;AACA,SAAKY,MAAL,CAAY,CAAZ;AACD;;AAgBSH,EAAAA,IAAI,CAACI,KAAD,EAAgB;AAC5B,SAAKD,MAAL,CAAYC,KAAZ;AACD;;AAEMC,EAAAA,KAAK,GAAG;AACb,QAAI,KAAKX,MAAL,KAAgBN,cAAc,CAACI,UAAnC,EAA+C;AAC7C,WAAKO,MAAL,GAAcF,IAAI,CAACD,GAAL,EAAd;AACA,WAAKU,KAAL,GAAa,KAAKP,MAAlB;AACD,KAJY,CAKb;;;AACA,UAAMQ,aAAa,GAAGV,IAAI,CAACD,GAAL,KAAa,KAAKU,KAAxC;;AACA,SAAKP,MAAL,IAAgBQ,aAAhB;AAEA,SAAKb,MAAL,GAAcN,cAAc,CAACO,OAA7B;;AACA,SAAKM,IAAL,CAAU,KAAKC,YAAf;AACD;;AAEMM,EAAAA,IAAI,GAAG;AACZ,QAAI,KAAKd,MAAL,KAAgBN,cAAc,CAACO,OAAnC,EAA4C;AAC1C,WAAKD,MAAL,GAAcN,cAAc,CAACqB,OAA7B;AACA,WAAKH,KAAL,GAAaT,IAAI,CAACD,GAAL,EAAb;AACD;AACF;;AA3CH","sourcesContent":["import type { SkiaClockValue } from \"../types\";\n\nimport { RNSkReadonlyValue } from \"./RNSkReadonlyValue\";\n\nenum RNSkClockState {\n NotStarted = 0,\n Running = 1,\n Stopped = 2,\n}\n\nexport class RNSkClockValue\n extends RNSkReadonlyValue<number>\n implements SkiaClockValue\n{\n constructor(raf: (callback: (time: number) => void) => number) {\n super(0);\n this._raf = raf;\n this.update(0);\n }\n\n private _raf: (callback: (time: number) => void) => number;\n private _start: number | undefined;\n private _stop: number | undefined;\n private _state: RNSkClockState = RNSkClockState.NotStarted;\n\n private notifyUpdate = (_: number) => {\n if (this._state === RNSkClockState.Running) {\n const now = Date.now();\n const deltaFromStart = now - this._start!;\n this.tick(deltaFromStart);\n this._raf(this.notifyUpdate);\n }\n };\n\n protected tick(value: number) {\n this.update(value);\n }\n\n public start() {\n if (this._state === RNSkClockState.NotStarted) {\n this._start = Date.now();\n this._stop = this._start;\n }\n // Subtract pause time from start\n const timeSinceStop = Date.now() - this._stop!;\n this._start! += timeSinceStop;\n\n this._state = RNSkClockState.Running;\n this._raf(this.notifyUpdate);\n }\n\n public stop() {\n if (this._state === RNSkClockState.Running) {\n this._state = RNSkClockState.Stopped;\n this._stop = Date.now();\n }\n }\n}\n"]}