@shopify/react-native-skia 2.0.7 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/android/CMakeLists.txt +20 -1
  2. package/cpp/api/JsiSkApi.h +3 -0
  3. package/cpp/api/JsiSkImageFilterFactory.h +478 -39
  4. package/cpp/api/JsiSkSkottie.h +590 -0
  5. package/cpp/api/JsiSkottieFactory.h +65 -0
  6. package/cpp/api/recorder/Command.h +1 -0
  7. package/cpp/api/recorder/Convertor.h +32 -0
  8. package/cpp/api/recorder/Drawings.h +23 -0
  9. package/cpp/api/recorder/ImageFilters.h +20 -0
  10. package/cpp/api/recorder/JsiRecorder.h +6 -0
  11. package/cpp/api/recorder/RNRecorder.h +15 -0
  12. package/cpp/api/third_party/SkottieUtils.cpp +333 -0
  13. package/cpp/api/third_party/SkottieUtils.h +172 -0
  14. package/cpp/skia/modules/jsonreader/SkJSONReader.cpp +980 -0
  15. package/cpp/skia/modules/jsonreader/SkJSONReader.h +389 -0
  16. package/cpp/skia/modules/skottie/include/ExternalLayer.h +56 -0
  17. package/cpp/skia/modules/skottie/include/Skottie.h +313 -0
  18. package/cpp/skia/modules/skottie/include/SkottieProperty.h +190 -0
  19. package/cpp/skia/modules/skottie/include/SlotManager.h +113 -0
  20. package/cpp/skia/modules/skottie/include/TextShaper.h +200 -0
  21. package/cpp/skia/modules/skottie/src/SkottieValue.h +56 -0
  22. package/cpp/skia/modules/skottie/src/animator/Animator.h +89 -0
  23. package/cpp/skia/modules/skottie/src/text/Font.h +82 -0
  24. package/cpp/skia/modules/skottie/src/text/TextAdapter.h +155 -0
  25. package/cpp/skia/modules/skottie/src/text/TextAnimator.h +121 -0
  26. package/cpp/skia/modules/skottie/src/text/TextValue.h +28 -0
  27. package/cpp/skia/modules/sksg/include/SkSGClipEffect.h +61 -0
  28. package/cpp/skia/modules/sksg/include/SkSGColorFilter.h +135 -0
  29. package/cpp/skia/modules/sksg/include/SkSGDraw.h +57 -0
  30. package/cpp/skia/modules/sksg/include/SkSGEffectNode.h +50 -0
  31. package/cpp/skia/modules/sksg/include/SkSGGeometryEffect.h +181 -0
  32. package/cpp/skia/modules/sksg/include/SkSGGeometryNode.h +54 -0
  33. package/cpp/skia/modules/sksg/include/SkSGGradient.h +108 -0
  34. package/cpp/skia/modules/sksg/include/SkSGGroup.h +65 -0
  35. package/cpp/skia/modules/sksg/include/SkSGImage.h +59 -0
  36. package/cpp/skia/modules/sksg/include/SkSGInvalidationController.h +46 -0
  37. package/cpp/skia/modules/sksg/include/SkSGMaskEffect.h +65 -0
  38. package/cpp/skia/modules/sksg/include/SkSGMerge.h +74 -0
  39. package/cpp/skia/modules/sksg/include/SkSGNode.h +128 -0
  40. package/cpp/skia/modules/sksg/include/SkSGOpacityEffect.h +54 -0
  41. package/cpp/skia/modules/sksg/include/SkSGPaint.h +112 -0
  42. package/cpp/skia/modules/sksg/include/SkSGPath.h +68 -0
  43. package/cpp/skia/modules/sksg/include/SkSGPlane.h +47 -0
  44. package/cpp/skia/modules/sksg/include/SkSGRect.h +122 -0
  45. package/cpp/skia/modules/sksg/include/SkSGRenderEffect.h +283 -0
  46. package/cpp/skia/modules/sksg/include/SkSGRenderNode.h +157 -0
  47. package/cpp/skia/modules/sksg/include/SkSGScene.h +47 -0
  48. package/cpp/skia/modules/sksg/include/SkSGText.h +82 -0
  49. package/cpp/skia/modules/sksg/include/SkSGTransform.h +127 -0
  50. package/cpp/skia/src/base/SkArenaAlloc.h +371 -0
  51. package/lib/commonjs/dom/nodes/datatypes/Gradient.d.ts +15 -15
  52. package/lib/commonjs/dom/types/Drawings.d.ts +8 -1
  53. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  54. package/lib/commonjs/dom/types/NodeType.d.ts +3 -1
  55. package/lib/commonjs/dom/types/NodeType.js +4 -0
  56. package/lib/commonjs/dom/types/NodeType.js.map +1 -1
  57. package/lib/commonjs/renderer/__tests__/e2e/AdvancedImageFilters.spec.d.ts +1 -0
  58. package/lib/commonjs/renderer/__tests__/e2e/Camera.spec.d.ts +21 -0
  59. package/lib/commonjs/renderer/__tests__/e2e/ImageFilter.spec.d.ts +1 -0
  60. package/lib/commonjs/renderer/__tests__/e2e/LightingImageFilters.spec.d.ts +1 -0
  61. package/lib/commonjs/renderer/__tests__/e2e/Skottie.spec.d.ts +1 -0
  62. package/lib/commonjs/renderer/__tests__/setup.d.ts +5 -0
  63. package/lib/commonjs/renderer/components/ImageFilter.d.ts +4 -0
  64. package/lib/commonjs/renderer/components/ImageFilter.js +13 -0
  65. package/lib/commonjs/renderer/components/ImageFilter.js.map +1 -0
  66. package/lib/commonjs/renderer/components/Skottie.d.ts +4 -0
  67. package/lib/commonjs/renderer/components/Skottie.js +13 -0
  68. package/lib/commonjs/renderer/components/Skottie.js.map +1 -0
  69. package/lib/commonjs/renderer/components/index.d.ts +2 -0
  70. package/lib/commonjs/renderer/components/index.js +22 -0
  71. package/lib/commonjs/renderer/components/index.js.map +1 -1
  72. package/lib/commonjs/skia/types/ImageFilter/ImageFilterFactory.d.ts +252 -15
  73. package/lib/commonjs/skia/types/ImageFilter/ImageFilterFactory.js.map +1 -1
  74. package/lib/commonjs/skia/types/Matrix4.d.ts +11 -2
  75. package/lib/commonjs/skia/types/Matrix4.js +42 -1
  76. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  77. package/lib/commonjs/skia/types/Recorder.d.ts +2 -1
  78. package/lib/commonjs/skia/types/Recorder.js.map +1 -1
  79. package/lib/commonjs/skia/types/Skia.d.ts +2 -0
  80. package/lib/commonjs/skia/types/Skia.js.map +1 -1
  81. package/lib/commonjs/skia/types/Skottie.d.ts +223 -0
  82. package/lib/commonjs/skia/types/Skottie.js +73 -0
  83. package/lib/commonjs/skia/types/Skottie.js.map +1 -0
  84. package/lib/commonjs/skia/types/index.d.ts +1 -0
  85. package/lib/commonjs/skia/types/index.js +11 -0
  86. package/lib/commonjs/skia/types/index.js.map +1 -1
  87. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +29 -12
  88. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +88 -19
  89. package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  90. package/lib/commonjs/skia/web/JsiSkia.js +2 -0
  91. package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
  92. package/lib/commonjs/skia/web/JsiSkottieAnimation.d.ts +59 -0
  93. package/lib/commonjs/skia/web/JsiSkottieAnimation.js +243 -0
  94. package/lib/commonjs/skia/web/JsiSkottieAnimation.js.map +1 -0
  95. package/lib/commonjs/skia/web/JsiSkottieFactory.d.ts +9 -0
  96. package/lib/commonjs/skia/web/JsiSkottieFactory.js +26 -0
  97. package/lib/commonjs/skia/web/JsiSkottieFactory.js.map +1 -0
  98. package/lib/commonjs/sksg/Elements.d.ts +3 -1
  99. package/lib/commonjs/sksg/Elements.js.map +1 -1
  100. package/lib/commonjs/sksg/Node.d.ts +1 -1
  101. package/lib/commonjs/sksg/Node.js +1 -1
  102. package/lib/commonjs/sksg/Node.js.map +1 -1
  103. package/lib/commonjs/sksg/Recorder/Core.d.ts +4 -2
  104. package/lib/commonjs/sksg/Recorder/Core.js +1 -0
  105. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
  106. package/lib/commonjs/sksg/Recorder/Player.js +2 -0
  107. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  108. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +2 -1
  109. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js +4 -0
  110. package/lib/commonjs/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
  111. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +2 -1
  112. package/lib/commonjs/sksg/Recorder/Recorder.js +6 -0
  113. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
  114. package/lib/commonjs/sksg/Recorder/Visitor.js +3 -0
  115. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
  116. package/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +2 -2
  117. package/lib/commonjs/sksg/Recorder/commands/Drawing.js +11 -4
  118. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
  119. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +12 -2
  120. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  121. package/lib/module/dom/nodes/datatypes/Gradient.d.ts +15 -15
  122. package/lib/module/dom/types/Drawings.d.ts +8 -1
  123. package/lib/module/dom/types/Drawings.js.map +1 -1
  124. package/lib/module/dom/types/NodeType.d.ts +3 -1
  125. package/lib/module/dom/types/NodeType.js +4 -0
  126. package/lib/module/dom/types/NodeType.js.map +1 -1
  127. package/lib/module/renderer/__tests__/e2e/AdvancedImageFilters.spec.d.ts +1 -0
  128. package/lib/module/renderer/__tests__/e2e/Camera.spec.d.ts +21 -0
  129. package/lib/module/renderer/__tests__/e2e/ImageFilter.spec.d.ts +1 -0
  130. package/lib/module/renderer/__tests__/e2e/LightingImageFilters.spec.d.ts +1 -0
  131. package/lib/module/renderer/__tests__/e2e/Skottie.spec.d.ts +1 -0
  132. package/lib/module/renderer/__tests__/setup.d.ts +5 -0
  133. package/lib/module/renderer/components/ImageFilter.d.ts +4 -0
  134. package/lib/module/renderer/components/ImageFilter.js +5 -0
  135. package/lib/module/renderer/components/ImageFilter.js.map +1 -0
  136. package/lib/module/renderer/components/Skottie.d.ts +4 -0
  137. package/lib/module/renderer/components/Skottie.js +5 -0
  138. package/lib/module/renderer/components/Skottie.js.map +1 -0
  139. package/lib/module/renderer/components/index.d.ts +2 -0
  140. package/lib/module/renderer/components/index.js +2 -0
  141. package/lib/module/renderer/components/index.js.map +1 -1
  142. package/lib/module/skia/types/ImageFilter/ImageFilterFactory.d.ts +252 -15
  143. package/lib/module/skia/types/ImageFilter/ImageFilterFactory.js.map +1 -1
  144. package/lib/module/skia/types/Matrix4.d.ts +11 -2
  145. package/lib/module/skia/types/Matrix4.js +40 -0
  146. package/lib/module/skia/types/Matrix4.js.map +1 -1
  147. package/lib/module/skia/types/Recorder.d.ts +2 -1
  148. package/lib/module/skia/types/Recorder.js.map +1 -1
  149. package/lib/module/skia/types/Skia.d.ts +2 -0
  150. package/lib/module/skia/types/Skia.js.map +1 -1
  151. package/lib/module/skia/types/Skottie.d.ts +223 -0
  152. package/lib/module/skia/types/Skottie.js +74 -0
  153. package/lib/module/skia/types/Skottie.js.map +1 -0
  154. package/lib/module/skia/types/index.d.ts +1 -0
  155. package/lib/module/skia/types/index.js +1 -0
  156. package/lib/module/skia/types/index.js.map +1 -1
  157. package/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +29 -12
  158. package/lib/module/skia/web/JsiSkImageFilterFactory.js +88 -19
  159. package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
  160. package/lib/module/skia/web/JsiSkia.js +2 -0
  161. package/lib/module/skia/web/JsiSkia.js.map +1 -1
  162. package/lib/module/skia/web/JsiSkottieAnimation.d.ts +59 -0
  163. package/lib/module/skia/web/JsiSkottieAnimation.js +236 -0
  164. package/lib/module/skia/web/JsiSkottieAnimation.js.map +1 -0
  165. package/lib/module/skia/web/JsiSkottieFactory.d.ts +9 -0
  166. package/lib/module/skia/web/JsiSkottieFactory.js +19 -0
  167. package/lib/module/skia/web/JsiSkottieFactory.js.map +1 -0
  168. package/lib/module/sksg/Elements.d.ts +3 -1
  169. package/lib/module/sksg/Elements.js.map +1 -1
  170. package/lib/module/sksg/Node.d.ts +1 -1
  171. package/lib/module/sksg/Node.js +1 -1
  172. package/lib/module/sksg/Node.js.map +1 -1
  173. package/lib/module/sksg/Recorder/Core.d.ts +4 -2
  174. package/lib/module/sksg/Recorder/Core.js +1 -0
  175. package/lib/module/sksg/Recorder/Core.js.map +1 -1
  176. package/lib/module/sksg/Recorder/Player.js +3 -1
  177. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  178. package/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +2 -1
  179. package/lib/module/sksg/Recorder/ReanimatedRecorder.js +4 -0
  180. package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
  181. package/lib/module/sksg/Recorder/Recorder.d.ts +2 -1
  182. package/lib/module/sksg/Recorder/Recorder.js +6 -0
  183. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  184. package/lib/module/sksg/Recorder/Visitor.js +3 -0
  185. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  186. package/lib/module/sksg/Recorder/commands/Drawing.d.ts +2 -2
  187. package/lib/module/sksg/Recorder/commands/Drawing.js +9 -2
  188. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
  189. package/lib/module/sksg/Recorder/commands/ImageFilters.js +12 -2
  190. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  191. package/lib/typescript/lib/commonjs/renderer/components/ImageFilter.d.ts +2 -0
  192. package/lib/typescript/lib/commonjs/renderer/components/Skottie.d.ts +2 -0
  193. package/lib/typescript/lib/commonjs/skia/types/Matrix4.d.ts +1 -0
  194. package/lib/typescript/lib/commonjs/skia/types/Skottie.d.ts +6 -0
  195. package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +22 -5
  196. package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +2 -0
  197. package/lib/typescript/lib/commonjs/skia/web/JsiSkottieAnimation.d.ts +48 -0
  198. package/lib/typescript/lib/commonjs/skia/web/JsiSkottieFactory.d.ts +6 -0
  199. package/lib/typescript/lib/commonjs/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
  200. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +1 -0
  201. package/lib/typescript/lib/commonjs/sksg/Recorder/commands/Drawing.d.ts +1 -1
  202. package/lib/typescript/lib/module/mock/index.d.ts +8 -0
  203. package/lib/typescript/lib/module/renderer/components/ImageFilter.d.ts +2 -0
  204. package/lib/typescript/lib/module/renderer/components/Skottie.d.ts +2 -0
  205. package/lib/typescript/lib/module/renderer/components/index.d.ts +2 -0
  206. package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -0
  207. package/lib/typescript/lib/module/skia/types/Matrix4.d.ts +1 -0
  208. package/lib/typescript/lib/module/skia/types/Skottie.d.ts +5 -0
  209. package/lib/typescript/lib/module/skia/types/index.d.ts +1 -0
  210. package/lib/typescript/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +22 -5
  211. package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +2 -0
  212. package/lib/typescript/lib/module/skia/web/JsiSkottieAnimation.d.ts +47 -0
  213. package/lib/typescript/lib/module/skia/web/JsiSkottieFactory.d.ts +5 -0
  214. package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
  215. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +1 -0
  216. package/lib/typescript/lib/module/sksg/Recorder/commands/Drawing.d.ts +1 -1
  217. package/lib/typescript/src/dom/nodes/datatypes/Gradient.d.ts +15 -15
  218. package/lib/typescript/src/dom/types/Drawings.d.ts +8 -1
  219. package/lib/typescript/src/dom/types/NodeType.d.ts +3 -1
  220. package/lib/typescript/src/renderer/__tests__/e2e/AdvancedImageFilters.spec.d.ts +1 -0
  221. package/lib/typescript/src/renderer/__tests__/e2e/Camera.spec.d.ts +21 -0
  222. package/lib/typescript/src/renderer/__tests__/e2e/ImageFilter.spec.d.ts +1 -0
  223. package/lib/typescript/src/renderer/__tests__/e2e/LightingImageFilters.spec.d.ts +1 -0
  224. package/lib/typescript/src/renderer/__tests__/e2e/Skottie.spec.d.ts +1 -0
  225. package/lib/typescript/src/renderer/__tests__/setup.d.ts +5 -0
  226. package/lib/typescript/src/renderer/components/ImageFilter.d.ts +4 -0
  227. package/lib/typescript/src/renderer/components/Skottie.d.ts +4 -0
  228. package/lib/typescript/src/renderer/components/index.d.ts +2 -0
  229. package/lib/typescript/src/skia/types/ImageFilter/ImageFilterFactory.d.ts +252 -15
  230. package/lib/typescript/src/skia/types/Matrix4.d.ts +11 -2
  231. package/lib/typescript/src/skia/types/Recorder.d.ts +2 -1
  232. package/lib/typescript/src/skia/types/Skia.d.ts +2 -0
  233. package/lib/typescript/src/skia/types/Skottie.d.ts +223 -0
  234. package/lib/typescript/src/skia/types/index.d.ts +1 -0
  235. package/lib/typescript/src/skia/web/JsiSkImageFilterFactory.d.ts +29 -12
  236. package/lib/typescript/src/skia/web/JsiSkottieAnimation.d.ts +59 -0
  237. package/lib/typescript/src/skia/web/JsiSkottieFactory.d.ts +9 -0
  238. package/lib/typescript/src/sksg/Elements.d.ts +3 -1
  239. package/lib/typescript/src/sksg/Node.d.ts +1 -1
  240. package/lib/typescript/src/sksg/Recorder/Core.d.ts +4 -2
  241. package/lib/typescript/src/sksg/Recorder/ReanimatedRecorder.d.ts +2 -1
  242. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +2 -1
  243. package/lib/typescript/src/sksg/Recorder/commands/Drawing.d.ts +2 -2
  244. package/libs/android/arm64-v8a/libjsonreader.a +0 -0
  245. package/libs/android/armeabi-v7a/libjsonreader.a +0 -0
  246. package/libs/android/x86/libjsonreader.a +0 -0
  247. package/libs/android/x86_64/libjsonreader.a +0 -0
  248. package/libs/apple/libpathops.xcframework/Info.plist +8 -8
  249. package/libs/apple/libskia.xcframework/Info.plist +14 -14
  250. package/libs/apple/libskottie.xcframework/Info.plist +14 -14
  251. package/libs/apple/libskparagraph.xcframework/Info.plist +16 -16
  252. package/libs/apple/libsksg.xcframework/Info.plist +5 -5
  253. package/libs/apple/libskshaper.xcframework/Info.plist +14 -14
  254. package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +14 -14
  255. package/libs/apple/libsvg.xcframework/Info.plist +14 -14
  256. package/package.json +1 -1
  257. package/react-native-skia.podspec +4 -2
  258. package/src/__tests__/snapshots/matrix4/camera-corner.png +0 -0
  259. package/src/__tests__/snapshots/matrix4/camera-offset.png +0 -0
  260. package/src/__tests__/snapshots/matrix4/camera-top-left-center.png +0 -0
  261. package/src/__tests__/snapshots/matrix4/camera-zoom-out.png +0 -0
  262. package/src/__tests__/snapshots/matrix4/full-rect.png +0 -0
  263. package/src/__tests__/snapshots/matrix4/rect.png +0 -0
  264. package/src/__tests__/snapshots/matrix4/scaled-rect.png +0 -0
  265. package/src/__tests__/snapshots/matrix4/test-perspective.png +0 -0
  266. package/src/__tests__/snapshots/matrix4/test-perspective2.png +0 -0
  267. package/src/dom/types/Drawings.ts +11 -0
  268. package/src/dom/types/NodeType.ts +4 -0
  269. package/src/renderer/__tests__/e2e/AdvancedImageFilters.spec.tsx +492 -0
  270. package/src/renderer/__tests__/e2e/Camera.spec.tsx +475 -0
  271. package/src/renderer/__tests__/e2e/ImageFilter.spec.tsx +99 -0
  272. package/src/renderer/__tests__/e2e/LightingImageFilters.spec.tsx +1478 -0
  273. package/src/renderer/__tests__/e2e/Skottie.spec.tsx +440 -0
  274. package/src/renderer/__tests__/e2e/setup/skottie/basic_slots.json +1118 -0
  275. package/src/renderer/__tests__/e2e/setup/skottie/color-props.json +1 -0
  276. package/src/renderer/__tests__/e2e/setup/skottie/confetti.json +5899 -0
  277. package/src/renderer/__tests__/e2e/setup/skottie/drinks.json +43857 -0
  278. package/src/renderer/__tests__/e2e/setup/skottie/fingerprint.json +1 -0
  279. package/src/renderer/__tests__/e2e/setup/skottie/lego_loader.json +29540 -0
  280. package/src/renderer/__tests__/e2e/setup/skottie/new-drop.json +1 -0
  281. package/src/renderer/__tests__/e2e/setup/skottie/onboarding.json +1 -0
  282. package/src/renderer/__tests__/e2e/setup/skottie/text-layer.json +1 -0
  283. package/src/renderer/__tests__/setup.tsx +31 -0
  284. package/src/renderer/components/ImageFilter.tsx +8 -0
  285. package/src/renderer/components/Skottie.tsx +8 -0
  286. package/src/renderer/components/index.ts +2 -0
  287. package/src/skia/__tests__/assets/Avenir-Heavy.ttf +0 -0
  288. package/src/skia/types/ImageFilter/ImageFilterFactory.ts +391 -21
  289. package/src/skia/types/Matrix4.ts +108 -2
  290. package/src/skia/types/Recorder.ts +2 -0
  291. package/src/skia/types/Skia.ts +2 -0
  292. package/src/skia/types/Skottie.ts +266 -0
  293. package/src/skia/types/index.ts +1 -0
  294. package/src/skia/web/JsiSkImageFilterFactory.ts +266 -31
  295. package/src/skia/web/JsiSkia.ts +2 -0
  296. package/src/skia/web/JsiSkottieAnimation.ts +259 -0
  297. package/src/skia/web/JsiSkottieFactory.ts +25 -0
  298. package/src/sksg/Elements.tsx +4 -0
  299. package/src/sksg/Node.ts +1 -0
  300. package/src/sksg/Recorder/Core.ts +3 -0
  301. package/src/sksg/Recorder/Player.ts +3 -0
  302. package/src/sksg/Recorder/ReanimatedRecorder.ts +6 -0
  303. package/src/sksg/Recorder/Recorder.ts +5 -0
  304. package/src/sksg/Recorder/Visitor.ts +3 -0
  305. package/src/sksg/Recorder/commands/Drawing.ts +7 -3
  306. package/src/sksg/Recorder/commands/ImageFilters.ts +15 -2
