@shopify/react-native-skia 1.8.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. package/android/cpp/rnskia-android/MainThreadDispatcher.h +1 -1
  2. package/android/cpp/rnskia-android/OpenGLContext.h +4 -4
  3. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +3 -3
  4. package/cpp/api/JsiSkCanvas.h +27 -25
  5. package/cpp/api/JsiSkImage.h +24 -0
  6. package/cpp/api/JsiSkPaint.h +1 -1
  7. package/cpp/rnskia/dom/nodes/JsiAtlasNode.h +5 -1
  8. package/cpp/rnskia/dom/nodes/JsiImageNode.h +8 -4
  9. package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +9 -38
  10. package/cpp/rnskia/dom/props/SamplingProp.h +54 -0
  11. package/ios/RNSkia-iOS/SkiaManager.mm +2 -4
  12. package/lib/commonjs/dom/types/Drawings.d.ts +3 -1
  13. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  14. package/lib/commonjs/dom/types/Shaders.d.ts +2 -3
  15. package/lib/commonjs/dom/types/Shaders.js.map +1 -1
  16. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +1 -8
  17. package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
  18. package/lib/commonjs/renderer/components/image/ImageShader.d.ts +1 -1
  19. package/lib/commonjs/renderer/components/image/ImageShader.js +0 -4
  20. package/lib/commonjs/renderer/components/image/ImageShader.js.map +1 -1
  21. package/lib/commonjs/skia/core/AnimatedImage.d.ts +1 -1
  22. package/lib/commonjs/skia/core/AnimatedImage.js +1 -1
  23. package/lib/commonjs/skia/core/AnimatedImage.js.map +1 -1
  24. package/lib/commonjs/skia/core/Data.d.ts +1 -1
  25. package/lib/commonjs/skia/core/Data.js +2 -8
  26. package/lib/commonjs/skia/core/Data.js.map +1 -1
  27. package/lib/commonjs/skia/types/Canvas.d.ts +2 -2
  28. package/lib/commonjs/skia/types/Canvas.js.map +1 -1
  29. package/lib/commonjs/skia/types/Image/Image.d.ts +18 -0
  30. package/lib/commonjs/skia/types/Image/Image.js +24 -1
  31. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  32. package/lib/commonjs/skia/types/Picture/PictureRecorder.d.ts +2 -1
  33. package/lib/commonjs/skia/types/Picture/PictureRecorder.js.map +1 -1
  34. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +2 -2
  35. package/lib/commonjs/skia/web/JsiSkCanvas.js +15 -2
  36. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  37. package/lib/commonjs/sksg/Container.d.ts +17 -14
  38. package/lib/commonjs/sksg/Container.js +59 -61
  39. package/lib/commonjs/sksg/Container.js.map +1 -1
  40. package/lib/commonjs/sksg/HostConfig.js +4 -9
  41. package/lib/commonjs/sksg/HostConfig.js.map +1 -1
  42. package/lib/commonjs/sksg/Reconciler.js +1 -2
  43. package/lib/commonjs/sksg/Reconciler.js.map +1 -1
  44. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +11 -0
  45. package/lib/commonjs/sksg/Recorder/Recorder.js +9 -0
  46. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
  47. package/lib/commonjs/sksg/Recorder/commands/Drawing.js +11 -4
  48. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
  49. package/lib/commonjs/sksg/Recorder/commands/Shaders.js +8 -3
  50. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
  51. package/lib/module/dom/types/Drawings.d.ts +3 -1
  52. package/lib/module/dom/types/Drawings.js.map +1 -1
  53. package/lib/module/dom/types/Shaders.d.ts +2 -3
  54. package/lib/module/dom/types/Shaders.js.map +1 -1
  55. package/lib/module/external/reanimated/useAnimatedImageValue.js +1 -8
  56. package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
  57. package/lib/module/renderer/components/image/ImageShader.d.ts +1 -1
  58. package/lib/module/renderer/components/image/ImageShader.js +0 -4
  59. package/lib/module/renderer/components/image/ImageShader.js.map +1 -1
  60. package/lib/module/skia/core/AnimatedImage.d.ts +1 -1
  61. package/lib/module/skia/core/AnimatedImage.js +1 -1
  62. package/lib/module/skia/core/AnimatedImage.js.map +1 -1
  63. package/lib/module/skia/core/Data.d.ts +1 -1
  64. package/lib/module/skia/core/Data.js +2 -8
  65. package/lib/module/skia/core/Data.js.map +1 -1
  66. package/lib/module/skia/types/Canvas.d.ts +2 -2
  67. package/lib/module/skia/types/Canvas.js.map +1 -1
  68. package/lib/module/skia/types/Image/Image.d.ts +18 -0
  69. package/lib/module/skia/types/Image/Image.js +21 -0
  70. package/lib/module/skia/types/Image/Image.js.map +1 -1
  71. package/lib/module/skia/types/Picture/PictureRecorder.d.ts +2 -1
  72. package/lib/module/skia/types/Picture/PictureRecorder.js.map +1 -1
  73. package/lib/module/skia/web/JsiSkCanvas.d.ts +2 -2
  74. package/lib/module/skia/web/JsiSkCanvas.js +15 -2
  75. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  76. package/lib/module/sksg/Container.d.ts +17 -14
  77. package/lib/module/sksg/Container.js +56 -59
  78. package/lib/module/sksg/Container.js.map +1 -1
  79. package/lib/module/sksg/HostConfig.js +4 -9
  80. package/lib/module/sksg/HostConfig.js.map +1 -1
  81. package/lib/module/sksg/Reconciler.js +2 -3
  82. package/lib/module/sksg/Reconciler.js.map +1 -1
  83. package/lib/module/sksg/Recorder/Recorder.d.ts +11 -0
  84. package/lib/module/sksg/Recorder/Recorder.js +9 -0
  85. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  86. package/lib/module/sksg/Recorder/commands/Drawing.js +12 -5
  87. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
  88. package/lib/module/sksg/Recorder/commands/Shaders.js +9 -4
  89. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
  90. package/lib/typescript/lib/commonjs/renderer/components/image/ImageShader.d.ts +1 -3
  91. package/lib/typescript/lib/commonjs/skia/core/AnimatedImage.d.ts +1 -1
  92. package/lib/typescript/lib/commonjs/skia/core/Data.d.ts +1 -1
  93. package/lib/typescript/lib/commonjs/skia/types/Image/Image.d.ts +21 -0
  94. package/lib/typescript/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
  95. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +15 -10
  96. package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +4 -4
  97. package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +21 -2
  98. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +5 -0
  99. package/lib/typescript/lib/module/mock/index.d.ts +19 -4
  100. package/lib/typescript/lib/module/renderer/components/image/ImageShader.d.ts +1 -3
  101. package/lib/typescript/lib/module/skia/core/AnimatedImage.d.ts +1 -1
  102. package/lib/typescript/lib/module/skia/core/Data.d.ts +1 -1
  103. package/lib/typescript/lib/module/skia/types/Image/Image.d.ts +21 -0
  104. package/lib/typescript/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
  105. package/lib/typescript/lib/module/sksg/Container.d.ts +15 -10
  106. package/lib/typescript/lib/module/sksg/HostConfig.d.ts +4 -4
  107. package/lib/typescript/lib/module/sksg/Reconciler.d.ts +21 -2
  108. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +5 -0
  109. package/lib/typescript/src/dom/types/Drawings.d.ts +3 -1
  110. package/lib/typescript/src/dom/types/Shaders.d.ts +2 -3
  111. package/lib/typescript/src/renderer/components/image/ImageShader.d.ts +1 -1
  112. package/lib/typescript/src/skia/core/AnimatedImage.d.ts +1 -1
  113. package/lib/typescript/src/skia/core/Data.d.ts +1 -1
  114. package/lib/typescript/src/skia/types/Canvas.d.ts +2 -2
  115. package/lib/typescript/src/skia/types/Image/Image.d.ts +18 -0
  116. package/lib/typescript/src/skia/types/Picture/PictureRecorder.d.ts +2 -1
  117. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +2 -2
  118. package/lib/typescript/src/sksg/Container.d.ts +17 -14
  119. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +11 -0
  120. package/libs/apple/libskia.xcframework/Info.plist +35 -2
  121. package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  122. package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  123. package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
  124. package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
  125. package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  126. package/libs/apple/libskottie.xcframework/Info.plist +36 -3
  127. package/libs/apple/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  128. package/libs/apple/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  129. package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
  130. package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e/libskottie.a +0 -0
  131. package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  132. package/libs/apple/libskparagraph.xcframework/Info.plist +40 -7
  133. package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  134. package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  135. package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
  136. package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e/libskparagraph.a +0 -0
  137. package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  138. package/libs/apple/libsksg.xcframework/Info.plist +35 -2
  139. package/libs/apple/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  140. package/libs/apple/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  141. package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
  142. package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e/libsksg.a +0 -0
  143. package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  144. package/libs/apple/libskshaper.xcframework/Info.plist +33 -0
  145. package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  146. package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  147. package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
  148. package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e/libskshaper.a +0 -0
  149. package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  150. package/libs/apple/libskunicode_core.xcframework/Info.plist +36 -3
  151. package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
  152. package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  153. package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
  154. package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e/libskunicode_core.a +0 -0
  155. package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  156. package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +35 -2
  157. package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  158. package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  159. package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
  160. package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  161. package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  162. package/libs/apple/libsvg.xcframework/Info.plist +36 -3
  163. package/libs/apple/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  164. package/libs/apple/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  165. package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
  166. package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e/libsvg.a +0 -0
  167. package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  168. package/package.json +1 -1
  169. package/react-native-skia.podspec +2 -2
  170. package/src/__tests__/snapshots/animated-images/bird.png +0 -0
  171. package/src/__tests__/snapshots/demos/product.png +0 -0
  172. package/src/__tests__/snapshots/demos/product2.png +0 -0
  173. package/src/__tests__/snapshots/images/bundle-android.png +0 -0
  174. package/src/__tests__/snapshots/images/bundle-ios.png +0 -0
  175. package/src/__tests__/snapshots/images/bundle-node.png +0 -0
  176. package/src/__tests__/snapshots/images/filter.png +0 -0
  177. package/src/dom/types/Drawings.ts +3 -0
  178. package/src/dom/types/Shaders.ts +2 -4
  179. package/src/external/reanimated/useAnimatedImageValue.ts +4 -15
  180. package/src/renderer/__tests__/e2e/Text.spec.tsx +1 -1
  181. package/src/renderer/components/image/ImageShader.tsx +2 -15
  182. package/src/skia/core/AnimatedImage.ts +2 -3
  183. package/src/skia/core/Data.ts +3 -9
  184. package/src/skia/types/Canvas.ts +2 -3
  185. package/src/skia/types/Image/Image.ts +14 -0
  186. package/src/skia/types/Picture/PictureRecorder.ts +2 -1
  187. package/src/skia/web/JsiSkCanvas.ts +50 -29
  188. package/src/sksg/Container.ts +64 -67
  189. package/src/sksg/HostConfig.ts +4 -9
  190. package/src/sksg/Reconciler.ts +3 -3
  191. package/src/sksg/Recorder/Recorder.ts +20 -0
  192. package/src/sksg/Recorder/commands/Drawing.ts +33 -4
  193. package/src/sksg/Recorder/commands/Shaders.ts +21 -8
  194. package/lib/commonjs/sksg/Recorder/Recording.d.ts +0 -7
  195. package/lib/commonjs/sksg/Recorder/Recording.js +0 -12
  196. package/lib/commonjs/sksg/Recorder/Recording.js.map +0 -1
  197. package/lib/module/sksg/Recorder/Recording.d.ts +0 -7
  198. package/lib/module/sksg/Recorder/Recording.js +0 -5
  199. package/lib/module/sksg/Recorder/Recording.js.map +0 -1
  200. package/lib/typescript/lib/commonjs/sksg/Recorder/Recording.d.ts +0 -5
  201. package/lib/typescript/lib/module/sksg/Recorder/Recording.d.ts +0 -4
  202. package/lib/typescript/src/sksg/Recorder/Recording.d.ts +0 -7
  203. package/src/sksg/Recorder/Recording.ts +0 -13
