@shopify/react-native-skia 2.1.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/android/CMakeLists.txt +1 -1
  2. package/android/cpp/rnskia-android/OpenGLWindowContext.h +1 -1
  3. package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +1 -1
  4. package/android/cpp/rnskia-android/RNSkAndroidVideo.cpp +1 -1
  5. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +1 -1
  6. package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +1 -1
  7. package/android/src/main/java/com/shopify/reactnative/skia/SkiaPictureViewManager.java +6 -0
  8. package/apple/MetalContext.h +2 -2
  9. package/apple/MetalWindowContext.h +2 -2
  10. package/apple/MetalWindowContext.mm +7 -4
  11. package/apple/RNSkApplePlatformContext.mm +1 -1
  12. package/apple/RNSkAppleView.h +7 -1
  13. package/apple/RNSkMetalCanvasProvider.h +4 -1
  14. package/apple/RNSkMetalCanvasProvider.mm +9 -4
  15. package/apple/SkiaPictureView.mm +4 -0
  16. package/apple/SkiaUIView.h +1 -0
  17. package/apple/SkiaUIView.mm +9 -0
  18. package/cpp/api/JsiSkImage.h +1 -1
  19. package/cpp/api/JsiSkSurface.h +1 -1
  20. package/cpp/api/JsiSkiaContext.h +1 -1
  21. package/cpp/api/recorder/ImageFilters.h +3 -3
  22. package/cpp/api/recorder/Paint.h +4 -0
  23. package/cpp/rnskia/{DawnContext.h → RNDawnContext.h} +3 -3
  24. package/cpp/rnskia/{DawnWindowContext.cpp → RNDawnWindowContext.cpp} +3 -3
  25. package/cpp/rnskia/{DawnWindowContext.h → RNDawnWindowContext.h} +2 -2
  26. package/cpp/rnskia/RNSkPlatformContext.h +1 -1
  27. package/lib/commonjs/dom/types/Drawings.d.ts +1 -1
  28. package/lib/commonjs/dom/types/Drawings.js.map +1 -1
  29. package/lib/commonjs/renderer/Canvas.d.ts +2 -1
  30. package/lib/commonjs/renderer/Canvas.js +2 -0
  31. package/lib/commonjs/renderer/Canvas.js.map +1 -1
  32. package/lib/commonjs/renderer/components/ImageFilter.js.map +1 -1
  33. package/lib/commonjs/skia/types/Matrix4.d.ts +4 -0
  34. package/lib/commonjs/skia/types/Matrix4.js +18 -1
  35. package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
  36. package/lib/commonjs/sksg/Recorder/Player.js +9 -3
  37. package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
  38. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js +2 -2
  39. package/lib/commonjs/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  40. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
  41. package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  42. package/lib/module/dom/types/Drawings.d.ts +1 -1
  43. package/lib/module/dom/types/Drawings.js.map +1 -1
  44. package/lib/module/renderer/Canvas.d.ts +2 -1
  45. package/lib/module/renderer/Canvas.js +2 -0
  46. package/lib/module/renderer/Canvas.js.map +1 -1
  47. package/lib/module/renderer/components/ImageFilter.js.map +1 -1
  48. package/lib/module/skia/types/Matrix4.d.ts +4 -0
  49. package/lib/module/skia/types/Matrix4.js +16 -0
  50. package/lib/module/skia/types/Matrix4.js.map +1 -1
  51. package/lib/module/sksg/Recorder/Player.js +9 -3
  52. package/lib/module/sksg/Recorder/Player.js.map +1 -1
  53. package/lib/module/sksg/Recorder/commands/ImageFilters.js +2 -2
  54. package/lib/module/sksg/Recorder/commands/ImageFilters.js.map +1 -1
  55. package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
  56. package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
  57. package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +2 -1
  58. package/lib/typescript/lib/commonjs/skia/types/Matrix4.d.ts +1 -0
  59. package/lib/typescript/lib/module/mock/index.d.ts +1 -0
  60. package/lib/typescript/lib/module/renderer/Canvas.d.ts +2 -1
  61. package/lib/typescript/lib/module/skia/types/Matrix4.d.ts +1 -0
  62. package/lib/typescript/src/dom/types/Drawings.d.ts +1 -1
  63. package/lib/typescript/src/renderer/Canvas.d.ts +2 -1
  64. package/lib/typescript/src/skia/types/Matrix4.d.ts +4 -0
  65. package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +1 -0
  66. package/libs/android/arm64-v8a/libskia.a +0 -0
  67. package/libs/android/armeabi-v7a/libskia.a +0 -0
  68. package/libs/android/x86/libskia.a +0 -0
  69. package/libs/android/x86_64/libskia.a +0 -0
  70. package/libs/apple/libpathops.xcframework/Info.plist +15 -15
  71. package/libs/apple/libskia.xcframework/Info.plist +11 -11
  72. package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
  73. package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  74. package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
  75. package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
  76. package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
  77. package/libs/apple/libskottie.xcframework/Info.plist +16 -16
  78. package/libs/apple/libskparagraph.xcframework/Info.plist +8 -8
  79. package/libs/apple/libsksg.xcframework/Info.plist +6 -6
  80. package/libs/apple/libskshaper.xcframework/Info.plist +10 -10
  81. package/libs/apple/libskunicode_core.xcframework/Info.plist +10 -10
  82. package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +14 -14
  83. package/libs/apple/libsvg.xcframework/Info.plist +15 -15
  84. package/package.json +1 -1
  85. package/react-native-skia.podspec +5 -5
  86. package/src/dom/types/Drawings.ts +1 -1
  87. package/src/renderer/Canvas.tsx +3 -0
  88. package/src/renderer/__tests__/FitBox.spec.tsx +556 -4
  89. package/src/renderer/__tests__/e2e/ImageFilter.spec.tsx +4 -4
  90. package/src/renderer/__tests__/e2e/Paint.spec.tsx +18 -0
  91. package/src/renderer/__tests__/e2e/Skottie.spec.tsx +24 -1
  92. package/src/renderer/__tests__/setup.tsx +2 -0
  93. package/src/renderer/components/ImageFilter.tsx +1 -1
  94. package/src/skia/types/Matrix4.ts +16 -0
  95. package/src/sksg/Recorder/Player.ts +7 -7
  96. package/src/sksg/Recorder/commands/ImageFilters.ts +3 -6
  97. package/src/specs/SkiaPictureViewNativeComponent.ts +1 -0
  98. /package/cpp/rnskia/{DawnUtils.h → RNDawnUtils.h} +0 -0
  99. /package/cpp/rnskia/{ImageProvider.h → RNImageProvider.h} +0 -0
  100. /package/cpp/rnskia/{WindowContext.h → RNWindowContext.h} +0 -0