@@ -899,6 +899,29 @@ public:
899
899
  }
900
900
  };
901
901
 
902
+ struct SkottieCmdProps {
903
+ sk_sp<skottie::Animation> animation;
904
+ float frame;
905
+ };
906
+
907
+ class SkottieCmd : public Command {
908
+ private:
909
+ SkottieCmdProps props;
910
+
911
+ public:
912
+ SkottieCmd(jsi::Runtime &runtime, const jsi::Object &object,
913
+ Variables &variables)
914
+ : Command(CommandType::DrawSkottie) {
915
+ convertProperty(runtime, object, "animation", props.animation, variables);
916
+ convertProperty(runtime, object, "frame", props.frame, variables);
917
+ }
918
+
919
+ void draw(DrawingCtx *ctx) {
920
+ props.animation->seekFrame(props.frame);
921
+ props.animation->render(ctx->canvas);
922
+ }
923
+ };
924
+
902
925
  struct AtlasCmdProps {
903
926
  sk_sp<SkImage> image;
904
927
  std::vector<SkRect> sprites;
@@ -289,4 +289,24 @@ public:
289
289
  }
290
290
  };
291
291
 
292
+ struct ImageFilterCmdProps {
293
+ sk_sp<SkImageFilter> imageFilter;
294
+ };
295
+
296
+ class ImageFilterCmd : public Command {
297
+ private:
298
+ ImageFilterCmdProps props;
299
+
300
+ public:
301
+ ImageFilterCmd(jsi::Runtime &runtime, const jsi::Object &object,
302
+ Variables &variables)
303
+ : Command(CommandType::PushImageFilter, "skImageFilter") {
304
+ convertProperty(runtime, object, "imageFilter", props.imageFilter, variables);
305
+ }
306
+
307
+ void pushImageFilter(DrawingCtx *ctx) {
308
+ ctx->imageFilters.push_back(props.imageFilter);
309
+ }
310
+ };
311
+
292
312
  } // namespace RNSkia
