@shopify/react-native-skia 0.1.233 → 0.1.236
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +0 -1
- package/android/cpp/jni/JniSkiaManager.cpp +0 -1
- package/android/cpp/rnskia-android/RNSkAndroidView.h +0 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp +1 -1
- package/android/cpp/rnskia-android/RNSkOpenGLCanvasProvider.h +1 -2
- package/cpp/api/JsiSkTypefaceFactory.h +2 -1
- package/cpp/skia/include/android/AHardwareBufferUtils.h +23 -0
- package/cpp/skia/include/android/GrAHardwareBufferUtils.h +2 -0
- package/cpp/skia/include/android/graphite/SurfaceAndroid.h +59 -0
- package/cpp/skia/include/codec/SkAvifDecoder.h +1 -1
- package/cpp/skia/include/codec/SkBmpDecoder.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +21 -3
- package/cpp/skia/include/codec/SkGifDecoder.h +1 -1
- package/cpp/skia/include/codec/SkIcoDecoder.h +1 -1
- package/cpp/skia/include/codec/SkJpegDecoder.h +1 -1
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +1 -1
- package/cpp/skia/include/codec/SkPngDecoder.h +1 -1
- package/cpp/skia/include/codec/SkRawDecoder.h +1 -1
- package/cpp/skia/include/codec/SkWbmpDecoder.h +1 -1
- package/cpp/skia/include/codec/SkWebpDecoder.h +1 -1
- package/cpp/skia/include/config/SkUserConfig.h +3 -1
- package/cpp/skia/include/core/SkCanvas.h +66 -37
- package/cpp/skia/include/core/SkColorFilter.h +5 -2
- package/cpp/skia/include/core/SkContourMeasure.h +1 -0
- package/cpp/skia/include/core/SkDocument.h +1 -0
- package/cpp/skia/include/core/SkFont.h +14 -24
- package/cpp/skia/include/core/SkFontArguments.h +1 -1
- package/cpp/skia/include/core/SkFontMetrics.h +1 -1
- package/cpp/skia/include/core/SkFontMgr.h +0 -7
- package/cpp/skia/include/core/SkGraphics.h +13 -0
- package/cpp/skia/include/core/SkMesh.h +9 -13
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPathMeasure.h +2 -0
- package/cpp/skia/include/core/SkSerialProcs.h +29 -11
- package/cpp/skia/include/core/SkSize.h +3 -3
- package/cpp/skia/include/core/SkStream.h +3 -13
- package/cpp/skia/include/core/SkSurface.h +6 -3
- package/cpp/skia/include/core/SkSurfaceProps.h +2 -4
- package/cpp/skia/include/core/SkTraceMemoryDump.h +15 -0
- package/cpp/skia/include/core/SkTypeface.h +8 -56
- package/cpp/skia/include/core/SkTypes.h +8 -0
- package/cpp/skia/include/core/SkVertices.h +1 -1
- package/cpp/skia/include/docs/SkMultiPictureDocument.h +53 -0
- package/cpp/skia/include/docs/SkPDFDocument.h +11 -0
- package/cpp/skia/include/effects/SkGradientShader.h +9 -0
- package/cpp/skia/include/effects/SkRuntimeEffect.h +3 -7
- package/cpp/skia/include/gpu/GrBackendSemaphore.h +33 -47
- package/cpp/skia/include/gpu/GrBackendSurface.h +2 -3
- package/cpp/skia/include/gpu/GrContextOptions.h +0 -6
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +44 -28
- package/cpp/skia/include/gpu/GrDirectContext.h +12 -31
- package/cpp/skia/include/gpu/GrTypes.h +1 -16
- package/cpp/skia/include/gpu/MutableTextureState.h +35 -80
- package/cpp/skia/include/gpu/ShaderErrorHandler.h +11 -1
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +2 -2
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +1 -1
- package/cpp/skia/include/gpu/ganesh/gl/GrGLDirectContext.h +3 -2
- package/cpp/skia/include/gpu/ganesh/vk/GrVkBackendSemaphore.h +20 -0
- package/cpp/skia/include/gpu/ganesh/vk/GrVkDirectContext.h +30 -0
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +2 -0
- package/cpp/skia/include/gpu/gl/glx/GrGLMakeGLXInterface.h +6 -0
- package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +3 -3
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +39 -27
- package/cpp/skia/include/gpu/graphite/Context.h +39 -13
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +2 -0
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +2 -1
- package/cpp/skia/include/gpu/graphite/Image.h +106 -87
- package/cpp/skia/include/gpu/graphite/Recorder.h +24 -3
- package/cpp/skia/include/gpu/graphite/Surface.h +7 -2
- package/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +41 -2
- package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +11 -6
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -2
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +6 -6
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +1 -0
- package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +1 -44
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanMutableTextureState.h +25 -0
- package/cpp/skia/include/gpu/vk/VulkanTypes.h +44 -0
- package/cpp/skia/include/ports/SkFontConfigInterface.h +3 -6
- package/cpp/skia/include/private/SkEncodedInfo.h +5 -0
- package/cpp/skia/include/private/SkExif.h +102 -0
- package/cpp/skia/include/private/SkGainmapInfo.h +11 -1
- package/cpp/skia/include/private/base/SkAssert.h +16 -0
- package/cpp/skia/include/private/base/SkDeque.h +2 -7
- package/cpp/skia/include/private/base/SkLoadUserConfig.h +1 -1
- package/cpp/skia/include/private/base/SkTArray.h +69 -28
- package/cpp/skia/include/private/base/SkThreadAnnotations.h +18 -5
- package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +26 -30
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +4 -3
- package/cpp/skia/include/private/chromium/SkImageChromium.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +8 -6
- package/cpp/skia/include/private/gpu/graphite/ContextOptionsPriv.h +29 -0
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +12 -9
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +16 -11
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +2 -2
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std.h +312 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h264std_decode.h +77 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std.h +446 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codec_h265std_decode.h +67 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vk_video/vulkan_video_codecs_common.h +36 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +9 -2
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +31 -3
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +10624 -5716
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +2 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +2 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +28 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +2 -1
- package/cpp/skia/include/utils/mac/SkCGUtils.h +23 -11
- package/cpp/skia/modules/skcms/skcms.h +2 -410
- package/cpp/skia/modules/skcms/src/Transform_inl.h +831 -704
- package/cpp/skia/modules/skcms/src/skcms_Transform.h +161 -0
- package/cpp/skia/modules/skcms/src/skcms_internals.h +136 -0
- package/cpp/skia/modules/skcms/src/skcms_public.h +404 -0
- package/cpp/skia/modules/skparagraph/include/FontArguments.h +1 -1
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -0
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -2
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +4 -3
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +1 -3
- package/cpp/skia/modules/skresources/include/SkResources.h +28 -17
- package/cpp/skia/modules/skunicode/include/SkUnicode.h +12 -0
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +4 -1
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +4 -1
- package/cpp/skia/src/base/SkUTF.h +7 -0
- package/cpp/skia/src/core/SkTHash.h +20 -8
- package/lib/commonjs/dom/nodes/JsiSkDOM.d.ts +3 -2
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +56 -57
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/external/reanimated/index.d.ts +1 -0
- package/lib/commonjs/external/reanimated/index.js +13 -0
- package/lib/commonjs/external/reanimated/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.js +16 -2
- package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +1 -0
- package/lib/commonjs/external/reanimated/moduleWrapper.js +5 -3
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/commonjs/external/reanimated/textures.d.ts +5 -0
- package/lib/commonjs/external/reanimated/textures.js +52 -0
- package/lib/commonjs/external/reanimated/textures.js.map +1 -0
- package/lib/commonjs/headless/index.js +1 -1
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/mock/index.js +3 -0
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +6 -5
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/renderer/Container.d.ts +1 -1
- package/lib/commonjs/renderer/Container.js +2 -1
- package/lib/commonjs/renderer/Container.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +1 -0
- package/lib/commonjs/renderer/Offscreen.js +18 -5
- package/lib/commonjs/renderer/Offscreen.js.map +1 -1
- package/lib/commonjs/renderer/Reconciler.d.ts +1 -1
- package/lib/commonjs/renderer/Reconciler.js +7 -4
- package/lib/commonjs/renderer/Reconciler.js.map +1 -1
- package/lib/commonjs/skia/types/Matrix4.d.ts +2 -2
- package/lib/commonjs/skia/types/Matrix4.js.map +1 -1
- package/lib/commonjs/skia/types/Shader/Shader.d.ts +1 -1
- package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkPath.js +10 -2
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/views/SkiaJSDomView.d.ts +31 -0
- package/lib/commonjs/views/SkiaJSDomView.js +161 -0
- package/lib/commonjs/views/SkiaJSDomView.js.map +1 -0
- package/lib/commonjs/views/SkiaJSDomView.web.d.ts +1 -0
- package/lib/commonjs/views/SkiaJSDomView.web.js +14 -0
- package/lib/commonjs/views/SkiaJSDomView.web.js.map +1 -0
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +3 -2
- package/lib/module/dom/nodes/JsiSkDOM.js +56 -56
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/external/reanimated/index.d.ts +1 -0
- package/lib/module/external/reanimated/index.js +1 -0
- package/lib/module/external/reanimated/index.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.js +15 -2
- package/lib/module/external/reanimated/interpolators.js.map +1 -1
- package/lib/module/external/reanimated/moduleWrapper.d.ts +1 -0
- package/lib/module/external/reanimated/moduleWrapper.js +3 -2
- package/lib/module/external/reanimated/moduleWrapper.js.map +1 -1
- package/lib/module/external/reanimated/textures.d.ts +5 -0
- package/lib/module/external/reanimated/textures.js +35 -0
- package/lib/module/external/reanimated/textures.js.map +1 -0
- package/lib/module/headless/index.js +1 -1
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/mock/index.js +3 -0
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +5 -4
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/renderer/Container.d.ts +1 -1
- package/lib/module/renderer/Container.js +2 -1
- package/lib/module/renderer/Container.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +1 -0
- package/lib/module/renderer/Offscreen.js +11 -3
- package/lib/module/renderer/Offscreen.js.map +1 -1
- package/lib/module/renderer/Reconciler.d.ts +1 -1
- package/lib/module/renderer/Reconciler.js +7 -4
- package/lib/module/renderer/Reconciler.js.map +1 -1
- package/lib/module/skia/types/Matrix4.d.ts +2 -2
- package/lib/module/skia/types/Matrix4.js.map +1 -1
- package/lib/module/skia/types/Shader/Shader.d.ts +1 -1
- package/lib/module/skia/types/Shader/Shader.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +2 -2
- package/lib/module/skia/web/JsiSkPath.js +10 -2
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/views/SkiaJSDomView.d.ts +31 -0
- package/lib/module/views/SkiaJSDomView.js +136 -0
- package/lib/module/views/SkiaJSDomView.js.map +1 -0
- package/lib/module/views/SkiaJSDomView.web.d.ts +1 -0
- package/lib/module/views/SkiaJSDomView.web.js +2 -0
- package/lib/module/views/SkiaJSDomView.web.js.map +1 -0
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +3 -2
- package/lib/typescript/src/external/reanimated/index.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +1 -0
- package/lib/typescript/src/external/reanimated/textures.d.ts +5 -0
- package/lib/typescript/src/renderer/Container.d.ts +1 -1
- package/lib/typescript/src/renderer/Offscreen.d.ts +1 -0
- package/lib/typescript/src/renderer/Reconciler.d.ts +1 -1
- package/lib/typescript/src/skia/types/Matrix4.d.ts +2 -2
- package/lib/typescript/src/skia/types/Shader/Shader.d.ts +1 -1
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +2 -2
- package/lib/typescript/src/views/SkiaJSDomView.d.ts +31 -0
- package/lib/typescript/src/views/SkiaJSDomView.web.d.ts +1 -0
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libskparagraph.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libskshaper.a +0 -0
- package/libs/android/arm64-v8a/libskunicode.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libskparagraph.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libskshaper.a +0 -0
- package/libs/android/armeabi-v7a/libskunicode.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libskparagraph.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libskshaper.a +0 -0
- package/libs/android/x86/libskunicode.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libskparagraph.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libskshaper.a +0 -0
- package/libs/android/x86_64/libskunicode.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/Info.plist +5 -5
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/src/dom/nodes/JsiSkDOM.ts +55 -56
- package/src/external/reanimated/index.ts +1 -0
- package/src/external/reanimated/interpolators.ts +17 -3
- package/src/external/reanimated/moduleWrapper.ts +1 -0
- package/src/external/reanimated/textures.tsx +50 -0
- package/src/headless/index.ts +1 -1
- package/src/mock/index.ts +3 -0
- package/src/renderer/Canvas.tsx +4 -3
- package/src/renderer/Container.tsx +3 -2
- package/src/renderer/Offscreen.tsx +12 -3
- package/src/renderer/Reconciler.tsx +5 -2
- package/src/skia/types/Matrix4.ts +2 -2
- package/src/skia/types/Shader/Shader.ts +6 -1
- package/src/skia/web/JsiSkPath.ts +23 -3
- package/src/views/SkiaJSDomView.tsx +126 -0
- package/src/views/SkiaJSDomView.web.tsx +1 -0
- package/android/cpp/jni/include/JniSkiaDrawView.h +0 -90
- package/cpp/rnskia/RNSkJsView.cpp +0 -236
- package/cpp/rnskia/RNSkJsView.h +0 -121
- package/cpp/skia/include/gpu/GrSurfaceInfo.h +0 -142
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +0 -107
- package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +0 -32
- package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +0 -83
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +0 -47
- package/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h +0 -57
- package/cpp/skia/include/utils/SkBase64.h +0 -53
- package/cpp/skia/modules/skcms/skcms_internal.h +0 -56
@@ -20,7 +20,7 @@ export const makeOffscreenSurface = (width, height) => {
|
|
20
20
|
return surface;
|
21
21
|
};
|
22
22
|
export const drawOffscreen = (surface, element) => {
|
23
|
-
const root = new SkiaRoot(Skia);
|
23
|
+
const root = new SkiaRoot(Skia, false);
|
24
24
|
root.render(element);
|
25
25
|
const canvas = surface.getCanvas();
|
26
26
|
const ctx = new JsiDrawingContext(Skia, canvas);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkApi","SkiaRoot","JsiDrawingContext","Skia","makeOffscreenSurface","width","height","CanvasKit","surface","Surface","MakeOffscreen","Error","drawOffscreen","element","root","render","canvas","getCanvas","ctx","dom","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nexport * from \"../renderer/components\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Skia: any;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":"AAAA;AACA;AAIA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,QAAT,QAAyB,wBAAzB;AACA,SAASC,iBAAT,QAAkC,cAAlC;AAGA,cAAc,wBAAd,C,CAEA;;AACA,IAAIC,IAAJ;AAEA,OAAO,MAAMC,oBAAoB,GAAG,CAACC,KAAD,EAAgBC,MAAhB,KAAmC;EACrE,IAAI,CAACH,IAAL,EAAW;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAD,CAAf;EACD;;EACD,MAAMC,OAAO,GAAGL,IAAI,CAACM,OAAL,CAAaC,aAAb,CAA2BL,KAA3B,EAAkCC,MAAlC,CAAhB;;EACA,IAAIE,OAAO,KAAK,IAAhB,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CAAU,0BAAV,CAAN;EACD;;EACD,OAAOH,OAAP;AACD,CATM;AAWP,OAAO,MAAMI,aAAa,GAAG,CAACJ,OAAD,EAAqBK,OAArB,KAA4C;EACvE,MAAMC,IAAI,GAAG,IAAIb,QAAJ,CAAaE,IAAb,CAAb;EACAW,IAAI,CAACC,MAAL,CAAYF,OAAZ;EACA,MAAMG,MAAM,GAAGR,OAAO,CAACS,SAAR,EAAf;EACA,MAAMC,GAAG,GAAG,IAAIhB,iBAAJ,CAAsBC,IAAtB,EAA4Ba,MAA5B,CAAZ;EACAF,IAAI,CAACK,GAAL,CAASJ,MAAT,CAAgBG,GAAhB;EACAV,OAAO,CAACY,KAAR;EACA,OAAOZ,OAAO,CAACa,iBAAR,EAAP;AACD,CARM"}
|
1
|
+
{"version":3,"names":["JsiSkApi","SkiaRoot","JsiDrawingContext","Skia","makeOffscreenSurface","width","height","CanvasKit","surface","Surface","MakeOffscreen","Error","drawOffscreen","element","root","render","canvas","getCanvas","ctx","dom","flush","makeImageSnapshot"],"sources":["index.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-ignore\nimport CanvasKitInit from \"canvaskit-wasm/bin/full/canvaskit\";\nimport type { ReactNode } from \"react\";\n\nimport { JsiSkApi } from \"../skia/web\";\nimport { SkiaRoot } from \"../renderer/Reconciler\";\nimport { JsiDrawingContext } from \"../dom/types\";\nimport type { SkSurface } from \"../skia\";\n\nexport * from \"../renderer/components\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nlet Skia: any;\n\nexport const makeOffscreenSurface = (width: number, height: number) => {\n if (!Skia) {\n Skia = JsiSkApi(CanvasKit);\n }\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (surface === null) {\n throw new Error(\"Couldn't create surface!\");\n }\n return surface;\n};\n\nexport const drawOffscreen = (surface: SkSurface, element: ReactNode) => {\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const canvas = surface.getCanvas();\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n surface.flush();\n return surface.makeImageSnapshot();\n};\n"],"mappings":"AAAA;AACA;AAIA,SAASA,QAAT,QAAyB,aAAzB;AACA,SAASC,QAAT,QAAyB,wBAAzB;AACA,SAASC,iBAAT,QAAkC,cAAlC;AAGA,cAAc,wBAAd,C,CAEA;;AACA,IAAIC,IAAJ;AAEA,OAAO,MAAMC,oBAAoB,GAAG,CAACC,KAAD,EAAgBC,MAAhB,KAAmC;EACrE,IAAI,CAACH,IAAL,EAAW;IACTA,IAAI,GAAGH,QAAQ,CAACO,SAAD,CAAf;EACD;;EACD,MAAMC,OAAO,GAAGL,IAAI,CAACM,OAAL,CAAaC,aAAb,CAA2BL,KAA3B,EAAkCC,MAAlC,CAAhB;;EACA,IAAIE,OAAO,KAAK,IAAhB,EAAsB;IACpB,MAAM,IAAIG,KAAJ,CAAU,0BAAV,CAAN;EACD;;EACD,OAAOH,OAAP;AACD,CATM;AAWP,OAAO,MAAMI,aAAa,GAAG,CAACJ,OAAD,EAAqBK,OAArB,KAA4C;EACvE,MAAMC,IAAI,GAAG,IAAIb,QAAJ,CAAaE,IAAb,EAAmB,KAAnB,CAAb;EACAW,IAAI,CAACC,MAAL,CAAYF,OAAZ;EACA,MAAMG,MAAM,GAAGR,OAAO,CAACS,SAAR,EAAf;EACA,MAAMC,GAAG,GAAG,IAAIhB,iBAAJ,CAAsBC,IAAtB,EAA4Ba,MAA5B,CAAZ;EACAF,IAAI,CAACK,GAAL,CAASJ,MAAT,CAAgBG,GAAhB;EACAV,OAAO,CAACY,KAAR;EACA,OAAOZ,OAAO,CAACa,iBAAR,EAAP;AACD,CARM"}
|
package/lib/module/mock/index.js
CHANGED
@@ -34,9 +34,12 @@ export const Mock = CanvasKit => {
|
|
34
34
|
// Reanimated hooks
|
35
35
|
useClock: NoopSharedValue,
|
36
36
|
usePathInterpolation: NoopSharedValue,
|
37
|
+
useTextureValue: NoopSharedValue,
|
38
|
+
useTextureValueFromPicture: NoopSharedValue,
|
37
39
|
useRawData: Noop,
|
38
40
|
useData: Noop,
|
39
41
|
useFont: () => Skia.Font(undefined, 0),
|
42
|
+
useFonts: Noop,
|
40
43
|
useTypeface: () => null,
|
41
44
|
useImage: () => null,
|
42
45
|
useSVG: () => null
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkApi","Noop","undefined","NoopValue","current","NoopSharedValue","value","Mock","CanvasKit","global","SkiaApi","Skia","require","Canvas","useValue","useComputedValue","useTouchHandler","useTiming","useLoop","useSpring","useClockValue","useValueEffect","useClock","usePathInterpolation","useRawData","useData","useFont","Font","useTypeface","useImage","useSVG"],"sources":["index.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport { JsiSkApi } from \"../skia/web\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Noop: () => any = () => undefined;\nconst NoopValue = () => ({ current: 0 });\nconst NoopSharedValue = () => ({ value: 0 });\n\nexport const Mock = (CanvasKit: CanvasKit) => {\n global.SkiaApi = JsiSkApi(CanvasKit);\n const Skia = global.SkiaApi;\n return {\n Skia,\n ...require(\"../renderer/components\"),\n ...require(\"../skia\"),\n ...require(\"../animation\"),\n ...require(\"../dom/types\"),\n ...require(\"../dom/nodes\"),\n // We could use the real Canvas if we mock the SkiaView component for node\n Canvas: Noop,\n // Skia Animations\n useValue: NoopValue,\n useComputedValue: NoopValue,\n useTouchHandler: Noop,\n useTiming: NoopValue,\n useLoop: NoopValue,\n useSpring: NoopValue,\n useClockValue: NoopValue,\n useValueEffect: Noop,\n // Reanimated hooks\n useClock: NoopSharedValue,\n usePathInterpolation: NoopSharedValue,\n useRawData: Noop,\n useData: Noop,\n useFont: () => Skia.Font(undefined, 0),\n useTypeface: () => null,\n useImage: () => null,\n useSVG: () => null,\n };\n};\n"],"mappings":"AAEA,SAASA,QAAT,QAAyB,aAAzB,C,CAEA;;AACA,MAAMC,IAAe,GAAG,MAAMC,SAA9B;;AACA,MAAMC,SAAS,GAAG,OAAO;EAAEC,OAAO,EAAE;AAAX,CAAP,CAAlB;;AACA,MAAMC,eAAe,GAAG,OAAO;EAAEC,KAAK,EAAE;AAAT,CAAP,CAAxB;;AAEA,OAAO,MAAMC,IAAI,GAAIC,SAAD,IAA0B;EAC5CC,MAAM,CAACC,OAAP,GAAiBV,QAAQ,CAACQ,SAAD,CAAzB;EACA,MAAMG,IAAI,GAAGF,MAAM,CAACC,OAApB;EACA,OAAO;IACLC,IADK;IAEL,GAAGC,OAAO,CAAC,wBAAD,CAFL;IAGL,GAAGA,OAAO,CAAC,SAAD,CAHL;IAIL,GAAGA,OAAO,CAAC,cAAD,CAJL;IAKL,GAAGA,OAAO,CAAC,cAAD,CALL;IAML,GAAGA,OAAO,CAAC,cAAD,CANL;IAOL;IACAC,MAAM,EAAEZ,IARH;IASL;IACAa,QAAQ,EAAEX,SAVL;IAWLY,gBAAgB,EAAEZ,SAXb;IAYLa,eAAe,EAAEf,IAZZ;IAaLgB,SAAS,EAAEd,SAbN;IAcLe,OAAO,EAAEf,SAdJ;IAeLgB,SAAS,EAAEhB,SAfN;IAgBLiB,aAAa,EAAEjB,SAhBV;IAiBLkB,cAAc,EAAEpB,IAjBX;IAkBL;IACAqB,QAAQ,EAAEjB,eAnBL;IAoBLkB,oBAAoB,EAAElB,eApBjB;IAqBLmB,UAAU,
|
1
|
+
{"version":3,"names":["JsiSkApi","Noop","undefined","NoopValue","current","NoopSharedValue","value","Mock","CanvasKit","global","SkiaApi","Skia","require","Canvas","useValue","useComputedValue","useTouchHandler","useTiming","useLoop","useSpring","useClockValue","useValueEffect","useClock","usePathInterpolation","useTextureValue","useTextureValueFromPicture","useRawData","useData","useFont","Font","useFonts","useTypeface","useImage","useSVG"],"sources":["index.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport { JsiSkApi } from \"../skia/web\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst Noop: () => any = () => undefined;\nconst NoopValue = () => ({ current: 0 });\nconst NoopSharedValue = () => ({ value: 0 });\n\nexport const Mock = (CanvasKit: CanvasKit) => {\n global.SkiaApi = JsiSkApi(CanvasKit);\n const Skia = global.SkiaApi;\n return {\n Skia,\n ...require(\"../renderer/components\"),\n ...require(\"../skia\"),\n ...require(\"../animation\"),\n ...require(\"../dom/types\"),\n ...require(\"../dom/nodes\"),\n // We could use the real Canvas if we mock the SkiaView component for node\n Canvas: Noop,\n // Skia Animations\n useValue: NoopValue,\n useComputedValue: NoopValue,\n useTouchHandler: Noop,\n useTiming: NoopValue,\n useLoop: NoopValue,\n useSpring: NoopValue,\n useClockValue: NoopValue,\n useValueEffect: Noop,\n // Reanimated hooks\n useClock: NoopSharedValue,\n usePathInterpolation: NoopSharedValue,\n useTextureValue: NoopSharedValue,\n useTextureValueFromPicture: NoopSharedValue,\n useRawData: Noop,\n useData: Noop,\n useFont: () => Skia.Font(undefined, 0),\n useFonts: Noop,\n useTyp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AAE,MAAM,IA3Bd;IA4BLC,QAAQ,EAAE,MAAM,IA5BX;IA6BLC,MAAM,EAAE,MAAM;EA7BT,CAAP;AA+BD,CAlCM"}
|
@@ -2,8 +2,8 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
2
2
|
|
3
3
|
import React, { useEffect, useCallback, useMemo, forwardRef, useRef } from "react";
|
4
4
|
import { SkiaDomView } from "../views";
|
5
|
-
import { SkiaDomView as SkiaDomViewWeb } from "../views/SkiaDomView.web";
|
6
5
|
import { Skia } from "../skia/Skia";
|
6
|
+
import { SkiaJSDomView } from "../views/SkiaJSDomView";
|
7
7
|
import { SkiaRoot } from "./Reconciler";
|
8
8
|
import { NATIVE_DOM } from "./HostComponents";
|
9
9
|
export const useCanvasRef = () => useRef(null);
|
@@ -53,7 +53,7 @@ export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
53
53
|
const id = (_innerRef$current$nat = (_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.nativeId) !== null && _innerRef$current$nat !== void 0 ? _innerRef$current$nat : -1;
|
54
54
|
return id;
|
55
55
|
}, [innerRef]);
|
56
|
-
const root = useMemo(() => new SkiaRoot(Skia, redraw, getNativeId), [redraw, getNativeId]); // Render effect
|
56
|
+
const root = useMemo(() => new SkiaRoot(Skia, NATIVE_DOM, redraw, getNativeId), [redraw, getNativeId]); // Render effect
|
57
57
|
|
58
58
|
useEffect(() => {
|
59
59
|
root.render(children);
|
@@ -75,8 +75,9 @@ export const Canvas = /*#__PURE__*/forwardRef((_ref, forwardedRef) => {
|
|
75
75
|
debug: debug
|
76
76
|
}, props));
|
77
77
|
} else {
|
78
|
-
return /*#__PURE__*/React.createElement(
|
79
|
-
|
78
|
+
return /*#__PURE__*/React.createElement(SkiaJSDomView, _extends({
|
79
|
+
Skia: Skia // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
80
|
+
,
|
80
81
|
ref: ref,
|
81
82
|
style: style,
|
82
83
|
root: root.dom,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","useEffect","useCallback","useMemo","forwardRef","useRef","SkiaDomView","
|
1
|
+
{"version":3,"names":["React","useEffect","useCallback","useMemo","forwardRef","useRef","SkiaDomView","Skia","SkiaJSDomView","SkiaRoot","NATIVE_DOM","useCanvasRef","useOnSizeEvent","resultValue","onLayout","event","width","height","nativeEvent","layout","value","Canvas","forwardedRef","children","style","debug","mode","onTouch","onSize","_onSize","_onLayout","props","innerRef","ref","useCombinedRefs","redraw","current","getNativeId","id","nativeId","root","render","unmount","dom","refs","targetRef","forEach"],"sources":["Canvas.tsx"],"sourcesContent":["import React, {\n useEffect,\n useCallback,\n useMemo,\n forwardRef,\n useRef,\n} from \"react\";\nimport type {\n RefObject,\n ReactNode,\n MutableRefObject,\n ForwardedRef,\n FunctionComponent,\n} from \"react\";\nimport type { LayoutChangeEvent } from \"react-native\";\n\nimport { SkiaDomView } from \"../views\";\nimport { Skia } from \"../skia/Skia\";\nimport type { TouchHandler, SkiaBaseViewProps } from \"../views\";\nimport { SkiaJSDomView } from \"../views/SkiaJSDomView\";\n\nimport { SkiaRoot } from \"./Reconciler\";\nimport { NATIVE_DOM } from \"./HostComponents\";\n\nexport const useCanvasRef = () => useRef<SkiaDomView>(null);\n\nexport interface CanvasProps extends SkiaBaseViewProps {\n ref?: RefObject<SkiaDomView>;\n children: ReactNode;\n onTouch?: TouchHandler;\n}\n\nconst useOnSizeEvent = (\n resultValue: SkiaBaseViewProps[\"onSize\"],\n onLayout?: (event: LayoutChangeEvent) => void\n) => {\n return useCallback(\n (event: LayoutChangeEvent) => {\n if (onLayout) {\n onLayout(event);\n }\n const { width, height } = event.nativeEvent.layout;\n\n if (resultValue) {\n resultValue.value = { width, height };\n }\n },\n [onLayout, resultValue]\n );\n};\n\nexport const Canvas = forwardRef<SkiaDomView, CanvasProps>(\n (\n {\n children,\n style,\n debug,\n mode,\n onTouch,\n onSize: _onSize,\n onLayout: _onLayout,\n ...props\n },\n forwardedRef\n ) => {\n const onLayout = useOnSizeEvent(_onSize, _onLayout);\n const innerRef = useCanvasRef();\n const ref = useCombinedRefs(forwardedRef, innerRef);\n const redraw = useCallback(() => {\n innerRef.current?.redraw();\n }, [innerRef]);\n const getNativeId = useCallback(() => {\n const id = innerRef.current?.nativeId ?? -1;\n return id;\n }, [innerRef]);\n\n const root = useMemo(\n () => new SkiaRoot(Skia, NATIVE_DOM, redraw, getNativeId),\n [redraw, getNativeId]\n );\n\n // Render effect\n useEffect(() => {\n root.render(children);\n }, [children, root, redraw]);\n\n useEffect(() => {\n return () => {\n root.unmount();\n };\n }, [root]);\n\n if (NATIVE_DOM) {\n return (\n <SkiaDomView\n ref={ref}\n style={style}\n root={root.dom}\n onTouch={onTouch}\n onLayout={onLayout}\n mode={mode}\n debug={debug}\n {...props}\n />\n );\n } else {\n return (\n <SkiaJSDomView\n Skia={Skia}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ref={ref as any}\n style={style}\n root={root.dom}\n onTouch={onTouch}\n onLayout={onLayout}\n mode={mode}\n debug={debug}\n {...props}\n />\n );\n }\n }\n) as FunctionComponent<CanvasProps & React.RefAttributes<SkiaDomView>>;\n\n/**\n * Combines a list of refs into a single ref. This can be used to provide\n * both a forwarded ref and an internal ref keeping the same functionality\n * on both of the refs.\n * @param refs Array of refs to combine\n * @returns A single ref that can be used in a ref prop.\n */\nconst useCombinedRefs = <T,>(\n ...refs: Array<MutableRefObject<T> | ForwardedRef<T>>\n) => {\n const targetRef = React.useRef<T>(null);\n React.useEffect(() => {\n refs.forEach((ref) => {\n if (ref) {\n if (typeof ref === \"function\") {\n ref(targetRef.current);\n } else {\n ref.current = targetRef.current;\n }\n }\n });\n }, [refs]);\n return targetRef;\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,IACEC,SADF,EAEEC,WAFF,EAGEC,OAHF,EAIEC,UAJF,EAKEC,MALF,QAMO,OANP;AAgBA,SAASC,WAAT,QAA4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IACA;IADAA,IACA;EAAA;;EACH,MAAMC,SAAS,GAAG7C,KAAK,CAACK,MAAN,CAAgB,IAAhB,CAAlB;EACAL,KAAK,CAACC,SAAN,CAAgB,MAAM;IACpB2C,IAAI,CAACE,OAAL,CAAcb,GAAD,IAAS;MACpB,IAAIA,GAAJ,EAAS;QACP,IAAI,OAAOA,GAAP,KAAe,UAAnB,EAA+B;UAC7BA,GAAG,CAACY,SAAS,CAACT,OAAX,CAAH;QACD,CAFD,MAEO;UACLH,GAAG,CAACG,OAAJ,GAAcS,SAAS,CAACT,OAAxB;QACD;MACF;IACF,CARD;EASD,CAVD,EAUG,CAACQ,IAAD,CAVH;EAWA,OAAOC,SAAP;AACD,CAhBD"}
|
@@ -5,7 +5,7 @@ export declare class Container {
|
|
5
5
|
getNativeId: () => number;
|
6
6
|
private _root;
|
7
7
|
Sk: SkDOM;
|
8
|
-
constructor(Skia: Skia, redraw
|
8
|
+
constructor(Skia: Skia, redraw: () => void, getNativeId: () => number, native: boolean);
|
9
9
|
draw(ctx: DrawingContext): void;
|
10
10
|
get root(): RenderNode<GroupProps>;
|
11
11
|
}
|
@@ -5,6 +5,7 @@ export class Container {
|
|
5
5
|
constructor(Skia) {
|
6
6
|
let redraw = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => {};
|
7
7
|
let getNativeId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => 0;
|
8
|
+
let native = arguments.length > 3 ? arguments[3] : undefined;
|
8
9
|
this.redraw = redraw;
|
9
10
|
this.getNativeId = getNativeId;
|
10
11
|
|
@@ -14,7 +15,7 @@ export class Container {
|
|
14
15
|
|
15
16
|
this.Sk = new JsiSkDOM({
|
16
17
|
Skia
|
17
|
-
});
|
18
|
+
}, native);
|
18
19
|
this._root = this.Sk.Group();
|
19
20
|
}
|
20
21
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiSkDOM","Container","constructor","Skia","redraw","getNativeId","Sk","_root","Group","draw","ctx","render","root"],"sources":["Container.tsx"],"sourcesContent":["import { JsiSkDOM } from \"../dom/nodes\";\nimport type {\n GroupProps,\n DrawingContext,\n RenderNode,\n SkDOM,\n} from \"../dom/types\";\nimport type { Skia } from \"../skia/types\";\n\nexport class Container {\n private _root: RenderNode<GroupProps>;\n public Sk: SkDOM;\n constructor(\n Skia: Skia,\n public redraw: () => void = () => {},\n public getNativeId: () => number = () => 0\n ) {\n this.Sk = new JsiSkDOM({ Skia });\n this._root = this.Sk.Group();\n }\n\n draw(ctx: DrawingContext) {\n this._root.render(ctx);\n }\n\n get root() {\n return this._root;\n }\n}\n"],"mappings":";;AAAA,SAASA,QAAT,QAAyB,cAAzB;AASA,OAAO,MAAMC,SAAN,CAAgB;EAGrBC,WAAW,CACTC,IADS,
|
1
|
+
{"version":3,"names":["JsiSkDOM","Container","constructor","Skia","redraw","getNativeId","native","Sk","_root","Group","draw","ctx","render","root"],"sources":["Container.tsx"],"sourcesContent":["import { JsiSkDOM } from \"../dom/nodes\";\nimport type {\n GroupProps,\n DrawingContext,\n RenderNode,\n SkDOM,\n} from \"../dom/types\";\nimport type { Skia } from \"../skia/types\";\n\nexport class Container {\n private _root: RenderNode<GroupProps>;\n public Sk: SkDOM;\n constructor(\n Skia: Skia,\n public redraw: () => void = () => {},\n public getNativeId: () => number = () => 0,\n native: boolean\n ) {\n this.Sk = new JsiSkDOM({ Skia }, native);\n this._root = this.Sk.Group();\n }\n\n draw(ctx: DrawingContext) {\n this._root.render(ctx);\n }\n\n get root() {\n return this._root;\n }\n}\n"],"mappings":";;AAAA,SAASA,QAAT,QAAyB,cAAzB;AASA,OAAO,MAAMC,SAAN,CAAgB;EAGrBC,WAAW,CACTC,IADS,EAKT;IAAA,IAHOC,MAGP,uEAH4B,MAAM,CAAE,CAGpC;IAAA,IAFOC,WAEP,uEAFmC,MAAM,CAEzC;IAAA,IADAC,MACA;IAAA,KAHOF,MAGP,GAHOA,MAGP;IAAA,KAFOC,WAEP,GAFOA,WAEP;;IAAA;;IAAA;;IACA,KAAKE,EAAL,GAAU,IAAIP,QAAJ,CAAa;MAAEG;IAAF,CAAb,EAAuBG,MAAvB,CAAV;IACA,KAAKE,KAAL,GAAa,KAAKD,EAAL,CAAQE,KAAR,EAAb;EACD;;EAEDC,IAAI,CAACC,GAAD,EAAsB;IACxB,KAAKH,KAAL,CAAWI,MAAX,CAAkBD,GAAlB;EACD;;EAEO,IAAJE,IAAI,GAAG;IACT,OAAO,KAAKL,KAAZ;EACD;;AAnBoB"}
|
@@ -2,6 +2,7 @@ import { JsiDrawingContext } from "../dom/types";
|
|
2
2
|
import { Skia } from "../skia";
|
3
3
|
import { SkiaRoot } from "./Reconciler";
|
4
4
|
export const drawAsImage = (element, width, height) => {
|
5
|
+
const picture = drawAsPicture(element);
|
5
6
|
const surface = Skia.Surface.MakeOffscreen(width, height);
|
6
7
|
|
7
8
|
if (!surface) {
|
@@ -9,11 +10,18 @@ export const drawAsImage = (element, width, height) => {
|
|
9
10
|
}
|
10
11
|
|
11
12
|
const canvas = surface.getCanvas();
|
12
|
-
|
13
|
+
canvas.drawPicture(picture);
|
14
|
+
surface.flush();
|
15
|
+
return surface.makeImageSnapshot();
|
16
|
+
};
|
17
|
+
export const drawAsPicture = element => {
|
18
|
+
const recorder = Skia.PictureRecorder();
|
19
|
+
const canvas = recorder.beginRecording();
|
20
|
+
const root = new SkiaRoot(Skia, false);
|
13
21
|
root.render(element);
|
14
22
|
const ctx = new JsiDrawingContext(Skia, canvas);
|
15
23
|
root.dom.render(ctx);
|
16
|
-
|
17
|
-
return
|
24
|
+
const picture = recorder.finishRecordingAsPicture();
|
25
|
+
return picture;
|
18
26
|
};
|
19
27
|
//# sourceMappingURL=Offscreen.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["JsiDrawingContext","Skia","SkiaRoot","drawAsImage","element","width","height","surface","Surface","MakeOffscreen","Error","canvas","getCanvas","root","render","ctx","dom","
|
1
|
+
{"version":3,"names":["JsiDrawingContext","Skia","SkiaRoot","drawAsImage","element","width","height","picture","drawAsPicture","surface","Surface","MakeOffscreen","Error","canvas","getCanvas","drawPicture","flush","makeImageSnapshot","recorder","PictureRecorder","beginRecording","root","render","ctx","dom","finishRecordingAsPicture"],"sources":["Offscreen.tsx"],"sourcesContent":["import type { ReactElement } from \"react\";\n\nimport { JsiDrawingContext } from \"../dom/types\";\nimport { Skia } from \"../skia\";\n\nimport { SkiaRoot } from \"./Reconciler\";\n\nexport const drawAsImage = (\n element: ReactElement,\n width: number,\n height: number\n) => {\n const picture = drawAsPicture(element);\n const surface = Skia.Surface.MakeOffscreen(width, height);\n if (!surface) {\n throw new Error(\"Could not create offscreen surface\");\n }\n const canvas = surface.getCanvas();\n canvas.drawPicture(picture);\n surface.flush();\n return surface.makeImageSnapshot();\n};\n\nexport const drawAsPicture = (element: ReactElement) => {\n const recorder = Skia.PictureRecorder();\n const canvas = recorder.beginRecording();\n const root = new SkiaRoot(Skia, false);\n root.render(element);\n const ctx = new JsiDrawingContext(Skia, canvas);\n root.dom.render(ctx);\n const picture = recorder.finishRecordingAsPicture();\n return picture;\n};\n"],"mappings":"AAEA,SAASA,iBAAT,QAAkC,cAAlC;AACA,SAASC,IAAT,QAAqB,SAArB;AAEA,SAASC,QAAT,QAAyB,cAAzB;AAEA,OAAO,MAAMC,WAAW,GAAG,CACzBC,OADyB,EAEzBC,KAFyB,EAGzBC,MAHyB,KAItB;EACH,MAAMC,OAAO,GAAGC,aAAa,CAACJ,OAAD,CAA7B;EACA,MAAMK,OAAO,GAAGR,IAAI,CAACS,OAAL,CAAaC,aAAb,CAA2BN,KAA3B,EAAkCC,MAAlC,CAAhB;;EACA,IAAI,CAACG,OAAL,EAAc;IACZ,MAAM,IAAIG,KAAJ,CAAU,oCAAV,CAAN;EACD;;EACD,MAAMC,MAAM,GAAGJ,OAAO,CAACK,SAAR,EAAf;EACAD,MAAM,CAACE,WAAP,CAAmBR,OAAnB;EACAE,OAAO,CAACO,KAAR;EACA,OAAOP,OAAO,CAACQ,iBAAR,EAAP;AACD,CAdM;AAgBP,OAAO,MAAMT,aAAa,GAAIJ,OAAD,IAA2B;EACtD,MAAMc,QAAQ,GAAGjB,IAAI,CAACkB,eAAL,EAAjB;EACA,MAAMN,MAAM,GAAGK,QAAQ,CAACE,cAAT,EAAf;EACA,MAAMC,IAAI,GAAG,IAAInB,QAAJ,CAAaD,IAAb,EAAmB,KAAnB,CAAb;EACAoB,IAAI,CAACC,MAAL,CAAYlB,OAAZ;EACA,MAAMmB,GAAG,GAAG,IAAIvB,iBAAJ,CAAsBC,IAAtB,EAA4BY,MAA5B,CAAZ;EACAQ,IAAI,CAACG,GAAL,CAASF,MAAT,CAAgBC,GAAhB;EACA,MAAMhB,OAAO,GAAGW,QAAQ,CAACO,wBAAT,EAAhB;EACA,OAAOlB,OAAP;AACD,CATM"}
|
@@ -3,7 +3,7 @@ import type { Skia } from "../skia/types";
|
|
3
3
|
export declare class SkiaRoot {
|
4
4
|
private root;
|
5
5
|
private container;
|
6
|
-
constructor(Skia: Skia, redraw?: () => void, getNativeId?: () => number);
|
6
|
+
constructor(Skia: Skia, native?: boolean, redraw?: () => void, getNativeId?: () => number);
|
7
7
|
render(element: ReactNode): void;
|
8
8
|
unmount(): void;
|
9
9
|
get dom(): import("..").RenderNode<import("..").GroupProps>;
|
@@ -11,14 +11,15 @@ skiaReconciler.injectIntoDevTools({
|
|
11
11
|
});
|
12
12
|
export class SkiaRoot {
|
13
13
|
constructor(Skia) {
|
14
|
-
let
|
15
|
-
let
|
14
|
+
let native = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
15
|
+
let redraw = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : () => {};
|
16
|
+
let getNativeId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : () => 0;
|
16
17
|
|
17
18
|
_defineProperty(this, "root", void 0);
|
18
19
|
|
19
20
|
_defineProperty(this, "container", void 0);
|
20
21
|
|
21
|
-
this.container = new Container(Skia, redraw, getNativeId);
|
22
|
+
this.container = new Container(Skia, redraw, getNativeId, native);
|
22
23
|
this.root = skiaReconciler.createContainer(this.container, 0, null, true, null, "", console.error, null);
|
23
24
|
}
|
24
25
|
|
@@ -30,7 +31,9 @@ export class SkiaRoot {
|
|
30
31
|
}
|
31
32
|
|
32
33
|
unmount() {
|
33
|
-
skiaReconciler.updateContainer(null, this.root, null, () => {
|
34
|
+
skiaReconciler.updateContainer(null, this.root, null, () => {
|
35
|
+
hostDebug("unmountContainer");
|
36
|
+
});
|
34
37
|
}
|
35
38
|
|
36
39
|
get dom() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["ReactReconciler","skHostConfig","debug","hostDebug","Container","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaRoot","constructor","Skia","redraw","getNativeId","container","root","createContainer","console","error","render","element","updateContainer","unmount","dom"],"sources":["Reconciler.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { Skia } from \"../skia/types\";\n\nimport { skHostConfig, debug as hostDebug } from \"./HostConfig\";\nimport { Container } from \"./Container\";\n\nconst skiaReconciler = ReactReconciler(skHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(\n Skia: Skia,\n redraw: () => void = () => {},\n getNativeId: () => number = () => 0\n ) {\n this.container = new Container(Skia, redraw, getNativeId);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n render(element: ReactNode) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skiaReconciler.updateContainer(element as any, this.root, null, () => {\n hostDebug(\"updateContainer\");\n });\n }\n\n unmount() {\n skiaReconciler.updateContainer(null, this.root, null, () => {});\n }\n\n get dom() {\n return this.container.root;\n }\n}\n"],"mappings":";;AAEA,OAAOA,eAAP,MAA4B,kBAA5B;AAIA,SAASC,YAAT,EAAuBC,KAAK,IAAIC,SAAhC,QAAiD,cAAjD;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,MAAMC,cAAc,GAAGL,eAAe,CAACC,YAAD,CAAtC;AAEAI,cAAc,CAACC,kBAAf,CAAkC;EAChCC,UAAU,EAAE,CADoB;EAEhCC,OAAO,EAAE,OAFuB;EAGhCC,mBAAmB,EAAE;AAHW,CAAlC;AAMA,OAAO,MAAMC,QAAN,CAAe;EAIpBC,WAAW,CACTC,IADS,
|
1
|
+
{"version":3,"names":["ReactReconciler","skHostConfig","debug","hostDebug","Container","skiaReconciler","injectIntoDevTools","bundleType","version","rendererPackageName","SkiaRoot","constructor","Skia","native","redraw","getNativeId","container","root","createContainer","console","error","render","element","updateContainer","unmount","dom"],"sources":["Reconciler.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { OpaqueRoot } from \"react-reconciler\";\nimport ReactReconciler from \"react-reconciler\";\n\nimport type { Skia } from \"../skia/types\";\n\nimport { skHostConfig, debug as hostDebug } from \"./HostConfig\";\nimport { Container } from \"./Container\";\n\nconst skiaReconciler = ReactReconciler(skHostConfig);\n\nskiaReconciler.injectIntoDevTools({\n bundleType: 1,\n version: \"0.0.1\",\n rendererPackageName: \"react-native-skia\",\n});\n\nexport class SkiaRoot {\n private root: OpaqueRoot;\n private container: Container;\n\n constructor(\n Skia: Skia,\n native = false,\n redraw: () => void = () => {},\n getNativeId: () => number = () => 0\n ) {\n this.container = new Container(Skia, redraw, getNativeId, native);\n this.root = skiaReconciler.createContainer(\n this.container,\n 0,\n null,\n true,\n null,\n \"\",\n console.error,\n null\n );\n }\n\n render(element: ReactNode) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n skiaReconciler.updateContainer(element as any, this.root, null, () => {\n hostDebug(\"updateContainer\");\n });\n }\n\n unmount() {\n skiaReconciler.updateContainer(null, this.root, null, () => {\n hostDebug(\"unmountContainer\");\n });\n }\n\n get dom() {\n return this.container.root;\n }\n}\n"],"mappings":";;AAEA,OAAOA,eAAP,MAA4B,kBAA5B;AAIA,SAASC,YAAT,EAAuBC,KAAK,IAAIC,SAAhC,QAAiD,cAAjD;AACA,SAASC,SAAT,QAA0B,aAA1B;AAEA,MAAMC,cAAc,GAAGL,eAAe,CAACC,YAAD,CAAtC;AAEAI,cAAc,CAACC,kBAAf,CAAkC;EAChCC,UAAU,EAAE,CADoB;EAEhCC,OAAO,EAAE,OAFuB;EAGhCC,mBAAmB,EAAE;AAHW,CAAlC;AAMA,OAAO,MAAMC,QAAN,CAAe;EAIpBC,WAAW,CACTC,IADS,EAKT;IAAA,IAHAC,MAGA,uEAHS,KAGT;IAAA,IAFAC,MAEA,uEAFqB,MAAM,CAAE,CAE7B;IAAA,IADAC,WACA,uEAD4B,MAAM,CAClC;;IAAA;;IAAA;;IACA,KAAKC,SAAL,GAAiB,IAAIZ,SAAJ,CAAcQ,IAAd,EAAoBE,MAApB,EAA4BC,WAA5B,EAAyCF,MAAzC,CAAjB;IACA,KAAKI,IAAL,GAAYZ,cAAc,CAACa,eAAf,CACV,KAAKF,SADK,EAEV,CAFU,EAGV,IAHU,EAIV,IAJU,EAKV,IALU,EAMV,EANU,EAOVG,OAAO,CAACC,KAPE,EAQV,IARU,CAAZ;EAUD;;EAEDC,MAAM,CAACC,OAAD,EAAqB;IACzB;IACAjB,cAAc,CAACkB,eAAf,CAA+BD,OAA/B,EAA+C,KAAKL,IAApD,EAA0D,IAA1D,EAAgE,MAAM;MACpEd,SAAS,CAAC,iBAAD,CAAT;IACD,CAFD;EAGD;;EAEDqB,OAAO,GAAG;IACRnB,cAAc,CAACkB,eAAf,CAA+B,IAA/B,EAAqC,KAAKN,IAA1C,EAAgD,IAAhD,EAAsD,MAAM;MAC1Dd,SAAS,CAAC,kBAAD,CAAT;IACD,CAFD;EAGD;;EAEM,IAAHsB,GAAG,GAAG;IACR,OAAO,KAAKT,SAAL,CAAeC,IAAtB;EACD;;AAtCmB"}
|
@@ -95,9 +95,9 @@ export declare const processTransform3d: (transforms: Transforms3d) => Matrix4;
|
|
95
95
|
/**
|
96
96
|
* @worklet
|
97
97
|
*/
|
98
|
-
export declare const convertToColumnMajor: (rowMajorMatrix: Matrix4) =>
|
98
|
+
export declare const convertToColumnMajor: (rowMajorMatrix: Matrix4) => Matrix4;
|
99
99
|
/**
|
100
100
|
* @worklet
|
101
101
|
*/
|
102
|
-
export declare const convertToAffineMatrix: (m4:
|
102
|
+
export declare const convertToAffineMatrix: (m4: Matrix4) => number[];
|
103
103
|
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["exhaustiveCheck","a","Error","Matrix4","translate","x","y","z","perspective","p","normalizeVec","vec","length","Math","sqrt","rotatedUnitSinCos","axisVec","sinAngle","cosAngle","c","s","t","matrixVecMul4","m","v","mapPoint3d","r","multiply4","b","result","Array","fill","i","j","skewY","angle","tan","skewX","toMatrix3","rotate","axis","value","sin","cos","pivot","scale","sx","sy","sz","m4","rotateAxis","rotateZ","rotateX","rotateY","processTransform3d","transforms","reduce","acc","val","key","Object","keys","transform","convertToColumnMajor","rowMajorMatrix","colMajorMatrix","size","row","col","convertToAffineMatrix","d","tx","ty"],"sources":["Matrix4.ts"],"sourcesContent":["type Point = { x: number; y: number };\ntype Vec2 = readonly [number, number];\ntype Vec3 = readonly [number, number, number];\ntype Vec4 = readonly [number, number, number, number];\n\nexport type Matrix3 = readonly [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\n\nexport type Matrix4 = readonly [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\n\ntype Transform3dName =\n | \"translateX\"\n | \"translateY\"\n | \"translateZ\"\n | \"translate\"\n | \"scale\"\n | \"scaleX\"\n | \"scaleY\"\n | \"skewX\"\n | \"skewY\"\n | \"rotateZ\"\n | \"rotate\"\n | \"perspective\"\n | \"rotateX\"\n | \"rotateY\"\n | \"matrix\";\n\ntype Transformations = {\n [Name in Transform3dName]: Name extends \"matrix\"\n ? Matrix4\n : Name extends \"translate\"\n ? Vec3 | Vec2\n : number;\n};\n\ntype Transform3d =\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"translateZ\">\n | Pick<Transformations, \"translate\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"perspective\">\n | Pick<Transformations, \"rotateX\">\n | Pick<Transformations, \"rotateY\">\n | Pick<Transformations, \"rotateZ\">\n | Pick<Transformations, \"rotate\">\n | Pick<Transformations, \"matrix\">;\n\nexport type Transforms3d = Transform3d[];\n\nconst exhaustiveCheck = (a: never): never => {\n \"worklet\";\n throw new Error(`Unexhaustive handling for ${a}`);\n};\n\n/**\n * @worklet\n */\nexport const Matrix4 = (): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const translate = (x: number, y: number, z: number = 0): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const perspective = (p: number): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1 / p, 1];\n};\n\nconst normalizeVec = (vec: Vec3): Vec3 => {\n \"worklet\";\n const [x, y, z] = vec;\n const length = Math.sqrt(x * x + y * y + z * z);\n // Check for zero length to avoid division by zero\n if (length === 0) {\n return [0, 0, 0];\n }\n return [x / length, y / length, z / length];\n};\n\nconst rotatedUnitSinCos = (\n axisVec: Vec3,\n sinAngle: number,\n cosAngle: number\n): Matrix4 => {\n \"worklet\";\n const x = axisVec[0];\n const y = axisVec[1];\n const z = axisVec[2];\n const c = cosAngle;\n const s = sinAngle;\n const t = 1 - c;\n return [\n t * x * x + c,\n t * x * y - s * z,\n t * x * z + s * y,\n 0,\n t * x * y + s * z,\n t * y * y + c,\n t * y * z - s * x,\n 0,\n t * x * z - s * y,\n t * y * z + s * x,\n t * z * z + c,\n 0,\n 0,\n 0,\n 0,\n 1,\n ];\n};\n\n/**\n * @worklet\n */\nexport const matrixVecMul4 = (m: Matrix4, v: Vec4): Vec4 => {\n \"worklet\";\n return [\n m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3] * v[3],\n m[4] * v[0] + m[5] * v[1] + m[6] * v[2] + m[7] * v[3],\n m[8] * v[0] + m[9] * v[1] + m[10] * v[2] + m[11] * v[3],\n m[12] * v[0] + m[13] * v[1] + m[14] * v[2] + m[15] * v[3],\n ];\n};\n\n/**\n * @worklet\n */\nexport const mapPoint3d = (m: Matrix4, v: Vec3) => {\n \"worklet\";\n const r = matrixVecMul4(m, [...v, 1]);\n return [r[0] / r[3], r[1] / r[3], r[2] / r[3]] as const;\n};\n\n/**\n * @worklet\n */\nexport const multiply4 = (a: Matrix4, b: Matrix4): Matrix4 => {\n \"worklet\";\n const result = new Array(16).fill(0);\n for (let i = 0; i < 4; i++) {\n for (let j = 0; j < 4; j++) {\n result[i * 4 + j] =\n a[i * 4] * b[j] +\n a[i * 4 + 1] * b[j + 4] +\n a[i * 4 + 2] * b[j + 8] +\n a[i * 4 + 3] * b[j + 12];\n }\n }\n return result as unknown as Matrix4;\n};\n\nconst skewY = (angle: number): Matrix4 => {\n \"worklet\";\n return [1, Math.tan(angle), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\nconst skewX = (angle: number): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, Math.tan(angle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const toMatrix3 = (m: Matrix4) => {\n \"worklet\";\n return [m[0], m[1], m[3], m[4], m[5], m[7], m[12], m[13], m[15]];\n};\n\nconst rotate = (axis: Vec3, value: number) => {\n \"worklet\";\n return rotatedUnitSinCos(\n normalizeVec(axis),\n Math.sin(value),\n Math.cos(value)\n );\n};\n\n/**\n * @worklet\n */\nexport const pivot = (m: Matrix4, p: Point) => {\n \"worklet\";\n return multiply4(translate(p.x, p.y), multiply4(m, translate(-p.x, -p.y)));\n};\n\n/**\n * @worklet\n */\nexport const scale = (\n sx: number,\n sy: number,\n sz: number = 1,\n p?: Point\n): Matrix4 => {\n \"worklet\";\n const m4: Matrix4 = [sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1];\n if (p) {\n return pivot(m4, p);\n }\n return m4;\n};\n\nconst rotateAxis = (axis: Vec3, angle: number, p?: Point) => {\n \"worklet\";\n const result = rotate(axis, angle);\n if (p) {\n return pivot(result, p);\n }\n return result;\n};\n\n/**\n * @worklet\n */\nexport const rotateZ = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([0, 0, 1], value, p);\n};\n\n/**\n * @worklet\n */\nexport const rotateX = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([1, 0, 0], value, p);\n};\n\n/**\n * @worklet\n */\nexport const rotateY = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([0, 1, 0], value, p);\n};\n\n/**\n * @worklet\n */\nexport const processTransform3d = (transforms: Transforms3d) => {\n \"worklet\";\n return transforms.reduce((acc, val) => {\n const key = Object.keys(val)[0] as Transform3dName;\n const transform = val as Pick<Transformations, typeof key>;\n if (key === \"translateX\") {\n const value = transform[key];\n return multiply4(acc, translate(value, 0, 0));\n }\n if (key === \"translate\") {\n const [x, y, z = 0] = transform[key];\n return multiply4(acc, translate(x, y, z));\n }\n if (key === \"translateY\") {\n const value = transform[key];\n return multiply4(acc, translate(0, value, 0));\n }\n if (key === \"translateZ\") {\n const value = transform[key];\n return multiply4(acc, translate(0, 0, value));\n }\n if (key === \"scale\") {\n const value = transform[key];\n return multiply4(acc, scale(value, value, 1));\n }\n if (key === \"scaleX\") {\n const value = transform[key];\n return multiply4(acc, scale(value, 1, 1));\n }\n if (key === \"scaleY\") {\n const value = transform[key];\n return multiply4(acc, scale(1, value, 1));\n }\n if (key === \"skewX\") {\n const value = transform[key];\n return multiply4(acc, skewX(value));\n }\n if (key === \"skewY\") {\n const value = transform[key];\n return multiply4(acc, skewY(value));\n }\n if (key === \"rotateX\") {\n const value = transform[key];\n return multiply4(acc, rotate([1, 0, 0], value));\n }\n if (key === \"rotateY\") {\n const value = transform[key];\n return multiply4(acc, rotate([0, 1, 0], value));\n }\n if (key === \"perspective\") {\n const value = transform[key];\n return multiply4(acc, perspective(value));\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n const value = transform[key];\n return multiply4(acc, rotate([0, 0, 1], value));\n }\n if (key === \"matrix\") {\n const value = transform[key];\n return multiply4(acc, value);\n }\n return exhaustiveCheck(key);\n }, Matrix4());\n};\n\n/**\n * @worklet\n */\nexport const convertToColumnMajor = (rowMajorMatrix: Matrix4) => {\n \"worklet\";\n\n const colMajorMatrix = new Array<number>(16);\n const size = 4;\n for (let row = 0; row < size; row++) {\n for (let col = 0; col < size; col++) {\n colMajorMatrix[col * size + row] = rowMajorMatrix[row * size + col];\n }\n }\n return colMajorMatrix;\n};\n\n/**\n * @worklet\n */\nexport const convertToAffineMatrix = (m4: number[]) => {\n \"worklet\";\n // Extracting the relevant components from the 4x4 matrix\n const a = m4[0]; // Scale X\n const b = m4[1]; // Skew Y\n const c = m4[4]; // Skew X\n const d = m4[5]; // Scale Y\n const tx = m4[12]; // Translate X\n const ty = m4[13]; // Translate Y\n\n // Returning the 6-element affine transformation matrix\n return [a, b, c, d, tx, ty];\n};\n"],"mappings":"AAgFA,MAAMA,eAAe,GAAIC,CAAD,IAAqB;EAC3C;;EACA,MAAM,IAAIC,KAAJ,CAAW,6BAA4BD,CAAE,E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","vec","length","Math","sqrt","rotatedUnitSinCos","axisVec","sinAngle","cosAngle","c","s","t","matrixVecMul4","m","v","mapPoint3d","r","multiply4","b","result","Array","fill","i","j","skewY","angle","tan","skewX","toMatrix3","rotate","axis","value","sin","cos","pivot","scale","sx","sy","sz","m4","rotateAxis","rotateZ","rotateX","rotateY","processTransform3d","transforms","reduce","acc","val","key","Object","keys","transform","convertToColumnMajor","rowMajorMatrix","colMajorMatrix","size","row","col","convertToAffineMatrix","d","tx","ty"],"sources":["Matrix4.ts"],"sourcesContent":["type Point = { x: number; y: number };\ntype Vec2 = readonly [number, number];\ntype Vec3 = readonly [number, number, number];\ntype Vec4 = readonly [number, number, number, number];\n\nexport type Matrix3 = readonly [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\n\nexport type Matrix4 = readonly [\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number,\n number\n];\n\ntype Transform3dName =\n | \"translateX\"\n | \"translateY\"\n | \"translateZ\"\n | \"translate\"\n | \"scale\"\n | \"scaleX\"\n | \"scaleY\"\n | \"skewX\"\n | \"skewY\"\n | \"rotateZ\"\n | \"rotate\"\n | \"perspective\"\n | \"rotateX\"\n | \"rotateY\"\n | \"matrix\";\n\ntype Transformations = {\n [Name in Transform3dName]: Name extends \"matrix\"\n ? Matrix4\n : Name extends \"translate\"\n ? Vec3 | Vec2\n : number;\n};\n\ntype Transform3d =\n | Pick<Transformations, \"translateX\">\n | Pick<Transformations, \"translateY\">\n | Pick<Transformations, \"translateZ\">\n | Pick<Transformations, \"translate\">\n | Pick<Transformations, \"scale\">\n | Pick<Transformations, \"scaleX\">\n | Pick<Transformations, \"scaleY\">\n | Pick<Transformations, \"skewX\">\n | Pick<Transformations, \"skewY\">\n | Pick<Transformations, \"perspective\">\n | Pick<Transformations, \"rotateX\">\n | Pick<Transformations, \"rotateY\">\n | Pick<Transformations, \"rotateZ\">\n | Pick<Transformations, \"rotate\">\n | Pick<Transformations, \"matrix\">;\n\nexport type Transforms3d = Transform3d[];\n\nconst exhaustiveCheck = (a: never): never => {\n \"worklet\";\n throw new Error(`Unexhaustive handling for ${a}`);\n};\n\n/**\n * @worklet\n */\nexport const Matrix4 = (): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const translate = (x: number, y: number, z: number = 0): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, x, 0, 1, 0, y, 0, 0, 1, z, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const perspective = (p: number): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1 / p, 1];\n};\n\nconst normalizeVec = (vec: Vec3): Vec3 => {\n \"worklet\";\n const [x, y, z] = vec;\n const length = Math.sqrt(x * x + y * y + z * z);\n // Check for zero length to avoid division by zero\n if (length === 0) {\n return [0, 0, 0];\n }\n return [x / length, y / length, z / length];\n};\n\nconst rotatedUnitSinCos = (\n axisVec: Vec3,\n sinAngle: number,\n cosAngle: number\n): Matrix4 => {\n \"worklet\";\n const x = axisVec[0];\n const y = axisVec[1];\n const z = axisVec[2];\n const c = cosAngle;\n const s = sinAngle;\n const t = 1 - c;\n return [\n t * x * x + c,\n t * x * y - s * z,\n t * x * z + s * y,\n 0,\n t * x * y + s * z,\n t * y * y + c,\n t * y * z - s * x,\n 0,\n t * x * z - s * y,\n t * y * z + s * x,\n t * z * z + c,\n 0,\n 0,\n 0,\n 0,\n 1,\n ];\n};\n\n/**\n * @worklet\n */\nexport const matrixVecMul4 = (m: Matrix4, v: Vec4): Vec4 => {\n \"worklet\";\n return [\n m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3] * v[3],\n m[4] * v[0] + m[5] * v[1] + m[6] * v[2] + m[7] * v[3],\n m[8] * v[0] + m[9] * v[1] + m[10] * v[2] + m[11] * v[3],\n m[12] * v[0] + m[13] * v[1] + m[14] * v[2] + m[15] * v[3],\n ];\n};\n\n/**\n * @worklet\n */\nexport const mapPoint3d = (m: Matrix4, v: Vec3) => {\n \"worklet\";\n const r = matrixVecMul4(m, [...v, 1]);\n return [r[0] / r[3], r[1] / r[3], r[2] / r[3]] as const;\n};\n\n/**\n * @worklet\n */\nexport const multiply4 = (a: Matrix4, b: Matrix4): Matrix4 => {\n \"worklet\";\n const result = new Array(16).fill(0);\n for (let i = 0; i < 4; i++) {\n for (let j = 0; j < 4; j++) {\n result[i * 4 + j] =\n a[i * 4] * b[j] +\n a[i * 4 + 1] * b[j + 4] +\n a[i * 4 + 2] * b[j + 8] +\n a[i * 4 + 3] * b[j + 12];\n }\n }\n return result as unknown as Matrix4;\n};\n\nconst skewY = (angle: number): Matrix4 => {\n \"worklet\";\n return [1, Math.tan(angle), 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\nconst skewX = (angle: number): Matrix4 => {\n \"worklet\";\n return [1, 0, 0, 0, Math.tan(angle), 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];\n};\n\n/**\n * @worklet\n */\nexport const toMatrix3 = (m: Matrix4) => {\n \"worklet\";\n return [m[0], m[1], m[3], m[4], m[5], m[7], m[12], m[13], m[15]];\n};\n\nconst rotate = (axis: Vec3, value: number) => {\n \"worklet\";\n return rotatedUnitSinCos(\n normalizeVec(axis),\n Math.sin(value),\n Math.cos(value)\n );\n};\n\n/**\n * @worklet\n */\nexport const pivot = (m: Matrix4, p: Point) => {\n \"worklet\";\n return multiply4(translate(p.x, p.y), multiply4(m, translate(-p.x, -p.y)));\n};\n\n/**\n * @worklet\n */\nexport const scale = (\n sx: number,\n sy: number,\n sz: number = 1,\n p?: Point\n): Matrix4 => {\n \"worklet\";\n const m4: Matrix4 = [sx, 0, 0, 0, 0, sy, 0, 0, 0, 0, sz, 0, 0, 0, 0, 1];\n if (p) {\n return pivot(m4, p);\n }\n return m4;\n};\n\nconst rotateAxis = (axis: Vec3, angle: number, p?: Point) => {\n \"worklet\";\n const result = rotate(axis, angle);\n if (p) {\n return pivot(result, p);\n }\n return result;\n};\n\n/**\n * @worklet\n */\nexport const rotateZ = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([0, 0, 1], value, p);\n};\n\n/**\n * @worklet\n */\nexport const rotateX = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([1, 0, 0], value, p);\n};\n\n/**\n * @worklet\n */\nexport const rotateY = (value: number, p?: Point) => {\n \"worklet\";\n return rotateAxis([0, 1, 0], value, p);\n};\n\n/**\n * @worklet\n */\nexport const processTransform3d = (transforms: Transforms3d) => {\n \"worklet\";\n return transforms.reduce((acc, val) => {\n const key = Object.keys(val)[0] as Transform3dName;\n const transform = val as Pick<Transformations, typeof key>;\n if (key === \"translateX\") {\n const value = transform[key];\n return multiply4(acc, translate(value, 0, 0));\n }\n if (key === \"translate\") {\n const [x, y, z = 0] = transform[key];\n return multiply4(acc, translate(x, y, z));\n }\n if (key === \"translateY\") {\n const value = transform[key];\n return multiply4(acc, translate(0, value, 0));\n }\n if (key === \"translateZ\") {\n const value = transform[key];\n return multiply4(acc, translate(0, 0, value));\n }\n if (key === \"scale\") {\n const value = transform[key];\n return multiply4(acc, scale(value, value, 1));\n }\n if (key === \"scaleX\") {\n const value = transform[key];\n return multiply4(acc, scale(value, 1, 1));\n }\n if (key === \"scaleY\") {\n const value = transform[key];\n return multiply4(acc, scale(1, value, 1));\n }\n if (key === \"skewX\") {\n const value = transform[key];\n return multiply4(acc, skewX(value));\n }\n if (key === \"skewY\") {\n const value = transform[key];\n return multiply4(acc, skewY(value));\n }\n if (key === \"rotateX\") {\n const value = transform[key];\n return multiply4(acc, rotate([1, 0, 0], value));\n }\n if (key === \"rotateY\") {\n const value = transform[key];\n return multiply4(acc, rotate([0, 1, 0], value));\n }\n if (key === \"perspective\") {\n const value = transform[key];\n return multiply4(acc, perspective(value));\n }\n if (key === \"rotate\" || key === \"rotateZ\") {\n const value = transform[key];\n return multiply4(acc, rotate([0, 0, 1], value));\n }\n if (key === \"matrix\") {\n const value = transform[key];\n return multiply4(acc, value);\n }\n return exhaustiveCheck(key);\n }, Matrix4());\n};\n\n/**\n * @worklet\n */\nexport const convertToColumnMajor = (rowMajorMatrix: Matrix4) => {\n \"worklet\";\n\n const colMajorMatrix = new Array<number>(16);\n const size = 4;\n for (let row = 0; row < size; row++) {\n for (let col = 0; col < size; col++) {\n colMajorMatrix[col * size + row] = rowMajorMatrix[row * size + col];\n }\n }\n return colMajorMatrix as unknown as Matrix4;\n};\n\n/**\n * @worklet\n */\nexport const convertToAffineMatrix = (m4: Matrix4) => {\n \"worklet\";\n // Extracting the relevant components from the 4x4 matrix\n const a = m4[0]; // Scale X\n const b = m4[1]; // Skew Y\n const c = m4[4]; // Skew X\n const d = m4[5]; // Scale Y\n const tx = m4[12]; // Translate X\n const ty = m4[13]; // Translate Y\n\n // Returning the 6-element affine transformation matrix\n return [a, b, c, d, tx, ty];\n};\n"],"mappings":"AAgFA,MAAMA,eAAe,GAAIC,CAAD,IAAqB;EAC3C;;EACA,MAAM,IAAIC,KAAJ,CAAW,6BAA4BD,CAAE,EAAzC,CAAN;AACD,CAHD;AAKA;AACA;AACA;;;AACA,OAAO,MAAME,OAAO,GAAG,MAAe;EACpC;;EACA,OAAO,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,EAAmB,CAAnB,EAAsB,CAAtB,EAAyB,CAAzB,EAA4B,CAA5B,EAA+B,CAA/B,EAAkC,CAAlC,EAAqC,CAArC,EAAwC,CAAxC,EAA2C,CAA3C,EAA8C,CAA9C,CAAP;AACD,CAHM;AAKP;AACA;AACA;;AACA,OAAO,MAAMC,SAAS,GAAG,UAACC,CAAD,EAAYC,CAAZ,EAAkD;EACzE;;EADyE,IAA3BC,CAA2B,uEAAf,CAAe;EAEzE,OAAO,CAAC,CAAD,EA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,GAAaE,GAAd,CAAjD;IACD;EACF;;EACD,OAAOH,cAAP;AACD,CAXM;AAaP;AACA;AACA;;AACA,OAAO,MAAMI,qBAAqB,GAAIpB,EAAD,IAAiB;EACpD,UADoD,CAEpD;;EACA,MAAMhD,CAAC,GAAGgD,EAAE,CAAC,CAAD,CAAZ,CAHoD,CAGnC;;EACjB,MAAMrB,CAAC,GAAGqB,EAAE,CAAC,CAAD,CAAZ,CAJoD,CAInC;;EACjB,MAAM9B,CAAC,GAAG8B,EAAE,CAAC,CAAD,CAAZ,CALoD,CAKnC;;EACjB,MAAMqB,CAAC,GAAGrB,EAAE,CAAC,CAAD,CAAZ,CANoD,CAMnC;;EACjB,MAAMsB,EAAE,GAAGtB,EAAE,CAAC,EAAD,CAAb,CAPoD,CAOjC;;EACnB,MAAMuB,EAAE,GAAGvB,EAAE,CAAC,EAAD,CAAb,CARoD,CAQjC;EAEnB;;EACA,OAAO,CAAChD,CAAD,EAAI2B,CAAJ,EAAOT,CAAP,EAAUmD,CAAV,EAAaC,EAAb,EAAiBC,EAAjB,CAAP;AACD,CAZM"}
|
@@ -3,7 +3,7 @@ import type { Vector } from "../Point";
|
|
3
3
|
import type { SkRuntimeEffect, SkRuntimeShaderBuilder } from "../RuntimeEffect";
|
4
4
|
export declare const isShader: (obj: SkJSIInstance<string> | null) => obj is SkShader;
|
5
5
|
export type SkShader = SkJSIInstance<"Shader">;
|
6
|
-
export type Uniform = number | Vector | Float32Array | Uniform[];
|
6
|
+
export type Uniform = number | Vector | Float32Array | readonly Uniform[] | Uniform[];
|
7
7
|
export interface Uniforms {
|
8
8
|
[name: string]: Uniform;
|
9
9
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["isShader","obj","__typename__","isVector","x","undefined","y","processValue","values","value","push","Array","isArray","forEach","v","Float32Array","processUniforms","source","uniforms","builder","result","uniformsCount","getUniformCount","i","name","getUniformName","Error","uniformValue","setUniform"],"sources":["Shader.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { Vector } from \"../Point\";\nimport type { SkRuntimeEffect, SkRuntimeShaderBuilder } from \"../RuntimeEffect\";\n\nexport const isShader = (obj: SkJSIInstance<string> | null): obj is SkShader =>\n obj !== null && obj.__typename__ === \"Shader\";\n\nexport type SkShader = SkJSIInstance<\"Shader\">;\n\nexport type Uniform
|
1
|
+
{"version":3,"names":["isShader","obj","__typename__","isVector","x","undefined","y","processValue","values","value","push","Array","isArray","forEach","v","Float32Array","processUniforms","source","uniforms","builder","result","uniformsCount","getUniformCount","i","name","getUniformName","Error","uniformValue","setUniform"],"sources":["Shader.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { Vector } from \"../Point\";\nimport type { SkRuntimeEffect, SkRuntimeShaderBuilder } from \"../RuntimeEffect\";\n\nexport const isShader = (obj: SkJSIInstance<string> | null): obj is SkShader =>\n obj !== null && obj.__typename__ === \"Shader\";\n\nexport type SkShader = SkJSIInstance<\"Shader\">;\n\nexport type Uniform =\n | number\n | Vector\n | Float32Array\n | readonly Uniform[]\n | Uniform[];\n\nexport interface Uniforms {\n [name: string]: Uniform;\n}\n\nconst isVector = (obj: unknown): obj is Vector =>\n // We have an issue to check property existence on JSI backed instances\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (obj as any).x !== undefined && (obj as any).y !== undefined;\n\nconst processValue = (values: number[], value: Uniform) => {\n if (typeof value === \"number\") {\n values.push(value);\n } else if (Array.isArray(value)) {\n value.forEach((v) => processValue(values, v));\n } else if (isVector(value)) {\n values.push(value.x, value.y);\n } else if (value instanceof Float32Array) {\n values.push(...value);\n }\n};\n\nexport const processUniforms = (\n source: SkRuntimeEffect,\n uniforms: Uniforms,\n builder?: SkRuntimeShaderBuilder\n) => {\n const result: number[] = [];\n const uniformsCount = source.getUniformCount();\n for (let i = 0; i < uniformsCount; i++) {\n const name = source.getUniformName(i);\n const value = uniforms[name];\n if (value === undefined) {\n throw new Error(\n // eslint-disable-next-line max-len\n `The runtime effect has the uniform value \"${name}\" declared, but it is missing from the uniforms property of the Runtime effect.`\n );\n }\n if (builder === undefined) {\n processValue(result, value);\n } else {\n const uniformValue: number[] = [];\n processValue(uniformValue, value);\n builder.setUniform(name, uniformValue);\n result.push(...uniformValue);\n }\n }\n return result;\n};\n"],"mappings":"AAIA,OAAO,MAAMA,QAAQ,GAAIC,GAAD,IACtBA,GAAG,KAAK,IAAR,IAAgBA,GAAG,CAACC,YAAJ,KAAqB,QADhC;;AAgBP,MAAMC,QAAQ,GAAIF,GAAD,IACf;AACA;AACCA,GAAD,CAAaG,CAAb,KAAmBC,SAAnB,IAAiCJ,GAAD,CAAaK,CAAb,KAAmBD,SAHrD;;AAKA,MAAME,YAAY,GAAG,CAACC,MAAD,EAAmBC,KAAnB,KAAsC;EACzD,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAC7BD,MAAM,CAACE,IAAP,CAAYD,KAAZ;EACD,CAFD,MAEO,IAAIE,KAAK,CAACC,OAAN,CAAcH,KAAd,CAAJ,EAA0B;IAC/BA,KAAK,CAACI,OAAN,CAAeC,CAAD,IAAOP,YAAY,CAACC,MAAD,EAASM,CAAT,CAAjC;EACD,CAFM,MAEA,IAAIX,QAAQ,CAACM,KAAD,CAAZ,EAAqB;IAC1BD,MAAM,CAACE,IAAP,CAAYD,KAAK,CAACL,CAAlB,EAAqBK,KAAK,CAACH,CAA3B;EACD,CAFM,MAEA,IAAIG,KAAK,YAAYM,YAArB,EAAmC;IACxCP,MAAM,CAACE,IAAP,CAAY,GAAGD,KAAf;EACD;AACF,CAVD;;AAYA,OAAO,MAAMO,eAAe,GAAG,CAC7BC,MAD6B,EAE7BC,QAF6B,EAG7BC,OAH6B,KAI1B;EACH,MAAMC,MAAgB,GAAG,EAAzB;EACA,MAAMC,aAAa,GAAGJ,MAAM,CAACK,eAAP,EAAtB;;EACA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,aAApB,EAAmCE,CAAC,EAApC,EAAwC;IACtC,MAAMC,IAAI,GAAGP,MAAM,CAACQ,cAAP,CAAsBF,CAAtB,CAAb;IACA,MAAMd,KAAK,GAAGS,QAAQ,CAACM,IAAD,CAAtB;;IACA,IAAIf,KAAK,KAAKJ,SAAd,EAAyB;MACvB,MAAM,IAAIqB,KAAJ,EACJ;MACC,6CAA4CF,IAAK,iFAF9C,CAAN;IAID;;IACD,IAAIL,OAAO,KAAKd,SAAhB,EAA2B;MACzBE,YAAY,CAACa,MAAD,EAASX,KAAT,CAAZ;IACD,CAFD,MAEO;MACL,MAAMkB,YAAsB,GAAG,EAA/B;MACApB,YAAY,CAACoB,YAAD,EAAelB,KAAf,CAAZ;MACAU,OAAO,CAACS,UAAR,CAAmBJ,IAAnB,EAAyBG,YAAzB;MACAP,MAAM,CAACV,IAAP,CAAY,GAAGiB,YAAf;IACD;EACF;;EACD,OAAOP,MAAP;AACD,CA1BM"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { CanvasKit, Path } from "canvaskit-wasm";
|
2
|
-
import type { FillType, PathCommand, PathOp, SkMatrix, SkPath, SkPoint, SkRect, InputRRect, StrokeOpts } from "../types";
|
2
|
+
import type { FillType, PathCommand, PathOp, SkMatrix, SkPath, SkPoint, SkRect, InputRRect, StrokeOpts, InputMatrix } from "../types";
|
3
3
|
import { HostObject } from "./Host";
|
4
4
|
import { JsiSkPoint } from "./JsiSkPoint";
|
5
5
|
import { JsiSkRect } from "./JsiSkRect";
|
@@ -51,7 +51,7 @@ export declare class JsiSkPath extends HostObject<Path, "Path"> implements SkPat
|
|
51
51
|
simplify(): boolean;
|
52
52
|
toSVGString(): string;
|
53
53
|
trim(start: number, stop: number, isComplement: boolean): this | null;
|
54
|
-
transform(
|
54
|
+
transform(m: InputMatrix): this;
|
55
55
|
interpolate(end: SkPath, t: number, output?: SkPath): SkPath | JsiSkPath | null;
|
56
56
|
isInterpolatable(path2: SkPath): boolean;
|
57
57
|
toCmds(): PathCommand[];
|
@@ -252,8 +252,16 @@ export class JsiSkPath extends HostObject {
|
|
252
252
|
return result === null ? result : this;
|
253
253
|
}
|
254
254
|
|
255
|
-
transform(
|
256
|
-
|
255
|
+
transform(m) {
|
256
|
+
let matrix = m instanceof JsiSkMatrix ? Array.from(JsiSkMatrix.fromValue(m)) : m;
|
257
|
+
|
258
|
+
if (matrix.length === 16) {
|
259
|
+
matrix = [matrix[0], matrix[1], matrix[3], matrix[4], matrix[5], matrix[7], matrix[12], matrix[13], matrix[15]];
|
260
|
+
} else if (matrix.length !== 9) {
|
261
|
+
throw new Error(`Invalid matrix length: ${matrix.length}`);
|
262
|
+
}
|
263
|
+
|
264
|
+
this.ref.transform(matrix);
|
257
265
|
return this;
|
258
266
|
}
|
259
267
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["PathVerb","getEnum","HostObject","optEnum","JsiSkPoint","JsiSkRect","JsiSkRRect","JsiSkMatrix","CommandCount","Move","Line","Quad","Conic","Cubic","Close","pinT","t","Math","min","max","JsiSkPath","constructor","CanvasKit","ref","delete","addPath","src","matrix","extend","args","fromValue","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","addOval","isCCW","startIndex","countPoints","addPoly","points","close","map","p","Array","from","flat","moveTo","x","y","lineTo","makeAsWinding","result","offset","dx","dy","rArcTo","rx","ry","xAxisRotateInDegrees","useSmallArc","rConicTo","dx1","dy1","dx2","dy2","w","rCubicTo","cpx1","cpy1","cpx2","cpy2","rMoveTo","rLineTo","rQuadTo","x1","y1","x2","y2","setFillType","fill","FillType","setIsVolatile","volatile","stroke","opts","undefined","width","miter_limit","precision","join","StrokeJoin","cap","StrokeCap","reset","rewind","computeTightBounds","arcToOval","forceMoveTo","arcToRotated","arcToTangent","radius","conicTo","contains","copy","cubicTo","dash","on","off","phase","equals","other","getBounds","getFillType","value","quadTo","addRect","rect","addRRect","rrect","getPoint","index","isEmpty","isVolatile","addCircle","r","getLastPt","op","path","PathOp","simplify","toSVGString","trim","start","stop","isComplement","startT","stopT","transform","m3","isArray","interpolate","end","output","Path","MakeFromPathInterpolation","isInterpolatable","path2","CanInterpolate","toCmds","cmds","reduce","acc","cmd","i","push","current","length"],"sources":["JsiSkPath.ts"],"sourcesContent":["import type { CanvasKit, Path } from \"canvaskit-wasm\";\n\nimport { PathVerb } from \"../types\";\nimport type {\n FillType,\n PathCommand,\n PathOp,\n SkMatrix,\n SkPath,\n SkPoint,\n SkRect,\n InputRRect,\n StrokeOpts,\n} from \"../types\";\n\nimport { getEnum, HostObject, optEnum } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\n\nconst CommandCount = {\n [PathVerb.Move]: 3,\n [PathVerb.Line]: 3,\n [PathVerb.Quad]: 5,\n [PathVerb.Conic]: 6,\n [PathVerb.Cubic]: 7,\n [PathVerb.Close]: 1,\n};\n\nconst pinT = (t: number) => Math.min(Math.max(t, 0), 1);\n\nexport class JsiSkPath extends HostObject<Path, \"Path\"> implements SkPath {\n constructor(CanvasKit: CanvasKit, ref: Path) {\n super(CanvasKit, ref, \"Path\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n addPath(src: SkPath, matrix?: SkMatrix, extend = false) {\n const args = [\n JsiSkPath.fromValue(src),\n ...(matrix ? JsiSkMatrix.fromValue<Float32Array>(matrix) : []),\n extend,\n ];\n this.ref.addPath(...args);\n return this;\n }\n\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ) {\n this.ref.addArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees\n );\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n this.ref.addOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n isCCW,\n startIndex\n );\n return this;\n }\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n addPoly(points: SkPoint[], close: boolean) {\n this.ref.addPoly(\n points.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),\n close\n );\n return this;\n }\n\n moveTo(x: number, y: number) {\n this.ref.moveTo(x, y);\n return this;\n }\n\n lineTo(x: number, y: number) {\n this.ref.lineTo(x, y);\n return this;\n }\n\n makeAsWinding() {\n const result = this.ref.makeAsWinding();\n return result === null ? result : this;\n }\n\n offset(dx: number, dy: number) {\n this.ref.offset(dx, dy);\n return this;\n }\n\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ) {\n this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);\n return this;\n }\n\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number) {\n this.ref.rConicTo(dx1, dy1, dx2, dy2, w);\n return this;\n }\n\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n rMoveTo(x: number, y: number) {\n this.ref.rMoveTo(x, y);\n return this;\n }\n\n rLineTo(x: number, y: number) {\n this.ref.rLineTo(x, y);\n return this;\n }\n\n rQuadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.rQuadTo(x1, y1, x2, y2);\n return this;\n }\n\n setFillType(fill: FillType) {\n this.ref.setFillType(getEnum(this.CanvasKit.FillType, fill));\n return this;\n }\n\n setIsVolatile(volatile: boolean) {\n this.ref.setIsVolatile(volatile);\n return this;\n }\n\n stroke(opts?: StrokeOpts) {\n const result = this.ref.stroke(\n opts === undefined\n ? undefined\n : {\n width: opts.width,\n // eslint-disable-next-line camelcase\n miter_limit: opts.width,\n precision: opts.width,\n join: optEnum(this.CanvasKit.StrokeJoin, opts.join),\n cap: optEnum(this.CanvasKit.StrokeCap, opts.cap),\n }\n );\n return result === null ? result : this;\n }\n\n close() {\n this.ref.close();\n return this;\n }\n\n reset() {\n this.ref.reset();\n return this;\n }\n\n rewind() {\n this.ref.rewind();\n return this;\n }\n\n computeTightBounds(): SkRect {\n return new JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());\n }\n\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ) {\n this.ref.arcToOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees,\n forceMoveTo\n );\n return this;\n }\n\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ) {\n this.ref.arcToRotated(\n rx,\n ry,\n xAxisRotateInDegrees,\n useSmallArc,\n isCCW,\n x,\n y\n );\n return this;\n }\n\n arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this.ref.arcToTangent(x1, y1, x2, y2, radius);\n return this;\n }\n\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n this.ref.conicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n contains(x: number, y: number) {\n return this.ref.contains(x, y);\n }\n\n copy() {\n return new JsiSkPath(this.CanvasKit, this.ref.copy());\n }\n\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n dash(on: number, off: number, phase: number) {\n return this.ref.dash(on, off, phase);\n }\n\n equals(other: SkPath) {\n return this.ref.equals(JsiSkPath.fromValue(other));\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType() {\n return this.ref.getFillType().value;\n }\n\n quadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.quadTo(x1, y1, x2, y2);\n return this;\n }\n\n addRect(rect: SkRect, isCCW?: boolean) {\n this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);\n return this;\n }\n\n addRRect(rrect: InputRRect, isCCW?: boolean) {\n this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);\n return this;\n }\n\n getPoint(index: number) {\n return new JsiSkPoint(this.CanvasKit, this.ref.getPoint(index));\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return this.ref.isVolatile();\n }\n\n addCircle(x: number, y: number, r: number) {\n this.ref.addCircle(x, y, r);\n return this;\n }\n\n getLastPt() {\n return new JsiSkPoint(\n this.CanvasKit,\n this.ref.getPoint(this.ref.countPoints() - 1)\n );\n }\n\n op(path: SkPath, op: PathOp) {\n return this.ref.op(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op)\n );\n }\n\n simplify() {\n return this.ref.simplify();\n }\n\n toSVGString() {\n return this.ref.toSVGString();\n }\n\n trim(start: number, stop: number, isComplement: boolean) {\n const startT = pinT(start);\n const stopT = pinT(stop);\n if (startT === 0 && stopT === 1) {\n return this;\n }\n const result = this.ref.trim(startT, stopT, isComplement);\n return result === null ? result : this;\n }\n\n transform(m3: SkMatrix) {\n this.ref.transform(Array.isArray(m3) ? m3 : JsiSkMatrix.fromValue(m3));\n return this;\n }\n\n interpolate(end: SkPath, t: number, output?: SkPath) {\n const path = this.CanvasKit.Path.MakeFromPathInterpolation(\n this.ref,\n JsiSkPath.fromValue(end),\n t\n );\n if (path === null) {\n return null;\n }\n if (output) {\n (output as JsiSkPath).ref = path;\n return output;\n } else {\n return new JsiSkPath(this.CanvasKit, path);\n }\n }\n\n isInterpolatable(path2: SkPath): boolean {\n return this.CanvasKit.Path.CanInterpolate(\n this.ref,\n JsiSkPath.fromValue(path2)\n );\n }\n\n toCmds() {\n const cmds = this.ref.toCmds();\n const result = cmds.reduce<PathCommand[]>((acc, cmd, i) => {\n if (i === 0) {\n acc.push([]);\n }\n const current = acc[acc.length - 1];\n if (current.length === 0) {\n current.push(cmd);\n const length = CommandCount[current[0] as PathVerb];\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n } else {\n const length = CommandCount[current[0] as PathVerb];\n if (current.length < length) {\n current.push(cmd);\n }\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n }\n return acc;\n }, []);\n return result;\n }\n}\n"],"mappings":";;AAEA,SAASA,QAAT,QAAyB,UAAzB;AAaA,SAASC,OAAT,EAAkBC,UAAlB,EAA8BC,OAA9B,QAA6C,QAA7C;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAASC,WAAT,QAA4B,eAA5B;AAEA,MAAMC,YAAY,GAAG;EACnB,CAACR,QAAQ,CAACS,IAAV,GAAiB,CADE;EAEnB,CAACT,QAAQ,CAACU,IAAV,GAAiB,CAFE;EAGnB,CAACV,QAAQ,CAACW,IAAV,GAAiB,CAHE;EAInB,CAACX,QAAQ,CAACY,KAAV,GAAkB,CAJC;EAKnB,CAACZ,QAAQ,CAACa,KAAV,GAAkB,CALC;EAMnB,CAACb,QAAQ,CAACc,KAAV,GAAkB;AANC,CAArB;;AASA,MAAMC,IAAI,GAAIC,CAAD,IAAeC,IAAI,CAACC,GAAL,CAASD,IAAI,CAACE,GAAL,CAASH,CAAT,EAAY,CAAZ,CAAT,EAAyB,CAAzB,CAA5B;;AAEA,OAAO,MAAMI,SAAN,SAAwBlB,UAAxB,CAAmE;EACxEmB,WAAW,CAACC,SAAD,EAAuBC,GAAvB,EAAkC;IAC3C,MAAMD,SAAN,EAAiBC,GAAjB,EAAsB,MAAtB;;IAD2C,iCAInC,MAAM;MACd,KAAKA,GAAL,CAASC,MAAT;IACD,CAN4C;EAE5C;;EAMDC,OAAO,CAACC,GAAD,EAAcC,MAAd,EAAiD;IAAA,IAAhBC,MAAgB,uEAAP,KAAO;IACtD,MAAMC,IAAI,GAAG,CACXT,SAAS,C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JsiSkMatrix","CommandCount","Move","Line","Quad","Conic","Cubic","Close","pinT","t","Math","min","max","JsiSkPath","constructor","CanvasKit","ref","delete","addPath","src","matrix","extend","args","fromValue","addArc","oval","startAngleInDegrees","sweepAngleInDegrees","addOval","isCCW","startIndex","countPoints","addPoly","points","close","map","p","Array","from","flat","moveTo","x","y","lineTo","makeAsWinding","result","offset","dx","dy","rArcTo","rx","ry","xAxisRotateInDegrees","useSmallArc","rConicTo","dx1","dy1","dx2","dy2","w","rCubicTo","cpx1","cpy1","cpx2","cpy2","rMoveTo","rLineTo","rQuadTo","x1","y1","x2","y2","setFillType","fill","FillType","setIsVolatile","volatile","stroke","opts","undefined","width","miter_limit","precision","join","StrokeJoin","cap","StrokeCap","reset","rewind","computeTightBounds","arcToOval","forceMoveTo","arcToRotated","arcToTangent","radius","conicTo","contains","copy","cubicTo","dash","on","off","phase","equals","other","getBounds","getFillType","value","quadTo","addRect","rect","addRRect","rrect","getPoint","index","isEmpty","isVolatile","addCircle","r","getLastPt","op","path","PathOp","simplify","toSVGString","trim","start","stop","isComplement","startT","stopT","transform","m","length","Error","interpolate","end","output","Path","MakeFromPathInterpolation","isInterpolatable","path2","CanInterpolate","toCmds","cmds","reduce","acc","cmd","i","push","current"],"sources":["JsiSkPath.ts"],"sourcesContent":["import type { CanvasKit, Matrix3x3, Path } from \"canvaskit-wasm\";\n\nimport { PathVerb } from \"../types\";\nimport type {\n FillType,\n PathCommand,\n PathOp,\n SkMatrix,\n SkPath,\n SkPoint,\n SkRect,\n InputRRect,\n StrokeOpts,\n InputMatrix,\n} from \"../types\";\n\nimport { getEnum, HostObject, optEnum } from \"./Host\";\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\n\nconst CommandCount = {\n [PathVerb.Move]: 3,\n [PathVerb.Line]: 3,\n [PathVerb.Quad]: 5,\n [PathVerb.Conic]: 6,\n [PathVerb.Cubic]: 7,\n [PathVerb.Close]: 1,\n};\n\nconst pinT = (t: number) => Math.min(Math.max(t, 0), 1);\n\nexport class JsiSkPath extends HostObject<Path, \"Path\"> implements SkPath {\n constructor(CanvasKit: CanvasKit, ref: Path) {\n super(CanvasKit, ref, \"Path\");\n }\n\n dispose = () => {\n this.ref.delete();\n };\n\n addPath(src: SkPath, matrix?: SkMatrix, extend = false) {\n const args = [\n JsiSkPath.fromValue(src),\n ...(matrix ? JsiSkMatrix.fromValue<Float32Array>(matrix) : []),\n extend,\n ];\n this.ref.addPath(...args);\n return this;\n }\n\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ) {\n this.ref.addArc(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees\n );\n return this;\n }\n\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {\n this.ref.addOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n isCCW,\n startIndex\n );\n return this;\n }\n\n countPoints() {\n return this.ref.countPoints();\n }\n\n addPoly(points: SkPoint[], close: boolean) {\n this.ref.addPoly(\n points.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),\n close\n );\n return this;\n }\n\n moveTo(x: number, y: number) {\n this.ref.moveTo(x, y);\n return this;\n }\n\n lineTo(x: number, y: number) {\n this.ref.lineTo(x, y);\n return this;\n }\n\n makeAsWinding() {\n const result = this.ref.makeAsWinding();\n return result === null ? result : this;\n }\n\n offset(dx: number, dy: number) {\n this.ref.offset(dx, dy);\n return this;\n }\n\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ) {\n this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);\n return this;\n }\n\n rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number) {\n this.ref.rConicTo(dx1, dy1, dx2, dy2, w);\n return this;\n }\n\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n rMoveTo(x: number, y: number) {\n this.ref.rMoveTo(x, y);\n return this;\n }\n\n rLineTo(x: number, y: number) {\n this.ref.rLineTo(x, y);\n return this;\n }\n\n rQuadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.rQuadTo(x1, y1, x2, y2);\n return this;\n }\n\n setFillType(fill: FillType) {\n this.ref.setFillType(getEnum(this.CanvasKit.FillType, fill));\n return this;\n }\n\n setIsVolatile(volatile: boolean) {\n this.ref.setIsVolatile(volatile);\n return this;\n }\n\n stroke(opts?: StrokeOpts) {\n const result = this.ref.stroke(\n opts === undefined\n ? undefined\n : {\n width: opts.width,\n // eslint-disable-next-line camelcase\n miter_limit: opts.width,\n precision: opts.width,\n join: optEnum(this.CanvasKit.StrokeJoin, opts.join),\n cap: optEnum(this.CanvasKit.StrokeCap, opts.cap),\n }\n );\n return result === null ? result : this;\n }\n\n close() {\n this.ref.close();\n return this;\n }\n\n reset() {\n this.ref.reset();\n return this;\n }\n\n rewind() {\n this.ref.rewind();\n return this;\n }\n\n computeTightBounds(): SkRect {\n return new JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());\n }\n\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ) {\n this.ref.arcToOval(\n JsiSkRect.fromValue(this.CanvasKit, oval),\n startAngleInDegrees,\n sweepAngleInDegrees,\n forceMoveTo\n );\n return this;\n }\n\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ) {\n this.ref.arcToRotated(\n rx,\n ry,\n xAxisRotateInDegrees,\n useSmallArc,\n isCCW,\n x,\n y\n );\n return this;\n }\n\n arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {\n this.ref.arcToTangent(x1, y1, x2, y2, radius);\n return this;\n }\n\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {\n this.ref.conicTo(x1, y1, x2, y2, w);\n return this;\n }\n\n contains(x: number, y: number) {\n return this.ref.contains(x, y);\n }\n\n copy() {\n return new JsiSkPath(this.CanvasKit, this.ref.copy());\n }\n\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ) {\n this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);\n return this;\n }\n\n dash(on: number, off: number, phase: number) {\n return this.ref.dash(on, off, phase);\n }\n\n equals(other: SkPath) {\n return this.ref.equals(JsiSkPath.fromValue(other));\n }\n\n getBounds() {\n return new JsiSkRect(this.CanvasKit, this.ref.getBounds());\n }\n\n getFillType() {\n return this.ref.getFillType().value;\n }\n\n quadTo(x1: number, y1: number, x2: number, y2: number) {\n this.ref.quadTo(x1, y1, x2, y2);\n return this;\n }\n\n addRect(rect: SkRect, isCCW?: boolean) {\n this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);\n return this;\n }\n\n addRRect(rrect: InputRRect, isCCW?: boolean) {\n this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);\n return this;\n }\n\n getPoint(index: number) {\n return new JsiSkPoint(this.CanvasKit, this.ref.getPoint(index));\n }\n\n isEmpty() {\n return this.ref.isEmpty();\n }\n\n isVolatile() {\n return this.ref.isVolatile();\n }\n\n addCircle(x: number, y: number, r: number) {\n this.ref.addCircle(x, y, r);\n return this;\n }\n\n getLastPt() {\n return new JsiSkPoint(\n this.CanvasKit,\n this.ref.getPoint(this.ref.countPoints() - 1)\n );\n }\n\n op(path: SkPath, op: PathOp) {\n return this.ref.op(\n JsiSkPath.fromValue(path),\n getEnum(this.CanvasKit.PathOp, op)\n );\n }\n\n simplify() {\n return this.ref.simplify();\n }\n\n toSVGString() {\n return this.ref.toSVGString();\n }\n\n trim(start: number, stop: number, isComplement: boolean) {\n const startT = pinT(start);\n const stopT = pinT(stop);\n if (startT === 0 && stopT === 1) {\n return this;\n }\n const result = this.ref.trim(startT, stopT, isComplement);\n return result === null ? result : this;\n }\n\n transform(m: InputMatrix) {\n let matrix =\n m instanceof JsiSkMatrix\n ? Array.from(JsiSkMatrix.fromValue<Matrix3x3>(m))\n : (m as Exclude<InputMatrix, SkMatrix>);\n if (matrix.length === 16) {\n matrix = [\n matrix[0],\n matrix[1],\n matrix[3],\n matrix[4],\n matrix[5],\n matrix[7],\n matrix[12],\n matrix[13],\n matrix[15],\n ];\n } else if (matrix.length !== 9) {\n throw new Error(`Invalid matrix length: ${matrix.length}`);\n }\n this.ref.transform(matrix);\n return this;\n }\n\n interpolate(end: SkPath, t: number, output?: SkPath) {\n const path = this.CanvasKit.Path.MakeFromPathInterpolation(\n this.ref,\n JsiSkPath.fromValue(end),\n t\n );\n if (path === null) {\n return null;\n }\n if (output) {\n (output as JsiSkPath).ref = path;\n return output;\n } else {\n return new JsiSkPath(this.CanvasKit, path);\n }\n }\n\n isInterpolatable(path2: SkPath): boolean {\n return this.CanvasKit.Path.CanInterpolate(\n this.ref,\n JsiSkPath.fromValue(path2)\n );\n }\n\n toCmds() {\n const cmds = this.ref.toCmds();\n const result = cmds.reduce<PathCommand[]>((acc, cmd, i) => {\n if (i === 0) {\n acc.push([]);\n }\n const current = acc[acc.length - 1];\n if (current.length === 0) {\n current.push(cmd);\n const length = CommandCount[current[0] as PathVerb];\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n } else {\n const length = CommandCount[current[0] as PathVerb];\n if (current.length < length) {\n current.push(cmd);\n }\n if (current.length === length && i !== cmds.length - 1) {\n acc.push([]);\n }\n }\n return acc;\n }, []);\n return result;\n }\n}\n"],"mappings":";;AAEA,SAASA,QAAT,QAAyB,UAAzB;AAcA,SAASC,OAAT,EAAkBC,UAAlB,EAA8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AAC,KAAKJ,IAAI,CAACX,MAAL,GAAc,CAArD,EAAwD;UACtDa,GAAG,CAACG,IAAJ,CAAS,EAAT;QACD;MACF;;MACD,OAAOH,GAAP;IACD,CArBc,EAqBZ,EArBY,CAAf;IAsBA,OAAOrG,MAAP;EACD;;AA9XuE"}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import type { Skia, SkRect } from "../skia/types";
|
3
|
+
import type { SkiaDomViewProps } from "./types";
|
4
|
+
export declare class SkiaJSDomView extends React.Component<SkiaDomViewProps & {
|
5
|
+
Skia: Skia;
|
6
|
+
}> {
|
7
|
+
constructor(props: SkiaDomViewProps & {
|
8
|
+
Skia: Skia;
|
9
|
+
});
|
10
|
+
private _nativeId;
|
11
|
+
get nativeId(): number;
|
12
|
+
componentDidUpdate(prevProps: SkiaDomViewProps & {
|
13
|
+
Skia: Skia;
|
14
|
+
}): void;
|
15
|
+
/**
|
16
|
+
* Creates a snapshot from the canvas in the surface
|
17
|
+
* @param rect Rect to use as bounds. Optional.
|
18
|
+
* @returns An Image object.
|
19
|
+
*/
|
20
|
+
makeImageSnapshot(rect?: SkRect): import("../skia/types").SkImage;
|
21
|
+
/**
|
22
|
+
* Sends a redraw request to the native SkiaView.
|
23
|
+
*/
|
24
|
+
redraw(): void;
|
25
|
+
private draw;
|
26
|
+
/**
|
27
|
+
* Clear up the dom node when unmounting to release resources.
|
28
|
+
*/
|
29
|
+
componentWillUnmount(): void;
|
30
|
+
render(): React.JSX.Element;
|
31
|
+
}
|