@@ -174,6 +174,7 @@ export const importSkia = (): typeof SkiaExports => {
174
174
  const skia = require("../../skia");
175
175
  const renderer = require("../../renderer");
176
176
  const offscreen = require("../Offscreen");
177
+ const nodes = require("../../dom/nodes");
177
178
  // TODO: to remove
178
179
  const animation = require("../../animation");
179
180
  return {
@@ -181,6 +182,7 @@ export const importSkia = (): typeof SkiaExports => {
181
182
  ...renderer,
182
183
  ...animation,
183
184
  ...offscreen,
185
+ ...nodes,
184
186
  };
185
187
  };
186
188
 
@@ -5,4 +5,4 @@ import type { SkiaProps } from "../processors";
5
5
 
6
6
  export const ImageFilter = (props: SkiaProps<ImageFilterProps>) => {
7
7
  return <skImageFilter {...props} />;
8
- };
8
+ };
@@ -354,6 +354,22 @@ export const convertToColumnMajor = (rowMajorMatrix: Matrix4) => {
354
354
  return colMajorMatrix as unknown as Matrix4;
355
355
  };
356
356
 
357
+ /**
358
+ * @worklet
359
+ */
360
+ export const convertToColumnMajor3 = (rowMajorMatrix: Matrix3 | number[]) => {
361
+ "worklet";
362
+
363
+ const colMajorMatrix = new Array<number>(9);
364
+ const size = 3;
365
+ for (let row = 0; row < size; row++) {
366
+ for (let col = 0; col < size; col++) {
367
+ colMajorMatrix[col * size + row] = rowMajorMatrix[row * size + col];
368
+ }
369
+ }
370
+ return colMajorMatrix as unknown as Matrix3;
371
+ };
372
+
357
373
  /**
358
374
  * @worklet
359
375
  */
@@ -67,14 +67,14 @@ function play(ctx: DrawingContext, _command: Command) {
67
67
  if (command.props.paint) {
68
68
  ctx.paints.push(command.props.paint);
69
69
  } else {
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
+ const { standalone } = command as any;
70
72
  ctx.savePaint();
71
- setPaintProperties(
72
- ctx.Skia,
73
- ctx,
74
- command.props,
75
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
- (command as any).standalone
77
- );
73
+ if (standalone) {
74
+ const freshPaint = ctx.Skia.Paint();
75
+ ctx.paint.assign(freshPaint);
76
+ }
77
+ setPaintProperties(ctx.Skia, ctx, command.props, standalone);
78
78
  }
79
79
  } else if (isCommand(command, CommandType.RestorePaint)) {
80
80
  ctx.restorePaint();
@@ -177,13 +177,10 @@ const declareRuntimeShaderImageFilter = (
177
177
  ctx.imageFilters.push(imgf);
178
178
  };
179
179
 
180
- const declareImageFilter = (
181
- ctx: DrawingContext,
182
- props: ImageFilterProps
183
- ) => {
180
+ const declareImageFilter = (ctx: DrawingContext, props: ImageFilterProps) => {
184
181
  "worklet";
185
- const { imageFilter } = props;
186
- ctx.imageFilters.push(imageFilter);
182
+ const { filter } = props;
183
+ ctx.imageFilters.push(filter);
187
184
  };
188
185
 
189
186
  export const composeImageFilters = (ctx: DrawingContext) => {
@@ -4,6 +4,7 @@ import type { ViewProps } from "react-native";
4
4
  export interface NativeProps extends ViewProps {
5
5
  debug?: boolean;
6
6
  opaque?: boolean;
7
+ colorSpace?: string;
7
8
  }
8
9
 
9
10
  // eslint-disable-next-line import/no-default-export
File without changes