@shopify/react-native-skia 1.11.9-next.1 → 1.11.10
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.
- package/android/CMakeLists.txt +153 -30
- package/android/build.gradle +1 -1
- package/cpp/skia/include/codec/SkCodec.h +2 -7
- package/cpp/skia/include/config/SkUserConfig.h +0 -11
- package/cpp/skia/include/core/SkCanvas.h +7 -11
- package/cpp/skia/include/core/SkColor.h +0 -10
- package/cpp/skia/include/core/SkColorSpace.h +2 -184
- package/cpp/skia/include/core/SkColorType.h +32 -114
- package/cpp/skia/include/core/SkFontScanner.h +8 -5
- package/cpp/skia/include/core/SkFontStyle.h +1 -1
- package/cpp/skia/include/core/SkMaskFilter.h +8 -0
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +1 -1
- package/cpp/skia/include/core/SkRRect.h +1 -3
- package/cpp/skia/include/core/SkShader.h +3 -3
- package/cpp/skia/include/core/SkString.h +8 -8
- package/cpp/skia/include/core/SkSurface.h +0 -14
- package/cpp/skia/include/core/SkTypeface.h +7 -24
- package/cpp/skia/include/effects/SkGradientShader.h +1 -6
- package/cpp/skia/include/effects/SkRuntimeEffect.h +0 -1
- package/cpp/skia/include/encode/SkPngEncoder.h +0 -14
- package/cpp/skia/include/gpu/GpuTypes.h +0 -9
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +133 -135
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +0 -5
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +9 -14
- package/cpp/skia/include/gpu/graphite/Context.h +2 -25
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +5 -23
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +1 -20
- package/cpp/skia/include/gpu/graphite/Image.h +0 -1
- package/cpp/skia/include/gpu/graphite/Recorder.h +0 -6
- package/cpp/skia/include/gpu/graphite/Recording.h +1 -3
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +36 -4
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +2 -3
- package/cpp/skia/include/pathops/SkPathOps.h +1 -9
- package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +0 -3
- package/cpp/skia/include/private/SkPathRef.h +21 -15
- package/cpp/skia/include/private/base/SkAttributes.h +10 -16
- package/cpp/skia/include/private/base/SkMutex.h +0 -8
- package/cpp/skia/include/private/base/SkTArray.h +1 -1
- package/cpp/skia/include/private/base/SkTDArray.h +1 -1
- package/cpp/skia/include/private/base/SkTemplates.h +11 -24
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/sksl/SkSLDebugTrace.h +3 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
- package/cpp/skia/modules/skcms/src/skcms_Transform.h +3 -4
- package/cpp/skia/modules/skcms/src/skcms_public.h +15 -19
- package/cpp/skia/modules/skresources/include/SkResources.h +1 -3
- package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGImage.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +0 -2
- package/cpp/skia/modules/svg/include/SkSVGShape.h +0 -1
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +0 -4
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/src/core/SkLRUCache.h +13 -19
- package/cpp/skia/src/core/SkTHash.h +4 -50
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +0 -1
- package/lib/commonjs/external/reanimated/textures.js +3 -4
- package/lib/commonjs/external/reanimated/textures.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +1 -1
- package/lib/commonjs/headless/index.js +2 -2
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.d.ts +2 -2
- package/lib/commonjs/renderer/Canvas.js +28 -11
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +2 -2
- package/lib/commonjs/renderer/Offscreen.js +4 -4
- package/lib/commonjs/renderer/Offscreen.js.map +1 -1
- package/lib/commonjs/renderer/__tests__/setup.d.ts +5 -5
- package/lib/commonjs/sksg/Container.d.ts +1 -3
- package/lib/commonjs/sksg/Container.js +1 -7
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.d.ts +1 -1
- package/lib/commonjs/sksg/HostConfig.js +6 -36
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig2.d.ts +19 -0
- package/lib/commonjs/sksg/HostConfig2.js +159 -0
- package/lib/commonjs/sksg/HostConfig2.js.map +1 -0
- package/lib/commonjs/sksg/Reconciler.d.ts +2 -3
- package/lib/commonjs/sksg/Reconciler.js +6 -16
- package/lib/commonjs/sksg/Reconciler.js.map +1 -1
- package/lib/module/Platform/Platform.web.js +1 -1
- package/lib/module/Platform/Platform.web.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Circle.js +2 -1
- package/lib/module/dom/nodes/datatypes/Circle.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Gradient.js +3 -3
- package/lib/module/dom/nodes/datatypes/Gradient.js.map +1 -1
- package/lib/module/dom/nodes/datatypes/Rect.js +5 -3
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/buffers.js +2 -1
- package/lib/module/external/reanimated/buffers.js.map +1 -1
- package/lib/module/external/reanimated/textures.js +4 -5
- package/lib/module/external/reanimated/textures.js.map +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/external/reanimated/useVideo.js +23 -10
- package/lib/module/external/reanimated/useVideo.js.map +1 -1
- package/lib/module/headless/index.d.ts +1 -1
- package/lib/module/headless/index.js +2 -2
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/renderer/Canvas.d.ts +2 -2
- package/lib/module/renderer/Canvas.js +28 -10
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +2 -2
- package/lib/module/renderer/Offscreen.js +4 -4
- package/lib/module/renderer/Offscreen.js.map +1 -1
- package/lib/module/renderer/__tests__/setup.d.ts +5 -5
- package/lib/module/skia/core/Vector.js +1 -1
- package/lib/module/skia/core/Vector.js.map +1 -1
- package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js +4 -1
- package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -1
- package/lib/module/skia/web/Host.js +7 -1
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkAnimatedImage.js +6 -3
- package/lib/module/skia/web/JsiSkAnimatedImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +6 -3
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilter.js +6 -3
- package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasure.js +6 -3
- package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasureIter.js +6 -3
- package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
- package/lib/module/skia/web/JsiSkData.js +6 -3
- package/lib/module/skia/web/JsiSkData.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +6 -3
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +12 -8
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilter.js +6 -3
- package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilter.js +6 -3
- package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +8 -5
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +6 -3
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilder.js +3 -2
- package/lib/module/skia/web/JsiSkParagraphBuilder.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphStyle.js +15 -15
- package/lib/module/skia/web/JsiSkParagraphStyle.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +6 -3
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffect.js +6 -3
- package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +6 -3
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +6 -3
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.js +6 -3
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +6 -3
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.js +6 -3
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.js +6 -3
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +6 -3
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkSVG.js +8 -5
- package/lib/module/skia/web/JsiSkSVG.js.map +1 -1
- package/lib/module/skia/web/JsiSkShader.js +6 -3
- package/lib/module/skia/web/JsiSkShader.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.js +6 -3
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlob.js +6 -3
- package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypeface.js +6 -3
- package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +4 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/module/skia/web/JsiSkVertices.js +6 -3
- package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
- package/lib/module/skia/web/JsiVideo.js +5 -2
- package/lib/module/skia/web/JsiVideo.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +1 -3
- package/lib/module/sksg/Container.js +8 -11
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/HostConfig.d.ts +1 -1
- package/lib/module/sksg/HostConfig.js +7 -36
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/HostConfig2.d.ts +19 -0
- package/lib/module/sksg/HostConfig2.js +152 -0
- package/lib/module/sksg/HostConfig2.js.map +1 -0
- package/lib/module/sksg/Reconciler.d.ts +2 -3
- package/lib/module/sksg/Reconciler.js +11 -16
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js +5 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Recorder.js +6 -3
- package/lib/module/sksg/Recorder/Recorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Visitor.js +1 -1
- package/lib/module/sksg/Recorder/Visitor.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.js +4 -2
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Shaders.js +3 -2
- package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +12 -9
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +5 -1
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +4 -1
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/web/LoadSkiaWeb.js +2 -1
- package/lib/module/web/LoadSkiaWeb.js.map +1 -1
- package/lib/module/web/WithSkiaWeb.js +1 -1
- package/lib/module/web/WithSkiaWeb.js.map +1 -1
- package/lib/typescript/lib/commonjs/headless/index.d.ts +1 -1
- package/lib/typescript/lib/commonjs/renderer/Canvas.d.ts +1 -9
- package/lib/typescript/lib/commonjs/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +0 -3
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +4 -21
- package/lib/typescript/lib/commonjs/sksg/HostConfig2.d.ts +44 -0
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +2 -9
- package/lib/typescript/lib/module/headless/index.d.ts +1 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +1 -9
- package/lib/typescript/lib/module/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/CanvasKitWebGLBufferImpl.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/JsiSkAnimatedImage.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkCanvas.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkColorFilter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkContourMeasure.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkData.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImage.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFilter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkMaskFilter.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkMatrix.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPathEffect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPicture.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPictureRecorder.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPoint.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRRect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRSXform.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkSVG.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkShader.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkSurface.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTextBlob.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTypeface.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkVertices.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +2 -2
- package/lib/typescript/lib/module/sksg/Container.d.ts +12 -7
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +4 -20
- package/lib/typescript/lib/module/sksg/HostConfig2.d.ts +43 -0
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +17 -18
- package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +0 -1
- package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +2 -5
- package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +11 -12
- package/lib/typescript/lib/module/views/SkiaPictureView.d.ts +2 -2
- package/lib/typescript/lib/module/views/SkiaPictureView.web.d.ts +1 -1
- package/lib/typescript/src/headless/index.d.ts +1 -1
- package/lib/typescript/src/renderer/Canvas.d.ts +2 -2
- package/lib/typescript/src/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/src/renderer/__tests__/setup.d.ts +5 -5
- package/lib/typescript/src/sksg/Container.d.ts +1 -3
- package/lib/typescript/src/sksg/HostConfig.d.ts +1 -1
- package/lib/typescript/src/sksg/HostConfig2.d.ts +19 -0
- package/lib/typescript/src/sksg/Reconciler.d.ts +2 -3
- package/package.json +9 -10
- package/src/external/reanimated/textures.tsx +4 -5
- package/src/headless/index.ts +2 -2
- package/src/renderer/Canvas.tsx +81 -57
- package/src/renderer/Offscreen.tsx +4 -4
- package/src/renderer/__tests__/Data.spec.tsx +10 -9
- package/src/renderer/__tests__/Drawings.spec.tsx +11 -11
- package/src/renderer/__tests__/FitBox.spec.tsx +10 -10
- package/src/renderer/__tests__/Glyphs.spec.tsx +2 -2
- package/src/renderer/__tests__/Image.spec.tsx +2 -2
- package/src/renderer/__tests__/Paths.spec.tsx +8 -8
- package/src/renderer/__tests__/Picture.spec.tsx +12 -10
- package/src/renderer/__tests__/Simple.spec.tsx +6 -6
- package/src/renderer/__tests__/Surfaces.spec.tsx +2 -2
- package/src/renderer/__tests__/Text.spec.tsx +12 -12
- package/src/renderer/__tests__/Transform.spec.tsx +8 -8
- package/src/renderer/__tests__/documentation/Group.spec.tsx +12 -12
- package/src/renderer/__tests__/documentation/getting-started/HelloWorld.spec.tsx +2 -2
- package/src/renderer/__tests__/documentation/paint/Overview.spec.tsx +8 -8
- package/src/renderer/__tests__/documentation/shapes/Box.spec.tsx +4 -4
- package/src/renderer/__tests__/e2e/Atlas.spec.tsx +3 -3
- package/src/renderer/__tests__/e2e/Offscreen.spec.tsx +1 -1
- package/src/renderer/__tests__/examples/BlendModes.spec.tsx +4 -4
- package/src/renderer/__tests__/setup.tsx +13 -13
- package/src/sksg/Container.ts +1 -9
- package/src/sksg/HostConfig.ts +7 -37
- package/src/sksg/HostConfig2.ts +247 -0
- package/src/sksg/Reconciler.ts +6 -17
- package/src/sksg/__tests__/Simple.spec.tsx +8 -8
- package/cpp/skia/include/gpu/graphite/LogPriority.h +0 -36
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +0 -52
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +0 -48
@@ -3,47 +3,46 @@ export class SkiaSGRoot {
|
|
3
3
|
Skia: any;
|
4
4
|
container: {
|
5
5
|
redraw(): void;
|
6
|
-
recording:
|
7
|
-
|
8
|
-
|
6
|
+
recording: {
|
7
|
+
commands: any;
|
8
|
+
paintPool: never[];
|
9
|
+
animationValues: any;
|
10
|
+
} | undefined;
|
9
11
|
Skia: any;
|
10
12
|
nativeId: any;
|
11
|
-
root: any[];
|
12
13
|
unmount(): void;
|
14
|
+
unmounted: boolean | undefined;
|
13
15
|
drawOnCanvas(canvas: any): void;
|
14
16
|
} | {
|
15
|
-
mapperId: null;
|
16
17
|
redraw(): void;
|
17
|
-
recording:
|
18
|
-
|
19
|
-
|
18
|
+
recording: {
|
19
|
+
commands: any;
|
20
|
+
paintPool: never[];
|
21
|
+
} | undefined;
|
22
|
+
mapperId: any;
|
20
23
|
Skia: any;
|
21
24
|
nativeId: any;
|
22
|
-
root: any[];
|
23
25
|
unmount(): void;
|
26
|
+
unmounted: boolean | undefined;
|
24
27
|
drawOnCanvas(canvas: any): void;
|
25
28
|
} | {
|
26
|
-
mapperId: null;
|
27
29
|
redraw(): void;
|
28
|
-
|
29
|
-
recording: null;
|
30
|
-
unmounted: boolean;
|
30
|
+
mapperId: any;
|
31
31
|
Skia: any;
|
32
32
|
nativeId: any;
|
33
|
-
root: any[];
|
34
33
|
unmount(): void;
|
34
|
+
unmounted: boolean | undefined;
|
35
35
|
drawOnCanvas(canvas: any): void;
|
36
36
|
};
|
37
37
|
root: any;
|
38
38
|
get sg(): {
|
39
39
|
type: any;
|
40
40
|
props: {};
|
41
|
-
children: any
|
41
|
+
children: any;
|
42
42
|
isDeclaration: boolean;
|
43
43
|
};
|
44
|
-
|
45
|
-
render(element: any): Promise<void>;
|
44
|
+
render(element: any): void;
|
46
45
|
drawOnCanvas(canvas: any): void;
|
47
46
|
getPicture(): any;
|
48
|
-
unmount():
|
47
|
+
unmount(): void;
|
49
48
|
}
|
@@ -1,11 +1,8 @@
|
|
1
1
|
export class Recorder {
|
2
|
-
commands: any[];
|
3
|
-
cursors: any[];
|
4
|
-
animationValues: Set<any>;
|
5
2
|
getRecording(): {
|
6
|
-
commands: any
|
3
|
+
commands: any;
|
7
4
|
paintPool: never[];
|
8
|
-
animationValues:
|
5
|
+
animationValues: any;
|
9
6
|
};
|
10
7
|
processProps(props: any): {
|
11
8
|
props: any;
|
@@ -1,18 +1,15 @@
|
|
1
1
|
export class SkiaBaseWebView extends React.Component<any, any, any> {
|
2
2
|
constructor(props: any);
|
3
|
-
_surface: null;
|
4
|
-
_unsubscriptions: any[];
|
5
|
-
_canvas: null;
|
6
|
-
_canvasRef: React.RefObject<any>;
|
7
|
-
_redrawRequests: number;
|
8
|
-
requestId: number;
|
9
|
-
width: number;
|
10
|
-
height: number;
|
11
3
|
unsubscribeAll(): void;
|
4
|
+
_unsubscriptions: any[] | undefined;
|
12
5
|
onLayoutEvent(evt: any): void;
|
6
|
+
width: any;
|
7
|
+
height: any;
|
8
|
+
_surface: JsiSkSurface | undefined;
|
9
|
+
_canvas: import("../skia/web/JsiSkCanvas").JsiSkCanvas | undefined;
|
13
10
|
getSize(): {
|
14
|
-
width:
|
15
|
-
height:
|
11
|
+
width: any;
|
12
|
+
height: any;
|
16
13
|
};
|
17
14
|
componentDidMount(): void;
|
18
15
|
componentDidUpdate(): void;
|
@@ -22,7 +19,7 @@ export class SkiaBaseWebView extends React.Component<any, any, any> {
|
|
22
19
|
* @param rect Rect to use as bounds. Optional.
|
23
20
|
* @returns An Image object.
|
24
21
|
*/
|
25
|
-
makeImageSnapshot(rect: any):
|
22
|
+
makeImageSnapshot(rect: any): import("..").JsiSkImage | undefined;
|
26
23
|
/**
|
27
24
|
* Override to render
|
28
25
|
*/
|
@@ -30,8 +27,10 @@ export class SkiaBaseWebView extends React.Component<any, any, any> {
|
|
30
27
|
* Sends a redraw request to the native SkiaView.
|
31
28
|
*/
|
32
29
|
tick(): void;
|
30
|
+
_redrawRequests: number | undefined;
|
31
|
+
requestId: number | undefined;
|
33
32
|
redraw(): void;
|
34
|
-
onLayout: (evt: any) => void;
|
35
33
|
render(): React.CElement<import("react-native").ViewProps, import("react-native").View>;
|
36
34
|
}
|
37
35
|
import React from "react";
|
36
|
+
import { JsiSkSurface } from "../skia/web/JsiSkSurface";
|
@@ -1,11 +1,11 @@
|
|
1
1
|
export class SkiaPictureView extends React.Component<any, any, any> {
|
2
2
|
constructor(props: any);
|
3
|
-
requestId: number;
|
4
3
|
_nativeId: number;
|
5
4
|
get nativeId(): number;
|
6
5
|
componentDidUpdate(prevProps: any): void;
|
7
6
|
componentWillUnmount(): void;
|
8
7
|
tick(): void;
|
8
|
+
requestId: number | undefined;
|
9
9
|
/**
|
10
10
|
* Creates a snapshot from the canvas in the surface
|
11
11
|
* @param rect Rect to use as bounds. Optional.
|
@@ -16,6 +16,6 @@ export class SkiaPictureView extends React.Component<any, any, any> {
|
|
16
16
|
* Sends a redraw request to the native SkiaView.
|
17
17
|
*/
|
18
18
|
redraw(): void;
|
19
|
-
render(): React.CElement<object, React.Component<object, {}, any> & import("react-native").NativeMethods
|
19
|
+
render(): React.CElement<object, React.Component<object, {}, any> & Readonly<import("react-native").NativeMethods>>;
|
20
20
|
}
|
21
21
|
import React from "react";
|
@@ -5,4 +5,4 @@ export declare const makeOffscreenSurface: (width: number, height: number) => Sk
|
|
5
5
|
export declare const getSkiaExports: () => {
|
6
6
|
Skia: import("../skia/types").Skia;
|
7
7
|
};
|
8
|
-
export declare const drawOffscreen: (surface: SkSurface, element: ReactNode) =>
|
8
|
+
export declare const drawOffscreen: (surface: SkSurface, element: ReactNode) => import("../skia").SkImage;
|
@@ -14,7 +14,7 @@ export interface CanvasProps extends ViewProps {
|
|
14
14
|
debug?: boolean;
|
15
15
|
opaque?: boolean;
|
16
16
|
onSize?: SharedValue<SkSize>;
|
17
|
-
|
17
|
+
mode?: "continuous" | "default";
|
18
18
|
}
|
19
|
-
export declare const Canvas:
|
19
|
+
export declare const Canvas: React.ForwardRefExoticComponent<CanvasProps & React.RefAttributes<unknown>>;
|
20
20
|
export {};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ReactElement } from "react";
|
2
2
|
import type { SkPicture, SkRect, SkSize } from "../skia/types";
|
3
3
|
export declare const isOnMainThread: () => boolean;
|
4
|
-
export declare const drawAsPicture: (element: ReactElement, bounds?: SkRect) =>
|
5
|
-
export declare const drawAsImage: (element: ReactElement, size: SkSize) =>
|
4
|
+
export declare const drawAsPicture: (element: ReactElement, bounds?: SkRect) => SkPicture;
|
5
|
+
export declare const drawAsImage: (element: ReactElement, size: SkSize) => import("../skia").SkImage;
|
6
6
|
export declare const drawAsImageFromPicture: (picture: SkPicture, size: SkSize) => import("../skia").SkImage;
|
@@ -43,13 +43,13 @@ export declare const center: {
|
|
43
43
|
x: number;
|
44
44
|
y: number;
|
45
45
|
};
|
46
|
-
export declare const drawOnNode: (element: ReactNode) =>
|
47
|
-
export declare const mountCanvas: (element: ReactNode) =>
|
46
|
+
export declare const drawOnNode: (element: ReactNode) => SkiaExports.SkSurface;
|
47
|
+
export declare const mountCanvas: (element: ReactNode) => {
|
48
48
|
surface: SkiaExports.SkSurface;
|
49
49
|
root: SkiaSGRoot;
|
50
|
-
draw: () =>
|
51
|
-
}
|
52
|
-
export declare const serialize: (element: ReactNode) =>
|
50
|
+
draw: () => void;
|
51
|
+
};
|
52
|
+
export declare const serialize: (element: ReactNode) => string;
|
53
53
|
export type EvalContext = Record<string, any>;
|
54
54
|
interface TestingSurface {
|
55
55
|
eval<Ctx extends EvalContext = EvalContext, R = any>(fn: (Skia: Skia, ctx: Ctx) => R, ctx?: Ctx): Promise<R>;
|
@@ -5,12 +5,10 @@ import "../views/api";
|
|
5
5
|
export declare abstract class Container {
|
6
6
|
protected Skia: Skia;
|
7
7
|
protected nativeId: number;
|
8
|
-
|
8
|
+
root: Node[];
|
9
9
|
protected recording: Recording | null;
|
10
10
|
protected unmounted: boolean;
|
11
11
|
constructor(Skia: Skia, nativeId: number);
|
12
|
-
get root(): Node[];
|
13
|
-
set root(value: Node[]);
|
14
12
|
unmount(): void;
|
15
13
|
drawOnCanvas(canvas: SkCanvas): void;
|
16
14
|
abstract redraw(): void;
|
@@ -9,7 +9,7 @@ type TextInstance = Node;
|
|
9
9
|
type SuspenseInstance = Instance;
|
10
10
|
type HydratableInstance = Instance;
|
11
11
|
type PublicInstance = Instance;
|
12
|
-
type HostContext =
|
12
|
+
type HostContext = null;
|
13
13
|
type UpdatePayload = Container;
|
14
14
|
type ChildSet = Node[];
|
15
15
|
type TimeoutHandle = NodeJS.Timeout;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { HostConfig } from "react-reconciler";
|
2
|
+
import type { NodeType } from "../dom/types";
|
3
|
+
import type { Container } from "./Container";
|
4
|
+
import type { Node } from "./Node";
|
5
|
+
export declare const debug: (message?: any, ...optionalParams: any[]) => void;
|
6
|
+
type Instance = Node<unknown>;
|
7
|
+
type Props = object;
|
8
|
+
type TextInstance = Node<unknown>;
|
9
|
+
type SuspenseInstance = Instance;
|
10
|
+
type HydratableInstance = Instance;
|
11
|
+
type PublicInstance = Instance;
|
12
|
+
type HostContext = null;
|
13
|
+
type UpdatePayload = Container;
|
14
|
+
type ChildSet = unknown;
|
15
|
+
type TimeoutHandle = NodeJS.Timeout;
|
16
|
+
type NoTimeout = -1;
|
17
|
+
type SkiaHostConfig = HostConfig<NodeType, Props, Container, Instance, TextInstance, SuspenseInstance, HydratableInstance, PublicInstance, HostContext, UpdatePayload, ChildSet, TimeoutHandle, NoTimeout>;
|
18
|
+
export declare const sksgHostConfig: SkiaHostConfig;
|
19
|
+
export {};
|
@@ -13,9 +13,8 @@ export declare class SkiaSGRoot {
|
|
13
13
|
children: import("./Node").Node<unknown>[];
|
14
14
|
isDeclaration: boolean;
|
15
15
|
};
|
16
|
-
|
17
|
-
render(element: ReactNode): Promise<void>;
|
16
|
+
render(element: ReactNode): void;
|
18
17
|
drawOnCanvas(canvas: SkCanvas): void;
|
19
18
|
getPicture(): import("../skia/types").SkPicture;
|
20
|
-
unmount():
|
19
|
+
unmount(): void;
|
21
20
|
}
|
package/package.json
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
"setup-skia-web": "./scripts/setup-canvaskit.js"
|
9
9
|
},
|
10
10
|
"title": "React Native Skia",
|
11
|
-
"version": "1.11.
|
11
|
+
"version": "1.11.10",
|
12
12
|
"description": "High-performance React Native Graphics using Skia",
|
13
13
|
"main": "lib/module/index.js",
|
14
14
|
"react-native": "src/index.ts",
|
@@ -76,9 +76,9 @@
|
|
76
76
|
"licenseFilename": "LICENSE.md",
|
77
77
|
"readmeFilename": "README.md",
|
78
78
|
"peerDependencies": {
|
79
|
-
"react": ">=
|
80
|
-
"react-native": ">=0.
|
81
|
-
"react-native-reanimated": ">=
|
79
|
+
"react": ">=18.0",
|
80
|
+
"react-native": ">=0.64",
|
81
|
+
"react-native-reanimated": ">=2.0.0"
|
82
82
|
},
|
83
83
|
"peerDependenciesMeta": {
|
84
84
|
"react-native": {
|
@@ -108,10 +108,10 @@
|
|
108
108
|
"pixelmatch": "5.3.0",
|
109
109
|
"pngjs": "6.0.0",
|
110
110
|
"prettier": "2.8.7",
|
111
|
-
"react": "
|
112
|
-
"react-native": "0.
|
111
|
+
"react": "18.3.1",
|
112
|
+
"react-native": "0.75.2",
|
113
113
|
"react-native-builder-bob": "0.18.2",
|
114
|
-
"react-native-reanimated": "^3.
|
114
|
+
"react-native-reanimated": "^3.16.5",
|
115
115
|
"rimraf": "3.0.2",
|
116
116
|
"semantic-release": "^24.1.0",
|
117
117
|
"semantic-release-yarn": "^3.0.2",
|
@@ -122,7 +122,7 @@
|
|
122
122
|
},
|
123
123
|
"dependencies": {
|
124
124
|
"canvaskit-wasm": "0.39.1",
|
125
|
-
"react-reconciler": "0.
|
125
|
+
"react-reconciler": "0.27.0"
|
126
126
|
},
|
127
127
|
"eslintIgnore": [
|
128
128
|
"node_modules/",
|
@@ -154,6 +154,5 @@
|
|
154
154
|
}
|
155
155
|
]
|
156
156
|
]
|
157
|
-
}
|
158
|
-
"stableVersion": "0.0.0"
|
157
|
+
}
|
159
158
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useEffect, useMemo
|
1
|
+
import { useEffect, useMemo } from "react";
|
2
2
|
import type { ReactElement } from "react";
|
3
3
|
import type { SharedValue } from "react-native-reanimated";
|
4
4
|
|
@@ -27,14 +27,13 @@ const createTexture = (
|
|
27
27
|
|
28
28
|
export const useTexture = (element: ReactElement, size: SkSize) => {
|
29
29
|
const { width, height } = size;
|
30
|
-
const
|
31
|
-
|
32
|
-
drawAsPicture(element, {
|
30
|
+
const picture = useMemo(() => {
|
31
|
+
return drawAsPicture(element, {
|
33
32
|
x: 0,
|
34
33
|
y: 0,
|
35
34
|
width,
|
36
35
|
height,
|
37
|
-
})
|
36
|
+
});
|
38
37
|
}, [element, width, height]);
|
39
38
|
return usePictureAsTexture(picture, size);
|
40
39
|
};
|
package/src/headless/index.ts
CHANGED
@@ -29,9 +29,9 @@ export const getSkiaExports = () => {
|
|
29
29
|
return { Skia };
|
30
30
|
};
|
31
31
|
|
32
|
-
export const drawOffscreen =
|
32
|
+
export const drawOffscreen = (surface: SkSurface, element: ReactNode) => {
|
33
33
|
const root = new SkiaSGRoot(Skia);
|
34
|
-
|
34
|
+
root.render(element);
|
35
35
|
const canvas = surface.getCanvas();
|
36
36
|
root.drawOnCanvas(canvas);
|
37
37
|
root.unmount();
|
package/src/renderer/Canvas.tsx
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
import type { FC } from "react";
|
2
2
|
import React, {
|
3
|
+
forwardRef,
|
3
4
|
useCallback,
|
4
5
|
useEffect,
|
5
6
|
useImperativeHandle,
|
7
|
+
useLayoutEffect,
|
6
8
|
useMemo,
|
7
9
|
useRef,
|
8
10
|
} from "react";
|
@@ -25,7 +27,7 @@ interface CanvasRef extends FC<CanvasProps> {
|
|
25
27
|
|
26
28
|
export const useCanvasRef = () => useRef<CanvasRef>(null);
|
27
29
|
|
28
|
-
|
30
|
+
const NativeSkiaPictureView = SkiaPictureViewNativeComponent;
|
29
31
|
|
30
32
|
// TODO: no need to go through the JS thread for this
|
31
33
|
const useOnSizeEvent = (
|
@@ -51,65 +53,87 @@ export interface CanvasProps extends ViewProps {
|
|
51
53
|
debug?: boolean;
|
52
54
|
opaque?: boolean;
|
53
55
|
onSize?: SharedValue<SkSize>;
|
54
|
-
|
56
|
+
mode?: "continuous" | "default";
|
55
57
|
}
|
56
58
|
|
57
|
-
export const Canvas = (
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
59
|
+
export const Canvas = forwardRef(
|
60
|
+
(
|
61
|
+
{
|
62
|
+
mode,
|
63
|
+
debug,
|
64
|
+
opaque,
|
65
|
+
children,
|
66
|
+
onSize,
|
67
|
+
onLayout: _onLayout,
|
68
|
+
...viewProps
|
69
|
+
}: CanvasProps,
|
70
|
+
ref
|
71
|
+
) => {
|
72
|
+
const rafId = useRef<number | null>(null);
|
73
|
+
const onLayout = useOnSizeEvent(onSize, _onLayout);
|
74
|
+
// Native ID
|
75
|
+
const nativeId = useMemo(() => {
|
76
|
+
return SkiaViewNativeId.current++;
|
77
|
+
}, []);
|
71
78
|
|
72
|
-
|
73
|
-
|
79
|
+
// Root
|
80
|
+
const root = useMemo(() => new SkiaSGRoot(Skia, nativeId), [nativeId]);
|
74
81
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
82
|
+
// Render effects
|
83
|
+
useLayoutEffect(() => {
|
84
|
+
root.render(children);
|
85
|
+
}, [children, root]);
|
79
86
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
87
|
+
useEffect(() => {
|
88
|
+
return () => {
|
89
|
+
root.unmount();
|
90
|
+
};
|
91
|
+
}, [root]);
|
85
92
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
93
|
+
const requestRedraw = useCallback(() => {
|
94
|
+
rafId.current = requestAnimationFrame(() => {
|
95
|
+
root.render(children);
|
96
|
+
if (mode === "continuous") {
|
97
|
+
requestRedraw();
|
98
|
+
}
|
99
|
+
});
|
100
|
+
}, [children, mode, root]);
|
101
|
+
|
102
|
+
useEffect(() => {
|
103
|
+
if (mode === "continuous") {
|
104
|
+
console.warn("The `mode` property in `Canvas` is deprecated.");
|
105
|
+
requestRedraw();
|
106
|
+
}
|
107
|
+
return () => {
|
108
|
+
if (rafId.current !== null) {
|
109
|
+
cancelAnimationFrame(rafId.current);
|
110
|
+
}
|
111
|
+
};
|
112
|
+
}, [mode, requestRedraw]);
|
113
|
+
// Component methods
|
114
|
+
useImperativeHandle(ref, () => ({
|
115
|
+
makeImageSnapshot: (rect?: SkRect) => {
|
116
|
+
return SkiaViewApi.makeImageSnapshot(nativeId, rect);
|
117
|
+
},
|
118
|
+
makeImageSnapshotAsync: (rect?: SkRect) => {
|
119
|
+
return SkiaViewApi.makeImageSnapshotAsync(nativeId, rect);
|
120
|
+
},
|
121
|
+
redraw: () => {
|
122
|
+
SkiaViewApi.requestRedraw(nativeId);
|
123
|
+
},
|
124
|
+
getNativeId: () => {
|
125
|
+
return nativeId;
|
126
|
+
},
|
127
|
+
}));
|
128
|
+
return (
|
129
|
+
<NativeSkiaPictureView
|
130
|
+
collapsable={false}
|
131
|
+
nativeID={`${nativeId}`}
|
132
|
+
debug={debug}
|
133
|
+
opaque={opaque}
|
134
|
+
onLayout={onLayout}
|
135
|
+
{...viewProps}
|
136
|
+
/>
|
137
|
+
);
|
138
|
+
}
|
139
|
+
);
|
@@ -14,19 +14,19 @@ export const isOnMainThread = () => {
|
|
14
14
|
);
|
15
15
|
};
|
16
16
|
|
17
|
-
export const drawAsPicture =
|
17
|
+
export const drawAsPicture = (element: ReactElement, bounds?: SkRect) => {
|
18
18
|
const recorder = Skia.PictureRecorder();
|
19
19
|
const canvas = recorder.beginRecording(bounds);
|
20
20
|
const root = new SkiaSGRoot(Skia);
|
21
|
-
|
21
|
+
root.render(element);
|
22
22
|
root.drawOnCanvas(canvas);
|
23
23
|
const picture = recorder.finishRecordingAsPicture();
|
24
24
|
root.unmount();
|
25
25
|
return picture;
|
26
26
|
};
|
27
27
|
|
28
|
-
export const drawAsImage =
|
29
|
-
return drawAsImageFromPicture(
|
28
|
+
export const drawAsImage = (element: ReactElement, size: SkSize) => {
|
29
|
+
return drawAsImageFromPicture(drawAsPicture(element), size);
|
30
30
|
};
|
31
31
|
|
32
32
|
export const drawAsImageFromPicture = (picture: SkPicture, size: SkSize) => {
|
@@ -39,28 +39,29 @@ describe("Data Loading", () => {
|
|
39
39
|
expect(SkiaRenderer).toBeDefined();
|
40
40
|
});
|
41
41
|
it("Should accept null as an argument", async () => {
|
42
|
-
const { surface, draw } =
|
43
|
-
|
42
|
+
const { surface, draw } = mountCanvas(<CheckData />);
|
43
|
+
draw();
|
44
44
|
processResult(surface, "snapshots/font/green.png");
|
45
|
-
await
|
45
|
+
await wait(42);
|
46
|
+
draw();
|
46
47
|
processResult(surface, "snapshots/font/green.png");
|
47
48
|
});
|
48
49
|
|
49
50
|
it("Should load a font file", async () => {
|
50
|
-
const { surface, draw } =
|
51
|
-
|
51
|
+
const { surface, draw } = mountCanvas(<CheckFont />);
|
52
|
+
draw();
|
52
53
|
processResult(surface, "snapshots/font/red.png");
|
53
54
|
await wait(1500);
|
54
|
-
|
55
|
+
draw();
|
55
56
|
processResult(surface, "snapshots/font/green.png");
|
56
57
|
});
|
57
58
|
|
58
59
|
it("Should load an image", async () => {
|
59
|
-
const { surface, draw } =
|
60
|
-
|
60
|
+
const { surface, draw } = mountCanvas(<CheckImage />);
|
61
|
+
draw();
|
61
62
|
processResult(surface, "snapshots/font/red.png");
|
62
63
|
await wait(1500);
|
63
|
-
|
64
|
+
draw();
|
64
65
|
processResult(surface, "snapshots/font/green.png");
|
65
66
|
});
|
66
67
|
});
|
@@ -30,9 +30,9 @@ const CheckEmptyCanvas = () => {
|
|
30
30
|
};
|
31
31
|
|
32
32
|
describe("Test introductionary examples from our documentation", () => {
|
33
|
-
it("Should blend colors using multiplication",
|
33
|
+
it("Should blend colors using multiplication", () => {
|
34
34
|
const r = width * 0.33;
|
35
|
-
const surface =
|
35
|
+
const surface = drawOnNode(
|
36
36
|
<Group blendMode="multiply">
|
37
37
|
<Circle cx={r} cy={r} r={r} color="cyan" />
|
38
38
|
<Circle cx={width - r} cy={r} r={r} color="magenta" />
|
@@ -42,9 +42,9 @@ describe("Test introductionary examples from our documentation", () => {
|
|
42
42
|
processResult(surface, "snapshots/drawings/blend-mode-multiply.png");
|
43
43
|
});
|
44
44
|
|
45
|
-
it("Should use a blur image filter",
|
45
|
+
it("Should use a blur image filter", () => {
|
46
46
|
const r = width * 0.33;
|
47
|
-
const surface =
|
47
|
+
const surface = drawOnNode(
|
48
48
|
<Group blendMode="multiply">
|
49
49
|
<Blur blur={30} />
|
50
50
|
<Circle cx={r} cy={r} r={r} color="cyan" />
|
@@ -55,10 +55,10 @@ describe("Test introductionary examples from our documentation", () => {
|
|
55
55
|
processResult(surface, "snapshots/drawings/blur-node.png");
|
56
56
|
});
|
57
57
|
|
58
|
-
it("Should use multiple paint definitions for one drawing command",
|
58
|
+
it("Should use multiple paint definitions for one drawing command", () => {
|
59
59
|
const r = width / 4;
|
60
60
|
const strokeWidth = 50;
|
61
|
-
const surface =
|
61
|
+
const surface = drawOnNode(
|
62
62
|
<>
|
63
63
|
<Circle cx={width / 2} cy={width / 2} r={r} color="red">
|
64
64
|
<Paint color="lightblue" />
|
@@ -70,7 +70,7 @@ describe("Test introductionary examples from our documentation", () => {
|
|
70
70
|
processResult(surface, "snapshots/drawings/multiple-paints.png");
|
71
71
|
});
|
72
72
|
|
73
|
-
it("Should draw DRect",
|
73
|
+
it("Should draw DRect", () => {
|
74
74
|
const { rrect, rect } = importSkia();
|
75
75
|
const padding = 25 * PIXEL_RATIO;
|
76
76
|
const outer = rrect(rect(0, 0, width, width), padding, padding);
|
@@ -79,18 +79,18 @@ describe("Test introductionary examples from our documentation", () => {
|
|
79
79
|
padding * 2,
|
80
80
|
padding * 2
|
81
81
|
);
|
82
|
-
const surface =
|
82
|
+
const surface = drawOnNode(
|
83
83
|
<DiffRect inner={inner} outer={outer} color="lightblue" />
|
84
84
|
);
|
85
85
|
processResult(surface, docPath("shapes/drect.png"));
|
86
86
|
});
|
87
87
|
|
88
88
|
it("should clear the canvas even if it's empty", async () => {
|
89
|
-
const { surface, draw } =
|
90
|
-
|
89
|
+
const { surface, draw } = mountCanvas(<CheckEmptyCanvas />);
|
90
|
+
draw();
|
91
91
|
processResult(surface, "snapshots/green.png");
|
92
92
|
await wait(1000);
|
93
|
-
|
93
|
+
draw();
|
94
94
|
processResult(surface, "snapshots/transparent.png");
|
95
95
|
});
|
96
96
|
});
|