@@ -262,6 +262,11 @@ public:
262
262
  return jsi::Value::undefined();
263
263
  }
264
264
 
265
+ JSI_HOST_FUNCTION(drawSkottie) {
266
+ getObject()->drawSkottie(runtime, arguments[0].asObject(runtime));
267
+ return jsi::Value::undefined();
268
+ }
269
+
265
270
  EXPORT_JSI_API_TYPENAME(JsiRecorder, Recorder)
266
271
 
267
272
  JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiRecorder, saveGroup),
@@ -303,6 +308,7 @@ public:
303
308
  JSI_EXPORT_FUNC(JsiRecorder, drawImageSVG),
304
309
  JSI_EXPORT_FUNC(JsiRecorder, drawParagraph),
305
310
  JSI_EXPORT_FUNC(JsiRecorder, drawAtlas),
311
+ JSI_EXPORT_FUNC(JsiRecorder, drawSkottie),
306
312
  JSI_EXPORT_FUNC(JsiRecorder, play),
307
313
  JSI_EXPORT_FUNC(JsiRecorder, applyUpdates))
308
314
 
@@ -142,6 +142,9 @@ public:
142
142
  } else if (nodeType == "skRuntimeShaderImageFilter") {
143
143
  commands.push_back(std::make_unique<RuntimeShaderImageFilterCmd>(
144
144
  runtime, props, variables));
145
+ } else if (nodeType == "skImageFilter") {
146
+ commands.push_back(
147
+ std::make_unique<ImageFilterCmd>(runtime, props, variables));
145
148
  }
