@shopify/react-native-skia 1.8.2 → 1.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) 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/renderer/components/image/ImageShader.d.ts +1 -1
  17. package/lib/commonjs/renderer/components/image/ImageShader.js +0 -4
  18. package/lib/commonjs/renderer/components/image/ImageShader.js.map +1 -1
  19. package/lib/commonjs/skia/types/Canvas.d.ts +2 -2
  20. package/lib/commonjs/skia/types/Canvas.js.map +1 -1
  21. package/lib/commonjs/skia/types/Image/Image.d.ts +18 -0
  22. package/lib/commonjs/skia/types/Image/Image.js +24 -1
  23. package/lib/commonjs/skia/types/Image/Image.js.map +1 -1
  24. package/lib/commonjs/skia/types/Picture/PictureRecorder.d.ts +2 -1
  25. package/lib/commonjs/skia/types/Picture/PictureRecorder.js.map +1 -1
  26. package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +2 -2
  27. package/lib/commonjs/skia/web/JsiSkCanvas.js +15 -2
  28. package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
  29. package/lib/commonjs/sksg/Container.d.ts +17 -14
  30. package/lib/commonjs/sksg/Container.js +59 -62
  31. package/lib/commonjs/sksg/Container.js.map +1 -1
  32. package/lib/commonjs/sksg/HostConfig.js +4 -9
  33. package/lib/commonjs/sksg/HostConfig.js.map +1 -1
  34. package/lib/commonjs/sksg/Reconciler.js +1 -2
  35. package/lib/commonjs/sksg/Reconciler.js.map +1 -1
  36. package/lib/commonjs/sksg/Recorder/Core.d.ts +42 -37
  37. package/lib/commonjs/sksg/Recorder/Core.js +45 -38
  38. package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
  39. package/lib/commonjs/sksg/Recorder/Player.js +4 -0
  40. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  41. package/lib/commonjs/sksg/Recorder/Recorder.d.ts +15 -0
  42. package/lib/commonjs/sksg/Recorder/Recorder.js +23 -1
  43. package/lib/commonjs/sksg/Recorder/Recorder.js.map +1 -1
  44. package/lib/commonjs/sksg/Recorder/Visitor.js +6 -0
  45. package/lib/commonjs/sksg/Recorder/Visitor.js.map +1 -1
  46. package/lib/commonjs/sksg/Recorder/commands/Drawing.js +11 -4
  47. package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
  48. package/lib/commonjs/sksg/Recorder/commands/Shaders.js +8 -3
  49. package/lib/commonjs/sksg/Recorder/commands/Shaders.js.map +1 -1
  50. package/lib/module/dom/types/Drawings.d.ts +3 -1
  51. package/lib/module/dom/types/Drawings.js.map +1 -1
  52. package/lib/module/dom/types/Shaders.d.ts +2 -3
  53. package/lib/module/dom/types/Shaders.js.map +1 -1
  54. package/lib/module/renderer/components/image/ImageShader.d.ts +1 -1
  55. package/lib/module/renderer/components/image/ImageShader.js +0 -4
  56. package/lib/module/renderer/components/image/ImageShader.js.map +1 -1
  57. package/lib/module/skia/types/Canvas.d.ts +2 -2
  58. package/lib/module/skia/types/Canvas.js.map +1 -1
  59. package/lib/module/skia/types/Image/Image.d.ts +18 -0
  60. package/lib/module/skia/types/Image/Image.js +21 -0
  61. package/lib/module/skia/types/Image/Image.js.map +1 -1
  62. package/lib/module/skia/types/Picture/PictureRecorder.d.ts +2 -1
  63. package/lib/module/skia/types/Picture/PictureRecorder.js.map +1 -1
  64. package/lib/module/skia/web/JsiSkCanvas.d.ts +2 -2
  65. package/lib/module/skia/web/JsiSkCanvas.js +15 -2
  66. package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
  67. package/lib/module/sksg/Container.d.ts +17 -14
  68. package/lib/module/sksg/Container.js +56 -60
  69. package/lib/module/sksg/Container.js.map +1 -1
  70. package/lib/module/sksg/HostConfig.js +4 -9
  71. package/lib/module/sksg/HostConfig.js.map +1 -1
  72. package/lib/module/sksg/Reconciler.js +2 -3
  73. package/lib/module/sksg/Reconciler.js.map +1 -1
  74. package/lib/module/sksg/Recorder/Core.d.ts +42 -37
  75. package/lib/module/sksg/Recorder/Core.js +43 -37
  76. package/lib/module/sksg/Recorder/Core.js.map +1 -1
  77. package/lib/module/sksg/Recorder/Player.js +5 -1
  78. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  79. package/lib/module/sksg/Recorder/Recorder.d.ts +15 -0
  80. package/lib/module/sksg/Recorder/Recorder.js +23 -1
  81. package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
  82. package/lib/module/sksg/Recorder/Visitor.js +6 -0
  83. package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
  84. package/lib/module/sksg/Recorder/commands/Drawing.js +12 -5
  85. package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
  86. package/lib/module/sksg/Recorder/commands/Shaders.js +9 -4
  87. package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
  88. package/lib/typescript/lib/commonjs/renderer/components/image/ImageShader.d.ts +1 -3
  89. package/lib/typescript/lib/commonjs/skia/types/Image/Image.d.ts +21 -0
  90. package/lib/typescript/lib/commonjs/skia/web/JsiSkCanvas.d.ts +1 -1
  91. package/lib/typescript/lib/commonjs/sksg/Container.d.ts +15 -10
  92. package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +4 -4
  93. package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +21 -2
  94. package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +1 -0
  95. package/lib/typescript/lib/commonjs/sksg/Recorder/Recorder.d.ts +7 -0
  96. package/lib/typescript/lib/module/mock/index.d.ts +18 -3
  97. package/lib/typescript/lib/module/renderer/components/image/ImageShader.d.ts +1 -3
  98. package/lib/typescript/lib/module/skia/types/Image/Image.d.ts +21 -0
  99. package/lib/typescript/lib/module/skia/web/JsiSkCanvas.d.ts +1 -1
  100. package/lib/typescript/lib/module/sksg/Container.d.ts +15 -10
  101. package/lib/typescript/lib/module/sksg/HostConfig.d.ts +4 -4
  102. package/lib/typescript/lib/module/sksg/Reconciler.d.ts +21 -2
  103. package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +1 -0
  104. package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +7 -0
  105. package/lib/typescript/src/dom/types/Drawings.d.ts +3 -1
  106. package/lib/typescript/src/dom/types/Shaders.d.ts +2 -3
  107. package/lib/typescript/src/renderer/components/image/ImageShader.d.ts +1 -1
  108. package/lib/typescript/src/skia/types/Canvas.d.ts +2 -2
  109. package/lib/typescript/src/skia/types/Image/Image.d.ts +18 -0
  110. package/lib/typescript/src/skia/types/Picture/PictureRecorder.d.ts +2 -1
  111. package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +2 -2
  112. package/lib/typescript/src/sksg/Container.d.ts +17 -14
  113. package/lib/typescript/src/sksg/Recorder/Core.d.ts +42 -37
  114. package/lib/typescript/src/sksg/Recorder/Recorder.d.ts +15 -0
  115. package/libs/apple/libskia.xcframework/Info.plist +35 -2
  116. package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  117. package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  118. package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
  119. package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
  120. package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  121. package/libs/apple/libskottie.xcframework/Info.plist +36 -3
  122. package/libs/apple/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
  123. package/libs/apple/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  124. package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
  125. package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e/libskottie.a +0 -0
  126. package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
  127. package/libs/apple/libskparagraph.xcframework/Info.plist +40 -7
  128. package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
  129. package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  130. package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
  131. package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e/libskparagraph.a +0 -0
  132. package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
  133. package/libs/apple/libsksg.xcframework/Info.plist +35 -2
  134. package/libs/apple/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
  135. package/libs/apple/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  136. package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
  137. package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e/libsksg.a +0 -0
  138. package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
  139. package/libs/apple/libskshaper.xcframework/Info.plist +33 -0
  140. package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
  141. package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  142. package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
  143. package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e/libskshaper.a +0 -0
  144. package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
  145. package/libs/apple/libskunicode_core.xcframework/Info.plist +36 -3
  146. package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
  147. package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  148. package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
  149. package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e/libskunicode_core.a +0 -0
  150. package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
  151. package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +35 -2
  152. package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  153. package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  154. package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
  155. package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
  156. package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
  157. package/libs/apple/libsvg.xcframework/Info.plist +36 -3
  158. package/libs/apple/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
  159. package/libs/apple/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  160. package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
  161. package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e/libsvg.a +0 -0
  162. package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
  163. package/package.json +3 -2
  164. package/react-native-skia.podspec +2 -2
  165. package/src/__tests__/snapshots/animated-images/bird.png +0 -0
  166. package/src/__tests__/snapshots/demos/product.png +0 -0
  167. package/src/__tests__/snapshots/demos/product2.png +0 -0
  168. package/src/__tests__/snapshots/images/bundle-android.png +0 -0
  169. package/src/__tests__/snapshots/images/bundle-ios.png +0 -0
  170. package/src/__tests__/snapshots/images/bundle-node.png +0 -0
  171. package/src/__tests__/snapshots/images/filter.png +0 -0
  172. package/src/dom/types/Drawings.ts +3 -0
  173. package/src/dom/types/Shaders.ts +2 -4
  174. package/src/renderer/__tests__/e2e/Text.spec.tsx +1 -1
  175. package/src/renderer/components/image/ImageShader.tsx +2 -15
  176. package/src/skia/types/Canvas.ts +2 -3
  177. package/src/skia/types/Image/Image.ts +14 -0
  178. package/src/skia/types/Picture/PictureRecorder.ts +2 -1
  179. package/src/skia/web/JsiSkCanvas.ts +50 -29
  180. package/src/sksg/Container.ts +64 -68
  181. package/src/sksg/HostConfig.ts +4 -9
  182. package/src/sksg/Reconciler.ts +3 -3
  183. package/src/sksg/Recorder/Core.ts +10 -0
  184. package/src/sksg/Recorder/Player.ts +5 -1
  185. package/src/sksg/Recorder/Recorder.ts +36 -1
  186. package/src/sksg/Recorder/Visitor.ts +6 -0
  187. package/src/sksg/Recorder/commands/Drawing.ts +33 -4
  188. package/src/sksg/Recorder/commands/Shaders.ts +21 -8
  189. package/lib/commonjs/sksg/Recorder/Recording.d.ts +0 -7
  190. package/lib/commonjs/sksg/Recorder/Recording.js +0 -12
  191. package/lib/commonjs/sksg/Recorder/Recording.js.map +0 -1
  192. package/lib/module/sksg/Recorder/Recording.d.ts +0 -7
  193. package/lib/module/sksg/Recorder/Recording.js +0 -5
  194. package/lib/module/sksg/Recorder/Recording.js.map +0 -1
  195. package/lib/typescript/lib/commonjs/sksg/Recorder/Recording.d.ts +0 -5
  196. package/lib/typescript/lib/module/sksg/Recorder/Recording.d.ts +0 -4
  197. package/lib/typescript/src/sksg/Recorder/Recording.d.ts +0 -7
  198. package/src/sksg/Recorder/Recording.ts +0 -13
