@shopify/react-native-skia 2.0.0-next.1 → 2.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +11 -1
- package/android/cpp/jni/JniPlatformContext.cpp +1 -0
- package/{ios/RNSkia-iOS → apple}/MetalContext.h +0 -5
- package/{ios/RNSkia-iOS → apple}/MetalWindowContext.mm +4 -0
- package/{ios/RNSkia-iOS/RNSkiOSPlatformContext.h → apple/RNSkApplePlatformContext.h} +7 -3
- package/{ios/RNSkia-iOS/RNSkiOSPlatformContext.mm → apple/RNSkApplePlatformContext.mm} +19 -19
- package/{ios/RNSkia-iOS/RNSkiOSVideo.h → apple/RNSkAppleVideo.h} +3 -3
- package/{ios/RNSkia-iOS/RNSkiOSVideo.mm → apple/RNSkAppleVideo.mm} +14 -14
- package/{ios/RNSkia-iOS/RNSkiOSView.h → apple/RNSkAppleView.h} +4 -4
- package/{ios/RNSkia-iOS/RNSkiOSView.mm → apple/RNSkAppleView.mm} +4 -4
- package/{ios/RNSkia-iOS → apple}/RNSkMetalCanvasProvider.mm +6 -1
- package/{ios/RNSkia-iOS → apple}/SkiaManager.mm +2 -2
- package/{ios/RNSkia-iOS → apple}/SkiaPictureView.mm +2 -2
- package/{ios/RNSkia-iOS → apple}/SkiaPictureViewManager.mm +6 -2
- package/{ios/RNSkia-iOS → apple}/SkiaUIView.h +12 -4
- package/{ios/RNSkia-iOS → apple}/SkiaUIView.mm +11 -7
- package/{ios/RNSkia-iOS → apple}/ViewScreenshotService.h +4 -0
- package/{ios/RNSkia-iOS → apple}/ViewScreenshotService.mm +4 -0
- package/cpp/api/JsiSkContourMeasure.h +1 -1
- package/cpp/api/JsiSkHostObjects.h +21 -10
- package/cpp/api/JsiSkParagraph.h +17 -27
- package/cpp/api/JsiSkPathEffect.h +1 -1
- package/cpp/api/JsiSkPictureFactory.h +1 -1
- package/cpp/api/JsiSkShaderFactory.h +43 -8
- package/cpp/api/JsiSkVertices.h +14 -3
- package/cpp/api/recorder/Drawings.h +4 -3
- package/cpp/rnskia/DawnContext.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +7 -2
- package/cpp/skia/include/config/SkUserConfig.h +11 -0
- package/cpp/skia/include/core/SkCanvas.h +11 -7
- package/cpp/skia/include/core/SkColor.h +10 -0
- package/cpp/skia/include/core/SkColorSpace.h +184 -2
- package/cpp/skia/include/core/SkColorType.h +114 -32
- package/cpp/skia/include/core/SkFontScanner.h +5 -8
- package/cpp/skia/include/core/SkFontStyle.h +1 -1
- package/cpp/skia/include/core/SkMaskFilter.h +0 -8
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +1 -1
- package/cpp/skia/include/core/SkRRect.h +3 -1
- package/cpp/skia/include/core/SkShader.h +3 -3
- package/cpp/skia/include/core/SkString.h +8 -8
- package/cpp/skia/include/core/SkSurface.h +14 -0
- package/cpp/skia/include/core/SkTypeface.h +24 -7
- package/cpp/skia/include/effects/SkGradientShader.h +6 -1
- package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -0
- package/cpp/skia/include/encode/SkPngEncoder.h +14 -0
- package/cpp/skia/include/gpu/GpuTypes.h +9 -0
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +135 -133
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +5 -0
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +14 -9
- package/cpp/skia/include/gpu/graphite/Context.h +25 -2
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +23 -5
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +20 -1
- package/cpp/skia/include/gpu/graphite/Image.h +1 -0
- package/cpp/skia/include/gpu/graphite/LogPriority.h +36 -0
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +52 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +6 -0
- package/cpp/skia/include/gpu/graphite/Recording.h +3 -1
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +4 -36
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +48 -0
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +3 -2
- package/cpp/skia/include/pathops/SkPathOps.h +9 -1
- package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +3 -0
- package/cpp/skia/include/private/SkPathRef.h +15 -21
- package/cpp/skia/include/private/base/SkAttributes.h +16 -10
- package/cpp/skia/include/private/base/SkMutex.h +8 -0
- package/cpp/skia/include/private/base/SkTArray.h +1 -1
- package/cpp/skia/include/private/base/SkTDArray.h +1 -1
- package/cpp/skia/include/private/base/SkTemplates.h +24 -11
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/sksl/SkSLDebugTrace.h +0 -3
- package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
- package/cpp/skia/modules/skcms/src/skcms_Transform.h +4 -3
- package/cpp/skia/modules/skcms/src/skcms_public.h +19 -15
- package/cpp/skia/modules/skresources/include/SkResources.h +3 -1
- package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGImage.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +2 -0
- package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -0
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +4 -0
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/src/core/SkLRUCache.h +19 -13
- package/cpp/skia/src/core/SkTHash.h +50 -4
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +1 -0
- package/lib/commonjs/__tests__/setup.d.ts +18 -0
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +4 -3
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +1 -0
- package/lib/commonjs/headless/index.js +12 -0
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/mock/index.js +1 -2
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +3 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +4 -6
- package/lib/commonjs/skia/web/Host.js +23 -10
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +15 -15
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +3 -3
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFontMgr.js +1 -1
- package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -6
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +9 -9
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +3 -3
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +4 -4
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +4 -3
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiVideo.js +2 -1
- package/lib/commonjs/skia/web/JsiVideo.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.js +3 -1
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Core.d.ts +1 -5
- package/lib/commonjs/sksg/Recorder/Core.js +12 -4
- package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +4 -5
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Box.js +2 -4
- package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.js +10 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/module/__tests__/setup.d.ts +18 -0
- package/lib/module/external/reanimated/useAnimatedImageValue.js +4 -3
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/headless/index.d.ts +1 -0
- package/lib/module/headless/index.js +1 -0
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/mock/index.js +1 -2
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +3 -1
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +4 -6
- package/lib/module/skia/web/Host.js +21 -8
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +15 -15
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +4 -4
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkFontMgr.js +2 -2
- package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +6 -6
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +4 -4
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +10 -10
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +3 -3
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +4 -4
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +4 -4
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +3 -3
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +1 -1
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +2 -2
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +4 -3
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/skia/web/JsiVideo.js +2 -1
- package/lib/module/skia/web/JsiVideo.js.map +1 -1
- package/lib/module/sksg/HostConfig.js +3 -1
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/Recorder/Core.d.ts +1 -5
- package/lib/module/sksg/Recorder/Core.js +10 -2
- package/lib/module/sksg/Recorder/Core.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +5 -6
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Box.js +3 -5
- package/lib/module/sksg/Recorder/commands/Box.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/module/specs/NativeSkiaModule.web.js +10 -1
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/typescript/lib/commonjs/mock/index.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/index.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/Host.d.ts +3 -5
- package/lib/typescript/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkFontMgr.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +3 -3
- package/lib/typescript/lib/commonjs/skia/web/JsiVideo.d.ts +1 -1
- package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +1 -1
- package/lib/typescript/lib/module/headless/index.d.ts +1 -0
- package/lib/typescript/lib/module/mock/index.d.ts +5 -5
- package/lib/typescript/lib/module/skia/Skia.d.ts +1 -1
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +3 -3
- package/lib/typescript/lib/module/skia/web/Host.d.ts +3 -5
- package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkFontMgr.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +3 -3
- package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +1 -1
- package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +1 -1
- package/lib/typescript/src/__tests__/setup.d.ts +18 -0
- package/lib/typescript/src/headless/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/Host.d.ts +4 -6
- package/lib/typescript/src/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/typescript/src/sksg/Recorder/Core.d.ts +1 -5
- package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +2 -0
- package/package.json +6 -5
- package/react-native-skia.podspec +3 -3
- package/src/__tests__/setup.ts +67 -1
- package/src/external/reanimated/useAnimatedImageValue.ts +4 -3
- package/src/headless/index.ts +2 -1
- package/src/mock/index.ts +1 -2
- package/src/renderer/Canvas.tsx +2 -1
- package/src/renderer/__tests__/e2e/Matrix4.spec.tsx +1 -2
- package/src/renderer/__tests__/e2e/Paths.spec.tsx +13 -11
- package/src/skia/__tests__/Enums.spec.ts +24 -2
- package/src/skia/__tests__/Path.spec.ts +2 -2
- package/src/skia/web/Host.ts +29 -11
- package/src/skia/web/JsiSkCanvas.ts +17 -17
- package/src/skia/web/JsiSkColorFilterFactory.ts +1 -1
- package/src/skia/web/JsiSkFont.ts +5 -5
- package/src/skia/web/JsiSkFontMgr.ts +3 -3
- package/src/skia/web/JsiSkImage.ts +14 -10
- package/src/skia/web/JsiSkImageFactory.ts +5 -5
- package/src/skia/web/JsiSkImageFilterFactory.ts +12 -22
- package/src/skia/web/JsiSkMaskFilterFactory.ts +1 -1
- package/src/skia/web/JsiSkPaint.ts +3 -3
- package/src/skia/web/JsiSkPath.ts +4 -4
- package/src/skia/web/JsiSkPathEffectFactory.ts +6 -6
- package/src/skia/web/JsiSkPathFactory.ts +4 -9
- package/src/skia/web/JsiSkPicture.ts +3 -3
- package/src/skia/web/JsiSkShaderFactory.ts +5 -5
- package/src/skia/web/JsiSkTypefaceFontProvider.ts +3 -3
- package/src/skia/web/JsiSkVerticesFactory.ts +1 -1
- package/src/skia/web/JsiSkia.ts +7 -4
- package/src/skia/web/JsiVideo.ts +2 -1
- package/src/sksg/HostConfig.ts +1 -1
- package/src/sksg/Recorder/Core.ts +5 -7
- package/src/sksg/Recorder/Player.ts +5 -6
- package/src/sksg/Recorder/commands/Box.ts +3 -5
- package/src/specs/NativeSkiaModule.web.ts +12 -2
- package/ios/Rnskia.xcodeproj/project.pbxproj +0 -281
- package/ios/Rnskia.xcworkspace/contents.xcworkspacedata +0 -7
- package/lib/commonjs/skia/types/Image/ColorType.web.d.ts +0 -19
- package/lib/commonjs/skia/types/Image/ColorType.web.js +0 -43
- package/lib/commonjs/skia/types/Image/ColorType.web.js.map +0 -1
- package/lib/module/skia/types/Image/ColorType.web.d.ts +0 -19
- package/lib/module/skia/types/Image/ColorType.web.js +0 -37
- package/lib/module/skia/types/Image/ColorType.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/skia/types/Image/ColorType.web.d.ts +0 -2
- package/lib/typescript/lib/module/skia/types/Image/ColorType.web.d.ts +0 -1
- package/lib/typescript/src/skia/types/Image/ColorType.web.d.ts +0 -19
- package/src/skia/types/Image/ColorType.web.ts +0 -19
- /package/{ios/RNSkia-iOS → apple}/MetalContext.mm +0 -0
- /package/{ios/RNSkia-iOS → apple}/MetalWindowContext.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/RNSkMetalCanvasProvider.h +0 -0
- /package/{ios → apple}/RNSkiaModule.h +0 -0
- /package/{ios → apple}/RNSkiaModule.mm +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaCVPixelBufferUtils.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaCVPixelBufferUtils.mm +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaManager.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaPictureView.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaPictureViewManager.h +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","isGroup","materializeProps","play","ctx","command","children","forEach","child","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeProps,\n type Command,\n} from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, command: Command) {\n \"worklet\";\n if (isGroup(command)) {\n command.children.forEach((child) => play(ctx, child));\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n materializeProps(command as any);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,SAAS,QACJ,oBAAoB;AAC3B,SAASC,OAAO,EAAEC,YAAY,QAAQ,gBAAgB;AACtD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,QACV,yBAAyB;AAChC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,QACT,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,UAAU,QAAQ,oBAAoB;AAC7D,SACEC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,OAAO,EACPC,gBAAgB,QAEX,QAAQ;AAGf,SAASC,IAAIA,CAACC,GAAmB,EAAEC,OAAgB,EAAE;EACnD,SAAS;;EACT,IAAIJ,OAAO,CAACI,OAAO,CAAC,EAAE;IACpBA,OAAO,CAACC,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAKL,IAAI,CAACC,GAAG,EAAEI,KAAK,CAAC,CAAC;IACrD;EACF;EACA;EACAN,gBAAgB,CAACG,OAAc,CAAC;EAChC,IAAIN,SAAS,CAACM,OAAO,EAAEP,WAAW,CAACW,kBAAkB,CAAC,EAAE;IACtDL,GAAG,CAACM,kBAAkB,CAAC,CAAC;EAC1B,CAAC,MAAM,IAAIX,SAAS,CAAC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AAW,CAACuD,UAAU,CAAC,EAAE;QACzD9E,UAAU,CAAC6B,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MAChC,CAAC,MAAM,IAAInB,aAAa,CAACK,OAAO,EAAEP,WAAW,CAACwD,WAAW,CAAC,EAAE;QAC1DhF,WAAW,CAAC8B,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MACjC,CAAC,MAAM,IAAInB,aAAa,CAACK,OAAO,EAAEP,WAAW,CAACyD,YAAY,CAAC,EAAE;QAC3DlF,YAAY,CAAC+B,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MAClC,CAAC,MAAM,IAAInB,aAAa,CAACK,OAAO,EAAEP,WAAW,CAAC0D,aAAa,CAAC,EAAE;QAC5DpF,aAAa,CAACgC,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MACnC,CAAC,MAAM,IAAInB,aAAa,CAACK,OAAO,EAAEP,WAAW,CAAC2D,SAAS,CAAC,EAAE;QACxDtF,SAAS,CAACiC,GAAG,EAAEC,OAAO,CAACc,KAAK,CAAC;MAC/B,CAAC,MAAM;QACLuC,OAAO,CAACC,IAAI,CAAC,oBAAoBtD,OAAO,CAACuD,IAAI,EAAE,CAAC;MAClD;MACAxD,GAAG,CAACgB,MAAM,CAACL,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEA,OAAO,MAAM8C,MAAM,GAAGA,CAACzD,GAAmB,EAAE0D,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAACvD,OAAO,CAAEF,OAAO,IAAK;IAC5BF,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"names":["drawCircle","drawImage","drawOval","drawPath","drawPoints","drawRect","drawRRect","drawLine","drawAtlas","drawParagraph","drawImageSVG","drawPicture","drawGlyphs","drawTextBlob","drawTextPath","drawText","drawDiffRect","drawVertices","drawPatch","drawBox","isBoxCommand","composeColorFilters","isPushColorFilter","pushColorFilter","saveCTM","setBlurMaskFilter","isPushImageFilter","pushImageFilter","composeImageFilters","setPaintProperties","composePathEffects","isPushPathEffect","pushPathEffect","isPushShader","pushShader","CommandType","isCommand","isDrawCommand","isGroup","materializeCommand","play","ctx","_command","children","forEach","child","command","SaveBackdropFilter","saveBackdropFilter","SaveLayer","materializePaint","paint","paintDeclarations","pop","canvas","saveLayer","SavePaint","props","paints","push","savePaint","Skia","RestorePaint","restorePaint","ComposeColorFilter","RestorePaintDeclaration","Error","MaterializePaint","ComposePathEffect","ComposeImageFilter","PushBlurMaskFilter","SaveCTM","RestoreCTM","restore","p","DrawPaint","drawPaint","DrawImage","DrawCircle","DrawPoints","DrawPath","DrawRect","DrawRRect","DrawOval","DrawLine","DrawPatch","DrawVertices","DrawDiffRect","DrawText","DrawTextPath","DrawTextBlob","DrawGlyphs","DrawPicture","DrawImageSVG","DrawParagraph","DrawAtlas","console","warn","type","replay","commands"],"sources":["Player.ts"],"sourcesContent":["import {\n drawCircle,\n drawImage,\n drawOval,\n drawPath,\n drawPoints,\n drawRect,\n drawRRect,\n drawLine,\n drawAtlas,\n drawParagraph,\n drawImageSVG,\n drawPicture,\n drawGlyphs,\n drawTextBlob,\n drawTextPath,\n drawText,\n drawDiffRect,\n drawVertices,\n drawPatch,\n} from \"./commands/Drawing\";\nimport { drawBox, isBoxCommand } from \"./commands/Box\";\nimport {\n composeColorFilters,\n isPushColorFilter,\n pushColorFilter,\n} from \"./commands/ColorFilters\";\nimport { saveCTM } from \"./commands/CTM\";\nimport {\n setBlurMaskFilter,\n isPushImageFilter,\n pushImageFilter,\n composeImageFilters,\n} from \"./commands/ImageFilters\";\nimport { setPaintProperties } from \"./commands/Paint\";\nimport {\n composePathEffects,\n isPushPathEffect,\n pushPathEffect,\n} from \"./commands/PathEffects\";\nimport { isPushShader, pushShader } from \"./commands/Shaders\";\nimport {\n CommandType,\n isCommand,\n isDrawCommand,\n isGroup,\n materializeCommand,\n type Command,\n} from \"./Core\";\nimport type { DrawingContext } from \"./DrawingContext\";\n\nfunction play(ctx: DrawingContext, _command: Command) {\n \"worklet\";\n if (isGroup(_command)) {\n _command.children.forEach((child) => play(ctx, child));\n return;\n }\n const command = materializeCommand(_command);\n if (isCommand(command, CommandType.SaveBackdropFilter)) {\n ctx.saveBackdropFilter();\n } else if (isCommand(command, CommandType.SaveLayer)) {\n ctx.materializePaint();\n const paint = ctx.paintDeclarations.pop();\n ctx.canvas.saveLayer(paint);\n } else if (isDrawCommand(command, CommandType.SavePaint)) {\n if (command.props.paint) {\n ctx.paints.push(command.props.paint);\n } else {\n ctx.savePaint();\n setPaintProperties(ctx.Skia, ctx.paint, command.props);\n }\n } else if (isCommand(command, CommandType.RestorePaint)) {\n ctx.restorePaint();\n } else if (isCommand(command, CommandType.ComposeColorFilter)) {\n composeColorFilters(ctx);\n } else if (isCommand(command, CommandType.RestorePaintDeclaration)) {\n ctx.materializePaint();\n const paint = ctx.restorePaint();\n if (!paint) {\n throw new Error(\"No paint declaration to push\");\n }\n ctx.paintDeclarations.push(paint);\n } else if (isCommand(command, CommandType.MaterializePaint)) {\n ctx.materializePaint();\n } else if (isPushColorFilter(command)) {\n pushColorFilter(ctx, command);\n } else if (isPushShader(command)) {\n pushShader(ctx, command);\n } else if (isPushImageFilter(command)) {\n pushImageFilter(ctx, command);\n } else if (isPushPathEffect(command)) {\n pushPathEffect(ctx, command);\n } else if (isCommand(command, CommandType.ComposePathEffect)) {\n composePathEffects(ctx);\n } else if (isCommand(command, CommandType.ComposeImageFilter)) {\n composeImageFilters(ctx);\n } else if (isDrawCommand(command, CommandType.PushBlurMaskFilter)) {\n setBlurMaskFilter(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.SaveCTM)) {\n saveCTM(ctx, command.props);\n } else if (isCommand(command, CommandType.RestoreCTM)) {\n ctx.canvas.restore();\n } else {\n const paints = [ctx.paint, ...ctx.paintDeclarations];\n ctx.paintDeclarations = [];\n paints.forEach((p) => {\n ctx.paints.push(p);\n if (isBoxCommand(command)) {\n drawBox(ctx, command);\n } else if (isCommand(command, CommandType.DrawPaint)) {\n ctx.canvas.drawPaint(ctx.paint);\n } else if (isDrawCommand(command, CommandType.DrawImage)) {\n drawImage(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawCircle)) {\n drawCircle(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPoints)) {\n drawPoints(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPath)) {\n drawPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRect)) {\n drawRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawRRect)) {\n drawRRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawOval)) {\n drawOval(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawLine)) {\n drawLine(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPatch)) {\n drawPatch(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawVertices)) {\n drawVertices(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawDiffRect)) {\n drawDiffRect(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawText)) {\n drawText(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextPath)) {\n drawTextPath(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawTextBlob)) {\n drawTextBlob(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawGlyphs)) {\n drawGlyphs(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawPicture)) {\n drawPicture(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawImageSVG)) {\n drawImageSVG(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawParagraph)) {\n drawParagraph(ctx, command.props);\n } else if (isDrawCommand(command, CommandType.DrawAtlas)) {\n drawAtlas(ctx, command.props);\n } else {\n console.warn(`Unknown command: ${command.type}`);\n }\n ctx.paints.pop();\n });\n }\n}\n\nexport const replay = (ctx: DrawingContext, commands: Command[]) => {\n \"worklet\";\n commands.forEach((command) => {\n play(ctx, command);\n });\n};\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZC,YAAY,EACZC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,SAAS,QACJ,oBAAoB;AAC3B,SAASC,OAAO,EAAEC,YAAY,QAAQ,gBAAgB;AACtD,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,eAAe,QACV,yBAAyB;AAChC,SAASC,OAAO,QAAQ,gBAAgB;AACxC,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,eAAe,EACfC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,kBAAkB,QAAQ,kBAAkB;AACrD,SACEC,kBAAkB,EAClBC,gBAAgB,EAChBC,cAAc,QACT,wBAAwB;AAC/B,SAASC,YAAY,EAAEC,UAAU,QAAQ,oBAAoB;AAC7D,SACEC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,OAAO,EACPC,kBAAkB,QAEb,QAAQ;AAGf,SAASC,IAAIA,CAACC,GAAmB,EAAEC,QAAiB,EAAE;EACpD,SAAS;;EACT,IAAIJ,OAAO,CAACI,QAAQ,CAAC,EAAE;IACrBA,QAAQ,CAACC,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAKL,IAAI,CAACC,GAAG,EAAEI,KAAK,CAAC,CAAC;IACtD;EACF;EACA,MAAMC,OAAO,GAAGP,kBAAkB,CAACG,QAAQ,CAAC;EAC5C,IAAIN,SAAS,CAACU,OAAO,EAAEX,WAAW,CAACY,kBAAkB,CAAC,EAAE;IACtDN,GAAG,CAACO,kBAAkB,CAAC,CAAC;EAC1B,CAAC,MAAM,IAAIZ,SAAS,CAACU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AAO,EAAEX,WAAW,CAACwD,UAAU,CAAC,EAAE;QACzD/E,UAAU,CAAC6B,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MAChC,CAAC,MAAM,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAACyD,WAAW,CAAC,EAAE;QAC1DjF,WAAW,CAAC8B,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MACjC,CAAC,MAAM,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAAC0D,YAAY,CAAC,EAAE;QAC3DnF,YAAY,CAAC+B,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MAClC,CAAC,MAAM,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAAC2D,aAAa,CAAC,EAAE;QAC5DrF,aAAa,CAACgC,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MACnC,CAAC,MAAM,IAAIpB,aAAa,CAACS,OAAO,EAAEX,WAAW,CAAC4D,SAAS,CAAC,EAAE;QACxDvF,SAAS,CAACiC,GAAG,EAAEK,OAAO,CAACW,KAAK,CAAC;MAC/B,CAAC,MAAM;QACLuC,OAAO,CAACC,IAAI,CAAC,oBAAoBnD,OAAO,CAACoD,IAAI,EAAE,CAAC;MAClD;MACAzD,GAAG,CAACiB,MAAM,CAACL,GAAG,CAAC,CAAC;IAClB,CAAC,CAAC;EACJ;AACF;AAEA,OAAO,MAAM8C,MAAM,GAAGA,CAAC1D,GAAmB,EAAE2D,QAAmB,KAAK;EAClE,SAAS;;EACTA,QAAQ,CAACxD,OAAO,CAAEE,OAAO,IAAK;IAC5BN,IAAI,CAACC,GAAG,EAAEK,OAAO,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { deflate, inflate, processColor } from "../../../dom/nodes";
|
2
2
|
import { BlurStyle, ClipOp, isRRect } from "../../../skia/types";
|
3
|
-
import { CommandType,
|
3
|
+
import { CommandType, materializeCommand } from "../Core";
|
4
4
|
export const isBoxCommand = command => {
|
5
5
|
"worklet";
|
6
6
|
|
@@ -9,11 +9,9 @@ export const isBoxCommand = command => {
|
|
9
9
|
export const drawBox = (ctx, command) => {
|
10
10
|
"worklet";
|
11
11
|
|
12
|
-
command.shadows.
|
13
|
-
|
14
|
-
materializeProps(shadow);
|
12
|
+
const shadows = command.shadows.map(shadow => {
|
13
|
+
return materializeCommand(shadow).props;
|
15
14
|
});
|
16
|
-
const shadows = command.shadows.map(shadow => shadow.props);
|
17
15
|
const {
|
18
16
|
paint,
|
19
17
|
Skia,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["deflate","inflate","processColor","BlurStyle","ClipOp","isRRect","CommandType","
|
1
|
+
{"version":3,"names":["deflate","inflate","processColor","BlurStyle","ClipOp","isRRect","CommandType","materializeCommand","isBoxCommand","command","type","DrawBox","drawBox","ctx","shadows","map","shadow","props","paint","Skia","canvas","box","defaultBox","opacity","getAlphaf","RRectXY","filter","inner","color","blur","spread","dx","dy","lPaint","Paint","setColor","setAlphaf","setMaskFilter","MaskFilter","MakeBlur","Normal","drawRRect","delta","Point","Math","abs","save","clipRRect","Intersect","Color","outer","x","y","drawDRRect","restore"],"sources":["Box.ts"],"sourcesContent":["import { deflate, inflate, processColor } from \"../../../dom/nodes\";\nimport type { BoxProps, BoxShadowProps } from \"../../../dom/types\";\nimport { BlurStyle, ClipOp, isRRect } from \"../../../skia/types\";\nimport type { Command } from \"../Core\";\nimport { CommandType, materializeCommand } from \"../Core\";\nimport type { DrawingContext } from \"../DrawingContext\";\n\ninterface BoxCommand extends Command<CommandType.DrawBox> {\n props: BoxProps;\n shadows: { props: BoxShadowProps }[];\n}\n\nexport const isBoxCommand = (command: Command): command is BoxCommand => {\n \"worklet\";\n return command.type === CommandType.DrawBox;\n};\n\nexport const drawBox = (ctx: DrawingContext, command: BoxCommand) => {\n \"worklet\";\n const shadows = command.shadows.map((shadow) => {\n return materializeCommand(shadow).props;\n });\n const { paint, Skia, canvas } = ctx;\n const { box: defaultBox } = command.props;\n const opacity = paint.getAlphaf();\n const box = isRRect(defaultBox) ? defaultBox : Skia.RRectXY(defaultBox, 0, 0);\n shadows\n .filter((shadow) => !shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const lPaint = Skia.Paint();\n lPaint.setColor(processColor(Skia, color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n canvas.drawRRect(inflate(Skia, box, spread, spread, dx, dy), lPaint);\n });\n\n canvas.drawRRect(box, paint);\n\n shadows\n .filter((shadow) => shadow.inner)\n .map((shadow) => {\n const { color = \"black\", blur, spread = 0, dx = 0, dy = 0 } = shadow;\n const delta = Skia.Point(10 + Math.abs(dx), 10 + Math.abs(dy));\n canvas.save();\n canvas.clipRRect(box, ClipOp.Intersect, false);\n const lPaint = Skia.Paint();\n lPaint.setColor(Skia.Color(color));\n lPaint.setAlphaf(paint.getAlphaf() * opacity);\n\n lPaint.setMaskFilter(\n Skia.MaskFilter.MakeBlur(BlurStyle.Normal, blur, true)\n );\n const inner = deflate(Skia, box, spread, spread, dx, dy);\n const outer = inflate(Skia, box, delta.x, delta.y);\n canvas.drawDRRect(outer, inner, lPaint);\n canvas.restore();\n });\n};\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,OAAO,EAAEC,YAAY,QAAQ,oBAAoB;AAEnE,SAASC,SAAS,EAAEC,MAAM,EAAEC,OAAO,QAAQ,qBAAqB;AAEhE,SAASC,WAAW,EAAEC,kBAAkB,QAAQ,SAAS;AAQzD,OAAO,MAAMC,YAAY,GAAIC,OAAgB,IAA4B;EACvE,SAAS;;EACT,OAAOA,OAAO,CAACC,IAAI,KAAKJ,WAAW,CAACK,OAAO;AAC7C,CAAC;AAED,OAAO,MAAMC,OAAO,GAAGA,CAACC,GAAmB,EAAEJ,OAAmB,KAA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,CAACiC,UAAU,CAACH,KAAK,EAAEvB,KAAK,EAAEM,MAAM,CAAC;IACvCb,MAAM,CAACkC,OAAO,CAAC,CAAC;EAClB,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
|
@@ -1,7 +1,9 @@
|
|
1
|
+
import type { SkPicture } from "../skia/types";
|
1
2
|
import type { ISkiaViewApi } from "../views/types";
|
2
3
|
import type { SkiaPictureView } from "../views/SkiaPictureView.web";
|
3
4
|
export type ISkiaViewApiWeb = ISkiaViewApi & {
|
4
5
|
views: Record<string, SkiaPictureView>;
|
6
|
+
deferedPictures: Record<string, SkPicture>;
|
5
7
|
registerView(nativeId: string, view: SkiaPictureView): void;
|
6
8
|
};
|
7
9
|
declare const _default: {};
|
@@ -2,14 +2,23 @@
|
|
2
2
|
|
3
3
|
global.SkiaViewApi = {
|
4
4
|
views: {},
|
5
|
+
deferedPictures: {},
|
5
6
|
web: true,
|
6
7
|
registerView(nativeId, view) {
|
8
|
+
// Maybe a picture for this view was already set
|
9
|
+
if (this.deferedPictures[nativeId]) {
|
10
|
+
view.setPicture(this.deferedPictures[nativeId]);
|
11
|
+
}
|
7
12
|
this.views[nativeId] = view;
|
8
13
|
},
|
9
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
10
15
|
setJsiProperty(nativeId, name, value) {
|
11
16
|
if (name === "picture") {
|
12
|
-
this.views[`${nativeId}`]
|
17
|
+
if (!this.views[`${nativeId}`]) {
|
18
|
+
this.deferedPictures[`${nativeId}`] = value;
|
19
|
+
} else {
|
20
|
+
this.views[`${nativeId}`].setPicture(value);
|
21
|
+
}
|
13
22
|
}
|
14
23
|
},
|
15
24
|
requestRedraw(nativeId) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["global","SkiaViewApi","views","web","registerView","nativeId","view","setJsiProperty","name","value","
|
1
|
+
{"version":3,"names":["global","SkiaViewApi","views","deferedPictures","web","registerView","nativeId","view","setPicture","setJsiProperty","name","value","requestRedraw","redraw","makeImageSnapshot","rect","makeImageSnapshotAsync","Promise","resolve","reject","result","Error"],"sources":["NativeSkiaModule.web.ts"],"sourcesContent":["/* eslint-disable import/no-anonymous-default-export */\nimport type { SkPicture, SkRect } from \"../skia/types\";\nimport type { ISkiaViewApi } from \"../views/types\";\nimport type { SkiaPictureView } from \"../views/SkiaPictureView.web\";\n\nexport type ISkiaViewApiWeb = ISkiaViewApi & {\n views: Record<string, SkiaPictureView>;\n deferedPictures: Record<string, SkPicture>;\n registerView(nativeId: string, view: SkiaPictureView): void;\n};\n\nglobal.SkiaViewApi = {\n views: {},\n deferedPictures: {},\n web: true,\n registerView(nativeId: string, view: SkiaPictureView) {\n // Maybe a picture for this view was already set\n if (this.deferedPictures[nativeId]) {\n view.setPicture(this.deferedPictures[nativeId] as SkPicture);\n }\n this.views[nativeId] = view;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n setJsiProperty(nativeId: number, name: string, value: any) {\n if (name === \"picture\") {\n if (!this.views[`${nativeId}`]) {\n this.deferedPictures[`${nativeId}`] = value;\n } else {\n this.views[`${nativeId}`].setPicture(value);\n }\n }\n },\n requestRedraw(nativeId: number) {\n this.views[`${nativeId}`].redraw();\n },\n makeImageSnapshot(nativeId: number, rect?: SkRect) {\n return this.views[`${nativeId}`].makeImageSnapshot(rect);\n },\n makeImageSnapshotAsync(nativeId: number, rect?: SkRect) {\n return new Promise((resolve, reject) => {\n const result = this.views[`${nativeId}`].makeImageSnapshot(rect);\n if (result) {\n resolve(result);\n } else {\n reject(new Error(\"Failed to make image snapshot\"));\n }\n });\n },\n} as ISkiaViewApiWeb;\n\n// eslint-disable-next-line import/no-default-export\nexport default {};\n"],"mappings":"AAAA;;AAWAA,MAAM,CAACC,WAAW,GAAG;EACnBC,KAAK,EAAE,CAAC,CAAC;EACTC,eAAe,EAAE,CAAC,CAAC;EACnBC,GAAG,EAAE,IAAI;EACTC,YAAYA,CAACC,QAAgB,EAAEC,IAAqB,EAAE;IACpD;IACA,IAAI,IAAI,C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AAoB;;AAEpB;AACA,eAAe,CAAC,CAAC","ignoreList":[]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
2
|
export function Mock(CanvasKit: any): {
|
3
|
-
Canvas: ()
|
3
|
+
Canvas: typeof import("react-native").View;
|
4
4
|
useValue: () => {
|
5
5
|
current: number;
|
6
6
|
};
|
@@ -59,5 +59,5 @@ export function Mock(CanvasKit: any): {
|
|
59
59
|
useSVG: () => null;
|
60
60
|
useVideo: () => null;
|
61
61
|
readonly __esModule: boolean;
|
62
|
-
readonly Skia: import("../../../src/
|
62
|
+
readonly Skia: import("../../../src/headless").Skia;
|
63
63
|
};
|
@@ -1,2 +1,2 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
|
-
export const Skia: import("../../../src/
|
2
|
+
export const Skia: import("../../../src/headless").Skia;
|
@@ -1,7 +1,5 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
|
-
export
|
3
|
-
constructor(msg: any);
|
4
|
-
}
|
2
|
+
export function throwNotImplementedOnRNWeb(): jest.Mock<any, any, any>;
|
5
3
|
export class Host {
|
6
4
|
constructor(CanvasKit: any);
|
7
5
|
CanvasKit: any;
|
@@ -14,5 +12,5 @@ export class BaseHostObject extends Host {
|
|
14
12
|
export class HostObject extends BaseHostObject {
|
15
13
|
static fromValue(value: any): any;
|
16
14
|
}
|
17
|
-
export function getEnum(
|
18
|
-
export function optEnum(
|
15
|
+
export function getEnum(CanvasKit: any, name: any, v: any): any;
|
16
|
+
export function optEnum(CanvasKit: any, name: any, v: any): any;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
2
|
export class JsiSkFont extends _Host.HostObject {
|
3
3
|
constructor(CanvasKit: any, ref: any);
|
4
|
-
measureText(_text: any, _paint: any):
|
4
|
+
measureText(_text: any, _paint: any): jest.Mock<any, any, any>;
|
5
5
|
getTextWidth(text: any, paint: any): any;
|
6
6
|
getMetrics(): {
|
7
7
|
ascent: any;
|
@@ -4,6 +4,6 @@ export class JsiSkFontMgr extends _Host.HostObject {
|
|
4
4
|
dispose(): void;
|
5
5
|
countFamilies(): any;
|
6
6
|
getFamilyName(index: any): any;
|
7
|
-
matchFamilyStyle(_familyName: any, _fontStyle: any):
|
7
|
+
matchFamilyStyle(_familyName: any, _fontStyle: any): jest.Mock<any, any, any>;
|
8
8
|
}
|
9
9
|
import _Host = require("./Host");
|
@@ -3,7 +3,7 @@ export class JsiSkImageFactory extends _Host.Host {
|
|
3
3
|
MakeImageFromViewTag(viewTag: any): Promise<null>;
|
4
4
|
MakeImageFromNativeBuffer(buffer: any, surface: any, image: any): _JsiSkImage.JsiSkImage;
|
5
5
|
MakeImageFromEncoded(encoded: any): _JsiSkImage.JsiSkImage | null;
|
6
|
-
MakeImageFromNativeTextureUnstable():
|
6
|
+
MakeImageFromNativeTextureUnstable(): jest.Mock<any, any, any>;
|
7
7
|
MakeImage(info: any, data: any, bytesPerRow: any): _JsiSkImage.JsiSkImage | null;
|
8
8
|
}
|
9
9
|
import _Host = require("./Host");
|
@@ -11,7 +11,7 @@ export class JsiSkImageFilterFactory extends _Host.Host {
|
|
11
11
|
MakeErode(rx: any, ry: any, input: any, cropRect: any): _JsiSkImageFilter.JsiSkImageFilter;
|
12
12
|
MakeDilate(rx: any, ry: any, input: any, cropRect: any): _JsiSkImageFilter.JsiSkImageFilter;
|
13
13
|
MakeBlend(mode: any, background: any, foreground: any, cropRect: any): _JsiSkImageFilter.JsiSkImageFilter;
|
14
|
-
MakeRuntimeShader(_builder: any, _childShaderName: any, _input: any):
|
14
|
+
MakeRuntimeShader(_builder: any, _childShaderName: any, _input: any): jest.Mock<any, any, any>;
|
15
15
|
}
|
16
16
|
import _Host = require("./Host");
|
17
17
|
import _JsiSkImageFilter = require("./JsiSkImageFilter");
|
@@ -3,8 +3,8 @@ export class JsiSkPathEffectFactory extends _Host.Host {
|
|
3
3
|
MakeCorner(radius: any): _JsiSkPathEffect.JsiSkPathEffect | null;
|
4
4
|
MakeDash(intervals: any, phase: any): _JsiSkPathEffect.JsiSkPathEffect;
|
5
5
|
MakeDiscrete(segLength: any, dev: any, seedAssist: any): _JsiSkPathEffect.JsiSkPathEffect;
|
6
|
-
MakeCompose(_outer: any, _inner: any):
|
7
|
-
MakeSum(_outer: any, _inner: any):
|
6
|
+
MakeCompose(_outer: any, _inner: any): jest.Mock<any, any, any>;
|
7
|
+
MakeSum(_outer: any, _inner: any): jest.Mock<any, any, any>;
|
8
8
|
MakeLine2D(width: any, matrix: any): _JsiSkPathEffect.JsiSkPathEffect | null;
|
9
9
|
MakePath1D(path: any, advance: any, phase: any, style: any): _JsiSkPathEffect.JsiSkPathEffect | null;
|
10
10
|
MakePath2D(matrix: any, path: any): _JsiSkPathEffect.JsiSkPathEffect | null;
|
@@ -4,7 +4,7 @@ export class JsiSkPathFactory extends _Host.Host {
|
|
4
4
|
MakeFromSVGString(str: any): _JsiSkPath.JsiSkPath | null;
|
5
5
|
MakeFromOp(one: any, two: any, op: any): _JsiSkPath.JsiSkPath | null;
|
6
6
|
MakeFromCmds(cmds: any): _JsiSkPath.JsiSkPath | null;
|
7
|
-
MakeFromText(_text: any, _x: any, _y: any, _font: any):
|
7
|
+
MakeFromText(_text: any, _x: any, _y: any, _font: any): jest.Mock<any, any, any>;
|
8
8
|
}
|
9
9
|
import _Host = require("./Host");
|
10
10
|
import _JsiSkPath = require("./JsiSkPath");
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
2
|
export class JsiSkTypefaceFontProvider extends _Host.HostObject {
|
3
3
|
constructor(CanvasKit: any, ref: any);
|
4
|
-
matchFamilyStyle(_name: any, _style: any):
|
4
|
+
matchFamilyStyle(_name: any, _style: any): jest.Mock<any, any, any>;
|
5
5
|
countFamilies(): any;
|
6
6
|
getFamilyName(index: any): any;
|
7
7
|
registerFont(typeface: any, familyName: any): void;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
2
|
export function JsiSkApi(CanvasKit: any): {
|
3
3
|
Point: (x: any, y: any) => _JsiSkPoint.JsiSkPoint;
|
4
|
-
RuntimeShaderBuilder: (_: any) =>
|
4
|
+
RuntimeShaderBuilder: (_: any) => jest.Mock<any, any, any>;
|
5
5
|
RRectXY: (rect: any, rx: any, ry: any) => _JsiSkRRect.JsiSkRRect;
|
6
6
|
RSXform: (scos: any, ssin: any, tx: any, ty: any) => _JsiSkRSXform.JsiSkRSXform;
|
7
7
|
RSXformFromRadians: (scale: any, r: any, tx: any, ty: any, px: any, py: any) => _JsiSkRSXform.JsiSkRSXform;
|
@@ -33,8 +33,8 @@ export function JsiSkApi(CanvasKit: any): {
|
|
33
33
|
ParagraphBuilder: _JsiSkParagraphBuilderFactory.JsiSkParagraphBuilderFactory;
|
34
34
|
NativeBuffer: _JsiSkNativeBufferFactory.JsiSkNativeBufferFactory;
|
35
35
|
Video: (url?: any) => Promise<any>;
|
36
|
-
Context: (_surface: any, _width: any, _height: any) =>
|
37
|
-
Recorder: () =>
|
36
|
+
Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
|
37
|
+
Recorder: () => jest.Mock<any, any, any>;
|
38
38
|
};
|
39
39
|
import _JsiSkPoint = require("./JsiSkPoint");
|
40
40
|
import _JsiSkRRect = require("./JsiSkRRect");
|
@@ -5,7 +5,7 @@ export class JsiVideo {
|
|
5
5
|
ImageFactory: any;
|
6
6
|
videoElement: any;
|
7
7
|
duration(): number;
|
8
|
-
framerate():
|
8
|
+
framerate(): jest.Mock<any, any, any>;
|
9
9
|
setSurface(surface: any): void;
|
10
10
|
webglBuffer: _CanvasKitWebGLBufferImpl.CanvasKitWebGLBufferImpl | undefined;
|
11
11
|
nextImage(): any;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export const __esModule: boolean;
|
2
2
|
export const CommandType: {};
|
3
|
-
export function
|
3
|
+
export function materializeCommand(command: any): any;
|
4
4
|
export function isCommand(command: any, type: any): boolean;
|
5
5
|
export function isGroup(command: any): boolean;
|
6
6
|
export function isDrawCommand(command: any, type: any): boolean;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export function Mock(CanvasKit: any): {
|
2
|
-
Canvas: ()
|
2
|
+
Canvas: typeof import("react-native").View;
|
3
3
|
useValue: () => {
|
4
4
|
current: number;
|
5
5
|
};
|
@@ -147,8 +147,9 @@ export function Mock(CanvasKit: any): {
|
|
147
147
|
x: any;
|
148
148
|
y: any;
|
149
149
|
};
|
150
|
-
interpolatePaths: (value: any, input: any,
|
151
|
-
|
150
|
+
interpolatePaths: (value: any, input: any, // Reanimated hooks
|
151
|
+
outputRange: any, options: any, output: any) => any;
|
152
|
+
Skia: import("../../../src/headless").Skia;
|
152
153
|
loadData: (source: any, factory: any, onError: any) => Promise<any>;
|
153
154
|
useCollectionLoading: (source: any, loader: any) => null;
|
154
155
|
matchFont: (inputStyle?: {}, fontMgr?: import("../../..").SkFontMgr) => import("../../..").SkFont;
|
@@ -193,8 +194,7 @@ export function Mock(CanvasKit: any): {
|
|
193
194
|
B: number;
|
194
195
|
C: number;
|
195
196
|
};
|
196
|
-
MakeCubic: (B: any,
|
197
|
-
C: any) => {
|
197
|
+
MakeCubic: (B: any, C: any) => {
|
198
198
|
B: any;
|
199
199
|
C: any;
|
200
200
|
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export const Skia: {
|
2
2
|
Point: (x: any, y: any) => import("./web/JsiSkPoint").JsiSkPoint;
|
3
|
-
RuntimeShaderBuilder: (_: any) =>
|
3
|
+
RuntimeShaderBuilder: (_: any) => jest.Mock<any, any, any>;
|
4
4
|
RRectXY: (rect: any, rx: any, ry: any) => import("./web/JsiSkRRect").JsiSkRRect;
|
5
5
|
RSXform: (scos: any, ssin: any, tx: any, ty: any) => import("./web/JsiSkRSXform").JsiSkRSXform;
|
6
6
|
RSXformFromRadians: (scale: any, r: any, tx: any, ty: any, px: any, py: any) => import("./web/JsiSkRSXform").JsiSkRSXform;
|
@@ -32,6 +32,6 @@ export const Skia: {
|
|
32
32
|
ParagraphBuilder: import("./web/JsiSkParagraphBuilderFactory").JsiSkParagraphBuilderFactory;
|
33
33
|
NativeBuffer: import("./web/JsiSkNativeBufferFactory").JsiSkNativeBufferFactory;
|
34
34
|
Video: (url?: any) => Promise<any>;
|
35
|
-
Context: (_surface: any, _width: any, _height: any) =>
|
36
|
-
Recorder: () =>
|
35
|
+
Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
|
36
|
+
Recorder: () => jest.Mock<any, any, any>;
|
37
37
|
};
|
@@ -1,6 +1,4 @@
|
|
1
|
-
export
|
2
|
-
constructor(msg: any);
|
3
|
-
}
|
1
|
+
export function throwNotImplementedOnRNWeb(): jest.Mock<any, any, any>;
|
4
2
|
export class Host {
|
5
3
|
constructor(CanvasKit: any);
|
6
4
|
CanvasKit: any;
|
@@ -13,5 +11,5 @@ export class BaseHostObject extends Host {
|
|
13
11
|
export class HostObject extends BaseHostObject {
|
14
12
|
static fromValue(value: any): any;
|
15
13
|
}
|
16
|
-
export function getEnum(
|
17
|
-
export function optEnum(
|
14
|
+
export function getEnum(CanvasKit: any, name: any, v: any): any;
|
15
|
+
export function optEnum(CanvasKit: any, name: any, v: any): any;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export class JsiSkFont extends HostObject {
|
2
2
|
constructor(CanvasKit: any, ref: any);
|
3
|
-
measureText(_text: any, _paint: any):
|
3
|
+
measureText(_text: any, _paint: any): jest.Mock<any, any, any>;
|
4
4
|
getTextWidth(text: any, paint: any): any;
|
5
5
|
getMetrics(): {
|
6
6
|
ascent: any;
|
@@ -3,6 +3,6 @@ export class JsiSkFontMgr extends HostObject {
|
|
3
3
|
dispose(): void;
|
4
4
|
countFamilies(): any;
|
5
5
|
getFamilyName(index: any): any;
|
6
|
-
matchFamilyStyle(_familyName: any, _fontStyle: any):
|
6
|
+
matchFamilyStyle(_familyName: any, _fontStyle: any): jest.Mock<any, any, any>;
|
7
7
|
}
|
8
8
|
import { HostObject } from "./Host";
|
@@ -2,7 +2,7 @@ export class JsiSkImageFactory extends Host {
|
|
2
2
|
MakeImageFromViewTag(viewTag: any): Promise<null>;
|
3
3
|
MakeImageFromNativeBuffer(buffer: any, surface: any, image: any): JsiSkImage;
|
4
4
|
MakeImageFromEncoded(encoded: any): JsiSkImage | null;
|
5
|
-
MakeImageFromNativeTextureUnstable():
|
5
|
+
MakeImageFromNativeTextureUnstable(): jest.Mock<any, any, any>;
|
6
6
|
MakeImage(info: any, data: any, bytesPerRow: any): JsiSkImage | null;
|
7
7
|
}
|
8
8
|
import { Host } from "./Host";
|
@@ -10,7 +10,7 @@ export class JsiSkImageFilterFactory extends Host {
|
|
10
10
|
MakeErode(rx: any, ry: any, input: any, cropRect: any): JsiSkImageFilter;
|
11
11
|
MakeDilate(rx: any, ry: any, input: any, cropRect: any): JsiSkImageFilter;
|
12
12
|
MakeBlend(mode: any, background: any, foreground: any, cropRect: any): JsiSkImageFilter;
|
13
|
-
MakeRuntimeShader(_builder: any, _childShaderName: any, _input: any):
|
13
|
+
MakeRuntimeShader(_builder: any, _childShaderName: any, _input: any): jest.Mock<any, any, any>;
|
14
14
|
}
|
15
15
|
import { Host } from "./Host";
|
16
16
|
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
@@ -2,8 +2,8 @@ export class JsiSkPathEffectFactory extends Host {
|
|
2
2
|
MakeCorner(radius: any): JsiSkPathEffect | null;
|
3
3
|
MakeDash(intervals: any, phase: any): JsiSkPathEffect;
|
4
4
|
MakeDiscrete(segLength: any, dev: any, seedAssist: any): JsiSkPathEffect;
|
5
|
-
MakeCompose(_outer: any, _inner: any):
|
6
|
-
MakeSum(_outer: any, _inner: any):
|
5
|
+
MakeCompose(_outer: any, _inner: any): jest.Mock<any, any, any>;
|
6
|
+
MakeSum(_outer: any, _inner: any): jest.Mock<any, any, any>;
|
7
7
|
MakeLine2D(width: any, matrix: any): JsiSkPathEffect | null;
|
8
8
|
MakePath1D(path: any, advance: any, phase: any, style: any): JsiSkPathEffect | null;
|
9
9
|
MakePath2D(matrix: any, path: any): JsiSkPathEffect | null;
|
@@ -3,7 +3,7 @@ export class JsiSkPathFactory extends Host {
|
|
3
3
|
MakeFromSVGString(str: any): JsiSkPath | null;
|
4
4
|
MakeFromOp(one: any, two: any, op: any): JsiSkPath | null;
|
5
5
|
MakeFromCmds(cmds: any): JsiSkPath | null;
|
6
|
-
MakeFromText(_text: any, _x: any, _y: any, _font: any):
|
6
|
+
MakeFromText(_text: any, _x: any, _y: any, _font: any): jest.Mock<any, any, any>;
|
7
7
|
}
|
8
8
|
import { Host } from "./Host";
|
9
9
|
import { JsiSkPath } from "./JsiSkPath";
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export class JsiSkTypefaceFontProvider extends HostObject {
|
2
2
|
constructor(CanvasKit: any, ref: any);
|
3
|
-
matchFamilyStyle(_name: any, _style: any):
|
3
|
+
matchFamilyStyle(_name: any, _style: any): jest.Mock<any, any, any>;
|
4
4
|
countFamilies(): any;
|
5
5
|
getFamilyName(index: any): any;
|
6
6
|
registerFont(typeface: any, familyName: any): void;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export function JsiSkApi(CanvasKit: any): {
|
2
2
|
Point: (x: any, y: any) => JsiSkPoint;
|
3
|
-
RuntimeShaderBuilder: (_: any) =>
|
3
|
+
RuntimeShaderBuilder: (_: any) => jest.Mock<any, any, any>;
|
4
4
|
RRectXY: (rect: any, rx: any, ry: any) => JsiSkRRect;
|
5
5
|
RSXform: (scos: any, ssin: any, tx: any, ty: any) => JsiSkRSXform;
|
6
6
|
RSXformFromRadians: (scale: any, r: any, tx: any, ty: any, px: any, py: any) => JsiSkRSXform;
|
@@ -32,8 +32,8 @@ export function JsiSkApi(CanvasKit: any): {
|
|
32
32
|
ParagraphBuilder: JsiSkParagraphBuilderFactory;
|
33
33
|
NativeBuffer: JsiSkNativeBufferFactory;
|
34
34
|
Video: (url?: any) => Promise<any>;
|
35
|
-
Context: (_surface: any, _width: any, _height: any) =>
|
36
|
-
Recorder: () =>
|
35
|
+
Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
|
36
|
+
Recorder: () => jest.Mock<any, any, any>;
|
37
37
|
};
|
38
38
|
import { JsiSkPoint } from "./JsiSkPoint";
|
39
39
|
import { JsiSkRRect } from "./JsiSkRRect";
|
@@ -1,5 +1,5 @@
|
|
1
1
|
export let CommandType: {};
|
2
|
-
export function
|
2
|
+
export function materializeCommand(command: any): any;
|
3
3
|
export function isCommand(command: any, type: any): boolean;
|
4
4
|
export function isGroup(command: any): boolean;
|
5
5
|
export function isDrawCommand(command: any, type: any): boolean;
|
@@ -15,4 +15,22 @@ interface CheckImageOptions {
|
|
15
15
|
shouldFail?: boolean;
|
16
16
|
}
|
17
17
|
export declare const checkImage: (image: SkImage, relPath: string, opts?: CheckImageOptions) => number;
|
18
|
+
declare global {
|
19
|
+
namespace jest {
|
20
|
+
interface Matchers<R> {
|
21
|
+
/**
|
22
|
+
* Checks if values are approximately equal within the given tolerance.
|
23
|
+
* Works with:
|
24
|
+
* - Single numbers
|
25
|
+
* - Arrays of numbers
|
26
|
+
* - Float32Arrays
|
27
|
+
* - SVG path strings (compares numeric values with tolerance)
|
28
|
+
*
|
29
|
+
* @param expected - The expected value to compare against
|
30
|
+
* @param tolerance - The maximum allowed difference between elements (default: 0.01)
|
31
|
+
*/
|
32
|
+
toBeApproximatelyEqual(expected: number | number[] | Float32Array | string, tolerance?: number): R;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
18
36
|
export {};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { ReactNode } from "react";
|
2
2
|
import type { SkSurface } from "../skia";
|
3
3
|
export * from "../renderer/components";
|
4
|
+
export * from "../skia/types";
|
4
5
|
export declare const makeOffscreenSurface: (width: number, height: number) => SkSurface;
|
5
6
|
export declare const getSkiaExports: () => {
|
6
7
|
Skia: import("../skia/types").Skia;
|
@@ -1,8 +1,6 @@
|
|
1
|
-
import type { CanvasKit, EmbindEnumEntity
|
1
|
+
import type { CanvasKit, EmbindEnumEntity } from "canvaskit-wasm";
|
2
2
|
import type { SkJSIInstance } from "../types";
|
3
|
-
export declare
|
4
|
-
constructor(msg?: string);
|
5
|
-
}
|
3
|
+
export declare const throwNotImplementedOnRNWeb: <T>() => T;
|
6
4
|
export declare abstract class Host {
|
7
5
|
readonly CanvasKit: CanvasKit;
|
8
6
|
constructor(CanvasKit: CanvasKit);
|
@@ -16,5 +14,5 @@ export declare abstract class BaseHostObject<T, N extends string> extends Host i
|
|
16
14
|
export declare abstract class HostObject<T, N extends string> extends BaseHostObject<T, N> {
|
17
15
|
static fromValue<T>(value: SkJSIInstance<string>): T;
|
18
16
|
}
|
19
|
-
export declare const getEnum: (
|
20
|
-
export declare const optEnum: (
|
17
|
+
export declare const getEnum: (CanvasKit: CanvasKit, name: keyof CanvasKit, v: number) => EmbindEnumEntity;
|
18
|
+
export declare const optEnum: (CanvasKit: CanvasKit, name: keyof CanvasKit, v: number | undefined) => EmbindEnumEntity | undefined;
|
@@ -9,5 +9,5 @@ export declare class JsiSkPathFactory extends Host implements PathFactory {
|
|
9
9
|
MakeFromSVGString(str: string): JsiSkPath | null;
|
10
10
|
MakeFromOp(one: SkPath, two: SkPath, op: PathOp): JsiSkPath | null;
|
11
11
|
MakeFromCmds(cmds: PathCommand[]): JsiSkPath | null;
|
12
|
-
MakeFromText(_text: string, _x: number, _y: number, _font: SkFont): SkPath
|
12
|
+
MakeFromText(_text: string, _x: number, _y: number, _font: SkFont): SkPath;
|
13
13
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { SharedValue } from "react-native-reanimated";
|
2
1
|
import type { BlurMaskFilterProps, CircleProps, CTMProps, ImageProps, PointsProps, PathProps, RectProps, RoundedRectProps, OvalProps, LineProps, PatchProps, VerticesProps, DiffRectProps, TextProps, TextPathProps, TextBlobProps, GlyphsProps, PictureProps, ImageSVGProps, ParagraphProps, AtlasProps, DrawingNodeProps } from "../../dom/types";
|
3
2
|
export declare enum CommandType {
|
4
3
|
Group = 0,
|
@@ -44,10 +43,7 @@ export type Command<T extends CommandType = CommandType> = {
|
|
44
43
|
type: T;
|
45
44
|
[key: string]: unknown;
|
46
45
|
};
|
47
|
-
export declare const
|
48
|
-
props: Record<string, unknown>;
|
49
|
-
animatedProps?: Record<string, SharedValue<unknown>>;
|
50
|
-
}) => void;
|
46
|
+
export declare const materializeCommand: (command: any) => any;
|
51
47
|
export declare const isCommand: <T extends CommandType>(command: Command, type: T) => command is Command<T>;
|
52
48
|
interface GroupCommand extends Command<CommandType.Group> {
|
53
49
|
children: Command[];
|
@@ -1,7 +1,9 @@
|
|
1
|
+
import type { SkPicture } from "../skia/types";
|
1
2
|
import type { ISkiaViewApi } from "../views/types";
|
2
3
|
import type { SkiaPictureView } from "../views/SkiaPictureView.web";
|
3
4
|
export type ISkiaViewApiWeb = ISkiaViewApi & {
|
4
5
|
views: Record<string, SkiaPictureView>;
|
6
|
+
deferedPictures: Record<string, SkPicture>;
|
5
7
|
registerView(nativeId: string, view: SkiaPictureView): void;
|
6
8
|
};
|
7
9
|
declare const _default: {};
|