146
149
  }
147
150
 
@@ -269,6 +272,10 @@ public:
269
272
  commands.push_back(std::make_unique<AtlasCmd>(runtime, props, variables));
270
273
  }
271
274
 
275
+ void drawSkottie(jsi::Runtime &runtime, const jsi::Object &props) {
276
+ commands.push_back(std::make_unique<SkottieCmd>(runtime, props, variables));
277
+ }
278
+
272
279
  void materializePaint() {
273
280
  commands.push_back(
274
281
  std::make_unique<Command>(CommandType::MaterializePaint));
@@ -415,6 +422,9 @@ public:
415
422
  auto *runtimeShaderCmd =
416
423
  static_cast<RuntimeShaderImageFilterCmd *>(cmd.get());
417
424
  runtimeShaderCmd->pushImageFilter(ctx);
425
+ } else if (nodeType == "skImageFilter") {
426
+ auto *imageFilterCmd = static_cast<ImageFilterCmd *>(cmd.get());
427
+ imageFilterCmd->pushImageFilter(ctx);
418
428
  } else {
419
429
  throw std::runtime_error("Invalid image filter type: " + nodeType);
420
430
  }
@@ -616,6 +626,11 @@ public:
616
626
  atlasCmd->draw(ctx);
617
627
  break;