@@ -2,7 +2,27 @@ export const __esModule: boolean;
2
2
  export class SkiaSGRoot {
3
3
  constructor(Skia: any, nativeId?: number);
4
4
  Skia: any;
5
- container: _Container.Container;
5
+ container: {
6
+ redraw(): void;
7
+ recording: {
8
+ commands: any;
9
+ paintPool: never[];
10
+ } | undefined;
11
+ mapperId: any;
12
+ Skia: any;
13
+ nativeId: any;
14
+ drawOnCanvas(canvas: any): void;
15
+ } | {
16
+ redraw(): void;
17
+ recording: {
18
+ commands: any;
19
+ paintPool: never[];
20
+ animationValues: any;
21
+ } | undefined;
22
+ Skia: any;
23
+ nativeId: any;
24
+ drawOnCanvas(canvas: any): void;
25
+ };
6
26
  root: any;
7
27
  get sg(): {
8
28
  type: any;
@@ -15,4 +35,3 @@ export class SkiaSGRoot {
15
35
  getPicture(): any;
16
36
  unmount(): void;
17
37
  }
18
- import _Container = require("./Container");
@@ -2,4 +2,5 @@ export const __esModule: boolean;
2
2
  export const CommandType: {};
3
3
  export function materializeProps(command: any): void;
4
4
  export function isCommand(command: any, type: any): boolean;
5
+ export function isGroup(command: any): boolean;
5
6
  export function isDrawCommand(command: any, type: any): boolean;
@@ -1,10 +1,17 @@
1
1
  export const __esModule: boolean;
2
2
  export class Recorder {
3
+ getRecording(): {
4
+ commands: any;
5
+ paintPool: never[];
6
+ animationValues: any;
7
+ };
3
8
  processProps(props: any): {
4
9
  props: any;
5
10
  animatedProps: {} | undefined;
6
11
  };
7
12
  add(command: any): void;
13
+ saveGroup(): void;
14
+ restoreGroup(): void;
8
15
  savePaint(props: any): void;
9
16
  restorePaint(): void;
10
17
  restorePaintDeclaration(): void;
@@ -178,6 +178,23 @@ export function Mock(CanvasKit: any): {
178
178
  FilterMode: {};
179
179
  MipmapMode: {};
180
180
  ImageFormat: {};
181
+ isCubicSampling: (sampling: any) => boolean;
182
+ MitchellCubicSampling: {
183
+ B: number;
184
+ C: number;
185
+ };
186
+ CatmullRomCubicSampling: {
187
+ B: number;
188
+ C: number;
189
+ };
190
+ CubicSampling: {
191
+ B: number;
192
+ C: number;
193
+ };
194
+ MakeCubic: (B: any, C: any) => {
195
+ B: any;
196
+ C: any;
197
+ };
181
198
  AlphaType: {};
182
199
  ColorType: {};
183
200
  isColorFilter: (obj: any) => boolean;
@@ -331,12 +348,10 @@ export function Mock(CanvasKit: any): {
331
348
  children: any;
332
349
  }>;
333
350
  Image: (props: any) => import("react").DOMElement<any, Element>;
334
- ImageShader: ({ tx, ty, fm, mm, fit, transform, ...props }: {
351
+ ImageShader: ({ tx, ty, fit, transform, ...props }: {
335
352
  [x: string]: any;
336
353
  tx?: string | undefined;
337
354
  ty?: string | undefined;
338
- fm?: string | undefined;
339
- mm?: string | undefined;
340
355
  fit?: string | undefined;
341
356
  transform?: any[] | undefined;
342
357
  }) => import("react").DOMElement<any, Element>;
@@ -1,9 +1,7 @@
1
- export function ImageShader({ tx, ty, fm, mm, fit, transform, ...props }: {
1
+ export function ImageShader({ tx, ty, fit, transform, ...props }: {
2
2
  [x: string]: any;
3
3
  tx?: string | undefined;
4
4
  ty?: string | undefined;
5
- fm?: string | undefined;
6
- mm?: string | undefined;
7
5
  fit?: string | undefined;
8
6
  transform?: any[] | undefined;
9
7
  }): React.DOMElement<any, Element>;
@@ -1,3 +1,24 @@
1
1
  export let FilterMode: {};
2
2
  export let MipmapMode: {};
3
3
  export let ImageFormat: {};
4
+ export function isCubicSampling(sampling: any): boolean;
5
+ export namespace MitchellCubicSampling {
6
+ let B: number;
7
+ let C: number;
8
+ }
9
+ export namespace CatmullRomCubicSampling {
10
+ let B_1: number;
11
+ export { B_1 as B };
12
+ let C_1: number;
13
+ export { C_1 as C };
14
+ }
15
+ export namespace CubicSampling {
16
+ let B_2: number;
17
+ export { B_2 as B };
18
+ let C_2: number;
19
+ export { C_2 as C };
20
+ }
21
+ export function MakeCubic(B: any, C: any): {
22
+ B: any;
23
+ C: any;
24
+ };
@@ -38,7 +38,7 @@ export class JsiSkCanvas extends HostObject {
38
38
  clipRRect(rrect: any, op: any, doAntiAlias: any): void;
39
39
  concat(m: any): void;
40
40
  drawPicture(skp: any): void;
41
- drawAtlas(atlas: any, srcs: any, dsts: any, paint: any, blendMode: any, colors: any, _sampling: any): void;
41
+ drawAtlas(atlas: any, srcs: any, dsts: any, paint: any, blendMode: any, colors: any, sampling: any): void;
42
42
  readPixels(srcX: any, srcY: any, imageInfo: any): any;
43
43
  }
44
44
  import { HostObject } from "./Host";
@@ -2,18 +2,23 @@ export class Container {
2
2
  constructor(Skia: any, nativeId: any);
3
3
  Skia: any;
4
4
  nativeId: any;
5
- set root(root: any);
6
- get root(): any;
7
- mapperId: any;
8
- _root: any;
9
- _recording: {
5
+ drawOnCanvas(canvas: any): void;
6
+ }
7
+ export function createContainer(Skia: any, nativeId: any): StaticContainer | ReanimatedContainer;
8
+ declare class StaticContainer extends Container {
9
+ redraw(): void;
10
+ recording: {
10
11
  commands: any;
11
12
  paintPool: never[];
13
+ animationValues: any;
12
14
  } | undefined;
13
- clear(): void;
15
+ }
16
+ declare class ReanimatedContainer extends Container {
14
17
  redraw(): void;
15
- getNativeId(): any;
16
- unregisterValues(values: any): void;
17
- registerValues(values: any): void;
18
- drawOnCanvas(canvas: any): void;
18
+ recording: {
19
+ commands: any;
20
+ paintPool: never[];
21
+ } | undefined;
22
+ mapperId: any;
19
23
  }
24
+ export {};
@@ -11,7 +11,7 @@ export namespace sksgHostConfig {
11
11
  function getChildHostContext(_parentHostContext: any, _type: any, _rootContainerInstance: any): null;
12
12
  function shouldSetTextContent(_type: any, _props: any): boolean;
13
13
  function createTextInstance(_text: any, _rootContainerInstance: any, _hostContext: any, _internalInstanceHandle: any): never;
14
- function createInstance(type: any, propsWithChildren: any, container: any, _hostContext: any, _internalInstanceHandle: any): {
14
+ function createInstance(type: any, propsWithChildren: any, _container: any, _hostContext: any, _internalInstanceHandle: any): {
15
15
  type: any;
16
16
  props: any;
17
17
  children: never[];
@@ -19,11 +19,11 @@ export namespace sksgHostConfig {
19
19
  function appendInitialChild(parentInstance: any, child: any): void;
20
20
  function finalizeInitialChildren(parentInstance: any, _type: any, _props: any, _rootContainerInstance: any, _hostContext: any): boolean;
21
21
  function commitMount(): void;
22
- function prepareForCommit(_containerInfo: any): null;
22
+ function prepareForCommit(_container: any): null;
23
23
  function resetAfterCommit(container: any): void;
24
24
  function getPublicInstance(node: any): any;
25
25
  function commitTextUpdate(_textInstance: any, _oldText: any, _newText: any): void;
26
- function clearContainer(container: any): void;
26
+ function clearContainer(_container: any): void;
27
27
  function prepareUpdate(_instance: any, _type: any, oldProps: any, newProps: any, container: any, _hostContext: any): any;
28
28
  function preparePortalMount(): void;
29
29
  function cloneInstance(instance: any, _updatePayload: any, _type: any, _oldProps: any, newProps: any, _internalInstanceHandle: any, keepChildren: any, _recyclableInstance: any): {
@@ -40,7 +40,7 @@ export namespace sksgHostConfig {
40
40
  function getCurrentEventPriority(): number;
41
41
  function beforeActiveInstanceBlur(): void;
42
42
  function afterActiveInstanceBlur(): void;
43
- function detachDeletedInstance(): void;
43
+ function detachDeletedInstance(_node: any): void;
44
44
  function getInstanceFromNode(_node: any): never;
45
45
  function prepareScopeUpdate(_scopeInstance: any, _instance: any): never;
46
46
  function getInstanceFromScope(_scopeInstance: any): never;
@@ -1,7 +1,27 @@
1
1
  export class SkiaSGRoot {
2
2
  constructor(Skia: any, nativeId?: number);
3
3
  Skia: any;
4
- container: Container;
4
+ container: {
5
+ redraw(): void;
6
+ recording: {
7
+ commands: any;
8
+ paintPool: never[];
9
+ animationValues: any;
10
+ } | undefined;
11
+ Skia: any;
12
+ nativeId: any;
13
+ drawOnCanvas(canvas: any): void;
14
+ } | {
15
+ redraw(): void;
16
+ recording: {
17
+ commands: any;
18
+ paintPool: never[];
19
+ } | undefined;
20
+ mapperId: any;
21
+ Skia: any;
22
+ nativeId: any;
23
+ drawOnCanvas(canvas: any): void;
24
+ };
5
25
  root: any;
6
26
  get sg(): {
7
27
  type: any;
@@ -14,4 +34,3 @@ export class SkiaSGRoot {
14
34
  getPicture(): any;
15
35
  unmount(): void;
16
36
  }
17
- import { Container } from "./Container";
@@ -1,4 +1,5 @@
1
1
  export let CommandType: {};
2
2
  export function materializeProps(command: any): void;
3
3
  export function isCommand(command: any, type: any): boolean;
4
+ export function isGroup(command: any): boolean;
4
5
  export function isDrawCommand(command: any, type: any): boolean;
@@ -1,9 +1,16 @@
1
1
  export class Recorder {
2
+ getRecording(): {
3
+ commands: any;
4
+ paintPool: never[];
5
+ animationValues: any;
6
+ };
2
7
  processProps(props: any): {
3
8
  props: any;
4
9
  animatedProps: {} | undefined;
5
10
  };
6
11
  add(command: any): void;
12
+ saveGroup(): void;
13
+ restoreGroup(): void;
7
14
  savePaint(props: any): void;
8
15
  restorePaint(): void;
9
16
  restorePaintDeclaration(): void;
@@ -1,4 +1,4 @@
1
- import type { FillType, SkImage, StrokeOpts, Vector, Color, SkPoint, BlendMode, PointMode, VertexMode, SkFont, SkRRect, SkTextBlob, SkPicture, SkSVG, SkPaint, SkRect, SkRSXform, SkColor } from "../../skia/types";
1
+ import type { FillType, SkImage, StrokeOpts, Vector, Color, SkPoint, BlendMode, PointMode, VertexMode, SkFont, SkRRect, SkTextBlob, SkPicture, SkSVG, SkPaint, SkRect, SkRSXform, SkColor, SamplingOptions } from "../../skia/types";
2
2
  import type { CircleDef, Fit, GroupProps, PathDef, RectDef, RRectDef, SkEnum } from "./Common";
3
3
  export interface DrawingNodeProps extends GroupProps {
4
4
  paint?: SkPaint;
@@ -6,6 +6,7 @@ export interface DrawingNodeProps extends GroupProps {
6
6
  export type ImageProps = DrawingNodeProps & RectDef & {
7
7
  fit?: Fit;
8
8
  image: SkImage | null;
9
+ sampling?: SamplingOptions;
9
10
  };
10
11
  export type CircleProps = CircleDef & DrawingNodeProps;
11
12
  export interface PathProps extends DrawingNodeProps {
@@ -27,6 +28,7 @@ export interface AtlasProps extends DrawingNodeProps {
27
28
  sprites: SkRect[];
28
29
  transforms: SkRSXform[];
29
30
  colors?: SkColor[];
31
+ sampling?: SamplingOptions;
30
32
  }
31
33
  export interface CubicBezierHandle {
32
34
  pos: Vector;
@@ -1,4 +1,4 @@
1
- import type { Color, FilterMode, MipmapMode, SkImage, SkRect, SkRuntimeEffect, TileMode, Uniforms, Vector } from "../../skia/types";
1
+ import type { Color, SamplingOptions, SkImage, SkRect, SkRuntimeEffect, TileMode, Uniforms, Vector } from "../../skia/types";
2
2
  import type { SkEnum, TransformProps, ChildrenProps, RectCtor, Fit } from "./Common";
3
3
  export interface ShaderProps extends TransformProps, ChildrenProps {
4
4
  source: SkRuntimeEffect;
@@ -7,11 +7,10 @@ export interface ShaderProps extends TransformProps, ChildrenProps {
7
7
  export interface ImageShaderProps extends TransformProps, Partial<RectCtor> {
8
8
  tx: SkEnum<typeof TileMode>;
9
9
  ty: SkEnum<typeof TileMode>;
10
- fm: SkEnum<typeof FilterMode>;
11
- mm: SkEnum<typeof MipmapMode>;
12
10
  fit: Fit;
13
11
  rect?: SkRect;
14
12
  image: SkImage | null;
13
+ sampling?: SamplingOptions;
15
14
  }
16
15
  export interface ColorProps {
17
16
  color: Color;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import type { ImageShaderProps } from "../../../dom/types";
3
3
  import type { SkiaDefaultProps } from "../../processors";
4
- export declare const ImageShader: ({ tx, ty, fm, mm, fit, transform, ...props }: SkiaDefaultProps<ImageShaderProps, "tx" | "ty" | "fm" | "mm" | "fit" | "transform">) => React.JSX.Element;
4
+ export declare const ImageShader: ({ tx, ty, fit, transform, ...props }: SkiaDefaultProps<ImageShaderProps, "tx" | "ty" | "fit" | "transform">) => React.JSX.Element;
@@ -2,7 +2,7 @@ import type { SkPaint } from "./Paint";
2
2
  import type { SkRect } from "./Rect";
3
3
  import type { SkFont } from "./Font";
4
4
  import type { SkPath } from "./Path";
5
- import type { SkImage, MipmapMode, FilterMode, ImageInfo, CubicResampler, FilterOptions } from "./Image";
5
+ import type { SkImage, MipmapMode, FilterMode, ImageInfo, SamplingOptions } from "./Image";
6
6
  import type { SkSVG } from "./SVG";
7
7
  import type { SkColor } from "./Color";
8
8
  import type { InputRRect } from "./RRect";
@@ -392,7 +392,7 @@ export interface SkCanvas {
392
392
  * @param {CubicResampler | FilterOptions} [sampling] - The sampling options. Optional.
393
393
  * @returns {void} This method does not return anything.
394
394
  */
395
- drawAtlas(atlas: SkImage, srcs: SkRect[], dsts: SkRSXform[], paint: SkPaint, blendMode?: BlendMode, colors?: SkColor[], sampling?: CubicResampler | FilterOptions): void;
395
+ drawAtlas(atlas: SkImage, srcs: SkRect[], dsts: SkRSXform[], paint: SkPaint, blendMode?: BlendMode, colors?: SkColor[], sampling?: SamplingOptions): void;
396
396
  /** Read Image pixels
397
397
  *
398
398
  * @param srcX - x-axis upper left corner of the rectangle to read from
@@ -25,6 +25,24 @@ export declare enum ImageFormat {
25
25
  PNG = 4,
26
26
  WEBP = 6
27
27
  }
28
+ export type SamplingOptions = CubicResampler | FilterOptions;
29
+ export declare const isCubicSampling: (sampling: SamplingOptions) => sampling is CubicResampler;
30
+ export declare const MitchellCubicSampling: {
31
+ B: number;
32
+ C: number;
33
+ };
34
+ export declare const CatmullRomCubicSampling: {
35
+ B: number;
36
+ C: number;
37
+ };
38
+ export declare const CubicSampling: {
39
+ B: number;
40
+ C: number;
41
+ };
42
+ export declare const MakeCubic: (B: number, C: number) => {
43
+ B: number;
44
+ C: number;
45
+ };
28
46
  export interface SkImage extends SkJSIInstance<"Image"> {
29
47
  /**
30
48
  * Returns the possibly scaled height of the image.
@@ -1,7 +1,8 @@
1
1
  import type { SkCanvas } from "../Canvas";
2
+ import type { SkJSIInstance } from "../JsiInstance";
2
3
  import type { SkRect } from "../Rect";
3
4
  import type { SkPicture } from "./Picture";
4
- export interface SkPictureRecorder {
5
+ export interface SkPictureRecorder extends SkJSIInstance<"PictureRecorder"> {
5
6
  /**
6
7
  * Returns a canvas on which to draw. When done drawing, call finishRecordingAsPicture()
7
8
  *
@@ -1,5 +1,5 @@
1
1
  import type { Canvas, CanvasKit } from "canvaskit-wasm";
2
- import type { BlendMode, ClipOp, FilterMode, MipmapMode, PointMode, SaveLayerFlag, ImageInfo, SkCanvas, SkColor, SkFont, SkImage, SkImageFilter, SkMatrix, SkPaint, SkPath, SkPicture, SkPoint, SkRect, InputRRect, SkSVG, SkTextBlob, SkVertices, SkRSXform, CubicResampler, FilterOptions } from "../types";
2
+ import { type BlendMode, type ClipOp, type FilterMode, type MipmapMode, type PointMode, type SaveLayerFlag, type ImageInfo, type SkCanvas, type SkColor, type SkFont, type SkImage, type SkImageFilter, type SkMatrix, type SkPaint, type SkPath, type SkPicture, type SkPoint, type SkRect, type InputRRect, type SkSVG, type SkTextBlob, type SkVertices, type SkRSXform, type CubicResampler, type FilterOptions } from "../types";
3
3
  import { HostObject } from "./Host";
4
4
  export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements SkCanvas {
5
5
  constructor(CanvasKit: CanvasKit, ref: Canvas);
@@ -42,6 +42,6 @@ export declare class JsiSkCanvas extends HostObject<Canvas, "Canvas"> implements
42
42
  clipRRect(rrect: InputRRect, op: ClipOp, doAntiAlias: boolean): void;
43
43
  concat(m: SkMatrix | number[]): void;
44
44
  drawPicture(skp: SkPicture): void;
45
- drawAtlas(atlas: SkImage, srcs: SkRect[], dsts: SkRSXform[], paint: SkPaint, blendMode?: BlendMode, colors?: SkColor[], _sampling?: CubicResampler | FilterOptions): void;
45
+ drawAtlas(atlas: SkImage, srcs: SkRect[], dsts: SkRSXform[], paint: SkPaint, blendMode?: BlendMode, colors?: SkColor[], sampling?: CubicResampler | FilterOptions): void;
46
46
  readPixels(srcX: number, srcY: number, imageInfo: ImageInfo): Float32Array | Uint8Array | null;
47
47
  }
@@ -1,20 +1,23 @@
1
1
  import type { Skia, SkCanvas } from "../skia/types";
2
2
  import type { Node } from "./Node";
3
- export declare class Container {
4
- Skia: Skia;
5
- private nativeId;
6
- private _root;
7
- private _recording;
8
- unmounted: boolean;
9
- private values;
3
+ import type { Recording } from "./Recorder/Recorder";
4
+ export declare abstract class Container {
5
+ protected Skia: Skia;
6
+ protected nativeId: number;
7
+ root: Node[];
8
+ protected recording: Recording | null;
9
+ constructor(Skia: Skia, nativeId: number);
10
+ drawOnCanvas(canvas: SkCanvas): void;
11
+ abstract redraw(): void;
12
+ }
13
+ declare class StaticContainer extends Container {
14
+ constructor(Skia: Skia, nativeId: number);
15
+ redraw(): void;
16
+ }
17
+ declare class ReanimatedContainer extends Container {
10
18
  private mapperId;
11
19
  constructor(Skia: Skia, nativeId: number);
12
- get root(): Node[];
13
- set root(root: Node[]);
14
- clear(): void;
15
20
  redraw(): void;
16
- getNativeId(): number;
17
- unregisterValues(values: object): void;
18
- registerValues(values: object): void;
19
- drawOnCanvas(canvas: SkCanvas): void;
20
21
  }
22
+ export declare const createContainer: (Skia: Skia, nativeId: number) => StaticContainer | ReanimatedContainer;
23
+ export {};
@@ -1,43 +1,44 @@
1
1
  import type { SharedValue } from "react-native-reanimated";
2
2
  import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, DrawingNodeProps } from "../../dom/types";
3
3
  export declare enum CommandType {
4
- SavePaint = 0,
5
- RestorePaint = 1,
6
- SaveCTM = 2,
7
- RestoreCTM = 3,
8
- PushColorFilter = 4,
9
- PushBlurMaskFilter = 5,
10
- PushImageFilter = 6,
11
- PushPathEffect = 7,
12
- PushShader = 8,
13
- ComposeColorFilter = 9,
14
- ComposeImageFilter = 10,
15
- ComposePathEffect = 11,
16
- MaterializePaint = 12,
17
- SaveBackdropFilter = 13,
18
- SaveLayer = 14,
19
- RestorePaintDeclaration = 15,
20
- DrawBox = 16,
21
- DrawImage = 17,
22
- DrawCircle = 18,
23
- DrawPaint = 19,
24
- DrawPoints = 20,
25
- DrawPath = 21,
26
- DrawRect = 22,
27
- DrawRRect = 23,
28
- DrawOval = 24,
29
- DrawLine = 25,
30
- DrawPatch = 26,
31
- DrawVertices = 27,
32
- DrawDiffRect = 28,
33
- DrawText = 29,
34
- DrawTextPath = 30,
35
- DrawTextBlob = 31,
36
- DrawGlyphs = 32,
37
- DrawPicture = 33,
38
- DrawImageSVG = 34,
39
- DrawParagraph = 35,
40
- DrawAtlas = 36
4
+ Group = 0,
5
+ SavePaint = 1,
6
+ RestorePaint = 2,
7
+ SaveCTM = 3,
8
+ RestoreCTM = 4,
9
+ PushColorFilter = 5,
10
+ PushBlurMaskFilter = 6,
11
+ PushImageFilter = 7,
12
+ PushPathEffect = 8,
13
+ PushShader = 9,
14
+ ComposeColorFilter = 10,
15
+ ComposeImageFilter = 11,
16
+ ComposePathEffect = 12,
17
+ MaterializePaint = 13,
18
+ SaveBackdropFilter = 14,
19
+ SaveLayer = 15,
20
+ RestorePaintDeclaration = 16,
21
+ DrawBox = 17,
22
+ DrawImage = 18,
23
+ DrawCircle = 19,
24
+ DrawPaint = 20,
25
+ DrawPoints = 21,
26
+ DrawPath = 22,
27
+ DrawRect = 23,
28
+ DrawRRect = 24,
29
+ DrawOval = 25,
30
+ DrawLine = 26,
31
+ DrawPatch = 27,
32
+ DrawVertices = 28,
33
+ DrawDiffRect = 29,
34
+ DrawText = 30,
35
+ DrawTextPath = 31,
36
+ DrawTextBlob = 32,
37
+ DrawGlyphs = 33,
38
+ DrawPicture = 34,
39
+ DrawImageSVG = 35,
40
+ DrawParagraph = 36,
41
+ DrawAtlas = 37
41
42
  }
42
43
  export type Command<T extends CommandType = CommandType> = {
43
44
  type: T;
@@ -48,6 +49,10 @@ export declare const materializeProps: (command: {
48
49
  animatedProps?: Record<string, SharedValue<unknown>>;
49
50
  }) => void;
50
51
  export declare const isCommand: <T extends CommandType>(command: Command, type: T) => command is Command<T>;
52
+ interface GroupCommand extends Command<CommandType.Group> {
53
+ children: Command[];
54
+ }
55
+ export declare const isGroup: (command: Command) => command is GroupCommand;
51
56
  interface Props {
52
57
  [CommandType.DrawImage]: ImageProps;
53
58
  [CommandType.DrawCircle]: CircleProps;
@@ -2,11 +2,25 @@ 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
+ cursors: Command[][];
17
+ animationValues: Set<SharedValue<unknown>>;
18
+ constructor();
19
+ getRecording(): Recording & AnimationValues;
8
20
  private processProps;
9
21
  private add;
22
+ saveGroup(): void;
23
+ restoreGroup(): void;
10
24
  savePaint(props: AnimatedProps<PaintProps>): void;
11
25
  restorePaint(): void;
12
26
  restorePaintDeclaration(): void;
@@ -48,3 +62,4 @@ export declare class Recorder {
48
62
  drawParagraph(props: AnimatedProps<ParagraphProps>): void;
49
63
  drawAtlas(props: AnimatedProps<AtlasProps>): void;
50
64
  }
65
+ export {};
@@ -19,6 +19,36 @@
19
19
  <key>SupportedPlatform</key>
20
20
  <string>ios</string>
21
21
  </dict>
22
+ <dict>
23
+ <key>BinaryPath</key>
24
+ <string>libskia.a</string>
25
+ <key>LibraryIdentifier</key>
26
+ <string>tvos-arm64_arm64e</string>
27
+ <key>LibraryPath</key>
28
+ <string>libskia.a</string>
29
+ <key>SupportedArchitectures</key>
30
+ <array>
31
+ <string>arm64</string>
32
+ <string>arm64e</string>
33
+ </array>
34
+ <key>SupportedPlatform</key>
35
+ <string>tvos</string>
36
+ </dict>
37
+ <dict>
38
+ <key>BinaryPath</key>
39
+ <string>libskia.a</string>
40
+ <key>LibraryIdentifier</key>
41
+ <string>macos-arm64_x86_64</string>
42
+ <key>LibraryPath</key>
43
+ <string>libskia.a</string>
44
+ <key>SupportedArchitectures</key>
45
+ <array>
46
+ <string>arm64</string>
47
+ <string>x86_64</string>
48
+ </array>
49
+ <key>SupportedPlatform</key>
50
+ <string>macos</string>
51
+ </dict>
22
52
  <dict>
23
53
  <key>BinaryPath</key>
24
54
  <string>libskia.a</string>
@@ -41,16 +71,19 @@
41
71
  <key>BinaryPath</key>
42
72
  <string>libskia.a</string>
43
73
  <key>LibraryIdentifier</key>
44
- <string>macos-arm64_x86_64</string>
74
+ <string>tvos-arm64_arm64e_x86_64-simulator</string>
45
75
  <key>LibraryPath</key>
46
76
  <string>libskia.a</string>
47
77
  <key>SupportedArchitectures</key>
48
78
  <array>
49
79
  <string>arm64</string>
80
+ <string>arm64e</string>
50
81
  <string>x86_64</string>
51
82
  </array>
52
83
  <key>SupportedPlatform</key>
53
- <string>macos</string>
84
+ <string>tvos</string>
85
+ <key>SupportedPlatformVariant</key>
86
+ <string>simulator</string>
54
87
  </dict>
55
88
  </array>
56
89
  <key>CFBundlePackageType</key>