@shopify/react-native-skia 0.1.234 → 0.1.237
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/cpp/api/JsiSkApi.h +2 -0
- package/cpp/api/JsiSkCanvas.h +36 -0
- package/cpp/api/JsiSkRSXform.h +35 -7
- package/cpp/api/JsiSkTypefaceFactory.h +2 -1
- package/cpp/rnskia/dom/JsiDomApi.h +2 -0
- package/cpp/rnskia/dom/nodes/JsiAtlasNode.h +60 -0
- package/cpp/rnskia/dom/props/RSXformProp.h +52 -0
- package/cpp/rnskia/dom/props/RectProp.h +31 -0
- 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 +5 -3
- package/lib/commonjs/dom/nodes/JsiSkDOM.js +60 -57
- package/lib/commonjs/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/commonjs/dom/nodes/drawings/AtlasNode.d.ts +8 -0
- package/lib/commonjs/dom/nodes/drawings/AtlasNode.js +47 -0
- package/lib/commonjs/dom/nodes/drawings/AtlasNode.js.map +1 -0
- package/lib/commonjs/dom/nodes/drawings/index.d.ts +1 -0
- package/lib/commonjs/dom/nodes/drawings/index.js +13 -0
- package/lib/commonjs/dom/nodes/drawings/index.js.map +1 -1
- package/lib/commonjs/dom/types/Drawings.d.ts +7 -1
- package/lib/commonjs/dom/types/Drawings.js.map +1 -1
- package/lib/commonjs/dom/types/NodeType.d.ts +1 -0
- package/lib/commonjs/dom/types/NodeType.js +1 -0
- package/lib/commonjs/dom/types/NodeType.js.map +1 -1
- package/lib/commonjs/dom/types/SkDOM.d.ts +2 -1
- package/lib/commonjs/dom/types/SkDOM.js.map +1 -1
- package/lib/commonjs/external/reanimated/buffers.d.ts +5 -0
- package/lib/commonjs/external/reanimated/buffers.js +48 -0
- package/lib/commonjs/external/reanimated/buffers.js.map +1 -0
- package/lib/commonjs/external/reanimated/index.d.ts +2 -0
- package/lib/commonjs/external/reanimated/index.js +26 -0
- package/lib/commonjs/external/reanimated/index.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.js +13 -1
- 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 +38 -0
- package/lib/commonjs/external/reanimated/textures.js.map +1 -0
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +8 -1
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/commonjs/headless/index.js +1 -1
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/mock/index.js +8 -0
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +1 -1
- 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/HostComponents.d.ts +3 -1
- package/lib/commonjs/renderer/HostComponents.js +3 -0
- package/lib/commonjs/renderer/HostComponents.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.d.ts +4 -1
- package/lib/commonjs/renderer/Offscreen.js +28 -10
- 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/renderer/components/shapes/Atlas.d.ts +4 -0
- package/lib/commonjs/renderer/components/shapes/Atlas.js +17 -0
- package/lib/commonjs/renderer/components/shapes/Atlas.js.map +1 -0
- package/lib/commonjs/renderer/components/shapes/index.d.ts +1 -0
- package/lib/commonjs/renderer/components/shapes/index.js +13 -0
- package/lib/commonjs/renderer/components/shapes/index.js.map +1 -1
- package/lib/commonjs/skia/core/AnimatedImage.d.ts +1 -1
- package/lib/commonjs/skia/core/AnimatedImage.js +4 -1
- package/lib/commonjs/skia/core/AnimatedImage.js.map +1 -1
- package/lib/commonjs/skia/core/Data.d.ts +1 -1
- package/lib/commonjs/skia/core/Data.js +11 -4
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/Rect.d.ts +2 -2
- package/lib/commonjs/skia/types/Canvas.d.ts +16 -1
- package/lib/commonjs/skia/types/Canvas.js.map +1 -1
- package/lib/commonjs/skia/types/Image/Image.d.ts +8 -0
- package/lib/commonjs/skia/types/Image/Image.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/RSXform.d.ts +7 -1
- package/lib/commonjs/skia/types/RSXform.js.map +1 -1
- package/lib/commonjs/skia/types/Rect.d.ts +4 -0
- package/lib/commonjs/skia/types/Rect.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/types/Skia.d.ts +3 -2
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +19 -0
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRSXform.d.ts +8 -2
- package/lib/commonjs/skia/web/JsiSkRSXform.js +33 -2
- package/lib/commonjs/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkRect.d.ts +3 -2
- package/lib/commonjs/skia/web/JsiSkRect.js +7 -0
- package/lib/commonjs/skia/web/JsiSkRect.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js +2 -1
- package/lib/commonjs/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +5 -0
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/dom/nodes/JsiSkDOM.d.ts +5 -3
- package/lib/module/dom/nodes/JsiSkDOM.js +61 -57
- package/lib/module/dom/nodes/JsiSkDOM.js.map +1 -1
- package/lib/module/dom/nodes/drawings/AtlasNode.d.ts +8 -0
- package/lib/module/dom/nodes/drawings/AtlasNode.js +34 -0
- package/lib/module/dom/nodes/drawings/AtlasNode.js.map +1 -0
- package/lib/module/dom/nodes/drawings/index.d.ts +1 -0
- package/lib/module/dom/nodes/drawings/index.js +1 -0
- package/lib/module/dom/nodes/drawings/index.js.map +1 -1
- package/lib/module/dom/types/Drawings.d.ts +7 -1
- package/lib/module/dom/types/Drawings.js.map +1 -1
- package/lib/module/dom/types/NodeType.d.ts +1 -0
- package/lib/module/dom/types/NodeType.js +1 -0
- package/lib/module/dom/types/NodeType.js.map +1 -1
- package/lib/module/dom/types/SkDOM.d.ts +2 -1
- package/lib/module/dom/types/SkDOM.js.map +1 -1
- package/lib/module/external/reanimated/buffers.d.ts +5 -0
- package/lib/module/external/reanimated/buffers.js +27 -0
- package/lib/module/external/reanimated/buffers.js.map +1 -0
- package/lib/module/external/reanimated/index.d.ts +2 -0
- package/lib/module/external/reanimated/index.js +2 -0
- package/lib/module/external/reanimated/index.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.js +13 -1
- 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 +24 -0
- package/lib/module/external/reanimated/textures.js.map +1 -0
- package/lib/module/external/reanimated/useAnimatedImageValue.js +7 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/headless/index.js +1 -1
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/mock/index.js +8 -0
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +1 -1
- 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/HostComponents.d.ts +3 -1
- package/lib/module/renderer/HostComponents.js +3 -0
- package/lib/module/renderer/HostComponents.js.map +1 -1
- package/lib/module/renderer/Offscreen.d.ts +4 -1
- package/lib/module/renderer/Offscreen.js +19 -9
- 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/renderer/components/shapes/Atlas.d.ts +4 -0
- package/lib/module/renderer/components/shapes/Atlas.js +5 -0
- package/lib/module/renderer/components/shapes/Atlas.js.map +1 -0
- package/lib/module/renderer/components/shapes/index.d.ts +1 -0
- package/lib/module/renderer/components/shapes/index.js +1 -0
- package/lib/module/renderer/components/shapes/index.js.map +1 -1
- package/lib/module/skia/core/AnimatedImage.d.ts +1 -1
- package/lib/module/skia/core/AnimatedImage.js +4 -1
- package/lib/module/skia/core/AnimatedImage.js.map +1 -1
- package/lib/module/skia/core/Data.d.ts +1 -1
- package/lib/module/skia/core/Data.js +11 -4
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/Rect.d.ts +2 -2
- package/lib/module/skia/types/Canvas.d.ts +16 -1
- package/lib/module/skia/types/Canvas.js.map +1 -1
- package/lib/module/skia/types/Image/Image.d.ts +8 -0
- package/lib/module/skia/types/Image/Image.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/RSXform.d.ts +7 -1
- package/lib/module/skia/types/RSXform.js.map +1 -1
- package/lib/module/skia/types/Rect.d.ts +4 -0
- package/lib/module/skia/types/Rect.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/types/Skia.d.ts +3 -2
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.d.ts +2 -1
- package/lib/module/skia/web/JsiSkCanvas.js +18 -0
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkRSXform.d.ts +8 -2
- package/lib/module/skia/web/JsiSkRSXform.js +34 -3
- package/lib/module/skia/web/JsiSkRSXform.js.map +1 -1
- package/lib/module/skia/web/JsiSkRect.d.ts +3 -2
- package/lib/module/skia/web/JsiSkRect.js +7 -0
- package/lib/module/skia/web/JsiSkRect.js.map +1 -1
- package/lib/module/skia/web/JsiSkTextBlobFactory.js +2 -1
- package/lib/module/skia/web/JsiSkTextBlobFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +5 -0
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/typescript/src/dom/nodes/JsiSkDOM.d.ts +5 -3
- package/lib/typescript/src/dom/nodes/drawings/AtlasNode.d.ts +8 -0
- package/lib/typescript/src/dom/nodes/drawings/index.d.ts +1 -0
- package/lib/typescript/src/dom/types/Drawings.d.ts +7 -1
- package/lib/typescript/src/dom/types/NodeType.d.ts +1 -0
- package/lib/typescript/src/dom/types/SkDOM.d.ts +2 -1
- package/lib/typescript/src/external/reanimated/buffers.d.ts +5 -0
- package/lib/typescript/src/external/reanimated/index.d.ts +2 -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/HostComponents.d.ts +3 -1
- package/lib/typescript/src/renderer/Offscreen.d.ts +4 -1
- package/lib/typescript/src/renderer/Reconciler.d.ts +1 -1
- package/lib/typescript/src/renderer/components/shapes/Atlas.d.ts +4 -0
- package/lib/typescript/src/renderer/components/shapes/index.d.ts +1 -0
- package/lib/typescript/src/skia/core/AnimatedImage.d.ts +1 -1
- package/lib/typescript/src/skia/core/Data.d.ts +1 -1
- package/lib/typescript/src/skia/core/Rect.d.ts +2 -2
- package/lib/typescript/src/skia/types/Canvas.d.ts +16 -1
- package/lib/typescript/src/skia/types/Image/Image.d.ts +8 -0
- package/lib/typescript/src/skia/types/Matrix4.d.ts +2 -2
- package/lib/typescript/src/skia/types/RSXform.d.ts +7 -1
- package/lib/typescript/src/skia/types/Rect.d.ts +4 -0
- package/lib/typescript/src/skia/types/Shader/Shader.d.ts +1 -1
- package/lib/typescript/src/skia/types/Skia.d.ts +3 -2
- package/lib/typescript/src/skia/web/JsiSkCanvas.d.ts +2 -1
- package/lib/typescript/src/skia/web/JsiSkRSXform.d.ts +8 -2
- package/lib/typescript/src/skia/web/JsiSkRect.d.ts +3 -2
- 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 +63 -56
- package/src/dom/nodes/drawings/AtlasNode.ts +24 -0
- package/src/dom/nodes/drawings/index.ts +1 -0
- package/src/dom/types/Drawings.ts +9 -0
- package/src/dom/types/NodeType.ts +1 -0
- package/src/dom/types/SkDOM.ts +2 -0
- package/src/external/reanimated/buffers.ts +53 -0
- package/src/external/reanimated/index.ts +2 -0
- package/src/external/reanimated/interpolators.ts +15 -2
- package/src/external/reanimated/moduleWrapper.ts +1 -0
- package/src/external/reanimated/textures.tsx +38 -0
- package/src/external/reanimated/useAnimatedImageValue.ts +15 -4
- package/src/headless/index.ts +1 -1
- package/src/mock/index.ts +8 -0
- package/src/renderer/Canvas.tsx +1 -1
- package/src/renderer/Container.tsx +3 -2
- package/src/renderer/HostComponents.ts +6 -1
- package/src/renderer/Offscreen.tsx +24 -11
- package/src/renderer/Reconciler.tsx +5 -2
- package/src/renderer/components/shapes/Atlas.tsx +8 -0
- package/src/renderer/components/shapes/index.ts +1 -0
- package/src/skia/core/AnimatedImage.ts +3 -2
- package/src/skia/core/Data.ts +8 -4
- package/src/skia/types/Canvas.ts +32 -1
- package/src/skia/types/Image/Image.ts +10 -0
- package/src/skia/types/Matrix4.ts +2 -2
- package/src/skia/types/RSXform.ts +7 -1
- package/src/skia/types/Rect.ts +6 -0
- package/src/skia/types/Shader/Shader.ts +6 -1
- package/src/skia/types/Skia.ts +10 -2
- package/src/skia/web/JsiSkCanvas.ts +60 -23
- package/src/skia/web/JsiSkRSXform.ts +28 -4
- package/src/skia/web/JsiSkRect.ts +12 -2
- package/src/skia/web/JsiSkTextBlobFactory.ts +5 -5
- package/src/skia/web/JsiSkia.ts +15 -0
- 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
package/src/mock/index.ts
CHANGED
|
@@ -31,9 +31,17 @@ export const Mock = (CanvasKit: CanvasKit) => {
|
|
|
31
31
|
// Reanimated hooks
|
|
32
32
|
useClock: NoopSharedValue,
|
|
33
33
|
usePathInterpolation: NoopSharedValue,
|
|
34
|
+
useTextureValue: NoopSharedValue,
|
|
35
|
+
useTextureValueFromPicture: NoopSharedValue,
|
|
36
|
+
useRSXformBuffer: NoopSharedValue,
|
|
37
|
+
usePointBuffer: NoopSharedValue,
|
|
38
|
+
useColorBuffer: NoopSharedValue,
|
|
39
|
+
useRectBuffer: NoopSharedValue,
|
|
40
|
+
useBuffer: NoopSharedValue,
|
|
34
41
|
useRawData: Noop,
|
|
35
42
|
useData: Noop,
|
|
36
43
|
useFont: () => Skia.Font(undefined, 0),
|
|
44
|
+
useFonts: Noop,
|
|
37
45
|
useTypeface: () => null,
|
|
38
46
|
useImage: () => null,
|
|
39
47
|
useSVG: () => null,
|
package/src/renderer/Canvas.tsx
CHANGED
|
@@ -13,9 +13,10 @@ export class Container {
|
|
|
13
13
|
constructor(
|
|
14
14
|
Skia: Skia,
|
|
15
15
|
public redraw: () => void = () => {},
|
|
16
|
-
public getNativeId: () => number = () => 0
|
|
16
|
+
public getNativeId: () => number = () => 0,
|
|
17
|
+
native: boolean
|
|
17
18
|
) {
|
|
18
|
-
this.Sk = new JsiSkDOM({ Skia });
|
|
19
|
+
this.Sk = new JsiSkDOM({ Skia }, native);
|
|
19
20
|
this._root = this.Sk.Group();
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -50,6 +50,7 @@ import type {
|
|
|
50
50
|
BoxProps,
|
|
51
51
|
BoxShadowProps,
|
|
52
52
|
ParagraphProps,
|
|
53
|
+
AtlasProps,
|
|
53
54
|
} from "../dom/types";
|
|
54
55
|
import type { ChildrenProps } from "../dom/types/Common";
|
|
55
56
|
import type {
|
|
@@ -69,7 +70,6 @@ export const NATIVE_DOM = shouldUseJSDomOnNative ? false : !!global.SkiaDomApi;
|
|
|
69
70
|
|
|
70
71
|
declare global {
|
|
71
72
|
var SkiaDomApi: {
|
|
72
|
-
// FIXME: We need a better type for this
|
|
73
73
|
RectNode: (props: RectProps) => JsiDrawingNode<RectProps, SkRect>;
|
|
74
74
|
RRectNode: (
|
|
75
75
|
props: RoundedRectProps
|
|
@@ -85,6 +85,8 @@ declare global {
|
|
|
85
85
|
PatchNode: (props: PatchProps) => RenderNode<PatchProps>;
|
|
86
86
|
PointsNode: (props: PointsProps) => RenderNode<PointsProps>;
|
|
87
87
|
DiffRectNode: (props: DiffRectProps) => RenderNode<DiffRectProps>;
|
|
88
|
+
AtlasNode: (props: AtlasProps) => RenderNode<AtlasProps>;
|
|
89
|
+
|
|
88
90
|
// Mask filters
|
|
89
91
|
BlurMaskFilterNode: (
|
|
90
92
|
props: BlurMaskFilterProps
|
|
@@ -207,6 +209,7 @@ declare global {
|
|
|
207
209
|
skPoints: SkiaProps<PointsProps>;
|
|
208
210
|
skRect: SkiaProps<RectProps>;
|
|
209
211
|
skRRect: SkiaProps<RoundedRectProps>;
|
|
212
|
+
skAtlas: SkiaProps<AtlasProps>;
|
|
210
213
|
skVertices: SkiaProps<VerticesProps>;
|
|
211
214
|
skText: SkiaProps<TextProps>;
|
|
212
215
|
skTextPath: SkiaProps<TextPathProps>;
|
|
@@ -313,6 +316,8 @@ export const createNode = (
|
|
|
313
316
|
return Sk.TextBlob(props);
|
|
314
317
|
case NodeType.Glyphs:
|
|
315
318
|
return Sk.Glyphs(props);
|
|
319
|
+
case NodeType.Atlas:
|
|
320
|
+
return Sk.Atlas(props);
|
|
316
321
|
case NodeType.DiffRect:
|
|
317
322
|
return Sk.DiffRect(props);
|
|
318
323
|
case NodeType.Picture:
|
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
2
|
|
|
3
3
|
import { JsiDrawingContext } from "../dom/types";
|
|
4
|
+
import type { SkPicture, SkSize } from "../skia/types";
|
|
4
5
|
import { Skia } from "../skia";
|
|
5
6
|
|
|
6
7
|
import { SkiaRoot } from "./Reconciler";
|
|
7
8
|
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
) => {
|
|
13
|
-
const surface = Skia.Surface.MakeOffscreen(width, height);
|
|
14
|
-
if (!surface) {
|
|
15
|
-
throw new Error("Could not create offscreen surface");
|
|
16
|
-
}
|
|
17
|
-
const canvas = surface.getCanvas();
|
|
18
|
-
const root = new SkiaRoot(Skia);
|
|
9
|
+
export const drawAsPicture = (element: ReactElement) => {
|
|
10
|
+
const recorder = Skia.PictureRecorder();
|
|
11
|
+
const canvas = recorder.beginRecording();
|
|
12
|
+
const root = new SkiaRoot(Skia, false);
|
|
19
13
|
root.render(element);
|
|
20
14
|
const ctx = new JsiDrawingContext(Skia, canvas);
|
|
21
15
|
root.dom.render(ctx);
|
|
16
|
+
const picture = recorder.finishRecordingAsPicture();
|
|
17
|
+
return picture;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const drawAsImage = (element: ReactElement, size: SkSize) => {
|
|
21
|
+
return drawAsImageFromPicture(drawAsPicture(element), size);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// TODO: We're not sure yet why PixelRatio is not needed here.
|
|
25
|
+
const pd = 1;
|
|
26
|
+
export const drawAsImageFromPicture = (picture: SkPicture, size: SkSize) => {
|
|
27
|
+
"worklet";
|
|
28
|
+
const surface = Skia.Surface.MakeOffscreen(
|
|
29
|
+
size.width * pd,
|
|
30
|
+
size.height * pd
|
|
31
|
+
)!;
|
|
32
|
+
const canvas = surface.getCanvas();
|
|
33
|
+
canvas.scale(pd, pd);
|
|
34
|
+
canvas.drawPicture(picture);
|
|
22
35
|
surface.flush();
|
|
23
36
|
return surface.makeImageSnapshot();
|
|
24
37
|
};
|
|
@@ -21,10 +21,11 @@ export class SkiaRoot {
|
|
|
21
21
|
|
|
22
22
|
constructor(
|
|
23
23
|
Skia: Skia,
|
|
24
|
+
native = false,
|
|
24
25
|
redraw: () => void = () => {},
|
|
25
26
|
getNativeId: () => number = () => 0
|
|
26
27
|
) {
|
|
27
|
-
this.container = new Container(Skia, redraw, getNativeId);
|
|
28
|
+
this.container = new Container(Skia, redraw, getNativeId, native);
|
|
28
29
|
this.root = skiaReconciler.createContainer(
|
|
29
30
|
this.container,
|
|
30
31
|
0,
|
|
@@ -45,7 +46,9 @@ export class SkiaRoot {
|
|
|
45
46
|
}
|
|
46
47
|
|
|
47
48
|
unmount() {
|
|
48
|
-
skiaReconciler.updateContainer(null, this.root, null, () => {
|
|
49
|
+
skiaReconciler.updateContainer(null, this.root, null, () => {
|
|
50
|
+
hostDebug("unmountContainer");
|
|
51
|
+
});
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
get dom() {
|
|
@@ -12,5 +12,6 @@ const animatedImgFactory = Skia.AnimatedImage.MakeAnimatedImageFromEncoded.bind(
|
|
|
12
12
|
* */
|
|
13
13
|
export const useAnimatedImage = (
|
|
14
14
|
source: DataSourceParam,
|
|
15
|
-
onError?: (err: Error) => void
|
|
16
|
-
|
|
15
|
+
onError?: (err: Error) => void,
|
|
16
|
+
managed = true
|
|
17
|
+
) => useRawData(source, animatedImgFactory, onError, managed);
|
package/src/skia/core/Data.ts
CHANGED
|
@@ -40,7 +40,8 @@ export const loadData = <T>(
|
|
|
40
40
|
|
|
41
41
|
const useLoading = <T extends SkJSIInstance<string>>(
|
|
42
42
|
source: DataSourceParam,
|
|
43
|
-
loader: () => Promise<T | null
|
|
43
|
+
loader: () => Promise<T | null>,
|
|
44
|
+
manage = true
|
|
44
45
|
) => {
|
|
45
46
|
const mounted = useRef(false);
|
|
46
47
|
const [data, setData] = useState<T | null>(null);
|
|
@@ -54,7 +55,9 @@ const useLoading = <T extends SkJSIInstance<string>>(
|
|
|
54
55
|
}
|
|
55
56
|
});
|
|
56
57
|
return () => {
|
|
57
|
-
|
|
58
|
+
if (manage) {
|
|
59
|
+
dataRef.current?.dispose();
|
|
60
|
+
}
|
|
58
61
|
mounted.current = false;
|
|
59
62
|
};
|
|
60
63
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -94,8 +97,9 @@ export const useCollectionLoading = <T extends SkJSIInstance<string>>(
|
|
|
94
97
|
export const useRawData = <T extends SkJSIInstance<string>>(
|
|
95
98
|
source: DataSourceParam,
|
|
96
99
|
factory: (data: SkData) => T | null,
|
|
97
|
-
onError?: (err: Error) => void
|
|
98
|
-
|
|
100
|
+
onError?: (err: Error) => void,
|
|
101
|
+
manage = true
|
|
102
|
+
) => useLoading(source, () => loadData<T>(source, factory, onError), manage);
|
|
99
103
|
|
|
100
104
|
const identity = (data: SkData) => data;
|
|
101
105
|
|
package/src/skia/types/Canvas.ts
CHANGED
|
@@ -2,7 +2,14 @@ import type { SkPaint } from "./Paint";
|
|
|
2
2
|
import type { SkRect } from "./Rect";
|
|
3
3
|
import type { SkFont } from "./Font";
|
|
4
4
|
import type { SkPath } from "./Path";
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
SkImage,
|
|
7
|
+
MipmapMode,
|
|
8
|
+
FilterMode,
|
|
9
|
+
ImageInfo,
|
|
10
|
+
CubicResampler,
|
|
11
|
+
FilterOptions,
|
|
12
|
+
} from "./Image";
|
|
6
13
|
import type { SkSVG } from "./SVG";
|
|
7
14
|
import type { SkColor } from "./Color";
|
|
8
15
|
import type { InputRRect } from "./RRect";
|
|
@@ -13,6 +20,7 @@ import type { SkImageFilter } from "./ImageFilter";
|
|
|
13
20
|
import type { SkVertices } from "./Vertices";
|
|
14
21
|
import type { SkTextBlob } from "./TextBlob";
|
|
15
22
|
import type { SkPicture } from "./Picture";
|
|
23
|
+
import type { SkRSXform } from "./RSXform";
|
|
16
24
|
|
|
17
25
|
export enum ClipOp {
|
|
18
26
|
Difference,
|
|
@@ -493,6 +501,29 @@ export interface SkCanvas {
|
|
|
493
501
|
*/
|
|
494
502
|
drawPicture(skp: SkPicture): void;
|
|
495
503
|
|
|
504
|
+
/**
|
|
505
|
+
* This method is used to draw an atlas on the canvas.
|
|
506
|
+
*
|
|
507
|
+
* @method drawAtlas
|
|
508
|
+
* @param {SkImage} atlas - The image to be drawn.
|
|
509
|
+
* @param {SkRect[]} srcs - The source rectangles.
|
|
510
|
+
* @param {SkRSXform[]} dsts - The destination transformations.
|
|
511
|
+
* @param {SkPaint} paint - The paint used for drawing.
|
|
512
|
+
* @param {BlendMode} [blendMode] - The blend mode used for drawing. Optional.
|
|
513
|
+
* @param {SkColor[]} [colors] - The colors used for drawing. Optional.
|
|
514
|
+
* @param {CubicResampler | FilterOptions} [sampling] - The sampling options. Optional.
|
|
515
|
+
* @returns {void} This method does not return anything.
|
|
516
|
+
*/
|
|
517
|
+
drawAtlas(
|
|
518
|
+
atlas: SkImage,
|
|
519
|
+
srcs: SkRect[],
|
|
520
|
+
dsts: SkRSXform[],
|
|
521
|
+
paint: SkPaint,
|
|
522
|
+
blendMode?: BlendMode,
|
|
523
|
+
colors?: SkColor[],
|
|
524
|
+
sampling?: CubicResampler | FilterOptions
|
|
525
|
+
): void;
|
|
526
|
+
|
|
496
527
|
/** Read Image pixels
|
|
497
528
|
*
|
|
498
529
|
* @param srcX - x-axis upper left corner of the rectangle to read from
|
|
@@ -5,6 +5,16 @@ import type { SkShader } from "../Shader";
|
|
|
5
5
|
|
|
6
6
|
import type { ImageInfo } from "./ImageFactory";
|
|
7
7
|
|
|
8
|
+
export interface CubicResampler {
|
|
9
|
+
B: number;
|
|
10
|
+
C: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface FilterOptions {
|
|
14
|
+
filter: FilterMode;
|
|
15
|
+
mipmap?: MipmapMode;
|
|
16
|
+
}
|
|
17
|
+
|
|
8
18
|
export enum FilterMode {
|
|
9
19
|
Nearest,
|
|
10
20
|
Linear,
|
|
@@ -356,13 +356,13 @@ export const convertToColumnMajor = (rowMajorMatrix: Matrix4) => {
|
|
|
356
356
|
colMajorMatrix[col * size + row] = rowMajorMatrix[row * size + col];
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
|
-
return colMajorMatrix;
|
|
359
|
+
return colMajorMatrix as unknown as Matrix4;
|
|
360
360
|
};
|
|
361
361
|
|
|
362
362
|
/**
|
|
363
363
|
* @worklet
|
|
364
364
|
*/
|
|
365
|
-
export const convertToAffineMatrix = (m4:
|
|
365
|
+
export const convertToAffineMatrix = (m4: Matrix4) => {
|
|
366
366
|
"worklet";
|
|
367
367
|
// Extracting the relevant components from the 4x4 matrix
|
|
368
368
|
const a = m4[0]; // Scale X
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import type { SkJSIInstance } from "./JsiInstance";
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface SkRSXform extends SkJSIInstance<"RSXform"> {
|
|
4
|
+
readonly scos: number;
|
|
5
|
+
readonly ssin: number;
|
|
6
|
+
readonly tx: number;
|
|
7
|
+
readonly ty: number;
|
|
8
|
+
set(scos: number, ssin: number, tx: number, ty: number): void;
|
|
9
|
+
}
|
package/src/skia/types/Rect.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SkJSIInstance } from "./JsiInstance";
|
|
2
|
+
|
|
1
3
|
export interface SkRect {
|
|
2
4
|
readonly x: number;
|
|
3
5
|
readonly y: number;
|
|
@@ -5,6 +7,10 @@ export interface SkRect {
|
|
|
5
7
|
readonly height: number;
|
|
6
8
|
}
|
|
7
9
|
|
|
10
|
+
export interface SkHostRect extends SkRect, SkJSIInstance<"Rect"> {
|
|
11
|
+
setXYWH(x: number, y: number, width: number, height: number): void;
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
export const isRect = (def: unknown): def is SkRect => {
|
|
9
15
|
"worklet";
|
|
10
16
|
if (typeof def === "object" && def !== null) {
|
|
@@ -7,7 +7,12 @@ export const isShader = (obj: SkJSIInstance<string> | null): obj is SkShader =>
|
|
|
7
7
|
|
|
8
8
|
export type SkShader = SkJSIInstance<"Shader">;
|
|
9
9
|
|
|
10
|
-
export type Uniform =
|
|
10
|
+
export type Uniform =
|
|
11
|
+
| number
|
|
12
|
+
| Vector
|
|
13
|
+
| Float32Array
|
|
14
|
+
| readonly Uniform[]
|
|
15
|
+
| Uniform[];
|
|
11
16
|
|
|
12
17
|
export interface Uniforms {
|
|
13
18
|
[name: string]: Uniform;
|
package/src/skia/types/Skia.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { SkTypeface, TypefaceFactory } from "./Typeface";
|
|
|
6
6
|
import type { ImageFactory } from "./Image";
|
|
7
7
|
import type { MaskFilterFactory } from "./MaskFilter";
|
|
8
8
|
import type { SkPaint } from "./Paint";
|
|
9
|
-
import type { SkRect } from "./Rect";
|
|
9
|
+
import type { SkHostRect, SkRect } from "./Rect";
|
|
10
10
|
import type { SkRRect } from "./RRect";
|
|
11
11
|
import type {
|
|
12
12
|
RuntimeEffectFactory,
|
|
@@ -36,10 +36,18 @@ import type { ParagraphBuilderFactory } from "./Paragraph/ParagraphBuilder";
|
|
|
36
36
|
*/
|
|
37
37
|
export interface Skia {
|
|
38
38
|
Point: (x: number, y: number) => SkPoint;
|
|
39
|
-
XYWHRect: (x: number, y: number, width: number, height: number) =>
|
|
39
|
+
XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;
|
|
40
40
|
RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;
|
|
41
41
|
RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;
|
|
42
42
|
RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;
|
|
43
|
+
RSXformFromRadians: (
|
|
44
|
+
scale: number,
|
|
45
|
+
radians: number,
|
|
46
|
+
tx: number,
|
|
47
|
+
ty: number,
|
|
48
|
+
px: number,
|
|
49
|
+
py: number
|
|
50
|
+
) => SkRSXform;
|
|
43
51
|
Color: (color: Color) => SkColor;
|
|
44
52
|
ContourMeasureIter: (
|
|
45
53
|
path: SkPath,
|
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import type { Canvas, CanvasKit } from "canvaskit-wasm";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
BlendMode,
|
|
5
|
-
ClipOp,
|
|
6
|
-
FilterMode,
|
|
7
|
-
MipmapMode,
|
|
8
|
-
PointMode,
|
|
9
|
-
SaveLayerFlag,
|
|
10
|
-
ImageInfo,
|
|
11
|
-
SkCanvas,
|
|
12
|
-
SkColor,
|
|
13
|
-
SkFont,
|
|
14
|
-
SkImage,
|
|
15
|
-
SkImageFilter,
|
|
16
|
-
SkMatrix,
|
|
17
|
-
SkPaint,
|
|
18
|
-
SkPath,
|
|
19
|
-
SkPicture,
|
|
20
|
-
SkPoint,
|
|
21
|
-
SkRect,
|
|
22
|
-
InputRRect,
|
|
23
|
-
SkSVG,
|
|
24
|
-
SkTextBlob,
|
|
25
|
-
SkVertices,
|
|
3
|
+
import {
|
|
4
|
+
type BlendMode,
|
|
5
|
+
type ClipOp,
|
|
6
|
+
type FilterMode,
|
|
7
|
+
type MipmapMode,
|
|
8
|
+
type PointMode,
|
|
9
|
+
type SaveLayerFlag,
|
|
10
|
+
type ImageInfo,
|
|
11
|
+
type SkCanvas,
|
|
12
|
+
type SkColor,
|
|
13
|
+
type SkFont,
|
|
14
|
+
type SkImage,
|
|
15
|
+
type SkImageFilter,
|
|
16
|
+
type SkMatrix,
|
|
17
|
+
type SkPaint,
|
|
18
|
+
type SkPath,
|
|
19
|
+
type SkPicture,
|
|
20
|
+
type SkPoint,
|
|
21
|
+
type SkRect,
|
|
22
|
+
type InputRRect,
|
|
23
|
+
type SkSVG,
|
|
24
|
+
type SkTextBlob,
|
|
25
|
+
type SkVertices,
|
|
26
|
+
type SkRSXform,
|
|
27
|
+
type CubicResampler,
|
|
28
|
+
type FilterOptions,
|
|
26
29
|
} from "../types";
|
|
27
30
|
|
|
28
31
|
import { getEnum, HostObject } from "./Host";
|
|
@@ -38,6 +41,7 @@ import { JsiSkPicture } from "./JsiSkPicture";
|
|
|
38
41
|
import { JsiSkMatrix } from "./JsiSkMatrix";
|
|
39
42
|
import { JsiSkImageFilter } from "./JsiSkImageFilter";
|
|
40
43
|
import { JsiSkPoint } from "./JsiSkPoint";
|
|
44
|
+
import { JsiSkRSXform } from "./JsiSkRSXform";
|
|
41
45
|
|
|
42
46
|
export class JsiSkCanvas
|
|
43
47
|
extends HostObject<Canvas, "Canvas">
|
|
@@ -383,6 +387,39 @@ export class JsiSkCanvas
|
|
|
383
387
|
this.ref.drawPicture(JsiSkPicture.fromValue(skp));
|
|
384
388
|
}
|
|
385
389
|
|
|
390
|
+
drawAtlas(
|
|
391
|
+
atlas: SkImage,
|
|
392
|
+
srcs: SkRect[],
|
|
393
|
+
dsts: SkRSXform[],
|
|
394
|
+
paint: SkPaint,
|
|
395
|
+
blendMode?: BlendMode,
|
|
396
|
+
colors?: SkColor[],
|
|
397
|
+
_sampling?: CubicResampler | FilterOptions
|
|
398
|
+
) {
|
|
399
|
+
const src = srcs.flatMap((s) =>
|
|
400
|
+
Array.from(JsiSkRect.fromValue(this.CanvasKit, s))
|
|
401
|
+
);
|
|
402
|
+
const dst = dsts.flatMap((s) => Array.from(JsiSkRSXform.fromValue(s)));
|
|
403
|
+
let cls: Uint32Array | undefined;
|
|
404
|
+
if (colors) {
|
|
405
|
+
cls = new Uint32Array(colors.length);
|
|
406
|
+
for (let i = 0; i < colors.length; i++) {
|
|
407
|
+
const [r, g, b, a] = colors[i];
|
|
408
|
+
cls[i] = this.CanvasKit.ColorAsInt(r * 255, g * 255, b * 255, a * 255);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
this.ref.drawAtlas(
|
|
412
|
+
JsiSkImage.fromValue(atlas),
|
|
413
|
+
src,
|
|
414
|
+
dst,
|
|
415
|
+
JsiSkPaint.fromValue(paint),
|
|
416
|
+
blendMode
|
|
417
|
+
? getEnum(this.CanvasKit.BlendMode, blendMode)
|
|
418
|
+
: this.CanvasKit.BlendMode.DstOver,
|
|
419
|
+
cls
|
|
420
|
+
);
|
|
421
|
+
}
|
|
422
|
+
|
|
386
423
|
readPixels(srcX: number, srcY: number, imageInfo: ImageInfo) {
|
|
387
424
|
const pxInfo = {
|
|
388
425
|
width: imageInfo.width,
|
|
@@ -2,19 +2,43 @@ import type { CanvasKit } from "canvaskit-wasm";
|
|
|
2
2
|
|
|
3
3
|
import type { SkRSXform } from "../types";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { BaseHostObject } from "./Host";
|
|
6
6
|
|
|
7
7
|
export type RSXform = Float32Array;
|
|
8
8
|
|
|
9
9
|
export class JsiSkRSXform
|
|
10
|
-
extends
|
|
10
|
+
extends BaseHostObject<RSXform, "RSXform">
|
|
11
11
|
implements SkRSXform
|
|
12
12
|
{
|
|
13
|
+
static fromValue(rsxform: SkRSXform) {
|
|
14
|
+
if (rsxform instanceof JsiSkRSXform) {
|
|
15
|
+
return rsxform.ref;
|
|
16
|
+
}
|
|
17
|
+
return Float32Array.of(rsxform.scos, rsxform.ssin, rsxform.tx, rsxform.ty);
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
constructor(CanvasKit: CanvasKit, ref: RSXform) {
|
|
14
21
|
super(CanvasKit, ref, "RSXform");
|
|
15
22
|
}
|
|
16
|
-
|
|
23
|
+
set(scos: number, ssin: number, tx: number, ty: number) {
|
|
24
|
+
this.ref[0] = scos;
|
|
25
|
+
this.ref[1] = ssin;
|
|
26
|
+
this.ref[2] = tx;
|
|
27
|
+
this.ref[3] = ty;
|
|
28
|
+
}
|
|
29
|
+
get scos() {
|
|
30
|
+
return this.ref[0];
|
|
31
|
+
}
|
|
32
|
+
get ssin() {
|
|
33
|
+
return this.ref[1];
|
|
34
|
+
}
|
|
35
|
+
get tx() {
|
|
36
|
+
return this.ref[2];
|
|
37
|
+
}
|
|
38
|
+
get ty() {
|
|
39
|
+
return this.ref[3];
|
|
40
|
+
}
|
|
17
41
|
dispose = () => {
|
|
18
|
-
//
|
|
42
|
+
// nothing to do here, RSXform is a Float32Array
|
|
19
43
|
};
|
|
20
44
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { CanvasKit, Rect } from "canvaskit-wasm";
|
|
2
2
|
|
|
3
|
-
import type { SkRect } from "../types";
|
|
3
|
+
import type { SkHostRect, SkRect } from "../types";
|
|
4
4
|
|
|
5
5
|
import { BaseHostObject } from "./Host";
|
|
6
6
|
|
|
7
|
-
export class JsiSkRect
|
|
7
|
+
export class JsiSkRect
|
|
8
|
+
extends BaseHostObject<Rect, "Rect">
|
|
9
|
+
implements SkHostRect
|
|
10
|
+
{
|
|
8
11
|
static fromValue(CanvasKit: CanvasKit, rect: SkRect) {
|
|
9
12
|
if (rect instanceof JsiSkRect) {
|
|
10
13
|
return rect.ref;
|
|
@@ -20,6 +23,13 @@ export class JsiSkRect extends BaseHostObject<Rect, "Rect"> implements SkRect {
|
|
|
20
23
|
super(CanvasKit, ref, "Rect");
|
|
21
24
|
}
|
|
22
25
|
|
|
26
|
+
setXYWH(x: number, y: number, width: number, height: number): void {
|
|
27
|
+
this.ref[0] = x;
|
|
28
|
+
this.ref[1] = y;
|
|
29
|
+
this.ref[2] = x + width;
|
|
30
|
+
this.ref[3] = y + height;
|
|
31
|
+
}
|
|
32
|
+
|
|
23
33
|
get x() {
|
|
24
34
|
return this.ref[0];
|
|
25
35
|
}
|
|
@@ -7,7 +7,6 @@ import type { SkRSXform } from "../types/RSXform";
|
|
|
7
7
|
import { Host } from "./Host";
|
|
8
8
|
import { JsiSkFont } from "./JsiSkFont";
|
|
9
9
|
import { JsiSkTextBlob } from "./JsiSkTextBlob";
|
|
10
|
-
import type { RSXform } from "./JsiSkRSXform";
|
|
11
10
|
import { JsiSkRSXform } from "./JsiSkRSXform";
|
|
12
11
|
|
|
13
12
|
export class JsiSkTextBlobFactory extends Host implements TextBlobFactory {
|
|
@@ -34,20 +33,21 @@ export class JsiSkTextBlobFactory extends Host implements TextBlobFactory {
|
|
|
34
33
|
this.CanvasKit,
|
|
35
34
|
this.CanvasKit.TextBlob.MakeFromRSXform(
|
|
36
35
|
str,
|
|
37
|
-
rsxforms
|
|
38
|
-
.map((f) => Array.from(JsiSkRSXform.fromValue<RSXform>(f)))
|
|
39
|
-
.flat(),
|
|
36
|
+
rsxforms.map((f) => Array.from(JsiSkRSXform.fromValue(f))).flat(),
|
|
40
37
|
JsiSkFont.fromValue(font)
|
|
41
38
|
)
|
|
42
39
|
);
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
MakeFromRSXformGlyphs(glyphs: number[], rsxforms: SkRSXform[], font: SkFont) {
|
|
43
|
+
const transforms = rsxforms.flatMap((s) =>
|
|
44
|
+
Array.from(JsiSkRSXform.fromValue(s))
|
|
45
|
+
);
|
|
46
46
|
return new JsiSkTextBlob(
|
|
47
47
|
this.CanvasKit,
|
|
48
48
|
this.CanvasKit.TextBlob.MakeFromRSXformGlyphs(
|
|
49
49
|
glyphs,
|
|
50
|
-
|
|
50
|
+
transforms,
|
|
51
51
|
JsiSkFont.fromValue(font)
|
|
52
52
|
)
|
|
53
53
|
);
|
package/src/skia/web/JsiSkia.ts
CHANGED
|
@@ -52,6 +52,21 @@ export const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({
|
|
|
52
52
|
new JsiSkRRect(CanvasKit, rect, rx, ry),
|
|
53
53
|
RSXform: (scos: number, ssin: number, tx: number, ty: number) =>
|
|
54
54
|
new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),
|
|
55
|
+
RSXformFromRadians: (
|
|
56
|
+
scale: number,
|
|
57
|
+
r: number,
|
|
58
|
+
tx: number,
|
|
59
|
+
ty: number,
|
|
60
|
+
px: number,
|
|
61
|
+
py: number
|
|
62
|
+
) => {
|
|
63
|
+
const s = Math.sin(r) * scale;
|
|
64
|
+
const c = Math.cos(r) * scale;
|
|
65
|
+
return new JsiSkRSXform(
|
|
66
|
+
CanvasKit,
|
|
67
|
+
Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)
|
|
68
|
+
);
|
|
69
|
+
},
|
|
55
70
|
Color,
|
|
56
71
|
ContourMeasureIter: (
|
|
57
72
|
path: SkPath,
|