618
628
  }
629
+ case CommandType::DrawSkottie: {
630
+ auto *skottieCmd = static_cast<SkottieCmd *>(cmd.get());
631
+ skottieCmd->draw(ctx);
632
+ break;
633
+ }
619
634
  }
620
635
 
621
636
  ctx->restorePaint();
@@ -0,0 +1,333 @@
1
+ /*
2
+ * Copyright 2018 Google Inc.
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #include "third_party/SkottieUtils.h"
9
+
10
+ #include "include/core/SkData.h"
11
+ #include "include/core/SkRect.h"
12
+ #include "include/core/SkSize.h"
13
+ #include "include/private/base/SkAssert.h"
14
+ #include "modules/skottie/include/Skottie.h"
15
+ #include "modules/skresources/include/SkResources.h"
16
+
17
+ #include <cstring>
18
+ #include <utility>
19
+
20
+ class SkCanvas;
21
+
22
+ namespace RNSkia {
23
+
24
+ class CustomPropertyManager::PropertyInterceptor final
25
+ : public skottie::PropertyObserver {
26
+ public:
27
+ explicit PropertyInterceptor(CustomPropertyManager *mgr) : fMgr(mgr) {}
28
+
29
+ void
30
+ onColorProperty(const char node_name[],
31
+ const LazyHandle<skottie::ColorPropertyHandle> &c) override {
32
+ const auto key = fMgr->acceptKey(node_name, ".Color");
33
+ if (!key.empty()) {
34
+ fMgr->fColorMap[key].push_back(c());
35
+ }
36
+ }
37
+
38
+ void onOpacityProperty(
39
+ const char node_name[],
40
+ const LazyHandle<skottie::OpacityPropertyHandle> &o) override {
41
+ const auto key = fMgr->acceptKey(node_name, ".Opacity");
42
+ if (!key.empty()) {
43
+ fMgr->fOpacityMap[key].push_back(o());
44
+ }
45
+ }
46
+
47
+ void onTransformProperty(
48
+ const char node_name[],
49
+ const LazyHandle<skottie::TransformPropertyHandle> &t) override {
50
+ const auto key = fMgr->acceptKey(node_name, ".Transform");
51
+ if (!key.empty()) {
52
+ fMgr->fTransformMap[key].push_back(t());
53
+ }
54
+ }
55
+
56
+ void
57
+ onTextProperty(const char node_name[],
58
+ const LazyHandle<skottie::TextPropertyHandle> &t) override {
59
+ const auto key = fMgr->acceptKey(node_name, ".Text");
60
+ if (!key.empty()) {
61
+ fMgr->fTextMap[key].push_back(t());
62
+ }
63
+ }
64
+
65
+ void onEnterNode(const char node_name[],
66
+ PropertyObserver::NodeType node_type) override {
67
+ if (node_name == nullptr) {
68
+ return;
69
+ }
70
+ fMgr->fCurrentNode = fMgr->fCurrentNode.empty()
71
+ ? node_name
72
+ : fMgr->fCurrentNode + "." + node_name;
73
+ }
74
+
75
+ void onLeavingNode(const char node_name[],
76
+ PropertyObserver::NodeType node_type) override {
77
+ if (node_name == nullptr) {
78
+ return;
79
+ }
80
+ auto length = strlen(node_name);
81
+ fMgr->fCurrentNode =
82
+ fMgr->fCurrentNode.length() > length
83
+ ? fMgr->fCurrentNode.substr(0, fMgr->fCurrentNode.length() -
84
+ strlen(node_name) - 1)
85
+ : "";
86
+ }
87
+
88
+ private:
89
+ CustomPropertyManager *fMgr;
90
+ };
91
+
92
+ class CustomPropertyManager::MarkerInterceptor final
93
+ : public skottie::MarkerObserver {
94
+ public:
95
+ explicit MarkerInterceptor(CustomPropertyManager *mgr) : fMgr(mgr) {}
96
+
97
+ void onMarker(const char name[], float t0, float t1) override {
98
+ // collect all markers
99
+ fMgr->fMarkers.push_back({std::string(name), t0, t1});
100
+ }
101
+
102
+ private:
103
+ CustomPropertyManager *fMgr;
104
+ };
105
+
106
+ CustomPropertyManager::CustomPropertyManager(Mode mode, const char *prefix)
107
+ : fMode(mode), fPrefix(prefix ? prefix : "$"),
108
+ fPropertyInterceptor(sk_make_sp<PropertyInterceptor>(this)),
109
+ fMarkerInterceptor(sk_make_sp<MarkerInterceptor>(this)) {
110
+ // there is a bug in the ref counting here
111
+ fPropertyInterceptor->ref();
112
+ fMarkerInterceptor->ref();
113
+ }
114
+
115
+ CustomPropertyManager::~CustomPropertyManager() {
116
+ // there is a bug in the ref counting here
117
+ // ref count 0 but the raw pointer still exists
118
+ auto rawptr1 = fPropertyInterceptor.get();
119
+ fPropertyInterceptor = nullptr;
120
+ delete rawptr1;
121
+
122
+ auto rawptr2 = fMarkerInterceptor.get();
123
+ fMarkerInterceptor = nullptr;
124
+ delete rawptr2;
125
+ }
126
+
127
+ std::string CustomPropertyManager::acceptKey(const char *name,
128
+ const char *suffix) const {
129
+ if (!SkStrStartsWith(name, fPrefix.c_str())) {
130
+ return std::string();
131
+ }
132
+
133
+ return fMode == Mode::kCollapseProperties ? std::string(name)
134
+ : fCurrentNode + suffix;
135
+ }
136
+
137
+ sk_sp<skottie::PropertyObserver>
138
+ CustomPropertyManager::getPropertyObserver() const {
139
+ return fPropertyInterceptor;
140
+ }
141
+
142
+ sk_sp<skottie::MarkerObserver>
143
+ CustomPropertyManager::getMarkerObserver() const {
144
+ return fMarkerInterceptor;
145
+ }
146
+
147
+ template <typename T>
148
+ std::vector<CustomPropertyManager::PropKey>
149
+ CustomPropertyManager::getProps(const PropMap<T> &container) const {
150
+ std::vector<PropKey> props;
151
+
152
+ for (const auto &prop_list : container) {
153
+ SkASSERT(!prop_list.second.empty());
154
+ props.push_back(prop_list.first);
155
+ }
156
+
157
+ return props;
158
+ }
159
+
160
+ template <typename V, typename T>
161
+ V CustomPropertyManager::get(const PropKey &key,
162
+ const PropMap<T> &container) const {
163
+ auto prop_group = container.find(key);
164
+
165
+ return prop_group == container.end() ? V()
166
+ : prop_group->second.front()->get();
167
+ }
168
+
169
+ template <typename T>
170
+ std::unique_ptr<T>
171
+ CustomPropertyManager::getHandle(const PropKey &key, size_t index,
172
+ const PropMap<T> &container) const {
173
+ auto prop_group = container.find(key);
174
+
175
+ if (prop_group == container.end() || index >= prop_group->second.size()) {
176
+ return nullptr;
177
+ }
178
+
179
+ return std::make_unique<T>(*prop_group->second[index]);
180
+ }
181
+
182
+ template <typename V, typename T>
183
+ bool CustomPropertyManager::set(const PropKey &key, const V &val,
184
+ const PropMap<T> &container) {
185
+ auto prop_group = container.find(key);
186
+
187
+ if (prop_group == container.end()) {
188
+ return false;
189
+ }
190
+
191
+ for (auto &handle : prop_group->second) {
192
+ handle->set(val);
193
+ }
194
+
195
+ return true;
196
+ }
197
+
198
+ std::vector<CustomPropertyManager::PropKey>
199
+ CustomPropertyManager::getColorProps() const {
200
+ return this->getProps(fColorMap);
201
+ }
202
+
203
+ skottie::ColorPropertyValue
204
+ CustomPropertyManager::getColor(const PropKey &key) const {
205
+ return this->get<skottie::ColorPropertyValue>(key, fColorMap);
206
+ }
207
+
208
+ std::unique_ptr<skottie::ColorPropertyHandle>
209
+ CustomPropertyManager::getColorHandle(const PropKey &key, size_t index) const {
210
+ return this->getHandle(key, index, fColorMap);
211
+ }
212
+
213
+ bool CustomPropertyManager::setColor(const PropKey &key,
214
+ const skottie::ColorPropertyValue &c) {
215
+ return this->set(key, c, fColorMap);
216
+ }
217
+
218
+ std::vector<CustomPropertyManager::PropKey>
219
+ CustomPropertyManager::getOpacityProps() const {
220
+ return this->getProps(fOpacityMap);
221
+ }
222
+
223
+ skottie::OpacityPropertyValue
224
+ CustomPropertyManager::getOpacity(const PropKey &key) const {
225
+ return this->get<skottie::OpacityPropertyValue>(key, fOpacityMap);
226
+ }
227
+
228
+ std::unique_ptr<skottie::OpacityPropertyHandle>
229
+ CustomPropertyManager::getOpacityHandle(const PropKey &key,
230
+ size_t index) const {
231
+ return this->getHandle(key, index, fOpacityMap);
232
+ }
233
+
234
+ bool CustomPropertyManager::setOpacity(const PropKey &key,
235
+ const skottie::OpacityPropertyValue &o) {
236
+ return this->set(key, o, fOpacityMap);
237
+ }
238
+
239
+ std::vector<CustomPropertyManager::PropKey>
240
+ CustomPropertyManager::getTransformProps() const {
241
+ return this->getProps(fTransformMap);
242
+ }
243
+
244
+ skottie::TransformPropertyValue
245
+ CustomPropertyManager::getTransform(const PropKey &key) const {
246
+ return this->get<skottie::TransformPropertyValue>(key, fTransformMap);
247
+ }
248
+
249
+ std::unique_ptr<skottie::TransformPropertyHandle>
250
+ CustomPropertyManager::getTransformHandle(const PropKey &key,
251
+ size_t index) const {
252
+ return this->getHandle(key, index, fTransformMap);
253
+ }
254
+
255
+ bool CustomPropertyManager::setTransform(
256
+ const PropKey &key, const skottie::TransformPropertyValue &t) {
257
+ return this->set(key, t, fTransformMap);
258
+ }
259
+
260
+ std::vector<CustomPropertyManager::PropKey>
261
+ CustomPropertyManager::getTextProps() const {
262
+ return this->getProps(fTextMap);
263
+ }
264
+
265
+ skottie::TextPropertyValue
266
+ CustomPropertyManager::getText(const PropKey &key) const {
267
+ return this->get<skottie::TextPropertyValue>(key, fTextMap);
268
+ }
269
+
270
+ std::unique_ptr<skottie::TextPropertyHandle>
271
+ CustomPropertyManager::getTextHandle(const PropKey &key, size_t index) const {
272
+ return this->getHandle(key, index, fTextMap);
273
+ }
274
+
275
+ bool CustomPropertyManager::setText(const PropKey &key,
276
+ const skottie::TextPropertyValue &o) {
277
+ return this->set(key, o, fTextMap);
278
+ }
279
+
280
+ namespace {
281
+
282
+ class ExternalAnimationLayer final : public skottie::ExternalLayer {
283
+ public:
284
+ ExternalAnimationLayer(sk_sp<skottie::Animation> anim, const SkSize &size)
285
+ : fAnimation(std::move(anim)), fSize(size) {}
286
+
287
+ private:
288
+ void render(SkCanvas *canvas, double t) override {
289
+ fAnimation->seekFrameTime(t);
290
+
291
+ // The main animation will layer-isolate if needed - we don't want the
292
+ // nested animation to override that decision.
293
+ const auto flags = skottie::Animation::RenderFlag::kSkipTopLevelIsolation;
294
+ const auto dst_rect = SkRect::MakeSize(fSize);
295
+ fAnimation->render(canvas, &dst_rect, flags);
296
+ }
297
+
298
+ const sk_sp<skottie::Animation> fAnimation;
299
+ const SkSize fSize;
300
+ };
301
+
302
+ } // namespace
303
+
304
+ ExternalAnimationPrecompInterceptor::ExternalAnimationPrecompInterceptor(
305
+ sk_sp<skresources::ResourceProvider> rprovider, const char prefixp[])
306
+ : fResourceProvider(std::move(rprovider)), fPrefix(prefixp) {}
307
+
308
+ ExternalAnimationPrecompInterceptor::~ExternalAnimationPrecompInterceptor() =
309
+ default;
310
+
311
+ sk_sp<skottie::ExternalLayer>
312
+ ExternalAnimationPrecompInterceptor::onLoadPrecomp(const char[],
313
+ const char name[],
314
+ const SkSize &size) {
315
+ if (0 != strncmp(name, fPrefix.c_str(), fPrefix.size())) {
316
+ return nullptr;
317
+ }
318
+
319
+ auto data = fResourceProvider->load("", name + fPrefix.size());
320
+ if (!data) {
321
+ return nullptr;
322
+ }
323
+
324
+ auto anim = skottie::Animation::Builder()
325
+ .setPrecompInterceptor(sk_ref_sp(this))
326
+ .setResourceProvider(fResourceProvider)
327
+ .make(static_cast<const char *>(data->data()), data->size());
328
+
329
+ return anim ? sk_make_sp<ExternalAnimationLayer>(std::move(anim), size)
330
+ : nullptr;
331
+ }
332
+
333
+ } // namespace RNSkia
@@ -0,0 +1,172 @@
1
+ /*
2
+ * Copyright 2018 Google Inc.
3
+ *
4
+ * Use of this source code is governed by a BSD-style license that can be
5
+ * found in the LICENSE file.
6
+ */
7
+
8
+ #pragma once
9
+
10
+ #include "include/core/SkRefCnt.h"
11
+ #include "include/core/SkString.h"
12
+ #include "modules/skottie/include/ExternalLayer.h"
13
+ #include "modules/skottie/include/SkottieProperty.h"
14
+
15
+ #include <cstddef>
16
+ #include <memory>
17
+ #include <string>
18
+ #include <unordered_map>
19
+ #include <vector>
20
+
21
+ struct SkSize;
22
+
23
+ namespace skottie {
24
+ class MarkerObserver;
25
+
26
+ inline void PropertyObserver::onColorProperty(
27
+ const char node_name[], const LazyHandle<ColorPropertyHandle> &) {}
28
+
29
+ inline void PropertyObserver::onOpacityProperty(
30
+ const char node_name[], const LazyHandle<OpacityPropertyHandle> &) {}
31
+ inline void PropertyObserver::onTextProperty(const char node_name[],
32
+ const LazyHandle<TextPropertyHandle> &) {}
33
+ inline void PropertyObserver::onTransformProperty(
34
+ const char node_name[], const LazyHandle<TransformPropertyHandle> &) {}
35
+ inline void PropertyObserver::onEnterNode(const char node_name[], NodeType node_type) {
36
+ }
37
+ inline void PropertyObserver::onLeavingNode(const char node_name[],
38
+ NodeType node_type) {}
39
+
40
+ } // namespace skottie
41
+
42
+ namespace skresources {
43
+ class ResourceProvider;
44
+ }
45
+
46
+ namespace RNSkia {
47
+
48
+ /**
49
+ * CustomPropertyManager implements a property management scheme where
50
+ * color/opacity/transform attributes are grouped and manipulated by name
51
+ * (one-to-many mapping).
52
+ *
53
+ * - setters apply the value to all properties in a named group
54
+ *
55
+ * - getters return all the managed property groups, and the first value
56
+ * within each of them (unchecked assumption: all properties within the same
57
+ * group have the same value)
58
+ *
59
+ * Attach to an Animation::Builder using the utility methods below to intercept
60
+ * properties and markers at build time.
61
+ */
62
+ class CustomPropertyManager final {
63
+ public:
64
+ enum class Mode {
65
+ kCollapseProperties, // keys ignore the ancestor chain and are
66
+ // grouped based on the local node name
67
+ kNamespacedProperties, // keys include the ancestor node names (no grouping)
68
+ };
69
+
70
+ explicit CustomPropertyManager(Mode = Mode::kNamespacedProperties,
71
+ const char *prefix = nullptr);
72
+ ~CustomPropertyManager();
73
+
74
+ using PropKey = std::string;
75
+
76
+ std::vector<PropKey> getColorProps() const;
77
+ skottie::ColorPropertyValue getColor(const PropKey &) const;
78
+ std::unique_ptr<skottie::ColorPropertyHandle> getColorHandle(const PropKey &,
79
+ size_t) const;
80
+ bool setColor(const PropKey &, const skottie::ColorPropertyValue &);
81
+
82
+ std::vector<PropKey> getOpacityProps() const;
83
+ skottie::OpacityPropertyValue getOpacity(const PropKey &) const;
84
+ std::unique_ptr<skottie::OpacityPropertyHandle>
85
+ getOpacityHandle(const PropKey &, size_t) const;
86
+ bool setOpacity(const PropKey &, const skottie::OpacityPropertyValue &);
87
+
88
+ std::vector<PropKey> getTransformProps() const;
89
+ skottie::TransformPropertyValue getTransform(const PropKey &) const;
90
+ std::unique_ptr<skottie::TransformPropertyHandle>
91
+ getTransformHandle(const PropKey &, size_t) const;
92
+ bool setTransform(const PropKey &, const skottie::TransformPropertyValue &);
93
+
94
+ std::vector<PropKey> getTextProps() const;
95
+ skottie::TextPropertyValue getText(const PropKey &) const;
96
+ std::unique_ptr<skottie::TextPropertyHandle>
97
+ getTextHandle(const PropKey &, size_t index) const;
98
+ bool setText(const PropKey &, const skottie::TextPropertyValue &);
99
+
100
+ struct MarkerInfo {
101
+ std::string name;
102
+ float t0, t1;
103
+ };
104
+ const std::vector<MarkerInfo> &markers() const { return fMarkers; }
105
+
106
+ // Returns a property observer to be attached to an animation builder.
107
+ sk_sp<skottie::PropertyObserver> getPropertyObserver() const;
108
+
109
+ // Returns a marker observer to be attached to an animation builder.
110
+ sk_sp<skottie::MarkerObserver> getMarkerObserver() const;
111
+
112
+ private:
113
+ class PropertyInterceptor;
114
+ class MarkerInterceptor;
115
+
116
+ std::string acceptKey(const char *, const char *) const;
117
+
118
+ template <typename T> using PropGroup = std::vector<std::unique_ptr<T>>;
119
+
120
+ template <typename T>
121
+ using PropMap = std::unordered_map<PropKey, PropGroup<T>>;
122
+
123
+ template <typename T>
124
+ std::vector<PropKey> getProps(const PropMap<T> &container) const;
125
+
126
+ template <typename V, typename T>
127
+ V get(const PropKey &, const PropMap<T> &container) const;
128
+
129
+ template <typename T>
130
+ std::unique_ptr<T> getHandle(const PropKey &, size_t,
131
+ const PropMap<T> &container) const;
132
+
133
+ template <typename V, typename T>
134
+ bool set(const PropKey &, const V &, const PropMap<T> &container);
135
+
136
+ const Mode fMode;
137
+ const SkString fPrefix;
138
+
139
+ sk_sp<PropertyInterceptor> fPropertyInterceptor;
140
+ sk_sp<MarkerInterceptor> fMarkerInterceptor;
141
+
142
+ PropMap<skottie::ColorPropertyHandle> fColorMap;
143
+ PropMap<skottie::OpacityPropertyHandle> fOpacityMap;
144
+ PropMap<skottie::TransformPropertyHandle> fTransformMap;
145
+ PropMap<skottie::TextPropertyHandle> fTextMap;
146
+ std::vector<MarkerInfo> fMarkers;
147
+ std::string fCurrentNode;
148
+ };
149
+
150
+ /**
151
+ * A sample PrecompInterceptor implementation.
152
+ *
153
+ * Attempts to substitute all precomp layers matching the given pattern (name
154
+ * prefix) with external Lottie animations.
155
+ */
156
+ class ExternalAnimationPrecompInterceptor final
157
+ : public skottie::PrecompInterceptor {
158
+ public:
159
+ ExternalAnimationPrecompInterceptor(sk_sp<skresources::ResourceProvider>,
160
+ const char prefix[]);
161
+ ~ExternalAnimationPrecompInterceptor() override;
162
+
163
+ private:
164
+ sk_sp<skottie::ExternalLayer> onLoadPrecomp(const char[], const char[],
165
+ const SkSize &) override;
166
+
167
+ const sk_sp<skresources::ResourceProvider> fResourceProvider;
168
+ const SkString fPrefix;
169
+ };
170
+
171
+ } // namespace RNSkia
172
+