@shopify/react-native-skia 1.11.8 → 1.11.9-next.1
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 +30 -153
- package/android/build.gradle +1 -1
- package/cpp/skia/include/codec/SkCodec.h +7 -2
- package/cpp/skia/include/config/SkUserConfig.h +11 -0
- package/cpp/skia/include/core/SkCanvas.h +11 -7
- package/cpp/skia/include/core/SkColor.h +10 -0
- package/cpp/skia/include/core/SkColorSpace.h +184 -2
- package/cpp/skia/include/core/SkColorType.h +114 -32
- package/cpp/skia/include/core/SkFontScanner.h +5 -8
- package/cpp/skia/include/core/SkFontStyle.h +1 -1
- package/cpp/skia/include/core/SkMaskFilter.h +0 -8
- 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 +3 -1
- 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 +14 -0
- package/cpp/skia/include/core/SkTypeface.h +24 -7
- package/cpp/skia/include/effects/SkGradientShader.h +6 -1
- package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -0
- package/cpp/skia/include/encode/SkPngEncoder.h +14 -0
- package/cpp/skia/include/gpu/GpuTypes.h +9 -0
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +135 -133
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +5 -0
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +14 -9
- package/cpp/skia/include/gpu/graphite/Context.h +25 -2
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +23 -5
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +20 -1
- package/cpp/skia/include/gpu/graphite/Image.h +1 -0
- package/cpp/skia/include/gpu/graphite/LogPriority.h +36 -0
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +52 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +6 -0
- package/cpp/skia/include/gpu/graphite/Recording.h +3 -1
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +4 -36
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +48 -0
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +3 -2
- package/cpp/skia/include/pathops/SkPathOps.h +9 -1
- package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +3 -0
- package/cpp/skia/include/private/SkPathRef.h +15 -21
- package/cpp/skia/include/private/base/SkAttributes.h +16 -10
- package/cpp/skia/include/private/base/SkMutex.h +8 -0
- 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 +24 -11
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/sksl/SkSLDebugTrace.h +0 -3
- package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
- package/cpp/skia/modules/skcms/src/skcms_Transform.h +4 -3
- package/cpp/skia/modules/skcms/src/skcms_public.h +19 -15
- package/cpp/skia/modules/skresources/include/SkResources.h +3 -1
- 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 +2 -0
- package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -0
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +4 -0
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/src/core/SkLRUCache.h +19 -13
- package/cpp/skia/src/core/SkTHash.h +50 -4
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +1 -0
- package/lib/commonjs/external/reanimated/textures.js +4 -3
- 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 +10 -27
- 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 +3 -1
- package/lib/commonjs/sksg/Container.js +7 -1
- package/lib/commonjs/sksg/Container.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.d.ts +1 -1
- package/lib/commonjs/sksg/HostConfig.js +36 -6
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/Reconciler.d.ts +3 -2
- package/lib/commonjs/sksg/Reconciler.js +16 -6
- 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 +1 -2
- 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 +3 -5
- package/lib/module/dom/nodes/datatypes/Rect.js.map +1 -1
- package/lib/module/external/reanimated/buffers.js +1 -2
- package/lib/module/external/reanimated/buffers.js.map +1 -1
- package/lib/module/external/reanimated/textures.js +5 -4
- 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 +10 -23
- 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 +9 -27
- 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 +1 -4
- package/lib/module/skia/web/CanvasKitWebGLBufferImpl.js.map +1 -1
- package/lib/module/skia/web/Host.js +1 -7
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkAnimatedImage.js +3 -6
- package/lib/module/skia/web/JsiSkAnimatedImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +3 -6
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilter.js +3 -6
- package/lib/module/skia/web/JsiSkColorFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasure.js +3 -6
- package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasureIter.js +3 -6
- package/lib/module/skia/web/JsiSkContourMeasureIter.js.map +1 -1
- package/lib/module/skia/web/JsiSkData.js +3 -6
- package/lib/module/skia/web/JsiSkData.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +3 -6
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +8 -12
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilter.js +3 -6
- package/lib/module/skia/web/JsiSkImageFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilter.js +3 -6
- package/lib/module/skia/web/JsiSkMaskFilter.js.map +1 -1
- package/lib/module/skia/web/JsiSkMatrix.js +5 -8
- package/lib/module/skia/web/JsiSkMatrix.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +3 -6
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkParagraphBuilder.js +2 -3
- 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 +3 -6
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffect.js +3 -6
- package/lib/module/skia/web/JsiSkPathEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +3 -6
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkPictureRecorder.js +3 -6
- package/lib/module/skia/web/JsiSkPictureRecorder.js.map +1 -1
- package/lib/module/skia/web/JsiSkPoint.js +3 -6
- package/lib/module/skia/web/JsiSkPoint.js.map +1 -1
- package/lib/module/skia/web/JsiSkRRect.js +3 -6
- package/lib/module/skia/web/JsiSkRRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.js +3 -6
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.js +3 -6
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkRuntimeEffect.js +3 -6
- package/lib/module/skia/web/JsiSkRuntimeEffect.js.map +1 -1
- package/lib/module/skia/web/JsiSkSVG.js +5 -8
- package/lib/module/skia/web/JsiSkSVG.js.map +1 -1
- package/lib/module/skia/web/JsiSkShader.js +3 -6
- package/lib/module/skia/web/JsiSkShader.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurface.js +3 -6
- package/lib/module/skia/web/JsiSkSurface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlob.js +3 -6
- package/lib/module/skia/web/JsiSkTextBlob.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypeface.js +3 -6
- package/lib/module/skia/web/JsiSkTypeface.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +1 -4
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/module/skia/web/JsiSkVertices.js +3 -6
- package/lib/module/skia/web/JsiSkVertices.js.map +1 -1
- package/lib/module/skia/web/JsiVideo.js +2 -5
- package/lib/module/skia/web/JsiVideo.js.map +1 -1
- package/lib/module/sksg/Container.d.ts +3 -1
- package/lib/module/sksg/Container.js +11 -8
- package/lib/module/sksg/Container.js.map +1 -1
- package/lib/module/sksg/HostConfig.d.ts +1 -1
- package/lib/module/sksg/HostConfig.js +36 -7
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/Reconciler.d.ts +3 -2
- package/lib/module/sksg/Reconciler.js +16 -11
- package/lib/module/sksg/Reconciler.js.map +1 -1
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js +1 -5
- package/lib/module/sksg/Recorder/ReanimatedRecorder.js.map +1 -1
- package/lib/module/sksg/Recorder/Recorder.js +3 -6
- 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 +2 -4
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Shaders.js +2 -3
- package/lib/module/sksg/Recorder/commands/Shaders.js.map +1 -1
- package/lib/module/views/SkiaBaseWebView.js +9 -12
- package/lib/module/views/SkiaBaseWebView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.js +1 -5
- package/lib/module/views/SkiaPictureView.js.map +1 -1
- package/lib/module/views/SkiaPictureView.web.js +1 -4
- package/lib/module/views/SkiaPictureView.web.js.map +1 -1
- package/lib/module/web/LoadSkiaWeb.js +1 -2
- 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 +9 -1
- package/lib/typescript/lib/commonjs/renderer/Offscreen.d.ts +2 -2
- package/lib/typescript/lib/commonjs/sksg/Container.d.ts +3 -0
- package/lib/typescript/lib/commonjs/sksg/HostConfig.d.ts +21 -4
- package/lib/typescript/lib/commonjs/sksg/Reconciler.d.ts +9 -2
- package/lib/typescript/lib/module/headless/index.d.ts +1 -1
- package/lib/typescript/lib/module/renderer/Canvas.d.ts +9 -1
- 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 +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkCanvas.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkColorFilter.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkContourMeasure.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkContourMeasureIter.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkData.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkImage.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkImageFilter.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkMaskFilter.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkMatrix.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkPaint.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkPathEffect.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkPicture.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkPictureRecorder.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkPoint.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkRRect.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkRSXform.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkRect.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkRuntimeEffect.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkSVG.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkShader.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkSurface.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkTextBlob.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkTypeface.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiSkVertices.d.ts +1 -0
- package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +2 -2
- package/lib/typescript/lib/module/sksg/Container.d.ts +7 -12
- package/lib/typescript/lib/module/sksg/HostConfig.d.ts +20 -4
- package/lib/typescript/lib/module/sksg/Reconciler.d.ts +18 -17
- package/lib/typescript/lib/module/sksg/Recorder/ReanimatedRecorder.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Recorder/Recorder.d.ts +5 -2
- package/lib/typescript/lib/module/views/SkiaBaseWebView.d.ts +12 -11
- 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 +3 -1
- package/lib/typescript/src/sksg/HostConfig.d.ts +1 -1
- package/lib/typescript/src/sksg/Reconciler.d.ts +3 -2
- package/libs/apple/libskia.xcframework/Info.plist +15 -15
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/macos-arm64_x86_64/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e/libskia.a +0 -0
- package/libs/apple/libskia.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/apple/libskottie.xcframework/Info.plist +8 -8
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/macos-arm64_x86_64/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e/libskottie.a +0 -0
- package/libs/apple/libskottie.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/apple/libskparagraph.xcframework/Info.plist +7 -7
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/macos-arm64_x86_64/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/apple/libskparagraph.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/apple/libsksg.xcframework/Info.plist +12 -12
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/macos-arm64_x86_64/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e/libsksg.a +0 -0
- package/libs/apple/libsksg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/apple/libskshaper.xcframework/Info.plist +14 -14
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/macos-arm64_x86_64/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e/libskshaper.a +0 -0
- package/libs/apple/libskshaper.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/Info.plist +14 -14
- package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/macos-arm64_x86_64/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_core.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_core.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/Info.plist +13 -13
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/macos-arm64_x86_64/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libskunicode_libgrapheme.xcframework/tvos-arm64_arm64e_x86_64-simulator/libskunicode_libgrapheme.a +0 -0
- package/libs/apple/libsvg.xcframework/Info.plist +11 -11
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/macos-arm64_x86_64/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e/libsvg.a +0 -0
- package/libs/apple/libsvg.xcframework/tvos-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +10 -9
- package/src/external/reanimated/textures.tsx +5 -4
- package/src/headless/index.ts +2 -2
- package/src/renderer/Canvas.tsx +57 -80
- package/src/renderer/Offscreen.tsx +4 -4
- package/src/renderer/__tests__/Data.spec.tsx +9 -10
- 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 +10 -12
- 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 +9 -1
- package/src/sksg/HostConfig.ts +37 -7
- package/src/sksg/Reconciler.ts +17 -6
- package/src/sksg/__tests__/Simple.spec.tsx +8 -8
- package/lib/commonjs/sksg/HostConfig2.d.ts +0 -19
- package/lib/commonjs/sksg/HostConfig2.js +0 -159
- package/lib/commonjs/sksg/HostConfig2.js.map +0 -1
- package/lib/module/sksg/HostConfig2.d.ts +0 -19
- package/lib/module/sksg/HostConfig2.js +0 -152
- package/lib/module/sksg/HostConfig2.js.map +0 -1
- package/lib/typescript/lib/commonjs/sksg/HostConfig2.d.ts +0 -44
- package/lib/typescript/lib/module/sksg/HostConfig2.d.ts +0 -43
- package/lib/typescript/src/sksg/HostConfig2.d.ts +0 -19
- package/src/sksg/HostConfig2.ts +0 -247
@@ -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 {
|
7
|
+
import { importSkia, mountCanvas, wait, width } from "./setup";
|
8
8
|
|
9
9
|
const CheckPicture = ({}: EmptyProps) => {
|
10
10
|
const { createPicture, Skia } = importSkia();
|
@@ -22,9 +22,7 @@ const CheckPicture = ({}: EmptyProps) => {
|
|
22
22
|
paint.setColor(Skia.Color(color));
|
23
23
|
canvas.drawCircle(r, r, r, paint);
|
24
24
|
}),
|
25
|
-
|
26
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
27
|
-
[color]
|
25
|
+
[Skia, color, createPicture, r]
|
28
26
|
);
|
29
27
|
return (
|
30
28
|
<Group>
|
@@ -63,20 +61,20 @@ const CheckPicture2 = ({}: EmptyProps) => {
|
|
63
61
|
|
64
62
|
describe("Picture", () => {
|
65
63
|
it("should respect dependency array", async () => {
|
66
|
-
const { surface, draw } = mountCanvas(<CheckPicture />);
|
67
|
-
draw();
|
64
|
+
const { surface, draw } = await mountCanvas(<CheckPicture />);
|
65
|
+
await draw();
|
68
66
|
processResult(surface, "snapshots/pictures/green.png");
|
69
|
-
await wait(
|
70
|
-
draw();
|
67
|
+
await wait(1000);
|
68
|
+
await draw();
|
71
69
|
processResult(surface, "snapshots/pictures/red.png");
|
72
70
|
});
|
73
71
|
|
74
72
|
it("should not redraw if there are no dependency", async () => {
|
75
|
-
const { surface, draw } = mountCanvas(<CheckPicture2 />);
|
76
|
-
draw();
|
73
|
+
const { surface, draw } = await mountCanvas(<CheckPicture2 />);
|
74
|
+
await draw();
|
77
75
|
processResult(surface, "snapshots/pictures/green.png");
|
78
|
-
await wait(
|
79
|
-
draw();
|
76
|
+
await wait(1000);
|
77
|
+
await draw();
|
80
78
|
processResult(surface, "snapshots/pictures/green.png");
|
81
79
|
});
|
82
80
|
});
|
@@ -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 = drawOnNode(
|
15
|
+
it("Light blue rectangle", async () => {
|
16
|
+
const surface = await 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", async () => {
|
28
28
|
const scale = 2;
|
29
29
|
const scaled = size / scale;
|
30
|
-
const surface = drawOnNode(
|
30
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
72
|
+
const surface = await 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)", async () => {
|
55
55
|
for (let i = 0; i < 10; i++) {
|
56
56
|
//const t = performance.now();
|
57
57
|
const r = 128;
|
58
|
-
const surface = drawOnNode(
|
58
|
+
const surface = await 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", async () => {
|
20
20
|
const font = loadFont("skia/__tests__/assets/Roboto-Medium.ttf");
|
21
|
-
const surface = drawOnNode(
|
21
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
36
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
51
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
66
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
88
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
112
|
+
const surface = await 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", async () => {
|
14
14
|
const { Skia } = importSkia();
|
15
15
|
const size = width;
|
16
16
|
const origin = Skia.Point(size / 2, size / 2);
|
17
|
-
const surface = drawOnNode(
|
17
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
34
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
47
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
59
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
59
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
85
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
108
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
131
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
154
|
+
const surface = await 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 = drawOnNode(<TestRasterization />);
|
167
|
+
it("Should use saveLayer() properly", async () => {
|
168
|
+
const surface = await 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 = drawOnNode(
|
38
|
+
it("Hello world with the declarative API", async () => {
|
39
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
27
|
+
const surface = await 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", async () => {
|
40
40
|
const r = width / 6;
|
41
41
|
const strokeWidth = 10 * PIXEL_RATIO;
|
42
|
-
const surface = drawOnNode(
|
42
|
+
const surface = await 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 = drawOnNode(<TestPaintAssignment />);
|
53
|
+
it("should use paint assignement properly", async () => {
|
54
|
+
const surface = await 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", async () => {
|
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 = drawOnNode(
|
63
|
+
const surface = await 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", async () => {
|
9
9
|
const { rect, rrect } = importSkia();
|
10
10
|
const size = width / 2;
|
11
11
|
const d = 10 * PIXEL_RATIO;
|
12
|
-
const surface = drawOnNode(
|
12
|
+
const surface = await 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", async () => {
|
33
33
|
const size = width / 2;
|
34
|
-
const surface = drawOnNode(
|
34
|
+
const surface = await 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 = drawAsImage(
|
171
|
+
const texture = await 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 = drawAsImage(
|
214
|
+
const texture = await 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 = drawAsImage(
|
286
|
+
const texture = await 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 = drawAsImage(
|
103
|
+
const image = await drawAsImage(
|
104
104
|
<Circle r={r} cx={r} cy={r} color="lightblue" />,
|
105
105
|
{ width, height }
|
106
106
|
);
|
@@ -12,10 +12,10 @@ import {
|
|
12
12
|
import { height, drawOnNode, width, loadImage, importSkia } from "../setup";
|
13
13
|
|
14
14
|
describe("Test blend modes", () => {
|
15
|
-
it("Should nicely blend the product color to the image", () => {
|
15
|
+
it("Should nicely blend the product color to the image", async () => {
|
16
16
|
const image = loadImage("skia/__tests__/assets/product.png");
|
17
17
|
const rect = { x: 0, y: 0, width, height };
|
18
|
-
const surface = drawOnNode(
|
18
|
+
const surface = await drawOnNode(
|
19
19
|
<Mask mask={<Image image={image} rect={rect} />}>
|
20
20
|
<Image image={image} rect={rect}>
|
21
21
|
<BlendColor color="lightgreen" mode="hue" />
|
@@ -24,12 +24,12 @@ describe("Test blend modes", () => {
|
|
24
24
|
);
|
25
25
|
processResult(surface, "snapshots/demos/product.png");
|
26
26
|
});
|
27
|
-
it("Should nicely blend the product color to the image using a runtime effect", () => {
|
27
|
+
it("Should nicely blend the product color to the image using a runtime effect", async () => {
|
28
28
|
const { Skia } = importSkia();
|
29
29
|
const image = loadImage("skia/__tests__/assets/product.png");
|
30
30
|
const rect = { x: 0, y: 0, width, height };
|
31
31
|
const source = Skia.RuntimeEffect.Make(blender)!;
|
32
|
-
const surface = drawOnNode(
|
32
|
+
const surface = await drawOnNode(
|
33
33
|
<Rect rect={rect}>
|
34
34
|
<Shader
|
35
35
|
source={source}
|
@@ -176,14 +176,14 @@ export const width = 256 * PIXEL_RATIO;
|
|
176
176
|
export const height = 256 * PIXEL_RATIO;
|
177
177
|
export const center = { x: width / 2, y: height / 2 };
|
178
178
|
|
179
|
-
export const drawOnNode = (element: ReactNode) => {
|
180
|
-
const { surface: ckSurface, draw, root } = mountCanvas(element);
|
181
|
-
draw();
|
179
|
+
export const drawOnNode = async (element: ReactNode) => {
|
180
|
+
const { surface: ckSurface, draw, root } = await mountCanvas(element);
|
181
|
+
await draw();
|
182
182
|
root.unmount();
|
183
183
|
return ckSurface;
|
184
184
|
};
|
185
185
|
|
186
|
-
export const mountCanvas = (element: ReactNode) => {
|
186
|
+
export const mountCanvas = async (element: ReactNode) => {
|
187
187
|
const Skia = global.SkiaApi;
|
188
188
|
expect(Skia).toBeDefined();
|
189
189
|
const ckSurface = Skia.Surface.MakeOffscreen(width, height)!;
|
@@ -191,18 +191,18 @@ export const mountCanvas = (element: ReactNode) => {
|
|
191
191
|
const canvas = ckSurface.getCanvas();
|
192
192
|
|
193
193
|
const root = new SkiaSGRoot(Skia);
|
194
|
-
root.render(element);
|
195
194
|
return {
|
196
195
|
surface: ckSurface,
|
197
196
|
root,
|
198
|
-
draw: () => {
|
197
|
+
draw: async () => {
|
198
|
+
await root.render(element);
|
199
199
|
root.drawOnCanvas(canvas);
|
200
200
|
},
|
201
201
|
};
|
202
202
|
};
|
203
203
|
|
204
|
-
export const serialize = (element: ReactNode) => {
|
205
|
-
const { root } = mountCanvas(element);
|
204
|
+
export const serialize = async (element: ReactNode) => {
|
205
|
+
const { root } = await mountCanvas(element);
|
206
206
|
const serialized = serializeNode(root.sg);
|
207
207
|
return JSON.stringify(serialized);
|
208
208
|
};
|
@@ -379,11 +379,11 @@ class LocalSurface implements TestingSurface {
|
|
379
379
|
return Promise.resolve(ckSurface.makeImageSnapshot());
|
380
380
|
}
|
381
381
|
|
382
|
-
draw(node: ReactNode): Promise<SkImage> {
|
383
|
-
const { surface: ckSurface, draw } = mountCanvas(
|
382
|
+
async draw(node: ReactNode): Promise<SkImage> {
|
383
|
+
const { surface: ckSurface, draw } = await mountCanvas(
|
384
384
|
<Group transform={[{ scale: PIXEL_RATIO }]}>{node}</Group>
|
385
385
|
);
|
386
|
-
draw();
|
386
|
+
await draw();
|
387
387
|
return Promise.resolve(ckSurface.makeImageSnapshot());
|
388
388
|
}
|
389
389
|
|
@@ -440,8 +440,8 @@ return surface.makeImageSnapshot().encodeToBase64();
|
|
440
440
|
return image;
|
441
441
|
}
|
442
442
|
|
443
|
-
draw(node: ReactNode) {
|
444
|
-
return this.handleImageResponse(serialize(node));
|
443
|
+
async draw(node: ReactNode) {
|
444
|
+
return this.handleImageResponse(await serialize(node));
|
445
445
|
}
|
446
446
|
|
447
447
|
screen(screen: string) {
|
package/src/sksg/Container.ts
CHANGED
@@ -40,12 +40,20 @@ const nativeDrawOnscreen = (nativeId: number, recorder: JsiRecorder) => {
|
|
40
40
|
};
|
41
41
|
|
42
42
|
export abstract class Container {
|
43
|
-
|
43
|
+
private _root: Node[] = [];
|
44
44
|
protected recording: Recording | null = null;
|
45
45
|
protected unmounted = false;
|
46
46
|
|
47
47
|
constructor(protected Skia: Skia, protected nativeId: number) {}
|
48
48
|
|
49
|
+
get root() {
|
50
|
+
return this._root;
|
51
|
+
}
|
52
|
+
|
53
|
+
set root(value: Node[]) {
|
54
|
+
this._root = value;
|
55
|
+
}
|
56
|
+
|
49
57
|
unmount() {
|
50
58
|
this.unmounted = true;
|
51
59
|
}
|