@@ -3,14 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Container = void 0;
6
+ exports.createContainer = exports.Container = void 0;
7
7
  var _ReanimatedProxy = _interopRequireDefault(require("../external/reanimated/ReanimatedProxy"));
8
- var _utils = require("./utils");
8
+ var _renderHelpers = require("../external/reanimated/renderHelpers");
9
9
  var _Recorder = require("./Recorder/Recorder");
10
10
  var _Visitor = require("./Recorder/Visitor");
11
11
  var _Player = require("./Recorder/Player");
12
12
  var _DrawingContext = require("./Recorder/DrawingContext");
13
- var _Recording = require("./Recorder/Recording");
14
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
14
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
15
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -22,7 +21,6 @@ const drawOnscreen = (Skia, nativeId, recording) => {
22
21
  const canvas = rec.beginRecording();
23
22
  // const start = performance.now();
24
23
 
25
- // TODO: because the pool is not a shared value here, it is copied on every frame
26
24
  const ctx = (0, _DrawingContext.createDrawingContext)(Skia, recording.paintPool, canvas);
27
25
  //console.log(recording.commands);
28
26
  (0, _Player.replay)(ctx, recording.commands);
@@ -30,79 +28,79 @@ const drawOnscreen = (Skia, nativeId, recording) => {
30
28
  //const end = performance.now();
31
29
  //console.log("Recording time: ", end - start);
32
30
  SkiaViewApi.setJsiProperty(nativeId, "picture", picture);
31
+ rec.dispose();
32
+ picture.dispose();
33
33
  };
34
34
  class Container {
35
35
  constructor(Skia, nativeId) {
36
36
  this.Skia = Skia;
37
37
  this.nativeId = nativeId;
38
- _defineProperty(this, "_root", []);
39
- _defineProperty(this, "_recording", null);
40
- _defineProperty(this, "unmounted", false);
41
- _defineProperty(this, "values", new Set());
42
- _defineProperty(this, "mapperId", null);
43
- }
44
- get root() {
45
- return this._root;
38
+ _defineProperty(this, "root", []);
39
+ _defineProperty(this, "recording", null);
46
40
  }
47
- set root(root) {
48
- const isOnscreen = this.nativeId !== -1;
49
- if (isOnscreen) {
50
- if (this.mapperId !== null) {
51
- _ReanimatedProxy.default.stopMapper(this.mapperId);
52
- }
53
- const {
54
- nativeId,
55
- Skia,
56
- _recording
57
- } = this;
58
- this.mapperId = _ReanimatedProxy.default.startMapper(() => {
59
- "worklet";
60
-
61
- drawOnscreen(Skia, nativeId, _recording);
62
- }, Array.from(this.values));
41
+ drawOnCanvas(canvas) {
42
+ if (!this.recording) {
43
+ throw new Error("No recording to draw");
63
44
  }
64
- this._root = root;
45
+ const ctx = (0, _DrawingContext.createDrawingContext)(this.Skia, this.recording.paintPool, canvas);
46
+ //console.log(this._recording);
47
+ (0, _Player.replay)(ctx, this.recording.commands);
48
+ }
49
+ }
50
+ exports.Container = Container;
51
+ class StaticContainer extends Container {
52
+ constructor(Skia, nativeId) {
53
+ super(Skia, nativeId);
54
+ }
55
+ redraw() {
65
56
  const recorder = new _Recorder.Recorder();
66
- (0, _Visitor.visit)(recorder, root);
67
- this._recording = (0, _Recording.createRecording)(recorder.commands);
57
+ (0, _Visitor.visit)(recorder, this.root);
58
+ this.recording = recorder.getRecording();
59
+ const isOnScreen = this.nativeId !== -1;
60
+ if (isOnScreen) {
61
+ const rec = this.Skia.PictureRecorder();
62
+ const canvas = rec.beginRecording();
63
+ this.drawOnCanvas(canvas);
64
+ const picture = rec.finishRecordingAsPicture();
65
+ SkiaViewApi.setJsiProperty(this.nativeId, "picture", picture);
66
+ }
68
67
  }
69
- clear() {
70
- console.log("clear container");
68
+ }
69
+ class ReanimatedContainer extends Container {
70
+ constructor(Skia, nativeId) {
71
+ super(Skia, nativeId);
72
+ _defineProperty(this, "mapperId", null);
71
73
  }
72
74
  redraw() {
73
- const isOnscreen = this.nativeId !== -1;
74
- if (isOnscreen) {
75
+ if (this.mapperId !== null) {
76
+ _ReanimatedProxy.default.stopMapper(this.mapperId);
77
+ }
78
+ const recorder = new _Recorder.Recorder();
79
+ (0, _Visitor.visit)(recorder, this.root);
80
+ const record = recorder.getRecording();
81
+ const {
82
+ animationValues
83
+ } = record;
84
+ this.recording = {
85
+ commands: record.commands,
86
+ paintPool: record.paintPool
87
+ };
88
+ if (animationValues.size > 0) {
75
89
  const {
76
90
  nativeId,
77
91
  Skia,
78
- _recording
92
+ recording
79
93
  } = this;
80
- _ReanimatedProxy.default.runOnUI(() => {
81
- drawOnscreen(Skia, nativeId, _recording);
82
- })();
83
- }
84
- }
85
- getNativeId() {
86
- return this.nativeId;
87
- }
88
- unregisterValues(values) {
89
- Object.values(values).filter(_utils.isSharedValue).forEach(value => {
90
- this.values.delete(value);
91
- });
92
- }
93
- registerValues(values) {
94
- Object.values(values).filter(_utils.isSharedValue).forEach(value => {
95
- this.values.add(value);
96
- });
97
- }
98
- drawOnCanvas(canvas) {
99
- if (!this._recording) {
100
- throw new Error("No recording to draw");
94
+ this.mapperId = _ReanimatedProxy.default.startMapper(() => {
95
+ "worklet";
96
+
97
+ drawOnscreen(Skia, nativeId, recording);
98
+ }, Array.from(animationValues));
101
99
  }
102
- const ctx = (0, _DrawingContext.createDrawingContext)(this.Skia, this._recording.paintPool, canvas);
103
- //console.log(this._recording);
104
- (0, _Player.replay)(ctx, this._recording.commands);
105
100
  }
106
101
  }
107
- exports.Container = Container;
102
+ const createContainer = (Skia, nativeId) => {
103
+ return _renderHelpers.HAS_REANIMATED_3 && nativeId !== -1 ? new ReanimatedContainer(Skia, nativeId) : new StaticContainer(Skia, nativeId);
104
+ };
105
+ exports.createContainer = createContainer;
108
106
  //# sourceMappingURL=Container.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_utils","_Recorder","_Visitor","_Player","_DrawingContext","_Recording","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","createDrawingContext","paintPool","replay","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","Container","constructor","Set","root","_root","isOnscreen","mapperId","Rea","stopMapper","_recording","startMapper","Array","from","values","recorder","Recorder","visit","createRecording","clear","console","log","redraw","runOnUI","getNativeId","unregisterValues","filter","isSharedValue","forEach","delete","registerValues","add","drawOnCanvas","Error","exports"],"sources":["Container.ts"],"sourcesContent":["import { type SharedValue } from \"react-native-reanimated\";\n\nimport Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\n\nimport type { Node } from \"./Node\";\nimport { isSharedValue } from \"./utils\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\nimport { createRecording, type Recording } from \"./Recorder/Recording\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n // const start = performance.now();\n\n // TODO: because the pool is not a shared value here, it is copied on every frame\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n //console.log(recording.commands);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nexport class Container {\n private _root: Node[] = [];\n private _recording: Recording | null = null;\n public unmounted = false;\n\n private values = new Set<SharedValue<unknown>>();\n private mapperId: number | null = null;\n\n constructor(public Skia: Skia, private nativeId: number) {}\n\n get root() {\n return this._root;\n }\n\n set root(root: Node[]) {\n const isOnscreen = this.nativeId !== -1;\n if (isOnscreen) {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n const { nativeId, Skia, _recording } = this;\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, _recording!);\n }, Array.from(this.values));\n }\n this._root = root;\n const recorder = new Recorder();\n visit(recorder, root);\n this._recording = createRecording(recorder.commands);\n }\n\n clear() {\n console.log(\"clear container\");\n }\n\n redraw() {\n const isOnscreen = this.nativeId !== -1;\n if (isOnscreen) {\n const { nativeId, Skia, _recording } = this;\n Rea.runOnUI(() => {\n drawOnscreen(Skia, nativeId, _recording!);\n })();\n }\n }\n\n getNativeId() {\n return this.nativeId;\n }\n\n unregisterValues(values: object) {\n Object.values(values)\n .filter(isSharedValue)\n .forEach((value) => {\n this.values.delete(value);\n });\n }\n\n registerValues(values: object) {\n Object.values(values)\n .filter(isSharedValue)\n .forEach((value) => {\n this.values.add(value);\n });\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this._recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this._recording.paintPool,\n canvas\n );\n //console.log(this._recording);\n replay(ctx, this._recording.commands);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF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MzC,GAAG,GAAG,IAAAC,oCAAoB,EAC9B,IAAI,CAACR,IAAI,EACT,IAAI,CAACyB,UAAU,CAAChB,SAAS,EACzBJ,MACF,CAAC;IACD;IACA,IAAAK,cAAM,EAACH,GAAG,EAAE,IAAI,CAACkB,UAAU,CAACd,QAAQ,CAAC;EACvC;AACF;AAACsC,OAAA,CAAAjC,SAAA,GAAAA,SAAA","ignoreList":[]}
1
+ {"version":3,"names":["_ReanimatedProxy","_interopRequireDefault","require","_renderHelpers","_Recorder","_Visitor","_Player","_DrawingContext","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","drawOnscreen","Skia","nativeId","recording","rec","PictureRecorder","canvas","beginRecording","ctx","createDrawingContext","paintPool","replay","commands","picture","finishRecordingAsPicture","SkiaViewApi","setJsiProperty","dispose","Container","constructor","drawOnCanvas","Error","exports","StaticContainer","redraw","recorder","Recorder","visit","root","getRecording","isOnScreen","ReanimatedContainer","mapperId","Rea","stopMapper","record","animationValues","size","startMapper","Array","from","createContainer","HAS_REANIMATED_3"],"sources":["Container.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkCanvas } from \"../skia/types\";\nimport { HAS_REANIMATED_3 } from \"../external/reanimated/renderHelpers\";\n\nimport type { Node } from \"./Node\";\nimport type { Recording } from \"./Recorder/Recorder\";\nimport { Recorder } from \"./Recorder/Recorder\";\nimport { visit } from \"./Recorder/Visitor\";\nimport { replay } from \"./Recorder/Player\";\nimport { createDrawingContext } from \"./Recorder/DrawingContext\";\n\nconst drawOnscreen = (Skia: Skia, nativeId: number, recording: Recording) => {\n \"worklet\";\n\n const rec = Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n // const start = performance.now();\n\n const ctx = createDrawingContext(Skia, recording.paintPool, canvas);\n //console.log(recording.commands);\n replay(ctx, recording.commands);\n const picture = rec.finishRecordingAsPicture();\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n rec.dispose();\n picture.dispose();\n};\n\nexport abstract class Container {\n public root: Node[] = [];\n protected recording: Recording | null = null;\n\n constructor(protected Skia: Skia, protected nativeId: number) {}\n\n drawOnCanvas(canvas: SkCanvas) {\n if (!this.recording) {\n throw new Error(\"No recording to draw\");\n }\n const ctx = createDrawingContext(\n this.Skia,\n this.recording.paintPool,\n canvas\n );\n //console.log(this._recording);\n replay(ctx, this.recording.commands);\n }\n\n abstract redraw(): void;\n}\n\nclass StaticContainer extends Container {\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n const recorder = new Recorder();\n visit(recorder, this.root);\n this.recording = recorder.getRecording();\n const isOnScreen = this.nativeId !== -1;\n if (isOnScreen) {\n const rec = this.Skia.PictureRecorder();\n const canvas = rec.beginRecording();\n this.drawOnCanvas(canvas);\n const picture = rec.finishRecordingAsPicture();\n SkiaViewApi.setJsiProperty(this.nativeId, \"picture\", picture);\n }\n }\n}\n\nclass ReanimatedContainer extends Container {\n private mapperId: number | null = null;\n\n constructor(Skia: Skia, nativeId: number) {\n super(Skia, nativeId);\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n }\n const recorder = new Recorder();\n visit(recorder, this.root);\n const record = recorder.getRecording();\n const { animationValues } = record;\n this.recording = {\n commands: record.commands,\n paintPool: record.paintPool,\n };\n if (animationValues.size > 0) {\n const { nativeId, Skia, recording } = this;\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n drawOnscreen(Skia, nativeId, recording!);\n }, Array.from(animationValues));\n }\n }\n}\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n return HAS_REANIMATED_3 && nativeId !== -1\n ? new ReanimatedContainer(Skia, nativeId)\n : new StaticContainer(Skia, nativeId);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,sBAAA,CA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C,GAAG,IAAI;MAC1C,IAAI,CAAC6B,QAAQ,GAAGC,wBAAG,CAACK,WAAW,CAAC,MAAM;QACpC,SAAS;;QACTtC,YAAY,CAACC,IAAI,EAAEC,QAAQ,EAAEC,SAAU,CAAC;MAC1C,CAAC,EAAEoC,KAAK,CAACC,IAAI,CAACJ,eAAe,CAAC,CAAC;IACjC;EACF;AACF;AAEO,MAAMK,eAAe,GAAGA,CAACxC,IAAU,EAAEC,QAAgB,KAAK;EAC/D,OAAOwC,+BAAgB,IAAIxC,QAAQ,KAAK,CAAC,CAAC,GACtC,IAAI6B,mBAAmB,CAAC9B,IAAI,EAAEC,QAAQ,CAAC,GACvC,IAAIqB,eAAe,CAACtB,IAAI,EAAEC,QAAQ,CAAC;AACzC,CAAC;AAACoB,OAAA,CAAAmB,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -43,14 +43,13 @@ const sksgHostConfig = exports.sksgHostConfig = {
43
43
  // return SpanNode({}, text) as SkNode;
44
44
  throw new Error("Text nodes are not supported yet");
45
45
  },
46
- createInstance(type, propsWithChildren, container, _hostContext, _internalInstanceHandle) {
46
+ createInstance(type, propsWithChildren, _container, _hostContext, _internalInstanceHandle) {
47
47
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
48
  const {
49
49
  children,
50
50
  ...props
51
51
  } = propsWithChildren;
52
52
  debug("createInstance", type);
53
- container.registerValues(props);
54
53
  const instance = {
55
54
  type,
56
55
  props,
@@ -69,7 +68,7 @@ const sksgHostConfig = exports.sksgHostConfig = {
69
68
  // if finalizeInitialChildren = true
70
69
  debug("commitMount");
71
70
  },
72
- prepareForCommit(_containerInfo) {
71
+ prepareForCommit(_container) {
73
72
  debug("prepareForCommit");
74
73
  return null;
75
74
  },
@@ -84,9 +83,8 @@ const sksgHostConfig = exports.sksgHostConfig = {
84
83
  commitTextUpdate: (_textInstance, _oldText, _newText) => {
85
84
  // textInstance.instance = newText;
86
85
  },
87
- clearContainer: container => {
86
+ clearContainer: _container => {
88
87
  debug("clearContainer");
89
- container.clear();
90
88
  },
91
89
  prepareUpdate(_instance, _type, oldProps, newProps, container, _hostContext) {
92
90
  debug("prepareUpdate");
@@ -94,8 +92,6 @@ const sksgHostConfig = exports.sksgHostConfig = {
94
92
  if (propsAreEqual) {
95
93
  return null;
96
94
  }
97
- container.unregisterValues(oldProps);
98
- container.registerValues(newProps);
99
95
  return container;
100
96
  },
101
97
  preparePortalMount: () => {
@@ -121,7 +117,6 @@ const sksgHostConfig = exports.sksgHostConfig = {
121
117
  container.root = newChildren;
122
118
  },
123
119
  replaceContainerChildren(container, newChildren) {
124
- debug("replaceContainerChildren");
125
120
  container.root = newChildren;
126
121
  },
127
122
  cloneHiddenInstance(_instance, _type, _props) {
@@ -136,7 +131,7 @@ const sksgHostConfig = exports.sksgHostConfig = {
136
131
  getCurrentEventPriority: () => _constants.DefaultEventPriority,
137
132
  beforeActiveInstanceBlur: () => {},
138
133
  afterActiveInstanceBlur: () => {},
139
- detachDeletedInstance: () => {},
134
+ detachDeletedInstance: _node => {},
140
135
  getInstanceFromNode: function (_node) {
141
136
  throw new Error("Function not implemented.");
142
137
  },
@@ -1 +1 @@
1
- {"version":3,"names":["_constants","require","_typeddash","DEBUG","debug","args","console","log","exports","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","container","children","props","registerValues","instance","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","_containerInfo","resetAfterCommit","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","clear","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","shallowEq","unregisterValues","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","getInstanceFromNode","_node","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport type { NodeType } from \"../dom/types\";\nimport { shallowEq } from \"../renderer/typeddash\";\n\nimport type { Node } from \"./Node\";\nimport type { Container } from \"./Container\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ntype Instance = Node;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nexport const sksgHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n supportsMutation: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n propsWithChildren,\n container,\n _hostContext,\n _internalInstanceHandle\n ) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { children, ...props } = propsWithChildren as any;\n debug(\"createInstance\", type);\n container.registerValues(props);\n const instance = {\n type,\n props,\n children: [],\n };\n return instance;\n },\n\n appendInitialChild(parentInstance: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_containerInfo) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (container) => {\n debug(\"clearContainer\");\n container.clear();\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n container.unregisterValues(oldProps);\n container.registerValues(newProps);\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: newProps,\n children: keepChildren ? [...instance.children] : [],\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"replaceContainerChildren\");\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: () => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\n },\n};\n"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AALA;;AAUA,MAAME,KAAK,GAAG,KAAK;AACZ,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AAACG,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AA+BK,MAAMK,cAA8B,GAAAD,OAAA,CAAAC,cAAA,GAAG;EAC5C;AACF;AACA;EACEC,gBAAgB,E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AAC;EACjCC,qBAAqB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAC/BC,mBAAmB,EAAE,SAAAA,CAAUC,KAAK,EAA4B;IAC9D,MAAM,IAAIvD,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDwD,kBAAkB,EAAE,SAAAA,CAAUC,cAAc,EAAE7B,SAAS,EAAQ;IAC7D,MAAM,IAAI5B,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACD0D,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,MAAM,IAAIzD,KAAK,CAAC,2BAA2B,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_constants","require","_typeddash","DEBUG","debug","args","console","log","exports","sksgHostConfig","supportsMutation","isPrimaryRenderer","supportsPersistence","supportsHydration","scheduleTimeout","setTimeout","cancelTimeout","clearTimeout","noTimeout","getRootHostContext","_rootContainerInstance","getChildHostContext","_parentHostContext","_type","shouldSetTextContent","_props","createTextInstance","_text","_hostContext","_internalInstanceHandle","Error","createInstance","type","propsWithChildren","_container","children","props","instance","appendInitialChild","parentInstance","child","push","finalizeInitialChildren","commitMount","prepareForCommit","resetAfterCommit","container","redraw","getPublicInstance","node","commitTextUpdate","_textInstance","_oldText","_newText","clearContainer","prepareUpdate","_instance","oldProps","newProps","propsAreEqual","shallowEq","preparePortalMount","cloneInstance","_updatePayload","_oldProps","keepChildren","_recyclableInstance","createContainerChildSet","appendChildToContainerChildSet","childSet","finalizeContainerChildren","newChildren","root","replaceContainerChildren","cloneHiddenInstance","cloneHiddenTextInstance","getCurrentEventPriority","DefaultEventPriority","beforeActiveInstanceBlur","afterActiveInstanceBlur","detachDeletedInstance","_node","getInstanceFromNode","prepareScopeUpdate","_scopeInstance","getInstanceFromScope"],"sources":["HostConfig.ts"],"sourcesContent":["/*global NodeJS*/\nimport type { Fiber, HostConfig } from \"react-reconciler\";\nimport { DefaultEventPriority } from \"react-reconciler/constants\";\n\nimport type { NodeType } from \"../dom/types\";\nimport { shallowEq } from \"../renderer/typeddash\";\n\nimport type { Node } from \"./Node\";\nimport type { Container } from \"./Container\";\n\nconst DEBUG = false;\nexport const debug = (...args: Parameters<typeof console.log>) => {\n if (DEBUG) {\n console.log(...args);\n }\n};\n\ntype Instance = Node;\n\ntype Props = object;\ntype TextInstance = Node;\ntype SuspenseInstance = Instance;\ntype HydratableInstance = Instance;\ntype PublicInstance = Instance;\ntype HostContext = null;\ntype UpdatePayload = Container;\ntype ChildSet = Node[];\ntype TimeoutHandle = NodeJS.Timeout;\ntype NoTimeout = -1;\n\ntype SkiaHostConfig = HostConfig<\n NodeType,\n Props,\n Container,\n Instance,\n TextInstance,\n SuspenseInstance,\n HydratableInstance,\n PublicInstance,\n HostContext,\n UpdatePayload,\n ChildSet,\n TimeoutHandle,\n NoTimeout\n>;\n\nexport const sksgHostConfig: SkiaHostConfig = {\n /**\n * This function is used by the reconciler in order to calculate current time for prioritising work.\n */\n supportsMutation: false,\n isPrimaryRenderer: false,\n supportsPersistence: true,\n supportsHydration: false,\n //supportsMicrotask: true,\n scheduleTimeout: setTimeout,\n cancelTimeout: clearTimeout,\n noTimeout: -1,\n\n getRootHostContext: (_rootContainerInstance: Container) => {\n debug(\"getRootHostContext\");\n return null;\n },\n\n getChildHostContext(_parentHostContext, _type, _rootContainerInstance) {\n debug(\"getChildHostContext\");\n return null;\n },\n\n shouldSetTextContent(_type, _props) {\n return false;\n },\n\n createTextInstance(\n _text,\n _rootContainerInstance,\n _hostContext,\n _internalInstanceHandle\n ) {\n debug(\"createTextInstance\");\n // return SpanNode({}, text) as SkNode;\n throw new Error(\"Text nodes are not supported yet\");\n },\n\n createInstance(\n type,\n propsWithChildren,\n _container,\n _hostContext,\n _internalInstanceHandle\n ) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const { children, ...props } = propsWithChildren as any;\n debug(\"createInstance\", type);\n const instance = {\n type,\n props,\n children: [],\n };\n return instance;\n },\n\n appendInitialChild(parentInstance: Instance, child: Instance | TextInstance) {\n parentInstance.children.push(child);\n },\n\n finalizeInitialChildren(\n parentInstance,\n _type,\n _props,\n _rootContainerInstance,\n _hostContext\n ) {\n debug(\"finalizeInitialChildren\", parentInstance);\n return false;\n },\n\n commitMount() {\n // if finalizeInitialChildren = true\n debug(\"commitMount\");\n },\n\n prepareForCommit(_container: Container) {\n debug(\"prepareForCommit\");\n return null;\n },\n\n resetAfterCommit(container) {\n debug(\"resetAfterCommit\");\n container.redraw();\n },\n\n getPublicInstance(node: Instance) {\n debug(\"getPublicInstance\");\n return node;\n },\n\n commitTextUpdate: (\n _textInstance: TextInstance,\n _oldText: string,\n _newText: string\n ) => {\n // textInstance.instance = newText;\n },\n\n clearContainer: (_container) => {\n debug(\"clearContainer\");\n },\n\n prepareUpdate(\n _instance: Instance,\n _type: string,\n oldProps: Props,\n newProps: Props,\n container: Container,\n _hostContext: HostContext\n ) {\n debug(\"prepareUpdate\");\n const propsAreEqual = shallowEq(oldProps, newProps);\n if (propsAreEqual) {\n return null;\n }\n return container;\n },\n\n preparePortalMount: () => {\n debug(\"preparePortalMount\");\n },\n\n cloneInstance(\n instance,\n _updatePayload,\n _type,\n _oldProps,\n newProps,\n _internalInstanceHandle,\n keepChildren: boolean,\n _recyclableInstance: null | Instance\n ) {\n debug(\"cloneInstance\");\n\n return {\n type: instance.type,\n props: newProps,\n children: keepChildren ? [...instance.children] : [],\n };\n },\n\n createContainerChildSet(): ChildSet {\n debug(\"createContainerChildSet\");\n return [];\n },\n\n appendChildToContainerChildSet(\n childSet: ChildSet,\n child: Instance | TextInstance\n ): void {\n childSet.push(child);\n },\n\n finalizeContainerChildren(container: Container, newChildren: ChildSet) {\n debug(\"finalizeContainerChildren\");\n container.root = newChildren;\n },\n\n replaceContainerChildren(container: Container, newChildren: ChildSet) {\n container.root = newChildren;\n },\n\n cloneHiddenInstance(\n _instance: Instance,\n _type: string,\n _props: Props\n ): Instance {\n debug(\"cloneHiddenInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n\n cloneHiddenTextInstance(_instance: Instance, _text: string): TextInstance {\n debug(\"cloneHiddenTextInstance\");\n throw new Error(\"Not yet implemented.\");\n },\n // see https://github.com/pmndrs/react-three-fiber/pull/2360#discussion_r916356874\n getCurrentEventPriority: () => DefaultEventPriority,\n beforeActiveInstanceBlur: () => {},\n afterActiveInstanceBlur: () => {},\n detachDeletedInstance: (_node: Instance) => {},\n getInstanceFromNode: function (_node): Fiber | null | undefined {\n throw new Error(\"Function not implemented.\");\n },\n prepareScopeUpdate: function (_scopeInstance, _instance): void {\n throw new Error(\"Function not implemented.\");\n },\n getInstanceFromScope: function (_scopeInstance): Instance | null {\n throw new Error(\"Function not implemented.\");\n },\n};\n"],"mappings":";;;;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AALA;;AAUA,MAAME,KAAK,GAAG,KAAK;AACZ,MAAMC,KAAK,GAAGA,CAAC,GAAGC,IAAoC,KAAK;EAChE,IAAIF,KAAK,EAAE;IACTG,OAAO,CAACC,GAAG,CAAC,GAAGF,IAAI,CAAC;EACtB;AACF,CAAC;AAACG,OAAA,CAAAJ,KAAA,GAAAA,KAAA;AA+BK,MAAMK,cAA8B,GAAAD,OAAA,CAAAC,cAAA,GAAG;EAC5C;AACF;AACA;EACEC,gBAAgB,EAAE,KAAK;EACvBC,iBAAiB,EAAE,KAAK;EACxBC,mBAAmB,EAAE,IAAI;EACzBC,iBAAiB,EAAE,KAAK;EACxB;EACAC,eAAe,EAAEC,UAAU;EAC3BC,aAAa,EAAEC,YAAY;EAC3BC,SAAS,EAAE,CAAC,CAAC;EAEbC,kBAAkB,EAAGC,sBAAiC,IAAK;IACzDhB,KAAK,CAAC,oBAAoB,CAAC;IAC3B,OAAO,IAAI;EACb,CAAC;EAEDiB,mBAAmBA,CAACC,kBAAkB,EAAEC,KAAK,EAAEH,sBAAsB,EAAE;IACrEhB,KAAK,CAAC,qBAAqB,CAAC;I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K,CAAC,2BAA2B,CAAC;IAClC0C,SAAS,CAAC0B,IAAI,GAAGD,WAAW;EAC9B,CAAC;EAEDE,wBAAwBA,CAAC3B,SAAoB,EAAEyB,WAAqB,EAAE;IACpEzB,SAAS,CAAC0B,IAAI,GAAGD,WAAW;EAC9B,CAAC;EAEDG,mBAAmBA,CACjBlB,SAAmB,EACnBjC,KAAa,EACbE,MAAa,EACH;IACVrB,KAAK,CAAC,qBAAqB,CAAC;IAC5B,MAAM,IAAI0B,KAAK,CAAC,sBAAsB,CAAC;EACzC,CAAC;EAED6C,uBAAuBA,CAACnB,SAAmB,EAAE7B,KAAa,EAAgB;IACxEvB,KAAK,CAAC,yBAAyB,CAAC;IAChC,MAAM,IAAI0B,KAAK,CAAC,sBAAsB,CAAC;EACzC,CAAC;EACD;EACA8C,uBAAuB,EAAEA,CAAA,KAAMC,+BAAoB;EACnDC,wBAAwB,EAAEA,CAAA,KAAM,CAAC,CAAC;EAClCC,uBAAuB,EAAEA,CAAA,KAAM,CAAC,CAAC;EACjCC,qBAAqB,EAAGC,KAAe,IAAK,CAAC,CAAC;EAC9CC,mBAAmB,EAAE,SAAAA,CAAUD,KAAK,EAA4B;IAC9D,MAAM,IAAInD,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDqD,kBAAkB,EAAE,SAAAA,CAAUC,cAAc,EAAE5B,SAAS,EAAQ;IAC7D,MAAM,IAAI1B,KAAK,CAAC,2BAA2B,CAAC;EAC9C,CAAC;EACDuD,oBAAoB,EAAE,SAAAA,CAAUD,cAAc,EAAmB;IAC/D,MAAM,IAAItD,KAAK,CAAC,2BAA2B,CAAC;EAC9C;AACF,CAAC","ignoreList":[]}
@@ -23,7 +23,7 @@ class SkiaSGRoot {
23
23
  this.Skia = Skia;
24
24
  _defineProperty(this, "root", void 0);
25
25
  _defineProperty(this, "container", void 0);
26
- this.container = new _Container.Container(Skia, nativeId);
26
+ this.container = (0, _Container.createContainer)(Skia, nativeId);
27
27
  this.root = skiaReconciler.createContainer(this.container, 0, null, true, null, "", console.error, null);
28
28
  }
29
29
  get sg() {
@@ -51,7 +51,6 @@ class SkiaSGRoot {
51
51
  return recorder.finishRecordingAsPicture();
52
52
  }
53
53
  unmount() {
54
- this.container.unmounted = true;
55
54
  skiaReconciler.updateContainer(null, this.root, null, () => {
56
55
  (0, _HostConfig.debug)("unmountContainer");
57
56
  });
@@ -1 +1 @@
1
- {"version":3,"names":["_reactReconciler","_interopRequireDefault","require","_types","_HostConfig","_Container","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","skiaReconciler","ReactReconciler","sksgHostConfig","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","container","Container","root","createContainer","console","error","sg","children","type","NodeType","Group","props","isDeclaration","render","element","updateContainer","debug","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount","unmounted","exports"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport { Container } from \"./Container\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(public Skia: Skia, nativeId = -1) {\n this.container = new Container(Skia, nativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n render(element: ReactNode) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skiaReconciler.updateContainer(element as any, this.root, null, () => {\n debug(\"updateContainer\");\n });\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n getPicture() {\n const recorder = this.Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n this.drawOnCanvas(canvas);\n return recorder.finishRecordingAsPicture();\n }\n\n unmount() {\n this.container.unmounted = true;\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAAwC,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAL,CAAA,GAAAK,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAA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,MAAMC,QAAQ,GAAG,IAAI,CAACtB,IAAI,CAACuB,eAAe,CAAC,CAAC;IAC5C,MAAMH,MAAM,GAAGE,QAAQ,CAACE,cAAc,CAAC,CAAC;IACxC,IAAI,CAACL,YAAY,CAACC,MAAM,CAAC;IACzB,OAAOE,QAAQ,CAACG,wBAAwB,CAAC,CAAC;EAC5C;EAEAC,OAAOA,CAAA,EAAG;IACR,IAAI,CAACxB,SAAS,CAACyB,SAAS,GAAG,IAAI;IAC/BpC,cAAc,CAAC0B,eAAe,CAAC,IAAI,EAAE,IAAI,CAACb,IAAI,EAAE,IAAI,EAAE,MAAM;MAC1D,IAAAc,iBAAK,EAAC,kBAAkB,CAAC;IAC3B,CAAC,CAAC;EACJ;AACF;AAACU,OAAA,CAAA9B,UAAA,GAAAA,UAAA","ignoreList":[]}
1
+ {"version":3,"names":["_reactReconciler","_interopRequireDefault","require","_types","_HostConfig","_Container","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","skiaReconciler","ReactReconciler","sksgHostConfig","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaSGRoot","constructor","Skia","nativeId","container","createContainer","root","console","error","sg","children","type","NodeType","Group","props","isDeclaration","render","element","updateContainer","debug","drawOnCanvas","canvas","getPicture","recorder","PictureRecorder","beginRecording","finishRecordingAsPicture","unmount","exports"],"sources":["Reconciler.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { SkCanvas, Skia } from \"../skia/types\";\nimport { NodeType } from \"../dom/types\";\n\nimport { debug, sksgHostConfig } from \"./HostConfig\";\nimport type { Container } from \"./Container\";\nimport { createContainer } from \"./Container\";\n\nconst skiaReconciler = ReactReconciler(sksgHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaSGRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(public Skia: Skia, nativeId = -1) {\n this.container = createContainer(Skia, nativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n get sg() {\n const children = this.container.root;\n return { type: NodeType.Group, props: {}, children, isDeclaration: false };\n }\n\n render(element: ReactNode) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skiaReconciler.updateContainer(element as any, this.root, null, () => {\n debug(\"updateContainer\");\n });\n }\n\n drawOnCanvas(canvas: SkCanvas) {\n this.container.drawOnCanvas(canvas);\n }\n\n getPicture() {\n const recorder = this.Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n this.drawOnCanvas(canvas);\n return recorder.finishRecordingAsPicture();\n }\n\n unmount() {\n skiaReconciler.updateContainer(null, this.root, null, () => {\n debug(\"unmountContainer\");\n });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,gBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AAA8C,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,CAAAC,cAAA,CAAAR,CAAA,EAAAI,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAZ,CAAA,CAAAI,CAAA,IAAAC,CAAA,EAAAL,CAAA;AAAA,SAAAM,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAA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e,CAACD,OAAO,EAAS,IAAI,CAACX,IAAI,EAAE,IAAI,EAAE,MAAM;MACpE,IAAAa,iBAAK,EAAC,iBAAiB,CAAC;IAC1B,CAAC,CAAC;EACJ;EAEAC,YAAYA,CAACC,MAAgB,EAAE;IAC7B,IAAI,CAACjB,SAAS,CAACgB,YAAY,CAACC,MAAM,CAAC;EACrC;EAEAC,UAAUA,CAAA,EAAG;IACX,MAAMC,QAAQ,GAAG,IAAI,CAACrB,IAAI,CAACsB,eAAe,CAAC,CAAC;IAC5C,MAAMH,MAAM,GAAGE,QAAQ,CAACE,cAAc,CAAC,CAAC;IACxC,IAAI,CAACL,YAAY,CAACC,MAAM,CAAC;IACzB,OAAOE,QAAQ,CAACG,wBAAwB,CAAC,CAAC;EAC5C;EAEAC,OAAOA,CAAA,EAAG;IACRlC,cAAc,CAACyB,eAAe,CAAC,IAAI,EAAE,IAAI,CAACZ,IAAI,EAAE,IAAI,EAAE,MAAM;MAC1D,IAAAa,iBAAK,EAAC,kBAAkB,CAAC;IAC3B,CAAC,CAAC;EACJ;AACF;AAACS,OAAA,CAAA5B,UAAA,GAAAA,UAAA","ignoreList":[]}
@@ -2,9 +2,19 @@ import type { SharedValue } from "react-native-reanimated";
2
2
  import { NodeType } from "../../dom/types";
3
3
  import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PaintProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, BoxProps, BoxShadowProps } from "../../dom/types";
4
4
  import type { AnimatedProps } from "../../renderer";
5
+ import type { SkPaint } from "../../skia/types";
5
6
  import type { Command } from "./Core";
7
+ export interface Recording {
8
+ commands: Command[];
9
+ paintPool: SkPaint[];
10
+ }
11
+ interface AnimationValues {
12
+ animationValues: Set<SharedValue<unknown>>;
13
+ }
6
14
  export declare class Recorder {
7
15
  commands: Command[];
16
+ animationValues: Set<SharedValue<unknown>>;
17
+ getRecording(): Recording & AnimationValues;
8
18
  private processProps;
9
19
  private add;
10
20
  savePaint(props: AnimatedProps<PaintProps>): void;
@@ -48,3 +58,4 @@ export declare class Recorder {
48
58
  drawParagraph(props: AnimatedProps<ParagraphProps>): void;
49
59
  drawAtlas(props: AnimatedProps<AtlasProps>): void;
50
60
  }
61
+ export {};
@@ -14,6 +14,14 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
14
14
  class Recorder {
15
15
  constructor() {
16
16
  _defineProperty(this, "commands", []);
17
+ _defineProperty(this, "animationValues", new Set());
18
+ }
19
+ getRecording() {
20
+ return {
21
+ commands: this.commands,
22
+ paintPool: [],
23
+ animationValues: this.animationValues
24
+ };
17
25
  }
18
26
  processProps(props) {
19
27
  const animatedProps = {};
@@ -21,6 +29,7 @@ class Recorder {
21
29
  for (const key in props) {
22
30
  const prop = props[key];
23
31
  if ((0, _utils.isSharedValue)(prop)) {
32
+ this.animationValues.add(prop);
24
33
  props[key] = prop.value;
25
34
  animatedProps[key] = prop;
26
35
  hasAnimatedProps = true;
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","_utils","_Node","_Core","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Recorder","constructor","processProps","props","animatedProps","hasAnimatedProps","key","prop","isSharedValue","undefined","add","command","commands","push","savePaint","type","CommandType","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","isPathEffect","Error","PushPathEffect","pushImageFilter","imageFilterType","isImageFilter","PushImageFilter","pushColorFilter","colorFilterType","isColorFilter","PushColorFilter","pushShader","shaderType","isShader","NodeType","Blend","PushShader","pushBlurMaskFilter","PushBlurMaskFilter","composePathEffect","ComposePathEffect","composeColorFilter","ComposeColorFilter","composeImageFilter","ComposeImageFilter","saveCTM","SaveCTM","restoreCTM","RestoreCTM","drawPaint","DrawPaint","saveLayer","SaveLayer","saveBackdropFilter","SaveBackdropFilter","drawBox","boxProps","shadows","forEach","shadow","DrawBox","drawImage","DrawImage","drawCircle","DrawCircle","drawPoints","DrawPoints","drawPath","DrawPath","drawRect","DrawRect","drawRRect","DrawRRect","drawOval","DrawOval","drawLine","DrawLine","drawPatch","DrawPatch","drawVertices","DrawVertices","drawDiffRect","DrawDiffRect","drawText","DrawText","drawTextPath","DrawTextPath","drawTextBlob","DrawTextBlob","drawGlyphs","DrawGlyphs","drawPicture","DrawPicture","drawImageSVG","DrawImageSVG","drawParagraph","DrawParagraph","drawAtlas","DrawAtlas","exports"],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport { NodeType } from \"../../dom/types\";\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PaintProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n BoxProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\n\nimport { CommandType } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nexport class Recorder {\n commands: Command[] = [];\n\n private processProps(props: Record<string, unknown>) {\n const animatedProps: Record<string, SharedValue<unknown>> = {};\n let hasAnimatedProps = false;\n\n for (const key in props) {\n const prop = props[key];\n if (isSharedValue(prop)) {\n props[key] = prop.value;\n animatedProps[key] = prop;\n hasAnimatedProps = true;\n }\n }\n\n return {\n props,\n animatedProps: hasAnimatedProps ? animatedProps : undefined,\n };\n }\n\n private add(command: Command) {\n if (command.props) {\n const { animatedProps } = this.processProps(\n command.props as Record<string, unknown>\n );\n if (animatedProps) {\n command.animatedProps = animatedProps;\n }\n }\n this.commands.push(command);\n }\n\n savePaint(props: AnimatedProps<PaintProps>) {\n this.add({ type: CommandType.SavePaint, props });\n }\n\n restorePaint() {\n this.add({ type: CommandType.RestorePaint });\n }\n\n restorePaintDeclaration() {\n this.add({ type: CommandType.RestorePaintDeclaration });\n }\n\n materializePaint() {\n this.add({ type: CommandType.MaterializePaint });\n }\n\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>) {\n if (!isPathEffect(pathEffectType)) {\n throw new Error(\"Invalid color filter type: \" + pathEffectType);\n }\n this.add({\n type: CommandType.PushPathEffect,\n pathEffectType,\n props,\n });\n }\n\n pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isImageFilter(imageFilterType)) {\n throw new Error(\"Invalid color filter type: \" + imageFilterType);\n }\n this.add({\n type: CommandType.PushImageFilter,\n imageFilterType,\n props,\n });\n }\n\n pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isColorFilter(colorFilterType)) {\n throw new Error(\"Invalid color filter type: \" + colorFilterType);\n }\n this.add({\n type: CommandType.PushColorFilter,\n colorFilterType,\n props,\n });\n }\n\n pushShader(shaderType: NodeType, props: AnimatedProps<unknown>) {\n if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {\n throw new Error(\"Invalid color filter type: \" + shaderType);\n }\n this.add({ type: CommandType.PushShader, shaderType, props });\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>) {\n this.add({ type: CommandType.PushBlurMaskFilter, props });\n }\n\n composePathEffect() {\n this.add({ type: CommandType.ComposePathEffect });\n }\n\n composeColorFilter() {\n this.add({ type: CommandType.ComposeColorFilter });\n }\n\n composeImageFilter() {\n this.add({ type: CommandType.ComposeImageFilter });\n }\n\n saveCTM(props: AnimatedProps<CTMProps>) {\n this.add({ type: CommandType.SaveCTM, props });\n }\n\n restoreCTM() {\n this.add({ type: CommandType.RestoreCTM });\n }\n\n drawPaint() {\n this.add({ type: CommandType.DrawPaint });\n }\n\n saveLayer() {\n this.add({ type: CommandType.SaveLayer });\n }\n\n saveBackdropFilter() {\n this.add({ type: CommandType.SaveBackdropFilter });\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ) {\n shadows.forEach((shadow) => {\n if (shadow.props) {\n if (shadow.props) {\n const { animatedProps } = this.processProps(\n shadow.props as unknown as Record<string, unknown>\n );\n if (animatedProps) {\n shadow.animatedProps = animatedProps;\n }\n }\n }\n });\n this.add({ type: CommandType.DrawBox, props: boxProps, shadows });\n }\n\n drawImage(props: AnimatedProps<ImageProps>) {\n this.add({ type: CommandType.DrawImage, props });\n }\n\n drawCircle(props: AnimatedProps<CircleProps>) {\n this.add({ type: CommandType.DrawCircle, props });\n }\n drawPoints(props: AnimatedProps<PointsProps>) {\n this.add({ type: CommandType.DrawPoints, props });\n }\n\n drawPath(props: AnimatedProps<PathProps>) {\n this.add({ type: CommandType.DrawPath, props });\n }\n\n drawRect(props: AnimatedProps<RectProps>) {\n this.add({ type: CommandType.DrawRect, props });\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>) {\n this.add({ type: CommandType.DrawRRect, props });\n }\n\n drawOval(props: AnimatedProps<OvalProps>) {\n this.add({ type: CommandType.DrawOval, props });\n }\n\n drawLine(props: AnimatedProps<LineProps>) {\n this.add({ type: CommandType.DrawLine, props });\n }\n\n drawPatch(props: AnimatedProps<PatchProps>) {\n this.add({ type: CommandType.DrawPatch, props });\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>) {\n this.add({ type: CommandType.DrawVertices, props });\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>) {\n this.add({ type: CommandType.DrawDiffRect, props });\n }\n\n drawText(props: AnimatedProps<TextProps>) {\n this.add({ type: CommandType.DrawText, props });\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>) {\n this.add({ type: CommandType.DrawTextPath, props });\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>) {\n this.add({ type: CommandType.DrawTextBlob, props });\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>) {\n this.add({ type: CommandType.DrawGlyphs, props });\n }\n\n drawPicture(props: AnimatedProps<PictureProps>) {\n this.add({ type: CommandType.DrawPicture, props });\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>) {\n this.add({ type: CommandType.DrawImageSVG, props });\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>) {\n this.add({ type: CommandType.DrawParagraph, props });\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>) {\n this.add({ type: CommandType.DrawAtlas, props });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AA4BA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CA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G,CAAC;MAAEK,IAAI,EAAEC,iBAAW,CAAC8E,YAAY;MAAE3F;IAAM,CAAC,CAAC;EACrD;EAEA4F,UAAUA,CAAC5F,KAAiC,EAAE;IAC5C,IAAI,CAACO,GAAG,CAAC;MAAEK,IAAI,EAAEC,iBAAW,CAACgF,UAAU;MAAE7F;IAAM,CAAC,CAAC;EACnD;EAEA8F,WAAWA,CAAC9F,KAAkC,EAAE;IAC9C,IAAI,CAACO,GAAG,CAAC;MAAEK,IAAI,EAAEC,iBAAW,CAACkF,WAAW;MAAE/F;IAAM,CAAC,CAAC;EACpD;EAEAgG,YAAYA,CAAChG,KAAmC,EAAE;IAChD,IAAI,CAACO,GAAG,CAAC;MAAEK,IAAI,EAAEC,iBAAW,CAACoF,YAAY;MAAEjG;IAAM,CAAC,CAAC;EACrD;EAEAkG,aAAaA,CAAClG,KAAoC,EAAE;IAClD,IAAI,CAACO,GAAG,CAAC;MAAEK,IAAI,EAAEC,iBAAW,CAACsF,aAAa;MAAEnG;IAAM,CAAC,CAAC;EACtD;EAEAoG,SAASA,CAACpG,KAAgC,EAAE;IAC1C,IAAI,CAACO,GAAG,CAAC;MAAEK,IAAI,EAAEC,iBAAW,CAACwF,SAAS;MAAErG;IAAM,CAAC,CAAC;EAClD;AACF;AAACsG,OAAA,CAAAzG,QAAA,GAAAA,QAAA","ignoreList":[]}
1
+ {"version":3,"names":["_types","require","_utils","_Node","_Core","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","Recorder","constructor","Set","getRecording","commands","paintPool","animationValues","processProps","props","animatedProps","hasAnimatedProps","key","prop","isSharedValue","add","undefined","command","push","savePaint","type","CommandType","SavePaint","restorePaint","RestorePaint","restorePaintDeclaration","RestorePaintDeclaration","materializePaint","MaterializePaint","pushPathEffect","pathEffectType","isPathEffect","Error","PushPathEffect","pushImageFilter","imageFilterType","isImageFilter","PushImageFilter","pushColorFilter","colorFilterType","isColorFilter","PushColorFilter","pushShader","shaderType","isShader","NodeType","Blend","PushShader","pushBlurMaskFilter","PushBlurMaskFilter","composePathEffect","ComposePathEffect","composeColorFilter","ComposeColorFilter","composeImageFilter","ComposeImageFilter","saveCTM","SaveCTM","restoreCTM","RestoreCTM","drawPaint","DrawPaint","saveLayer","SaveLayer","saveBackdropFilter","SaveBackdropFilter","drawBox","boxProps","shadows","forEach","shadow","DrawBox","drawImage","DrawImage","drawCircle","DrawCircle","drawPoints","DrawPoints","drawPath","DrawPath","drawRect","DrawRect","drawRRect","DrawRRect","drawOval","DrawOval","drawLine","DrawLine","drawPatch","DrawPatch","drawVertices","DrawVertices","drawDiffRect","DrawDiffRect","drawText","DrawText","drawTextPath","DrawTextPath","drawTextBlob","DrawTextBlob","drawGlyphs","DrawGlyphs","drawPicture","DrawPicture","drawImageSVG","DrawImageSVG","drawParagraph","DrawParagraph","drawAtlas","DrawAtlas","exports"],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport { NodeType } from \"../../dom/types\";\nimport type {\n BlurMaskFilterProps,\n CircleProps,\n CTMProps,\n ImageProps,\n PaintProps,\n PointsProps,\n PathProps,\n RectProps,\n RoundedRectProps,\n OvalProps,\n LineProps,\n PatchProps,\n VerticesProps,\n DiffRectProps,\n TextProps,\n TextPathProps,\n TextBlobProps,\n GlyphsProps,\n PictureProps,\n ImageSVGProps,\n ParagraphProps,\n AtlasProps,\n BoxProps,\n BoxShadowProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer\";\nimport { isSharedValue } from \"../utils\";\nimport { isColorFilter, isImageFilter, isPathEffect, isShader } from \"../Node\";\nimport type { SkPaint } from \"../../skia/types\";\n\nimport { CommandType } from \"./Core\";\nimport type { Command } from \"./Core\";\n\nexport interface Recording {\n commands: Command[];\n paintPool: SkPaint[];\n}\n\ninterface AnimationValues {\n animationValues: Set<SharedValue<unknown>>;\n}\n\nexport class Recorder {\n commands: Command[] = [];\n animationValues: Set<SharedValue<unknown>> = new Set();\n\n getRecording(): Recording & AnimationValues {\n return {\n commands: this.commands,\n paintPool: [],\n animationValues: this.animationValues,\n };\n }\n\n private processProps(props: Record<string, unknown>) {\n const animatedProps: Record<string, SharedValue<unknown>> = {};\n let hasAnimatedProps = false;\n\n for (const key in props) {\n const prop = props[key];\n if (isSharedValue(prop)) {\n this.animationValues.add(prop);\n props[key] = prop.value;\n animatedProps[key] = prop;\n hasAnimatedProps = true;\n }\n }\n\n return {\n props,\n animatedProps: hasAnimatedProps ? animatedProps : undefined,\n };\n }\n\n private add(command: Command) {\n if (command.props) {\n const { animatedProps } = this.processProps(\n command.props as Record<string, unknown>\n );\n if (animatedProps) {\n command.animatedProps = animatedProps;\n }\n }\n this.commands.push(command);\n }\n\n savePaint(props: AnimatedProps<PaintProps>) {\n this.add({ type: CommandType.SavePaint, props });\n }\n\n restorePaint() {\n this.add({ type: CommandType.RestorePaint });\n }\n\n restorePaintDeclaration() {\n this.add({ type: CommandType.RestorePaintDeclaration });\n }\n\n materializePaint() {\n this.add({ type: CommandType.MaterializePaint });\n }\n\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>) {\n if (!isPathEffect(pathEffectType)) {\n throw new Error(\"Invalid color filter type: \" + pathEffectType);\n }\n this.add({\n type: CommandType.PushPathEffect,\n pathEffectType,\n props,\n });\n }\n\n pushImageFilter(imageFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isImageFilter(imageFilterType)) {\n throw new Error(\"Invalid color filter type: \" + imageFilterType);\n }\n this.add({\n type: CommandType.PushImageFilter,\n imageFilterType,\n props,\n });\n }\n\n pushColorFilter(colorFilterType: NodeType, props: AnimatedProps<unknown>) {\n if (!isColorFilter(colorFilterType)) {\n throw new Error(\"Invalid color filter type: \" + colorFilterType);\n }\n this.add({\n type: CommandType.PushColorFilter,\n colorFilterType,\n props,\n });\n }\n\n pushShader(shaderType: NodeType, props: AnimatedProps<unknown>) {\n if (!isShader(shaderType) && !(shaderType === NodeType.Blend)) {\n throw new Error(\"Invalid color filter type: \" + shaderType);\n }\n this.add({ type: CommandType.PushShader, shaderType, props });\n }\n\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>) {\n this.add({ type: CommandType.PushBlurMaskFilter, props });\n }\n\n composePathEffect() {\n this.add({ type: CommandType.ComposePathEffect });\n }\n\n composeColorFilter() {\n this.add({ type: CommandType.ComposeColorFilter });\n }\n\n composeImageFilter() {\n this.add({ type: CommandType.ComposeImageFilter });\n }\n\n saveCTM(props: AnimatedProps<CTMProps>) {\n this.add({ type: CommandType.SaveCTM, props });\n }\n\n restoreCTM() {\n this.add({ type: CommandType.RestoreCTM });\n }\n\n drawPaint() {\n this.add({ type: CommandType.DrawPaint });\n }\n\n saveLayer() {\n this.add({ type: CommandType.SaveLayer });\n }\n\n saveBackdropFilter() {\n this.add({ type: CommandType.SaveBackdropFilter });\n }\n\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ) {\n shadows.forEach((shadow) => {\n if (shadow.props) {\n if (shadow.props) {\n const { animatedProps } = this.processProps(\n shadow.props as unknown as Record<string, unknown>\n );\n if (animatedProps) {\n shadow.animatedProps = animatedProps;\n }\n }\n }\n });\n this.add({ type: CommandType.DrawBox, props: boxProps, shadows });\n }\n\n drawImage(props: AnimatedProps<ImageProps>) {\n this.add({ type: CommandType.DrawImage, props });\n }\n\n drawCircle(props: AnimatedProps<CircleProps>) {\n this.add({ type: CommandType.DrawCircle, props });\n }\n drawPoints(props: AnimatedProps<PointsProps>) {\n this.add({ type: CommandType.DrawPoints, props });\n }\n\n drawPath(props: AnimatedProps<PathProps>) {\n this.add({ type: CommandType.DrawPath, props });\n }\n\n drawRect(props: AnimatedProps<RectProps>) {\n this.add({ type: CommandType.DrawRect, props });\n }\n\n drawRRect(props: AnimatedProps<RoundedRectProps>) {\n this.add({ type: CommandType.DrawRRect, props });\n }\n\n drawOval(props: AnimatedProps<OvalProps>) {\n this.add({ type: CommandType.DrawOval, props });\n }\n\n drawLine(props: AnimatedProps<LineProps>) {\n this.add({ type: CommandType.DrawLine, props });\n }\n\n drawPatch(props: AnimatedProps<PatchProps>) {\n this.add({ type: CommandType.DrawPatch, props });\n }\n\n drawVertices(props: AnimatedProps<VerticesProps>) {\n this.add({ type: CommandType.DrawVertices, props });\n }\n\n drawDiffRect(props: AnimatedProps<DiffRectProps>) {\n this.add({ type: CommandType.DrawDiffRect, props });\n }\n\n drawText(props: AnimatedProps<TextProps>) {\n this.add({ type: CommandType.DrawText, props });\n }\n\n drawTextPath(props: AnimatedProps<TextPathProps>) {\n this.add({ type: CommandType.DrawTextPath, props });\n }\n\n drawTextBlob(props: AnimatedProps<TextBlobProps>) {\n this.add({ type: CommandType.DrawTextBlob, props });\n }\n\n drawGlyphs(props: AnimatedProps<GlyphsProps>) {\n this.add({ type: CommandType.DrawGlyphs, props });\n }\n\n drawPicture(props: AnimatedProps<PictureProps>) {\n this.add({ type: CommandType.DrawPicture, props });\n }\n\n drawImageSVG(props: AnimatedProps<ImageSVGProps>) {\n this.add({ type: CommandType.DrawImageSVG, props });\n }\n\n drawParagraph(props: AnimatedProps<ParagraphProps>) {\n this.add({ type: CommandType.DrawParagraph, props });\n }\n\n drawAtlas(props: AnimatedProps<AtlasProps>) {\n this.add({ type: CommandType.DrawAtlas, props });\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AA4BA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AAGA,IAAAG,KAAA,GAAAH,OAAA;AAAqC,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,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I,EAAEC,iBAAW,CAACsF,aAAa;MAAElG;IAAM,CAAC,CAAC;EACtD;EAEAmG,SAASA,CAACnG,KAAgC,EAAE;IAC1C,IAAI,CAACM,GAAG,CAAC;MAAEK,IAAI,EAAEC,iBAAW,CAACwF,SAAS;MAAEpG;IAAM,CAAC,CAAC;EAClD;AACF;AAACqG,OAAA,CAAA7G,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -85,7 +85,8 @@ const drawImage = (ctx, props) => {
85
85
  "worklet";
86
86
 
87
87
  const {
88
- image
88
+ image,
89
+ sampling
89
90
  } = props;
90
91
  if (image) {
91
92
  var _props$fit;
@@ -100,7 +101,12 @@ const drawImage = (ctx, props) => {
100
101
  width: image.width(),
101
102
  height: image.height()
102
103
  }, rect);
103
- ctx.canvas.drawImageRect(image, src, dst, ctx.paint);
104
+ if (sampling && (0, _types.isCubicSampling)(sampling)) {
105
+ ctx.canvas.drawImageRectCubic(image, src, dst, sampling.B, sampling.C, ctx.paint);
106
+ } else {
107
+ var _sampling$filter, _sampling$mipmap;
108
+ ctx.canvas.drawImageRectOptions(image, src, dst, (_sampling$filter = sampling === null || sampling === void 0 ? void 0 : sampling.filter) !== null && _sampling$filter !== void 0 ? _sampling$filter : _types.FilterMode.Linear, (_sampling$mipmap = sampling === null || sampling === void 0 ? void 0 : sampling.mipmap) !== null && _sampling$mipmap !== void 0 ? _sampling$mipmap : _types.MipmapMode.None, ctx.paint);
109
+ }
104
110
  }
105
111
  };
106
112
  exports.drawImage = drawImage;
@@ -369,11 +375,12 @@ const drawAtlas = (ctx, props) => {
369
375
  sprites,
370
376
  transforms,
371
377
  colors,
372
- blendMode
378
+ blendMode,
379
+ sampling
373
380
  } = props;
374
381
  const blend = blendMode ? _types.BlendMode[(0, _nodes.enumKey)(blendMode)] : undefined;
375
382
  if (image) {
376
- ctx.canvas.drawAtlas(image, sprites, transforms, ctx.paint, blend, colors);
383
+ ctx.canvas.drawAtlas(image, sprites, transforms, ctx.paint, blend, colors, sampling);
377
384
  }
378
385
  };
379
386
  exports.drawAtlas = drawAtlas;