@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
@@ -9,9 +9,9 @@ import { Circle, FitBox, Rect, Image, Group, fitbox } from "../components";
|
|
9
9
|
import { drawOnNode, width, height, importSkia } from "./setup";
|
10
10
|
|
11
11
|
describe("FitBox", () => {
|
12
|
-
it("Should scale the rectangle in half",
|
12
|
+
it("Should scale the rectangle in half", () => {
|
13
13
|
const { Skia } = importSkia();
|
14
|
-
const surface =
|
14
|
+
const surface = drawOnNode(
|
15
15
|
<FitBox
|
16
16
|
src={Skia.XYWHRect(0, 0, width, height)}
|
17
17
|
dst={Skia.XYWHRect(width / 4, height / 4, width / 2, height / 2)}
|
@@ -21,9 +21,9 @@ describe("FitBox", () => {
|
|
21
21
|
);
|
22
22
|
processResult(surface, "snapshots/drawings/lightblue-rect.png");
|
23
23
|
});
|
24
|
-
it("Should take the bottom right quarter of the circle and scale to the full canvas",
|
24
|
+
it("Should take the bottom right quarter of the circle and scale to the full canvas", () => {
|
25
25
|
const { Skia } = importSkia();
|
26
|
-
const surface =
|
26
|
+
const surface = drawOnNode(
|
27
27
|
<FitBox
|
28
28
|
src={Skia.XYWHRect(width / 2, height / 2, width / 2, height / 2)}
|
29
29
|
dst={Skia.XYWHRect(0, 0, width, height)}
|
@@ -38,7 +38,7 @@ describe("FitBox", () => {
|
|
38
38
|
);
|
39
39
|
processResult(surface, "snapshots/drawings/lightblue-quarter-circle.png");
|
40
40
|
});
|
41
|
-
it("Should scale the image (1)",
|
41
|
+
it("Should scale the image (1)", () => {
|
42
42
|
const { Skia, rect } = importSkia();
|
43
43
|
const image = Skia.Image.MakeImageFromEncoded(
|
44
44
|
Skia.Data.fromBytes(
|
@@ -47,7 +47,7 @@ describe("FitBox", () => {
|
|
47
47
|
)
|
48
48
|
)
|
49
49
|
)!;
|
50
|
-
const surface =
|
50
|
+
const surface = drawOnNode(
|
51
51
|
<Group
|
52
52
|
transform={fitbox(
|
53
53
|
"cover",
|
@@ -66,7 +66,7 @@ describe("FitBox", () => {
|
|
66
66
|
);
|
67
67
|
processResult(surface, "snapshots/drawings/scaled-image.png");
|
68
68
|
});
|
69
|
-
it("Should scale the image (2)",
|
69
|
+
it("Should scale the image (2)", () => {
|
70
70
|
const { Skia, rect } = importSkia();
|
71
71
|
const image = Skia.Image.MakeImageFromEncoded(
|
72
72
|
Skia.Data.fromBytes(
|
@@ -76,7 +76,7 @@ describe("FitBox", () => {
|
|
76
76
|
)
|
77
77
|
)!;
|
78
78
|
const screen = rect(256, 128, 256, 512);
|
79
|
-
const surface =
|
79
|
+
const surface = drawOnNode(
|
80
80
|
<Group>
|
81
81
|
<Image
|
82
82
|
image={image}
|
@@ -95,7 +95,7 @@ describe("FitBox", () => {
|
|
95
95
|
);
|
96
96
|
processResult(surface, "snapshots/drawings/scaled-image2.png");
|
97
97
|
});
|
98
|
-
it("Should rotate and scale the image",
|
98
|
+
it("Should rotate and scale the image", () => {
|
99
99
|
const { Skia, rect } = importSkia();
|
100
100
|
const image = Skia.Image.MakeImageFromEncoded(
|
101
101
|
Skia.Data.fromBytes(
|
@@ -107,7 +107,7 @@ describe("FitBox", () => {
|
|
107
107
|
const screen = rect(256, 128, 256, 512);
|
108
108
|
const imageRect = rect(0, 0, image.width(), image.height());
|
109
109
|
const transform = fitbox("contain", imageRect, screen, 270);
|
110
|
-
const surface =
|
110
|
+
const surface = drawOnNode(
|
111
111
|
<Group>
|
112
112
|
<Image
|
113
113
|
image={image}
|
@@ -25,7 +25,7 @@ describe("Glyphs", () => {
|
|
25
25
|
font = Skia.Font(tf!, 64);
|
26
26
|
expect(font !== null).toBe(true);
|
27
27
|
});
|
28
|
-
it("Should draw glyphs in lightblue",
|
28
|
+
it("Should draw glyphs in lightblue", () => {
|
29
29
|
const { Skia } = importSkia();
|
30
30
|
const ids = font.getGlyphIDs("ab");
|
31
31
|
const glyphs = [
|
@@ -38,7 +38,7 @@ describe("Glyphs", () => {
|
|
38
38
|
),
|
39
39
|
},
|
40
40
|
];
|
41
|
-
const surface =
|
41
|
+
const surface = drawOnNode(
|
42
42
|
<Glyphs x={0} y={0} font={font} glyphs={glyphs} color="lightblue" />
|
43
43
|
);
|
44
44
|
processResult(surface, "snapshots/glyphs/simple.png");
|
@@ -9,7 +9,7 @@ import { Fill, ImageShader, Shader } from "../components";
|
|
9
9
|
import { drawOnNode, width, height, importSkia } from "./setup";
|
10
10
|
|
11
11
|
describe("Test Image Component", () => {
|
12
|
-
it("Should display the image with a filter",
|
12
|
+
it("Should display the image with a filter", () => {
|
13
13
|
const { Skia } = importSkia();
|
14
14
|
const image = Skia.Image.MakeImageFromEncoded(
|
15
15
|
Skia.Data.fromBytes(
|
@@ -26,7 +26,7 @@ half4 main(float2 xy) {
|
|
26
26
|
xy.x += sin(xy.y / r) * 4;
|
27
27
|
return image.eval(xy).rbga;
|
28
28
|
}`)!;
|
29
|
-
const surface =
|
29
|
+
const surface = drawOnNode(
|
30
30
|
<Fill>
|
31
31
|
<Shader source={filter} uniforms={{ r: 50 }}>
|
32
32
|
<ImageShader
|
@@ -8,7 +8,7 @@ import { drawOnNode, width, importSkia } from "./setup";
|
|
8
8
|
const size = width;
|
9
9
|
|
10
10
|
describe("Path Examples", () => {
|
11
|
-
it("Should draw an arc",
|
11
|
+
it("Should draw an arc", () => {
|
12
12
|
const { Skia } = importSkia();
|
13
13
|
const path = Skia.Path.Make();
|
14
14
|
const arcRect = {
|
@@ -18,11 +18,11 @@ describe("Path Examples", () => {
|
|
18
18
|
height: size,
|
19
19
|
};
|
20
20
|
path.addArc(arcRect, 45, 270);
|
21
|
-
const surface =
|
21
|
+
const surface = drawOnNode(<Path path={path} color="lightblue" />);
|
22
22
|
processResult(surface, "snapshots/paths/arc.png");
|
23
23
|
});
|
24
24
|
|
25
|
-
it("Should draw an oval",
|
25
|
+
it("Should draw an oval", () => {
|
26
26
|
const { Skia } = importSkia();
|
27
27
|
const path = Skia.Path.Make();
|
28
28
|
const rct = {
|
@@ -32,11 +32,11 @@ describe("Path Examples", () => {
|
|
32
32
|
height: size,
|
33
33
|
};
|
34
34
|
path.addOval(rct);
|
35
|
-
const surface =
|
35
|
+
const surface = drawOnNode(<Path path={path} color="lightblue" />);
|
36
36
|
processResult(surface, "snapshots/paths/oval.png");
|
37
37
|
});
|
38
38
|
|
39
|
-
it("Should draw an rounded rectangle",
|
39
|
+
it("Should draw an rounded rectangle", () => {
|
40
40
|
const { Skia } = importSkia();
|
41
41
|
const path = Skia.Path.Make();
|
42
42
|
path.addRRect({
|
@@ -49,11 +49,11 @@ describe("Path Examples", () => {
|
|
49
49
|
rx: size / 4,
|
50
50
|
ry: size / 4,
|
51
51
|
});
|
52
|
-
const surface =
|
52
|
+
const surface = drawOnNode(<Path path={path} color="lightblue" />);
|
53
53
|
processResult(surface, "snapshots/paths/rrect.png");
|
54
54
|
});
|
55
55
|
|
56
|
-
it("Should draw a polygon",
|
56
|
+
it("Should draw a polygon", () => {
|
57
57
|
const { Skia, vec } = importSkia();
|
58
58
|
const path = Skia.Path.Make();
|
59
59
|
const r = size / 4;
|
@@ -67,7 +67,7 @@ describe("Path Examples", () => {
|
|
67
67
|
true
|
68
68
|
);
|
69
69
|
|
70
|
-
const surface =
|
70
|
+
const surface = drawOnNode(
|
71
71
|
<Path path={path} strokeWidth={4} style="stroke" color="lightblue" />
|
72
72
|
);
|
73
73
|
processResult(surface, "snapshots/paths/poly.png");
|
@@ -4,7 +4,7 @@ import { processResult } from "../../__tests__/setup";
|
|
4
4
|
import { Fill, Picture, Group } from "../components";
|
5
5
|
|
6
6
|
import type { EmptyProps } from "./setup";
|
7
|
-
import { importSkia, mountCanvas,
|
7
|
+
import { wait, importSkia, mountCanvas, width } from "./setup";
|
8
8
|
|
9
9
|
const CheckPicture = ({}: EmptyProps) => {
|
10
10
|
const { createPicture, Skia } = importSkia();
|
@@ -22,7 +22,9 @@ const CheckPicture = ({}: EmptyProps) => {
|
|
22
22
|
paint.setColor(Skia.Color(color));
|
23
23
|
canvas.drawCircle(r, r, r, paint);
|
24
24
|
}),
|
25
|
-
|
25
|
+
// In a non-test environment, createPicture and Skia will be top-level, not part of the array
|
26
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
27
|
+
[color]
|
26
28
|
);
|
27
29
|
return (
|
28
30
|
<Group>
|
@@ -61,20 +63,20 @@ const CheckPicture2 = ({}: EmptyProps) => {
|
|
61
63
|
|
62
64
|
describe("Picture", () => {
|
63
65
|
it("should respect dependency array", async () => {
|
64
|
-
const { surface, draw } =
|
65
|
-
|
66
|
+
const { surface, draw } = mountCanvas(<CheckPicture />);
|
67
|
+
draw();
|
66
68
|
processResult(surface, "snapshots/pictures/green.png");
|
67
|
-
await wait(
|
68
|
-
|
69
|
+
await wait(32);
|
70
|
+
draw();
|
69
71
|
processResult(surface, "snapshots/pictures/red.png");
|
70
72
|
});
|
71
73
|
|
72
74
|
it("should not redraw if there are no dependency", async () => {
|
73
|
-
const { surface, draw } =
|
74
|
-
|
75
|
+
const { surface, draw } = mountCanvas(<CheckPicture2 />);
|
76
|
+
draw();
|
75
77
|
processResult(surface, "snapshots/pictures/green.png");
|
76
|
-
await wait(
|
77
|
-
|
78
|
+
await wait(32);
|
79
|
+
draw();
|
78
80
|
processResult(surface, "snapshots/pictures/green.png");
|
79
81
|
});
|
80
82
|
});
|
@@ -12,8 +12,8 @@ describe("Renderer", () => {
|
|
12
12
|
it("Loads renderer without Skia", () => {
|
13
13
|
expect(SkiaRenderer).toBeDefined();
|
14
14
|
});
|
15
|
-
it("Light blue rectangle",
|
16
|
-
const surface =
|
15
|
+
it("Light blue rectangle", () => {
|
16
|
+
const surface = drawOnNode(
|
17
17
|
<Rect
|
18
18
|
x={(width - size) / 2}
|
19
19
|
y={(width - size) / 2}
|
@@ -24,10 +24,10 @@ describe("Renderer", () => {
|
|
24
24
|
);
|
25
25
|
processResult(surface, "snapshots/drawings/lightblue-rect.png");
|
26
26
|
});
|
27
|
-
it("Scaled light blue rectangle",
|
27
|
+
it("Scaled light blue rectangle", () => {
|
28
28
|
const scale = 2;
|
29
29
|
const scaled = size / scale;
|
30
|
-
const surface =
|
30
|
+
const surface = drawOnNode(
|
31
31
|
<Group transform={[{ scale }]} origin={center}>
|
32
32
|
<Rect
|
33
33
|
x={(width - scaled) / 2}
|
@@ -40,7 +40,7 @@ describe("Renderer", () => {
|
|
40
40
|
);
|
41
41
|
processResult(surface, "snapshots/drawings/lightblue-rect.png");
|
42
42
|
});
|
43
|
-
it("Points",
|
43
|
+
it("Points", () => {
|
44
44
|
const { vec } = importSkia();
|
45
45
|
const c = { x: width / 2, y: size / 2 + 16 };
|
46
46
|
const S = 25;
|
@@ -69,7 +69,7 @@ describe("Renderer", () => {
|
|
69
69
|
];
|
70
70
|
|
71
71
|
const cubics = [...c1, ...c2, ...c3, ...c4];
|
72
|
-
const surface =
|
72
|
+
const surface = drawOnNode(
|
73
73
|
<Group color="#61DAFB" style="stroke" strokeWidth={3}>
|
74
74
|
<Points mode="polygon" points={cubics} />
|
75
75
|
<Line p1={c} p2={vec(size, 0)} />
|
@@ -51,11 +51,11 @@ describe("Surface", () => {
|
|
51
51
|
surface.dispose();
|
52
52
|
}
|
53
53
|
});
|
54
|
-
it("A raster surface shouldn't leak (3)",
|
54
|
+
it("A raster surface shouldn't leak (3)", () => {
|
55
55
|
for (let i = 0; i < 10; i++) {
|
56
56
|
//const t = performance.now();
|
57
57
|
const r = 128;
|
58
|
-
const surface =
|
58
|
+
const surface = drawOnNode(
|
59
59
|
<>
|
60
60
|
<Group blendMode="multiply">
|
61
61
|
<Circle cx={r} cy={r} r={r} color="cyan" />
|
@@ -16,9 +16,9 @@ import {
|
|
16
16
|
} from "./setup";
|
17
17
|
|
18
18
|
describe("Test different text examples", () => {
|
19
|
-
it("Should draw Hello World",
|
19
|
+
it("Should draw Hello World", () => {
|
20
20
|
const font = loadFont("skia/__tests__/assets/Roboto-Medium.ttf");
|
21
|
-
const surface =
|
21
|
+
const surface = drawOnNode(
|
22
22
|
<>
|
23
23
|
<Fill color="white" />
|
24
24
|
<Text x={0} y={fontSize} font={font} text="Hello World" />
|
@@ -27,13 +27,13 @@ describe("Test different text examples", () => {
|
|
27
27
|
processResult(surface, docPath("text/hello-world.png"));
|
28
28
|
});
|
29
29
|
|
30
|
-
it("Should draw Hello World vertically",
|
30
|
+
it("Should draw Hello World vertically", () => {
|
31
31
|
const font = loadFont("skia/__tests__/assets/Roboto-Medium.ttf");
|
32
32
|
const { Skia } = importSkia();
|
33
33
|
const glyphs = font
|
34
34
|
.getGlyphIDs("Hello World!")
|
35
35
|
.map((id, i) => ({ id, pos: Skia.Point(0, (i + 1) * fontSize) }));
|
36
|
-
const surface =
|
36
|
+
const surface = drawOnNode(
|
37
37
|
<>
|
38
38
|
<Fill color="white" />
|
39
39
|
<Glyphs font={font} glyphs={glyphs} />
|
@@ -42,13 +42,13 @@ describe("Test different text examples", () => {
|
|
42
42
|
processResult(surface, docPath("text/hello-world-vertical.png"));
|
43
43
|
});
|
44
44
|
|
45
|
-
it("Should render the text around a circle",
|
45
|
+
it("Should render the text around a circle", () => {
|
46
46
|
const font = loadFont("skia/__tests__/assets/Roboto-Medium.ttf");
|
47
47
|
const { Skia } = importSkia();
|
48
48
|
const path = Skia.Path.Make();
|
49
49
|
const r = width / 2;
|
50
50
|
path.addCircle(r, r, r / 2);
|
51
|
-
const surface =
|
51
|
+
const surface = drawOnNode(
|
52
52
|
<>
|
53
53
|
<Fill color="white" />
|
54
54
|
<Group transform={[{ rotate: Math.PI }]} origin={Skia.Point(r, r)}>
|
@@ -59,11 +59,11 @@ describe("Test different text examples", () => {
|
|
59
59
|
processResult(surface, docPath("text/text-path.png"));
|
60
60
|
});
|
61
61
|
|
62
|
-
it("Should render a text blob",
|
62
|
+
it("Should render a text blob", () => {
|
63
63
|
const font = loadFont("skia/__tests__/assets/Roboto-Medium.ttf");
|
64
64
|
const { Skia } = importSkia();
|
65
65
|
const blob = Skia.TextBlob.MakeFromText("Hello World!", font);
|
66
|
-
const surface =
|
66
|
+
const surface = drawOnNode(
|
67
67
|
<>
|
68
68
|
<Fill color="white" />
|
69
69
|
<TextBlob blob={blob} y={fontSize} x={0} />
|
@@ -72,7 +72,7 @@ describe("Test different text examples", () => {
|
|
72
72
|
processResult(surface, docPath("text/text-blob.png"));
|
73
73
|
});
|
74
74
|
|
75
|
-
it("Should render text with Emojis",
|
75
|
+
it("Should render text with Emojis", () => {
|
76
76
|
const { Skia } = importSkia();
|
77
77
|
const data = Skia.Data.fromBytes(
|
78
78
|
fs.readFileSync(
|
@@ -85,7 +85,7 @@ describe("Test different text examples", () => {
|
|
85
85
|
const tf = Skia.Typeface.MakeFreeTypeFaceFromData(data)!;
|
86
86
|
expect(tf).toBeTruthy();
|
87
87
|
const emojiFont = Skia.Font(tf, fontSize);
|
88
|
-
const surface =
|
88
|
+
const surface = drawOnNode(
|
89
89
|
<>
|
90
90
|
<Fill color="white" />
|
91
91
|
<Text text="🙋🌎" font={emojiFont} y={fontSize} x={0} />
|
@@ -94,7 +94,7 @@ describe("Test different text examples", () => {
|
|
94
94
|
processResult(surface, docPath("text/text-emoji.png"));
|
95
95
|
});
|
96
96
|
|
97
|
-
it("Should calculate chinese text width correctly",
|
97
|
+
it("Should calculate chinese text width correctly", () => {
|
98
98
|
const { Skia } = importSkia();
|
99
99
|
const data = Skia.Data.fromBytes(
|
100
100
|
fs.readFileSync(
|
@@ -109,7 +109,7 @@ describe("Test different text examples", () => {
|
|
109
109
|
const font = Skia.Font(tf, fontSize);
|
110
110
|
const text = "欢迎";
|
111
111
|
const padding = 16;
|
112
|
-
const surface =
|
112
|
+
const surface = drawOnNode(
|
113
113
|
<>
|
114
114
|
<Text
|
115
115
|
text={text}
|
@@ -10,18 +10,18 @@ describe("Renderer", () => {
|
|
10
10
|
it("Loads renderer without Skia", () => {
|
11
11
|
expect(SkiaRenderer).toBeDefined();
|
12
12
|
});
|
13
|
-
it("Scale with origin",
|
13
|
+
it("Scale with origin", () => {
|
14
14
|
const { Skia } = importSkia();
|
15
15
|
const size = width;
|
16
16
|
const origin = Skia.Point(size / 2, size / 2);
|
17
|
-
const surface =
|
17
|
+
const surface = drawOnNode(
|
18
18
|
<Group transform={[{ scale: 0.5 }]} origin={origin}>
|
19
19
|
<Rect x={0} y={0} width={size} height={size} color="lightblue" />
|
20
20
|
</Group>
|
21
21
|
);
|
22
22
|
processResult(surface, "snapshots/transform/scale-origin.png");
|
23
23
|
});
|
24
|
-
it("Scale with origin using a matrix",
|
24
|
+
it("Scale with origin using a matrix", () => {
|
25
25
|
const { Skia } = importSkia();
|
26
26
|
const size = width;
|
27
27
|
const matrix = Skia.Matrix();
|
@@ -31,32 +31,32 @@ describe("Renderer", () => {
|
|
31
31
|
.scale(0.5)
|
32
32
|
.translate(-origin.x, -origin.y);
|
33
33
|
expect(matrix.get()).toStrictEqual([0.5, 0, 192, 0, 0.5, 192, 0, 0, 1]);
|
34
|
-
const surface =
|
34
|
+
const surface = drawOnNode(
|
35
35
|
<Group matrix={matrix}>
|
36
36
|
<Rect x={0} y={0} width={size} height={size} color="lightblue" />
|
37
37
|
</Group>
|
38
38
|
);
|
39
39
|
processResult(surface, "snapshots/transform/scale-origin.png");
|
40
40
|
});
|
41
|
-
it("Scale with matrix and origin",
|
41
|
+
it("Scale with matrix and origin", () => {
|
42
42
|
const { Skia } = importSkia();
|
43
43
|
const size = width;
|
44
44
|
const matrix = Skia.Matrix();
|
45
45
|
const origin = Skia.Point(size / 2, size / 2);
|
46
46
|
matrix.scale(0.5);
|
47
|
-
const surface =
|
47
|
+
const surface = drawOnNode(
|
48
48
|
<Group matrix={matrix} origin={origin}>
|
49
49
|
<Rect x={0} y={0} width={size} height={size} color="lightblue" />
|
50
50
|
</Group>
|
51
51
|
);
|
52
52
|
processResult(surface, "snapshots/transform/scale-origin.png");
|
53
53
|
});
|
54
|
-
it("Should rotate a rectangle to 180deg",
|
54
|
+
it("Should rotate a rectangle to 180deg", () => {
|
55
55
|
const { Skia } = importSkia();
|
56
56
|
const size = width;
|
57
57
|
const origin = Skia.Point(size / 2, size / 2);
|
58
58
|
const w = size / 4;
|
59
|
-
const surface =
|
59
|
+
const surface = drawOnNode(
|
60
60
|
<Group transform={[{ rotate: Math.PI }]} origin={origin}>
|
61
61
|
<Rect
|
62
62
|
x={origin.x - w / 2}
|
@@ -51,12 +51,12 @@ const TestRasterization = () => {
|
|
51
51
|
};
|
52
52
|
|
53
53
|
describe("Group", () => {
|
54
|
-
it("Should use a rectangle as a clip",
|
54
|
+
it("Should use a rectangle as a clip", () => {
|
55
55
|
const image = loadImage("skia/__tests__/assets/oslo.jpg");
|
56
56
|
const { rect } = importSkia();
|
57
57
|
expect(image).toBeTruthy();
|
58
58
|
const rct = rect(padding, padding, size - padding * 2, size - padding * 2);
|
59
|
-
const surface =
|
59
|
+
const surface = drawOnNode(
|
60
60
|
<>
|
61
61
|
<Fill color="lightblue" />
|
62
62
|
<Group clip={rct}>
|
@@ -73,7 +73,7 @@ describe("Group", () => {
|
|
73
73
|
);
|
74
74
|
processResult(surface, docPath("group/clip-rect.png"));
|
75
75
|
});
|
76
|
-
it("Should use a rounded rectangle as a clip",
|
76
|
+
it("Should use a rounded rectangle as a clip", () => {
|
77
77
|
const image = loadImage("skia/__tests__/assets/oslo.jpg");
|
78
78
|
const { rect, rrect } = importSkia();
|
79
79
|
expect(image).toBeTruthy();
|
@@ -82,7 +82,7 @@ describe("Group", () => {
|
|
82
82
|
r,
|
83
83
|
r
|
84
84
|
);
|
85
|
-
const surface =
|
85
|
+
const surface = drawOnNode(
|
86
86
|
<Group clip={rct}>
|
87
87
|
<Image
|
88
88
|
image={image}
|
@@ -96,7 +96,7 @@ describe("Group", () => {
|
|
96
96
|
);
|
97
97
|
processResult(surface, docPath("group/clip-rrect.png"));
|
98
98
|
});
|
99
|
-
it("Should use a path as a clip",
|
99
|
+
it("Should use a path as a clip", () => {
|
100
100
|
const image = loadImage("skia/__tests__/assets/oslo.jpg");
|
101
101
|
const { processTransform2d, Skia } = importSkia();
|
102
102
|
expect(image).toBeTruthy();
|
@@ -105,7 +105,7 @@ describe("Group", () => {
|
|
105
105
|
)!;
|
106
106
|
expect(star).toBeTruthy();
|
107
107
|
star.transform(processTransform2d([{ scale: 3 }]));
|
108
|
-
const surface =
|
108
|
+
const surface = drawOnNode(
|
109
109
|
<Group clip={star}>
|
110
110
|
<Image
|
111
111
|
image={image}
|
@@ -119,7 +119,7 @@ describe("Group", () => {
|
|
119
119
|
);
|
120
120
|
processResult(surface, docPath("group/clip-path.png"));
|
121
121
|
});
|
122
|
-
it("Should invert a clip",
|
122
|
+
it("Should invert a clip", () => {
|
123
123
|
const image = loadImage("skia/__tests__/assets/oslo.jpg");
|
124
124
|
const { processTransform2d, Skia } = importSkia();
|
125
125
|
expect(image).toBeTruthy();
|
@@ -128,7 +128,7 @@ describe("Group", () => {
|
|
128
128
|
)!;
|
129
129
|
expect(star).toBeTruthy();
|
130
130
|
star.transform(processTransform2d([{ scale: 3 }]));
|
131
|
-
const surface =
|
131
|
+
const surface = drawOnNode(
|
132
132
|
<Group clip={star} invertClip>
|
133
133
|
<Image
|
134
134
|
image={image}
|
@@ -142,7 +142,7 @@ describe("Group", () => {
|
|
142
142
|
);
|
143
143
|
processResult(surface, docPath("group/invert-clip.png"));
|
144
144
|
});
|
145
|
-
it("Should scale an SVG Path properly",
|
145
|
+
it("Should scale an SVG Path properly", () => {
|
146
146
|
const { rect, Skia } = importSkia();
|
147
147
|
const svgPath =
|
148
148
|
// eslint-disable-next-line max-len
|
@@ -151,7 +151,7 @@ describe("Group", () => {
|
|
151
151
|
expect(path).toBeTruthy();
|
152
152
|
const src = path.computeTightBounds();
|
153
153
|
const strokeWidth = 30 * PIXEL_RATIO;
|
154
|
-
const surface =
|
154
|
+
const surface = drawOnNode(
|
155
155
|
<FitBox src={src} dst={rect(0, 0, width, height)}>
|
156
156
|
<Path
|
157
157
|
path={path}
|
@@ -164,8 +164,8 @@ describe("Group", () => {
|
|
164
164
|
);
|
165
165
|
processResult(surface, docPath("group/scale-path.png"));
|
166
166
|
});
|
167
|
-
it("Should use saveLayer() properly",
|
168
|
-
const surface =
|
167
|
+
it("Should use saveLayer() properly", () => {
|
168
|
+
const surface = drawOnNode(<TestRasterization />);
|
169
169
|
processResult(surface, docPath("group/rasterize.png"));
|
170
170
|
});
|
171
171
|
});
|
@@ -35,8 +35,8 @@ describe("Getting Started / Hello World", () => {
|
|
35
35
|
docPath("getting-started/hello-world/blend-modes.png")
|
36
36
|
);
|
37
37
|
});
|
38
|
-
it("Hello world with the declarative API",
|
39
|
-
const surface =
|
38
|
+
it("Hello world with the declarative API", () => {
|
39
|
+
const surface = drawOnNode(
|
40
40
|
<Group blendMode="multiply">
|
41
41
|
<Circle cx={r} cy={r} r={r} color="cyan" />
|
42
42
|
<Circle cx={size - r} cy={r} r={r} color="magenta" />
|
@@ -19,12 +19,12 @@ const TestPaintAssignment = () => {
|
|
19
19
|
};
|
20
20
|
|
21
21
|
describe("Paint", () => {
|
22
|
-
it("should draw the color fill and strokes properly",
|
22
|
+
it("should draw the color fill and strokes properly", () => {
|
23
23
|
const { vec } = importSkia();
|
24
24
|
const strokeWidth = 10 * PIXEL_RATIO;
|
25
25
|
const c = vec(width / 2, height / 2);
|
26
26
|
const r = (width - strokeWidth) / 2;
|
27
|
-
const surface =
|
27
|
+
const surface = drawOnNode(
|
28
28
|
<>
|
29
29
|
<Circle c={c} r={r} color="red">
|
30
30
|
<Paint color="lightblue" />
|
@@ -36,10 +36,10 @@ describe("Paint", () => {
|
|
36
36
|
processResult(surface, docPath("paint/stroke.png"));
|
37
37
|
});
|
38
38
|
|
39
|
-
it("should use paint inheritance properly",
|
39
|
+
it("should use paint inheritance properly", () => {
|
40
40
|
const r = width / 6;
|
41
41
|
const strokeWidth = 10 * PIXEL_RATIO;
|
42
|
-
const surface =
|
42
|
+
const surface = drawOnNode(
|
43
43
|
<Group color="lightblue">
|
44
44
|
<Circle cx={r} cy={r} r={r} />
|
45
45
|
<Group style="stroke" strokeWidth={strokeWidth}>
|
@@ -50,17 +50,17 @@ describe("Paint", () => {
|
|
50
50
|
processResult(surface, docPath("paint/inheritance.png"));
|
51
51
|
});
|
52
52
|
|
53
|
-
it("should use paint assignement properly",
|
54
|
-
const surface =
|
53
|
+
it("should use paint assignement properly", () => {
|
54
|
+
const surface = drawOnNode(<TestPaintAssignment />);
|
55
55
|
processResult(surface, docPath("paint/assignement.png"));
|
56
56
|
});
|
57
57
|
|
58
|
-
it("should use the opacity property properly",
|
58
|
+
it("should use the opacity property properly", () => {
|
59
59
|
const { vec } = importSkia();
|
60
60
|
const strokeWidth = 30 * PIXEL_RATIO;
|
61
61
|
const r = width / 2 - strokeWidth / 2;
|
62
62
|
const c = vec(width / 2, height / 2);
|
63
|
-
const surface =
|
63
|
+
const surface = drawOnNode(
|
64
64
|
<Group opacity={0.5}>
|
65
65
|
<Circle c={c} r={r} color="red" />
|
66
66
|
<Circle
|
@@ -5,11 +5,11 @@ import { docPath, processResult } from "../../../../__tests__/setup";
|
|
5
5
|
import { Box, BoxShadow, Fill } from "../../../components";
|
6
6
|
|
7
7
|
describe("Box", () => {
|
8
|
-
it("should draw a box with inner and outer shadow",
|
8
|
+
it("should draw a box with inner and outer shadow", () => {
|
9
9
|
const { rect, rrect } = importSkia();
|
10
10
|
const size = width / 2;
|
11
11
|
const d = 10 * PIXEL_RATIO;
|
12
|
-
const surface =
|
12
|
+
const surface = drawOnNode(
|
13
13
|
<>
|
14
14
|
<Fill color="#add8e6" />
|
15
15
|
<Box
|
@@ -29,9 +29,9 @@ describe("Box", () => {
|
|
29
29
|
);
|
30
30
|
processResult(surface, docPath("box/shadows.png"));
|
31
31
|
});
|
32
|
-
it("should draw a box with red stroke",
|
32
|
+
it("should draw a box with red stroke", () => {
|
33
33
|
const size = width / 2;
|
34
|
-
const surface =
|
34
|
+
const surface = drawOnNode(
|
35
35
|
<>
|
36
36
|
<Box
|
37
37
|
box={{ width: size, height: size, x: 1, y: 1 }}
|
@@ -168,7 +168,7 @@ describe("Atlas", () => {
|
|
168
168
|
width: size.width + strokeWidth,
|
169
169
|
height: size.height + strokeWidth,
|
170
170
|
};
|
171
|
-
const texture =
|
171
|
+
const texture = drawAsImage(
|
172
172
|
<Group>
|
173
173
|
<Rect
|
174
174
|
rect={rect(strokeWidth / 2, strokeWidth / 2, size.width, size.height)}
|
@@ -211,7 +211,7 @@ describe("Atlas", () => {
|
|
211
211
|
width: size.width + strokeWidth,
|
212
212
|
height: size.height + strokeWidth,
|
213
213
|
};
|
214
|
-
const texture =
|
214
|
+
const texture = drawAsImage(
|
215
215
|
<Group>
|
216
216
|
<Rect
|
217
217
|
rect={rect(strokeWidth / 2, strokeWidth / 2, size.width, size.height)}
|
@@ -283,7 +283,7 @@ describe("Atlas", () => {
|
|
283
283
|
width: size.width + strokeWidth,
|
284
284
|
height: size.height + strokeWidth,
|
285
285
|
};
|
286
|
-
const texture =
|
286
|
+
const texture = drawAsImage(
|
287
287
|
<Group>
|
288
288
|
<Rect
|
289
289
|
rect={rect(strokeWidth / 2, strokeWidth / 2, size.width, size.height)}
|
@@ -100,7 +100,7 @@ describe("Offscreen Drawings", () => {
|
|
100
100
|
const { width, height } = surface;
|
101
101
|
const { drawAsImage } = importSkia();
|
102
102
|
const r = width / 2;
|
103
|
-
const image =
|
103
|
+
const image = drawAsImage(
|
104
104
|
<Circle r={r} cx={r} cy={r} color="lightblue" />,
|
105
105
|
{ width, height }
|
106
106
|
);
|