@shopify/react-native-skia 2.9.1 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +8 -46
- package/android/build.gradle +33 -0
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -2
- package/cpp/api/JsiNativeBuffer.h +23 -24
- package/cpp/api/JsiSkAnimatedImage.h +24 -25
- package/cpp/api/JsiSkAnimatedImageFactory.h +18 -17
- package/cpp/api/JsiSkApi.h +254 -96
- package/cpp/api/JsiSkCanvas.h +141 -266
- package/cpp/api/JsiSkColor.h +7 -5
- package/cpp/api/JsiSkColorFilter.h +15 -8
- package/cpp/api/JsiSkColorFilterFactory.h +49 -67
- package/cpp/api/JsiSkContourMeasure.h +31 -38
- package/cpp/api/JsiSkContourMeasureIter.h +20 -23
- package/cpp/api/JsiSkConverters.h +410 -0
- package/cpp/api/JsiSkData.h +13 -7
- package/cpp/api/JsiSkDataFactory.h +27 -32
- package/cpp/api/JsiSkFont.h +123 -192
- package/cpp/api/JsiSkFontMgr.h +33 -26
- package/cpp/api/JsiSkFontMgrFactory.h +12 -11
- package/cpp/api/JsiSkFontStyle.h +14 -12
- package/cpp/api/JsiSkImage.h +90 -79
- package/cpp/api/JsiSkImageFactory.h +93 -95
- package/cpp/api/JsiSkImageFilter.h +21 -11
- package/cpp/api/JsiSkImageFilterFactory.h +375 -629
- package/cpp/api/JsiSkImageInfo.h +25 -25
- package/cpp/api/JsiSkMaskFilter.h +21 -11
- package/cpp/api/JsiSkMaskFilterFactory.h +17 -17
- package/cpp/api/JsiSkMatrix.h +51 -88
- package/cpp/api/JsiSkNativeObjects.h +387 -0
- package/cpp/api/JsiSkPaint.h +104 -142
- package/cpp/api/JsiSkParagraph.h +54 -64
- package/cpp/api/JsiSkParagraphBuilder.h +43 -68
- package/cpp/api/JsiSkParagraphBuilderFactory.h +20 -24
- package/cpp/api/JsiSkPath.h +242 -350
- package/cpp/api/JsiSkPathBuilder.h +153 -273
- package/cpp/api/JsiSkPathBuilderFactory.h +19 -20
- package/cpp/api/JsiSkPathEffect.h +21 -11
- package/cpp/api/JsiSkPathEffectFactory.h +61 -80
- package/cpp/api/JsiSkPathFactory.h +148 -238
- package/cpp/api/JsiSkPicture.h +32 -27
- package/cpp/api/JsiSkPictureFactory.h +21 -26
- package/cpp/api/JsiSkPictureRecorder.h +27 -29
- package/cpp/api/JsiSkPoint.h +20 -23
- package/cpp/api/JsiSkRRect.h +24 -32
- package/cpp/api/JsiSkRSXform.h +31 -48
- package/cpp/api/JsiSkRect.h +40 -50
- package/cpp/api/JsiSkRuntimeEffect.h +85 -92
- package/cpp/api/JsiSkRuntimeEffectFactory.h +14 -18
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +28 -30
- package/cpp/api/JsiSkSVG.h +15 -15
- package/cpp/api/JsiSkSVGFactory.h +17 -20
- package/cpp/api/JsiSkShader.h +15 -8
- package/cpp/api/JsiSkShaderFactory.h +159 -238
- package/cpp/api/JsiSkSkottie.h +131 -143
- package/cpp/api/JsiSkSurface.h +29 -32
- package/cpp/api/JsiSkSurfaceFactory.h +18 -20
- package/cpp/api/JsiSkTextBlob.h +15 -8
- package/cpp/api/JsiSkTextBlobFactory.h +40 -66
- package/cpp/api/JsiSkTypeface.h +25 -22
- package/cpp/api/JsiSkTypefaceFactory.h +17 -15
- package/cpp/api/JsiSkTypefaceFontProvider.h +43 -39
- package/cpp/api/JsiSkTypefaceFontProviderFactory.h +13 -12
- package/cpp/api/JsiSkVertices.h +23 -22
- package/cpp/api/JsiSkiaContext.h +22 -23
- package/cpp/api/JsiSkottieFactory.h +16 -17
- package/cpp/api/JsiVideo.h +43 -81
- package/cpp/api/recorder/Convertor.h +31 -61
- package/cpp/api/recorder/DataTypes.h +8 -16
- package/cpp/api/recorder/JsiRecorder.h +83 -55
- package/cpp/api/recorder/RNRecorder.h +1 -1
- package/cpp/jsi/BoxedNativeObject.h +146 -0
- package/cpp/{jsi2 → jsi}/EnumMapper.h +4 -1
- package/cpp/{jsi2 → jsi}/JSIConverter.h +0 -31
- package/cpp/{jsi2 → jsi}/NativeObject.h +131 -152
- package/cpp/jsi/RuntimeAwareCache.cpp +1 -1
- package/cpp/jsi/RuntimeAwareCache.h +26 -8
- package/cpp/jsi/ViewProperty.h +5 -11
- package/cpp/rnskia/RNDawnContext.h +18 -2
- package/cpp/rnskia/RNDawnInterop.cpp +19 -0
- package/cpp/rnskia/RNDawnUtils.h +18 -1
- package/cpp/rnskia/RNSkJsiViewApi.h +20 -11
- package/cpp/rnskia/RNSkManager.cpp +9 -168
- package/cpp/rnskia/RNSkPictureView.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h +2 -0
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/commonjs/external/reanimated/renderHelpers.js +30 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/skia/NativeSetup.js +4 -0
- package/lib/commonjs/skia/NativeSetup.js.map +1 -1
- package/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js +66 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +15 -6
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +5 -15
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/index.d.ts +0 -1
- package/lib/commonjs/skia/types/index.js +0 -11
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +1 -4
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/sksg/Container.native.js +20 -1
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/views/index.d.ts +0 -1
- package/lib/commonjs/views/index.js +0 -11
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/module/external/reanimated/renderHelpers.js +29 -0
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/skia/NativeSetup.js +4 -0
- package/lib/module/skia/NativeSetup.js.map +1 -1
- package/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/module/skia/SkiaWorkletSerialization.js +59 -0
- package/lib/module/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/module/skia/types/Image/ImageFactory.d.ts +15 -6
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +5 -15
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/index.d.ts +0 -1
- package/lib/module/skia/types/index.js +0 -1
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/module/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +1 -4
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/sksg/Container.native.js +21 -2
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/views/index.d.ts +0 -1
- package/lib/module/views/index.js +0 -1
- package/lib/module/views/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
- package/lib/typescript/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +1 -2
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/lib/module/mock/index.d.ts +0 -2
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -2
- package/lib/typescript/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/index.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +1 -2
- package/lib/typescript/lib/module/views/index.d.ts +0 -1
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/src/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +15 -6
- package/lib/typescript/src/skia/types/Skia.d.ts +5 -15
- package/lib/typescript/src/skia/types/index.d.ts +0 -1
- package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/src/views/index.d.ts +0 -1
- package/package.json +8 -5
- package/react-native-skia.podspec +38 -5
- package/src/external/reanimated/renderHelpers.ts +30 -0
- package/src/mock/index.ts +0 -1
- package/src/skia/NativeSetup.ts +5 -0
- package/src/skia/SkiaWorkletSerialization.ts +67 -0
- package/src/skia/types/Image/ImageFactory.ts +15 -6
- package/src/skia/types/Skia.ts +5 -15
- package/src/skia/types/index.ts +0 -1
- package/src/skia/web/JsiSkImageFactory.ts +3 -3
- package/src/skia/web/JsiSkia.ts +2 -5
- package/src/sksg/Container.native.ts +40 -2
- package/src/views/index.ts +0 -1
- package/android/cpp/jni/JniWebGPUView.cpp +0 -112
- package/android/cpp/rnskia-android/SkiaPlatformContext.h +0 -26
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUSurfaceView.java +0 -43
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUTextureView.java +0 -50
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUView.java +0 -98
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewAPI.java +0 -19
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewManager.java +0 -58
- package/apple/RNWebGPUAppleNativeBuffer.mm +0 -33
- package/apple/SkiaPlatformContext.h +0 -20
- package/apple/SkiaPlatformContext.mm +0 -21
- package/apple/SkiaWebGPUView.mm +0 -81
- package/apple/WebGPUMetalView.mm +0 -136
- package/cpp/api/JsiSkHostObjects.h +0 -257
- package/cpp/jsi/JsiHostObject.cpp +0 -137
- package/cpp/jsi/JsiHostObject.h +0 -385
- package/cpp/rnwgpu/ArrayBuffer.h +0 -117
- package/cpp/rnwgpu/Canvas.h +0 -50
- package/cpp/rnwgpu/PlatformContext.h +0 -18
- package/cpp/rnwgpu/SurfaceRegistry.h +0 -605
- package/cpp/rnwgpu/api/AppleNativeBuffer.h +0 -22
- package/cpp/rnwgpu/api/Convertors.h +0 -783
- package/cpp/rnwgpu/api/External.h +0 -12
- package/cpp/rnwgpu/api/GPU.cpp +0 -162
- package/cpp/rnwgpu/api/GPU.h +0 -60
- package/cpp/rnwgpu/api/GPUAdapter.cpp +0 -240
- package/cpp/rnwgpu/api/GPUAdapter.h +0 -60
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +0 -57
- package/cpp/rnwgpu/api/GPUBindGroup.cpp +0 -3
- package/cpp/rnwgpu/api/GPUBindGroup.h +0 -51
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +0 -52
- package/cpp/rnwgpu/api/GPUBuffer.cpp +0 -107
- package/cpp/rnwgpu/api/GPUBuffer.h +0 -88
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +0 -75
- package/cpp/rnwgpu/api/GPUCanvasContext.h +0 -70
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +0 -45
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +0 -179
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +0 -111
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +0 -79
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +0 -36
- package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +0 -60
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +0 -85
- package/cpp/rnwgpu/api/GPUComputePipeline.cpp +0 -12
- package/cpp/rnwgpu/api/GPUComputePipeline.h +0 -60
- package/cpp/rnwgpu/api/GPUDevice.cpp +0 -614
- package/cpp/rnwgpu/api/GPUDevice.h +0 -258
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +0 -7
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +0 -40
- package/cpp/rnwgpu/api/GPUError.h +0 -35
- package/cpp/rnwgpu/api/GPUExtent3D.h +0 -66
- package/cpp/rnwgpu/api/GPUExternalTexture.cpp +0 -139
- package/cpp/rnwgpu/api/GPUExternalTexture.h +0 -95
- package/cpp/rnwgpu/api/GPUFeatures.h +0 -203
- package/cpp/rnwgpu/api/GPUInternalError.h +0 -31
- package/cpp/rnwgpu/api/GPUOrigin2D.h +0 -55
- package/cpp/rnwgpu/api/GPUOrigin3D.h +0 -62
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +0 -33
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +0 -45
- package/cpp/rnwgpu/api/GPUQuerySet.cpp +0 -11
- package/cpp/rnwgpu/api/GPUQuerySet.h +0 -73
- package/cpp/rnwgpu/api/GPUQueue.cpp +0 -179
- package/cpp/rnwgpu/api/GPUQueue.h +0 -84
- package/cpp/rnwgpu/api/GPURenderBundle.h +0 -44
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +0 -131
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +0 -110
- package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +0 -165
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +0 -130
- package/cpp/rnwgpu/api/GPURenderPipeline.cpp +0 -13
- package/cpp/rnwgpu/api/GPURenderPipeline.h +0 -61
- package/cpp/rnwgpu/api/GPUSampler.h +0 -44
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +0 -56
- package/cpp/rnwgpu/api/GPUShaderModule.h +0 -66
- package/cpp/rnwgpu/api/GPUSharedFence.cpp +0 -80
- package/cpp/rnwgpu/api/GPUSharedFence.h +0 -53
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +0 -135
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +0 -75
- package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +0 -129
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +0 -131
- package/cpp/rnwgpu/api/GPUTexture.cpp +0 -47
- package/cpp/rnwgpu/api/GPUTexture.h +0 -162
- package/cpp/rnwgpu/api/GPUTextureView.h +0 -44
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -60
- package/cpp/rnwgpu/api/GPUValidationError.h +0 -32
- package/cpp/rnwgpu/api/ImageBitmap.h +0 -62
- package/cpp/rnwgpu/api/NativeBufferUtils.h +0 -87
- package/cpp/rnwgpu/api/RNWebGPU.h +0 -82
- package/cpp/rnwgpu/api/WebGPUConstants.h +0 -36
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +0 -64
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +0 -78
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +0 -97
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +0 -52
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +0 -39
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +0 -76
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +0 -66
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +0 -29
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +0 -67
- package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +0 -103
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +0 -109
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +0 -38
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +0 -90
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +0 -73
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +0 -63
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +0 -65
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +0 -22
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +0 -69
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +0 -61
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +0 -55
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +0 -43
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +0 -80
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +0 -101
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +0 -92
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +0 -103
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +0 -51
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +0 -110
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +0 -60
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +0 -25
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +0 -51
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +0 -73
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +0 -64
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +0 -91
- package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +0 -29
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +0 -91
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +0 -64
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +0 -53
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +0 -73
- package/cpp/rnwgpu/api/descriptors/Unions.h +0 -1969
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +0 -214
- package/cpp/rnwgpu/async/AsyncTaskHandle.h +0 -58
- package/cpp/rnwgpu/async/RuntimeContext.cpp +0 -199
- package/cpp/rnwgpu/async/RuntimeContext.h +0 -134
- package/lib/commonjs/skia/types/WebGPU.d.ts +0 -184
- package/lib/commonjs/skia/types/WebGPU.js +0 -105
- package/lib/commonjs/skia/types/WebGPU.js.map +0 -1
- package/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +0 -8
- package/lib/commonjs/specs/WebGPUViewNativeComponent.js +0 -10
- package/lib/commonjs/specs/WebGPUViewNativeComponent.js.map +0 -1
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js +0 -103
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js.map +0 -1
- package/lib/commonjs/specs/utils.d.ts +0 -1
- package/lib/commonjs/specs/utils.js +0 -11
- package/lib/commonjs/specs/utils.js.map +0 -1
- package/lib/commonjs/views/WebGPUCanvas.d.ts +0 -33
- package/lib/commonjs/views/WebGPUCanvas.js +0 -79
- package/lib/commonjs/views/WebGPUCanvas.js.map +0 -1
- package/lib/commonjs/views/WebGPUCanvas.web.d.ts +0 -23
- package/lib/commonjs/views/WebGPUCanvas.web.js +0 -20
- package/lib/commonjs/views/WebGPUCanvas.web.js.map +0 -1
- package/lib/module/skia/types/WebGPU.d.ts +0 -184
- package/lib/module/skia/types/WebGPU.js +0 -99
- package/lib/module/skia/types/WebGPU.js.map +0 -1
- package/lib/module/specs/WebGPUViewNativeComponent.d.ts +0 -8
- package/lib/module/specs/WebGPUViewNativeComponent.js +0 -4
- package/lib/module/specs/WebGPUViewNativeComponent.js.map +0 -1
- package/lib/module/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
- package/lib/module/specs/WebGPUViewNativeComponent.web.js +0 -96
- package/lib/module/specs/WebGPUViewNativeComponent.web.js.map +0 -1
- package/lib/module/specs/utils.d.ts +0 -1
- package/lib/module/specs/utils.js +0 -5
- package/lib/module/specs/utils.js.map +0 -1
- package/lib/module/views/WebGPUCanvas.d.ts +0 -33
- package/lib/module/views/WebGPUCanvas.js +0 -70
- package/lib/module/views/WebGPUCanvas.js.map +0 -1
- package/lib/module/views/WebGPUCanvas.web.d.ts +0 -23
- package/lib/module/views/WebGPUCanvas.web.js +0 -12
- package/lib/module/views/WebGPUCanvas.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/skia/types/WebGPU.d.ts +0 -2
- package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +0 -4
- package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.web.d.ts +0 -3
- package/lib/typescript/lib/commonjs/specs/utils.d.ts +0 -2
- package/lib/typescript/lib/commonjs/views/WebGPUCanvas.d.ts +0 -6
- package/lib/typescript/lib/commonjs/views/WebGPUCanvas.web.d.ts +0 -6
- package/lib/typescript/lib/module/skia/types/WebGPU.d.ts +0 -31
- package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.d.ts +0 -2
- package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.web.d.ts +0 -2
- package/lib/typescript/lib/module/specs/utils.d.ts +0 -1
- package/lib/typescript/lib/module/views/WebGPUCanvas.d.ts +0 -7
- package/lib/typescript/lib/module/views/WebGPUCanvas.web.d.ts +0 -8
- package/lib/typescript/src/skia/types/WebGPU.d.ts +0 -184
- package/lib/typescript/src/specs/WebGPUViewNativeComponent.d.ts +0 -8
- package/lib/typescript/src/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
- package/lib/typescript/src/specs/utils.d.ts +0 -1
- package/lib/typescript/src/views/WebGPUCanvas.d.ts +0 -33
- package/lib/typescript/src/views/WebGPUCanvas.web.d.ts +0 -23
- package/src/skia/types/WebGPU.ts +0 -226
- package/src/specs/WebGPUViewNativeComponent.ts +0 -11
- package/src/specs/WebGPUViewNativeComponent.web.ts +0 -110
- package/src/specs/utils.ts +0 -4
- package/src/views/WebGPUCanvas.tsx +0 -125
- package/src/views/WebGPUCanvas.web.tsx +0 -36
- /package/cpp/{jsi2 → jsi}/Promise.cpp +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.h +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Platform } from "../Platform";
|
|
2
2
|
import NativeSkiaModule from "../specs/NativeSkiaModule";
|
|
3
|
+
import { registerSkiaWorkletSerialization } from "./SkiaWorkletSerialization";
|
|
3
4
|
if (Platform.OS !== "web" && global.SkiaApi == null) {
|
|
4
5
|
// Initialize RN Skia
|
|
5
6
|
const SkiaModule = NativeSkiaModule;
|
|
@@ -10,5 +11,8 @@ if (Platform.OS !== "web" && global.SkiaApi == null) {
|
|
|
10
11
|
if (result !== true) {
|
|
11
12
|
throw new Error(`Native Skia Module failed to correctly install JSI Bindings! Result: ${result}`);
|
|
12
13
|
}
|
|
14
|
+
// Skia objects use the JSI NativeState pattern and need a custom
|
|
15
|
+
// serializer to be transferable to worklet runtimes (Reanimated).
|
|
16
|
+
registerSkiaWorkletSerialization();
|
|
13
17
|
}
|
|
14
18
|
//# sourceMappingURL=NativeSetup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","NativeSkiaModule","OS","global","SkiaApi","SkiaModule","install","Error","result"],"sources":["NativeSetup.ts"],"sourcesContent":["import { Platform } from \"../Platform\";\nimport NativeSkiaModule from \"../specs/NativeSkiaModule\";\n\nif (Platform.OS !== \"web\" && global.SkiaApi == null) {\n // Initialize RN Skia\n const SkiaModule = NativeSkiaModule;\n if (SkiaModule == null || typeof SkiaModule.install !== \"function\") {\n throw new Error(\n \"Native RNSkia Module cannot be found! Make sure you correctly \" +\n \"installed native dependencies and rebuilt your app.\"\n );\n }\n const result = SkiaModule.install();\n if (result !== true) {\n throw new Error(\n `Native Skia Module failed to correctly install JSI Bindings! Result: ${result}`\n );\n }\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,aAAa;AACtC,OAAOC,gBAAgB,MAAM,2BAA2B;AAExD,
|
|
1
|
+
{"version":3,"names":["Platform","NativeSkiaModule","registerSkiaWorkletSerialization","OS","global","SkiaApi","SkiaModule","install","Error","result"],"sources":["NativeSetup.ts"],"sourcesContent":["import { Platform } from \"../Platform\";\nimport NativeSkiaModule from \"../specs/NativeSkiaModule\";\n\nimport { registerSkiaWorkletSerialization } from \"./SkiaWorkletSerialization\";\n\nif (Platform.OS !== \"web\" && global.SkiaApi == null) {\n // Initialize RN Skia\n const SkiaModule = NativeSkiaModule;\n if (SkiaModule == null || typeof SkiaModule.install !== \"function\") {\n throw new Error(\n \"Native RNSkia Module cannot be found! Make sure you correctly \" +\n \"installed native dependencies and rebuilt your app.\"\n );\n }\n const result = SkiaModule.install();\n if (result !== true) {\n throw new Error(\n `Native Skia Module failed to correctly install JSI Bindings! Result: ${result}`\n );\n }\n // Skia objects use the JSI NativeState pattern and need a custom\n // serializer to be transferable to worklet runtimes (Reanimated).\n registerSkiaWorkletSerialization();\n}\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,aAAa;AACtC,OAAOC,gBAAgB,MAAM,2BAA2B;AAExD,SAASC,gCAAgC,QAAQ,4BAA4B;AAE7E,IAAIF,QAAQ,CAACG,EAAE,KAAK,KAAK,IAAIC,MAAM,CAACC,OAAO,IAAI,IAAI,EAAE;EACnD;EACA,MAAMC,UAAU,GAAGL,gBAAgB;EACnC,IAAIK,UAAU,IAAI,IAAI,IAAI,OAAOA,UAAU,CAACC,OAAO,KAAK,UAAU,EAAE;IAClE,MAAM,IAAIC,KAAK,CACb,gEAAgE,GAC9D,qDACJ,CAAC;EACH;EACA,MAAMC,MAAM,GAAGH,UAAU,CAACC,OAAO,CAAC,CAAC;EACnC,IAAIE,MAAM,KAAK,IAAI,EAAE;IACnB,MAAM,IAAID,KAAK,CACb,wEAAwEC,MAAM,EAChF,CAAC;EACH;EACA;EACA;EACAP,gCAAgC,CAAC,CAAC;AACpC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const registerSkiaWorkletSerialization: () => void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Skia and WebGPU API objects are implemented with the JSI NativeState
|
|
5
|
+
* pattern: plain JS objects with a shared prototype and native state
|
|
6
|
+
* attached. Worklets cannot serialize such objects by default (the prototype
|
|
7
|
+
* would be lost when moving them to another runtime), so we register a
|
|
8
|
+
* Custom Serializable that:
|
|
9
|
+
*
|
|
10
|
+
* - determine: detects native objects via the `__box` method installed on
|
|
11
|
+
* every Skia and WebGPU prototype (plain objects never reach the
|
|
12
|
+
* custom-serializable path, so this cannot misfire on user data).
|
|
13
|
+
* - pack: boxes the object into a HostObject wrapper that carries the native
|
|
14
|
+
* state and the class brand. HostObjects are transferred by reference.
|
|
15
|
+
* - unpack: unboxes on the target runtime, re-installing the class prototype
|
|
16
|
+
* there and re-attaching the same native state.
|
|
17
|
+
*
|
|
18
|
+
* See cpp/jsi/BoxedNativeObject.h for the native side.
|
|
19
|
+
*
|
|
20
|
+
* `react-native-worklets` (Reanimated 4) is required for this to work —
|
|
21
|
+
* without it, Skia and WebGPU objects cannot be captured in worklets or
|
|
22
|
+
* stored in shared values.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const determine = value => {
|
|
26
|
+
"worklet";
|
|
27
|
+
|
|
28
|
+
return typeof value.__box === "function";
|
|
29
|
+
};
|
|
30
|
+
const pack = value => {
|
|
31
|
+
"worklet";
|
|
32
|
+
|
|
33
|
+
return value.__box();
|
|
34
|
+
};
|
|
35
|
+
const unpack = packed => {
|
|
36
|
+
"worklet";
|
|
37
|
+
|
|
38
|
+
return packed.unbox();
|
|
39
|
+
};
|
|
40
|
+
export const registerSkiaWorkletSerialization = () => {
|
|
41
|
+
try {
|
|
42
|
+
const worklets = require("react-native-worklets");
|
|
43
|
+
if (typeof worklets.registerCustomSerializable === "function") {
|
|
44
|
+
worklets.registerCustomSerializable({
|
|
45
|
+
name: "ReactNativeSkia",
|
|
46
|
+
determine,
|
|
47
|
+
pack,
|
|
48
|
+
unpack
|
|
49
|
+
});
|
|
50
|
+
} else {
|
|
51
|
+
console.error("React Native Skia requires react-native-worklets >= 0.7.0 " + "(registerCustomSerializable) to use Skia objects inside worklets. " + "Please upgrade react-native-worklets and react-native-reanimated.");
|
|
52
|
+
}
|
|
53
|
+
} catch (e) {
|
|
54
|
+
// react-native-worklets is not installed. This is fine for apps that do
|
|
55
|
+
// not use Reanimated: Skia objects simply cannot be used inside worklets
|
|
56
|
+
// or shared values in this configuration.
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=SkiaWorkletSerialization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["determine","value","__box","pack","unpack","packed","unbox","registerSkiaWorkletSerialization","worklets","require","registerCustomSerializable","name","console","error","e"],"sources":["SkiaWorkletSerialization.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n/**\n * Skia and WebGPU API objects are implemented with the JSI NativeState\n * pattern: plain JS objects with a shared prototype and native state\n * attached. Worklets cannot serialize such objects by default (the prototype\n * would be lost when moving them to another runtime), so we register a\n * Custom Serializable that:\n *\n * - determine: detects native objects via the `__box` method installed on\n * every Skia and WebGPU prototype (plain objects never reach the\n * custom-serializable path, so this cannot misfire on user data).\n * - pack: boxes the object into a HostObject wrapper that carries the native\n * state and the class brand. HostObjects are transferred by reference.\n * - unpack: unboxes on the target runtime, re-installing the class prototype\n * there and re-attaching the same native state.\n *\n * See cpp/jsi/BoxedNativeObject.h for the native side.\n *\n * `react-native-worklets` (Reanimated 4) is required for this to work —\n * without it, Skia and WebGPU objects cannot be captured in worklets or\n * stored in shared values.\n */\n\ninterface BoxedNativeObject {\n unbox: () => object;\n __boxedNativeObject: true;\n}\n\nconst determine = (value: object): value is object => {\n \"worklet\";\n return typeof (value as any).__box === \"function\";\n};\n\nconst pack = (value: object): BoxedNativeObject => {\n \"worklet\";\n return (value as any).__box();\n};\n\nconst unpack = (packed: BoxedNativeObject): object => {\n \"worklet\";\n return packed.unbox();\n};\n\nexport const registerSkiaWorkletSerialization = () => {\n try {\n const worklets = require(\"react-native-worklets\");\n if (typeof worklets.registerCustomSerializable === \"function\") {\n worklets.registerCustomSerializable({\n name: \"ReactNativeSkia\",\n determine,\n pack,\n unpack,\n });\n } else {\n console.error(\n \"React Native Skia requires react-native-worklets >= 0.7.0 \" +\n \"(registerCustomSerializable) to use Skia objects inside worklets. \" +\n \"Please upgrade react-native-worklets and react-native-reanimated.\"\n );\n }\n } catch (e) {\n // react-native-worklets is not installed. This is fine for apps that do\n // not use Reanimated: Skia objects simply cannot be used inside worklets\n // or shared values in this configuration.\n }\n};\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,MAAMA,SAAS,GAAIC,KAAa,IAAsB;EACpD,SAAS;;EACT,OAAO,OAAQA,KAAK,CAASC,KAAK,KAAK,UAAU;AACnD,CAAC;AAED,MAAMC,IAAI,GAAIF,KAAa,IAAwB;EACjD,SAAS;;EACT,OAAQA,KAAK,CAASC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,MAAME,MAAM,GAAIC,MAAyB,IAAa;EACpD,SAAS;;EACT,OAAOA,MAAM,CAACC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,OAAO,MAAMC,gCAAgC,GAAGA,CAAA,KAAM;EACpD,IAAI;IACF,MAAMC,QAAQ,GAAGC,OAAO,CAAC,uBAAuB,CAAC;IACjD,IAAI,OAAOD,QAAQ,CAACE,0BAA0B,KAAK,UAAU,EAAE;MAC7DF,QAAQ,CAACE,0BAA0B,CAAC;QAClCC,IAAI,EAAE,iBAAiB;QACvBX,SAAS;QACTG,IAAI;QACJC;MACF,CAAC,CAAC;IACJ,CAAC,MAAM;MACLQ,OAAO,CAACC,KAAK,CACX,4DAA4D,GAC1D,oEAAoE,GACpE,mEACJ,CAAC;IACH;EACF,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV;IACA;IACA;EAAA;AAEJ,CAAC","ignoreList":[]}
|
|
@@ -80,22 +80,31 @@ export interface ImageFactory {
|
|
|
80
80
|
MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;
|
|
81
81
|
/**
|
|
82
82
|
* Creates an SkImage from a WebGPU texture.
|
|
83
|
-
* This allows using textures rendered by WebGPU in Skia drawings.
|
|
83
|
+
* This allows using textures rendered by WebGPU in Skia drawings. The
|
|
84
|
+
* texture crosses the package boundary as a raw pointer: pass
|
|
85
|
+
* `texture.nativePointer` from a react-native-webgpu GPUTexture created on
|
|
86
|
+
* the shared device (importDevice(Skia.getNativeDevice())). The native side
|
|
87
|
+
* takes its own reference, so the handle stays valid even if the JS
|
|
88
|
+
* GPUTexture is garbage collected — but do not call texture.destroy()
|
|
89
|
+
* while the image is in use: destroy() releases the underlying GPU
|
|
90
|
+
* resource regardless of reference counts.
|
|
84
91
|
*
|
|
85
92
|
* Note: This method is only available when the Graphite backend is enabled.
|
|
86
93
|
*
|
|
87
|
-
* @param
|
|
94
|
+
* @param pointer - The WGPUTexture pointer (texture.nativePointer)
|
|
88
95
|
* @returns An SkImage wrapping the texture, or throws if the texture is invalid
|
|
89
96
|
*/
|
|
90
|
-
|
|
97
|
+
MakeImageFromNativeTexture(pointer: bigint): SkImage;
|
|
91
98
|
/**
|
|
92
99
|
* Creates a WebGPU texture from an SkImage.
|
|
93
|
-
* This allows using Skia images in WebGPU rendering pipelines.
|
|
100
|
+
* This allows using Skia images in WebGPU rendering pipelines. The
|
|
101
|
+
* returned pointer carries one reference and must be adopted exactly once
|
|
102
|
+
* with react-native-webgpu's adoptTexture(), which owns it from then on.
|
|
94
103
|
*
|
|
95
104
|
* Note: This method is only available when the Graphite backend is enabled.
|
|
96
105
|
*
|
|
97
106
|
* @param image - An SkImage to convert to a texture
|
|
98
|
-
* @returns A
|
|
107
|
+
* @returns A WGPUTexture pointer for adoptTexture(), or throws on failure
|
|
99
108
|
*/
|
|
100
|
-
|
|
109
|
+
MakeNativeTextureFromImage(image: SkImage): bigint;
|
|
101
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["AlphaType"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\nimport type { NativeBuffer } from \"../NativeBuffer\";\n\nimport type { ColorType } from \"./ColorType\";\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport interface ImageInfo {\n alphaType: AlphaType;\n // TODO: add support for color space\n // colorSpace: ColorSpace;\n colorType: ColorType;\n height: number;\n width: number;\n}\n\nexport interface ImageFactory {\n MakeNull: () => SkImage;\n /**\n * Return an Image backed by the encoded data, but attempt to defer decoding until the image\n * is actually used/drawn. This deferral allows the system to cache the result, either on the\n * CPU or on the GPU, depending on where the image is drawn.\n * This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are\n * invalid (or an unrecognized codec), null will be returned. See Image.h for more details.\n * @param data - Data object with bytes of data\n * @returns If the encoded format is not supported, or subset is outside of the bounds of the decoded\n * image, nullptr is returned.\n */\n MakeImageFromEncoded: (encoded: SkData) => SkImage | null;\n\n /**\n * Return an Image backed by a given native buffer.\n * The native buffer must be a valid owning reference.\n *\n * For instance, this API is used by\n * [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)\n * to render a Skia Camera preview.\n *\n * - On Android; This is an `AHardwareBuffer*`\n * - On iOS, this is a `CVPixelBufferRef`\n * @param nativeBuffer A strong `uintptr_t` pointer to the native buffer\n * @throws Throws an error if the Image could not be created, for example when the given\n * native buffer is invalid.\n */\n MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;\n\n /**\n *\n * Return an Image backed by a given native texture.\n *\n * The native texture must be a valid owning reference.\n *\n * This API might be used to integrate with other libraries using gpu textures,\n * or to transfer images between different threads.\n *\n * @param texture A native texture handle\n * @param width The width of the texture\n * @param height The height of the texture\n * @param mipmapped Whether the texture is mipmapped\n * @throws Throws an error if the Image could not be created, for example when the given native texture is invalid.\n *\n * @returns Returns a valid SkImage, if the texture is invalid, an error is thrown.\n */\n MakeImageFromNativeTextureUnstable: (\n texture: unknown,\n width: number,\n height: number,\n mipmapped?: boolean,\n outputImage?: SkImage\n ) => SkImage;\n\n /**\n * Returns an image that will be a screenshot of the view represented by\n * the view tag\n * @param viewTag - The tag of the view to make an image from.\n * @returns Returns a valid SkImage, if the view tag is invalid, nullptr is returned.\n */\n MakeImageFromViewTag: (viewTag: number) => Promise<SkImage | null>;\n\n /**\n * Returns an image with the given pixel data and format.\n * Note that we will always make a copy of the pixel data, because of inconsistencies in\n * behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and\n * not modifiable after creation).\n *\n * @param info\n * @param data - bytes representing the pixel data.\n * @param bytesPerRow\n */\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;\n\n /**\n * Creates an SkImage from a WebGPU texture.\n * This allows using textures rendered by WebGPU in Skia drawings.\n *\n * Note: This method is only available when the Graphite backend is enabled.\n *\n * @param
|
|
1
|
+
{"version":3,"names":["AlphaType"],"sources":["ImageFactory.ts"],"sourcesContent":["import type { SkData } from \"../Data\";\nimport type { NativeBuffer } from \"../NativeBuffer\";\n\nimport type { ColorType } from \"./ColorType\";\nimport type { SkImage } from \"./Image\";\n\nexport enum AlphaType {\n Unknown,\n Opaque,\n Premul,\n Unpremul,\n}\n\nexport interface ImageInfo {\n alphaType: AlphaType;\n // TODO: add support for color space\n // colorSpace: ColorSpace;\n colorType: ColorType;\n height: number;\n width: number;\n}\n\nexport interface ImageFactory {\n MakeNull: () => SkImage;\n /**\n * Return an Image backed by the encoded data, but attempt to defer decoding until the image\n * is actually used/drawn. This deferral allows the system to cache the result, either on the\n * CPU or on the GPU, depending on where the image is drawn.\n * This decoding uses the codecs that have been compiled into CanvasKit. If the bytes are\n * invalid (or an unrecognized codec), null will be returned. See Image.h for more details.\n * @param data - Data object with bytes of data\n * @returns If the encoded format is not supported, or subset is outside of the bounds of the decoded\n * image, nullptr is returned.\n */\n MakeImageFromEncoded: (encoded: SkData) => SkImage | null;\n\n /**\n * Return an Image backed by a given native buffer.\n * The native buffer must be a valid owning reference.\n *\n * For instance, this API is used by\n * [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera)\n * to render a Skia Camera preview.\n *\n * - On Android; This is an `AHardwareBuffer*`\n * - On iOS, this is a `CVPixelBufferRef`\n * @param nativeBuffer A strong `uintptr_t` pointer to the native buffer\n * @throws Throws an error if the Image could not be created, for example when the given\n * native buffer is invalid.\n */\n MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage;\n\n /**\n *\n * Return an Image backed by a given native texture.\n *\n * The native texture must be a valid owning reference.\n *\n * This API might be used to integrate with other libraries using gpu textures,\n * or to transfer images between different threads.\n *\n * @param texture A native texture handle\n * @param width The width of the texture\n * @param height The height of the texture\n * @param mipmapped Whether the texture is mipmapped\n * @throws Throws an error if the Image could not be created, for example when the given native texture is invalid.\n *\n * @returns Returns a valid SkImage, if the texture is invalid, an error is thrown.\n */\n MakeImageFromNativeTextureUnstable: (\n texture: unknown,\n width: number,\n height: number,\n mipmapped?: boolean,\n outputImage?: SkImage\n ) => SkImage;\n\n /**\n * Returns an image that will be a screenshot of the view represented by\n * the view tag\n * @param viewTag - The tag of the view to make an image from.\n * @returns Returns a valid SkImage, if the view tag is invalid, nullptr is returned.\n */\n MakeImageFromViewTag: (viewTag: number) => Promise<SkImage | null>;\n\n /**\n * Returns an image with the given pixel data and format.\n * Note that we will always make a copy of the pixel data, because of inconsistencies in\n * behavior between GPU and CPU (i.e. the pixel data will be turned into a GPU texture and\n * not modifiable after creation).\n *\n * @param info\n * @param data - bytes representing the pixel data.\n * @param bytesPerRow\n */\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): SkImage | null;\n\n /**\n * Creates an SkImage from a WebGPU texture.\n * This allows using textures rendered by WebGPU in Skia drawings. The\n * texture crosses the package boundary as a raw pointer: pass\n * `texture.nativePointer` from a react-native-webgpu GPUTexture created on\n * the shared device (importDevice(Skia.getNativeDevice())). The native side\n * takes its own reference, so the handle stays valid even if the JS\n * GPUTexture is garbage collected — but do not call texture.destroy()\n * while the image is in use: destroy() releases the underlying GPU\n * resource regardless of reference counts.\n *\n * Note: This method is only available when the Graphite backend is enabled.\n *\n * @param pointer - The WGPUTexture pointer (texture.nativePointer)\n * @returns An SkImage wrapping the texture, or throws if the texture is invalid\n */\n MakeImageFromNativeTexture(pointer: bigint): SkImage;\n\n /**\n * Creates a WebGPU texture from an SkImage.\n * This allows using Skia images in WebGPU rendering pipelines. The\n * returned pointer carries one reference and must be adopted exactly once\n * with react-native-webgpu's adoptTexture(), which owns it from then on.\n *\n * Note: This method is only available when the Graphite backend is enabled.\n *\n * @param image - An SkImage to convert to a texture\n * @returns A WGPUTexture pointer for adoptTexture(), or throws on failure\n */\n MakeNativeTextureFromImage(image: SkImage): bigint;\n}\n"],"mappings":"AAMA,WAAYA,SAAS,0BAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAATA,SAAS,CAATA,SAAS;EAAA,OAATA,SAAS;AAAA","ignoreList":[]}
|
|
@@ -86,20 +86,10 @@ export interface Skia {
|
|
|
86
86
|
NativeBuffer: NativeBufferFactory;
|
|
87
87
|
Recorder(): JsiRecorder;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
89
|
+
* Raw WGPUDevice pointer of Skia's Graphite device, as a BigInt. Pass it to
|
|
90
|
+
* react-native-webgpu's importDevice() to get a GPUDevice sharing Skia's
|
|
91
|
+
* device (zero-copy interop). Only available on Graphite builds; throws
|
|
92
|
+
* otherwise.
|
|
92
93
|
*/
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Returns the shared WebGPU device used by Skia's Graphite backend.
|
|
96
|
-
* This allows direct access to the GPU device for WebGPU operations.
|
|
97
|
-
*
|
|
98
|
-
* Note: This method is only available when the Graphite backend is enabled.
|
|
99
|
-
* Use hasDevice() to check availability before calling this method.
|
|
100
|
-
*
|
|
101
|
-
* @returns The GPUDevice used by Skia
|
|
102
|
-
* @throws Error if Graphite backend is not enabled
|
|
103
|
-
*/
|
|
104
|
-
getDevice(): GPUDevice;
|
|
94
|
+
getNativeDevice(): bigint;
|
|
105
95
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory, PathBuilderFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SkSurface, SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\nimport type { Video } from \"./Video\";\nimport type { NativeBufferFactory } from \"./NativeBuffer\";\nimport type { JsiRecorder } from \"./Recorder\";\nimport type { SkottieFactory } from \"./Skottie\";\n\nexport interface SkiaContext {\n getSurface(): SkSurface;\n present(): void;\n}\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n PathBuilder: PathBuilderFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n ParagraphBuilder: ParagraphBuilderFactory;\n Skottie: SkottieFactory;\n Video: (url: string) => Promise<Video> | Video;\n Context(surface: bigint, width: number, height: number): SkiaContext;\n NativeBuffer: NativeBufferFactory;\n Recorder(): JsiRecorder;\n /**\n *
|
|
1
|
+
{"version":3,"names":[],"sources":["Skia.ts"],"sourcesContent":["import type { ImageFilterFactory } from \"./ImageFilter\";\nimport type { PathFactory, PathBuilderFactory } from \"./Path\";\nimport type { ColorFilterFactory } from \"./ColorFilter\";\nimport type { SkFont, FontMgrFactory } from \"./Font\";\nimport type { SkTypeface, TypefaceFactory } from \"./Typeface\";\nimport type { ImageFactory } from \"./Image\";\nimport type { MaskFilterFactory } from \"./MaskFilter\";\nimport type { SkPaint } from \"./Paint\";\nimport type { SkHostRect, SkRect } from \"./Rect\";\nimport type { SkRRect } from \"./RRect\";\nimport type {\n RuntimeEffectFactory,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n} from \"./RuntimeEffect\";\nimport type { ShaderFactory } from \"./Shader\";\nimport type { SkMatrix } from \"./Matrix\";\nimport type { PathEffectFactory } from \"./PathEffect\";\nimport type { SkPoint } from \"./Point\";\nimport type { SkVertices, VertexMode } from \"./Vertices/Vertices\";\nimport type { DataFactory } from \"./Data\";\nimport type { SVGFactory } from \"./SVG\";\nimport type { TextBlobFactory } from \"./TextBlob\";\nimport type { SkSurface, SurfaceFactory } from \"./Surface\";\nimport type { SkRSXform } from \"./RSXform\";\nimport type { SkPath } from \"./Path/Path\";\nimport type { SkContourMeasureIter } from \"./ContourMeasure\";\nimport type { PictureFactory, SkPictureRecorder } from \"./Picture\";\nimport type { Color, SkColor } from \"./Color\";\nimport type { TypefaceFontProviderFactory } from \"./Paragraph/TypefaceFontProviderFactory\";\nimport type { AnimatedImageFactory } from \"./AnimatedImage\";\nimport type { ParagraphBuilderFactory } from \"./Paragraph/ParagraphBuilder\";\nimport type { Video } from \"./Video\";\nimport type { NativeBufferFactory } from \"./NativeBuffer\";\nimport type { JsiRecorder } from \"./Recorder\";\nimport type { SkottieFactory } from \"./Skottie\";\n\nexport interface SkiaContext {\n getSurface(): SkSurface;\n present(): void;\n}\n\n/**\n * Declares the interface for the native Skia API\n */\nexport interface Skia {\n Point: (x: number, y: number) => SkPoint;\n XYWHRect: (x: number, y: number, width: number, height: number) => SkHostRect;\n RuntimeShaderBuilder: (rt: SkRuntimeEffect) => SkRuntimeShaderBuilder;\n RRectXY: (rect: SkRect, rx: number, ry: number) => SkRRect;\n RSXform: (scos: number, ssin: number, tx: number, ty: number) => SkRSXform;\n RSXformFromRadians: (\n scale: number,\n radians: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => SkRSXform;\n Color: (color: Color) => SkColor;\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ) => SkContourMeasureIter;\n Paint: () => SkPaint;\n PictureRecorder: () => SkPictureRecorder;\n Picture: PictureFactory;\n Path: PathFactory;\n PathBuilder: PathBuilderFactory;\n Matrix: (matrix?: readonly number[]) => SkMatrix;\n ColorFilter: ColorFilterFactory;\n Font: (typeface?: SkTypeface, size?: number) => SkFont;\n Typeface: TypefaceFactory;\n TypefaceFontProvider: TypefaceFontProviderFactory;\n FontMgr: FontMgrFactory;\n MaskFilter: MaskFilterFactory;\n RuntimeEffect: RuntimeEffectFactory;\n ImageFilter: ImageFilterFactory;\n Shader: ShaderFactory;\n PathEffect: PathEffectFactory;\n /**\n * Returns an Vertices based on the given positions and optional parameters.\n * See SkVertices.h (especially the Builder) for more details.\n * @param mode\n * @param positions\n * @param textureCoordinates\n * @param colors - either a list of int colors or a flattened color array.\n * @param indices\n * @param isVolatile\n */\n MakeVertices(\n mode: VertexMode,\n positions: SkPoint[],\n textureCoordinates?: SkPoint[] | null,\n colors?: SkColor[],\n indices?: number[] | null,\n isVolatile?: boolean\n ): SkVertices;\n Data: DataFactory;\n Image: ImageFactory;\n AnimatedImage: AnimatedImageFactory;\n SVG: SVGFactory;\n TextBlob: TextBlobFactory;\n Surface: SurfaceFactory;\n ParagraphBuilder: ParagraphBuilderFactory;\n Skottie: SkottieFactory;\n Video: (url: string) => Promise<Video> | Video;\n Context(surface: bigint, width: number, height: number): SkiaContext;\n NativeBuffer: NativeBufferFactory;\n Recorder(): JsiRecorder;\n /**\n * Raw WGPUDevice pointer of Skia's Graphite device, as a BigInt. Pass it to\n * react-native-webgpu's importDevice() to get a GPUDevice sharing Skia's\n * device (zero-copy interop). Only available on Graphite builds; throws\n * otherwise.\n */\n getNativeDevice(): bigint;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Picture\";\nexport * from \"./Data\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./Vertices\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./AnimatedImage\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Paint\";\nexport * from \"./Path\";\nexport * from \"./Color\";\nexport * from \"./Canvas\";\nexport * from \"./ContourMeasure\";\nexport * from \"./MaskFilter\";\nexport * from \"./Matrix\";\nexport * from \"./PathEffect\";\nexport * from \"./Point\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./RSXform\";\nexport * from \"./JsiInstance\";\nexport * from \"./Skia\";\nexport * from \"./TextBlob\";\nexport * from \"./Size\";\nexport * from \"./Paragraph\";\nexport * from \"./Matrix4\";\nexport * from \"./NativeBuffer\";\nexport * from \"./
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Picture\";\nexport * from \"./Data\";\nexport * from \"./SVG\";\nexport * from \"./Surface\";\nexport * from \"./Vertices\";\nexport * from \"./RuntimeEffect\";\nexport * from \"./Shader\";\nexport * from \"./Image\";\nexport * from \"./AnimatedImage\";\nexport * from \"./ColorFilter\";\nexport * from \"./ImageFilter\";\nexport * from \"./Font\";\nexport * from \"./Typeface\";\nexport * from \"./Paint\";\nexport * from \"./Path\";\nexport * from \"./Color\";\nexport * from \"./Canvas\";\nexport * from \"./ContourMeasure\";\nexport * from \"./MaskFilter\";\nexport * from \"./Matrix\";\nexport * from \"./PathEffect\";\nexport * from \"./Point\";\nexport * from \"./Rect\";\nexport * from \"./RRect\";\nexport * from \"./RSXform\";\nexport * from \"./JsiInstance\";\nexport * from \"./Skia\";\nexport * from \"./TextBlob\";\nexport * from \"./Size\";\nexport * from \"./Paragraph\";\nexport * from \"./Matrix4\";\nexport * from \"./NativeBuffer\";\nexport * from \"./Recorder\";\nexport * from \"./Video\";\nexport * from \"./Skottie\";\n"],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,OAAO;AACrB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,iBAAiB;AAC/B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,kBAAkB;AAChC,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,WAAW","ignoreList":[]}
|
|
@@ -11,6 +11,6 @@ export declare class JsiSkImageFactory extends Host implements ImageFactory {
|
|
|
11
11
|
MakeImageFromEncoded(encoded: SkData): JsiSkImage | null;
|
|
12
12
|
MakeImageFromNativeTextureUnstable(): SkImage;
|
|
13
13
|
MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number): JsiSkImage | null;
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
MakeImageFromNativeTexture(_pointer: bigint): SkImage;
|
|
15
|
+
MakeNativeTextureFromImage(_image: SkImage): bigint;
|
|
16
16
|
}
|
|
@@ -63,10 +63,10 @@ export class JsiSkImageFactory extends Host {
|
|
|
63
63
|
}
|
|
64
64
|
return new JsiSkImage(this.CanvasKit, image);
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
MakeImageFromNativeTexture(_pointer) {
|
|
67
67
|
return throwNotImplementedOnRNWeb();
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
MakeNativeTextureFromImage(_image) {
|
|
70
70
|
return throwNotImplementedOnRNWeb();
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CanvasKitWebGLBuffer","isNativeBufferWeb","Host","getEnum","throwNotImplementedOnRNWeb","JsiSkImage","JsiSkData","JsiSkImageFactory","constructor","CanvasKit","MakeNull","MakeImageFromViewTag","viewTag","view","console","log","Promise","resolve","MakeImageFromNativeBuffer","buffer","surface","image","Error","img","HTMLImageElement","HTMLVideoElement","ImageBitmap","MakeLazyImageFromTextureSource","toImage","MakeImageFromCanvasImageSource","makeImageFromTextureSource","updateTextureFromSource","MakeImageFromEncoded","encoded","fromValue","MakeImageFromNativeTextureUnstable","MakeImage","info","data","bytesPerRow","alphaType","colorSpace","ColorSpace","SRGB","colorType","height","width","
|
|
1
|
+
{"version":3,"names":["CanvasKitWebGLBuffer","isNativeBufferWeb","Host","getEnum","throwNotImplementedOnRNWeb","JsiSkImage","JsiSkData","JsiSkImageFactory","constructor","CanvasKit","MakeNull","MakeImageFromViewTag","viewTag","view","console","log","Promise","resolve","MakeImageFromNativeBuffer","buffer","surface","image","Error","img","HTMLImageElement","HTMLVideoElement","ImageBitmap","MakeLazyImageFromTextureSource","toImage","MakeImageFromCanvasImageSource","makeImageFromTextureSource","updateTextureFromSource","MakeImageFromEncoded","encoded","fromValue","MakeImageFromNativeTextureUnstable","MakeImage","info","data","bytesPerRow","alphaType","colorSpace","ColorSpace","SRGB","colorType","height","width","MakeImageFromNativeTexture","_pointer","MakeNativeTextureFromImage","_image"],"sources":["JsiSkImageFactory.ts"],"sourcesContent":["import type { CanvasKit, Image } from \"canvaskit-wasm\";\n\nimport { CanvasKitWebGLBuffer, isNativeBufferWeb } from \"../types\";\nimport type {\n SkData,\n ImageInfo,\n SkImage,\n NativeBuffer,\n ImageFactory,\n} from \"../types\";\n\nimport { Host, getEnum, throwNotImplementedOnRNWeb } from \"./Host\";\nimport { JsiSkImage } from \"./JsiSkImage\";\nimport { JsiSkData } from \"./JsiSkData\";\nimport type { JsiSkSurface } from \"./JsiSkSurface\";\nimport type { CanvasKitWebGLBufferImpl } from \"./CanvasKitWebGLBufferImpl\";\n\nexport class JsiSkImageFactory extends Host implements ImageFactory {\n constructor(CanvasKit: CanvasKit) {\n super(CanvasKit);\n }\n\n MakeNull() {\n return new JsiSkImage(this.CanvasKit, null as unknown as Image);\n }\n\n MakeImageFromViewTag(viewTag: number): Promise<SkImage | null> {\n const view = viewTag as unknown as HTMLElement;\n // TODO: Implement screenshot from view in React JS\n console.log(view);\n return Promise.resolve(null);\n }\n\n MakeImageFromNativeBuffer(\n buffer: NativeBuffer,\n surface?: JsiSkSurface,\n image?: JsiSkImage\n ) {\n if (!isNativeBufferWeb(buffer)) {\n throw new Error(\"Invalid NativeBuffer\");\n }\n if (!surface) {\n let img: Image;\n if (\n buffer instanceof HTMLImageElement ||\n buffer instanceof HTMLVideoElement ||\n buffer instanceof ImageBitmap\n ) {\n img = this.CanvasKit.MakeLazyImageFromTextureSource(buffer);\n } else if (buffer instanceof CanvasKitWebGLBuffer) {\n img = (\n buffer as CanvasKitWebGLBuffer as CanvasKitWebGLBufferImpl\n ).toImage();\n } else {\n img = this.CanvasKit.MakeImageFromCanvasImageSource(buffer);\n }\n return new JsiSkImage(this.CanvasKit, img);\n } else if (!image) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).makeImageFromTextureSource(buffer) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const img = (surface as any).updateTextureFromSource(\n image,\n buffer\n ) as Image;\n return new JsiSkImage(this.CanvasKit, img);\n }\n }\n\n MakeImageFromEncoded(encoded: SkData) {\n const image = this.CanvasKit.MakeImageFromEncoded(\n JsiSkData.fromValue(encoded)\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n MakeImageFromNativeTextureUnstable() {\n return throwNotImplementedOnRNWeb<SkImage>();\n }\n\n MakeImage(info: ImageInfo, data: SkData, bytesPerRow: number) {\n // see toSkImageInfo() from canvaskit\n const image = this.CanvasKit.MakeImage(\n {\n alphaType: getEnum(this.CanvasKit, \"AlphaType\", info.alphaType),\n colorSpace: this.CanvasKit.ColorSpace.SRGB,\n colorType: getEnum(this.CanvasKit, \"ColorType\", info.colorType),\n height: info.height,\n width: info.width,\n },\n JsiSkData.fromValue(data),\n bytesPerRow\n );\n if (image === null) {\n return null;\n }\n return new JsiSkImage(this.CanvasKit, image);\n }\n\n MakeImageFromNativeTexture(_pointer: bigint): SkImage {\n return throwNotImplementedOnRNWeb<SkImage>();\n }\n\n MakeNativeTextureFromImage(_image: SkImage): bigint {\n return throwNotImplementedOnRNWeb<bigint>();\n }\n}\n"],"mappings":"AAEA,SAASA,oBAAoB,EAAEC,iBAAiB,QAAQ,UAAU;AASlE,SAASC,IAAI,EAAEC,OAAO,EAAEC,0BAA0B,QAAQ,QAAQ;AAClE,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AAIvC,OAAO,MAAMC,iBAAiB,SAASL,IAAI,CAAyB;EAClEM,WAAWA,CAACC,SAAoB,EAAE;IAChC,KAAK,CAACA,SAAS,CAAC;EAClB;EAEAC,QAAQA,CAAA,EAAG;IACT,OAAO,IAAIL,UAAU,CAAC,IAAI,CAACI,SAAS,EAAE,IAAwB,CAAC;EACjE;EAEAE,oBAAoBA,CAACC,OAAe,EAA2B;IAC7D,MAAMC,IAAI,GAAGD,OAAiC;IAC9C;IACAE,OAAO,CAACC,GAAG,CAACF,IAAI,CAAC;IACjB,OAAOG,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC;EAC9B;EAEAC,yBAAyBA,CACvBC,MAAoB,EACpBC,OAAsB,EACtBC,KAAkB,EAClB;IACA,IAAI,CAACpB,iBAAiB,CAACkB,MAAM,CAAC,EAAE;MAC9B,MAAM,IAAIG,KAAK,CAAC,sBAAsB,CAAC;IACzC;IACA,IAAI,CAACF,OAAO,EAAE;MACZ,IAAIG,GAAU;MACd,IACEJ,MAAM,YAAYK,gBAAgB,IAClCL,MAAM,YAAYM,gBAAgB,IAClCN,MAAM,YAAYO,WAAW,EAC7B;QACAH,GAAG,GAAG,IAAI,CAACd,SA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G,SAAS,CAAC;MAC/DC,UAAU,EAAE,IAAI,CAAChC,SAAS,CAACiC,UAAU,CAACC,IAAI;MAC1CC,SAAS,EAAEzC,OAAO,CAAC,IAAI,CAACM,SAAS,EAAE,WAAW,EAAE4B,IAAI,CAACO,SAAS,CAAC;MAC/DC,MAAM,EAAER,IAAI,CAACQ,MAAM;MACnBC,KAAK,EAAET,IAAI,CAACS;IACd,CAAC,EACDxC,SAAS,CAAC4B,SAAS,CAACI,IAAI,CAAC,EACzBC,WACF,CAAC;IACD,IAAIlB,KAAK,KAAK,IAAI,EAAE;MAClB,OAAO,IAAI;IACb;IACA,OAAO,IAAIhB,UAAU,CAAC,IAAI,CAACI,SAAS,EAAEY,KAAK,CAAC;EAC9C;EAEA0B,0BAA0BA,CAACC,QAAgB,EAAW;IACpD,OAAO5C,0BAA0B,CAAU,CAAC;EAC9C;EAEA6C,0BAA0BA,CAACC,MAAe,EAAU;IAClD,OAAO9C,0BAA0B,CAAS,CAAC;EAC7C;AACF","ignoreList":[]}
|
|
@@ -93,11 +93,8 @@ export const JsiSkApi = CanvasKit => ({
|
|
|
93
93
|
Recorder: () => {
|
|
94
94
|
return throwNotImplementedOnRNWeb();
|
|
95
95
|
},
|
|
96
|
-
|
|
96
|
+
getNativeDevice: () => {
|
|
97
97
|
return throwNotImplementedOnRNWeb();
|
|
98
|
-
},
|
|
99
|
-
hasDevice: () => {
|
|
100
|
-
return false;
|
|
101
98
|
}
|
|
102
99
|
});
|
|
103
100
|
//# sourceMappingURL=JsiSkia.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkPathBuilderFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkAnimatedImageFactory","JsiSkParagraphBuilderFactory","JsiSkNativeBufferFactory","createVideo","throwNotImplementedOnRNWeb","JsiSkottieFactory","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","ContourMeasureIter","path","forceClosed","resScale","p","pathFromValue","iter","delete","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","PathBuilder","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","fromValue","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","AnimatedImage","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr","ParagraphBuilder","NativeBuffer","Skottie","Video","Context","_surface","_width","_height","Recorder","getDevice","hasDevice"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n JsiRecorder,\n SkContourMeasureIter,\n Skia,\n SkiaContext,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkPathBuilderFactory } from \"./JsiSkPathBuilderFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\nimport { throwNotImplementedOnRNWeb } from \"./Host\";\nimport { JsiSkottieFactory } from \"./JsiSkottieFactory\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect) => {\n return throwNotImplementedOnRNWeb<SkRuntimeShaderBuilder>();\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n (() => {\n const p = JsiSkPath.pathFromValue(path);\n const iter = new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(p, forceClosed, resScale)\n );\n p.delete();\n return iter;\n })(),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n PathBuilder: new JsiSkPathBuilderFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Skottie: new JsiSkottieFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n return throwNotImplementedOnRNWeb<SkiaContext>();\n },\n Recorder: () => {\n return throwNotImplementedOnRNWeb<JsiRecorder>();\n },\n getDevice: () => {\n return throwNotImplementedOnRNWeb<GPUDevice>();\n },\n hasDevice: () => {\n return false;\n },\n});\n"],"mappings":"AAcA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,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;IACd,OAAOhF,0BAA0B,CAAc,CAAC;EAClD,CAAC;EACDiF,SAAS,EAAEA,CAAA,KAAM;IACf,OAAOjF,0BAA0B,CAAY,CAAC;EAChD,CAAC;EACDkF,SAAS,EAAEA,CAAA,KAAM;IACf,OAAO,KAAK;EACd;AACF,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["JsiSkPoint","JsiSkPaint","JsiSkRect","Color","JsiSkSurfaceFactory","JsiSkRRect","JsiSkRSXform","JsiSkContourMeasureIter","JsiSkPictureRecorder","JsiSkPictureFactory","JsiSkPathFactory","JsiSkPathBuilderFactory","JsiSkMatrix","JsiSkColorFilterFactory","JsiSkTypefaceFactory","JsiSkMaskFilterFactory","JsiSkRuntimeEffectFactory","JsiSkImageFilterFactory","JsiSkShaderFactory","JsiSkPathEffectFactory","JsiSkDataFactory","JsiSkImageFactory","JsiSkSVGFactory","JsiSkTextBlobFactory","JsiSkFont","MakeVertices","JsiSkPath","JsiSkTypeface","JsiSkTypefaceFontProviderFactory","JsiSkFontMgrFactory","JsiSkAnimatedImageFactory","JsiSkParagraphBuilderFactory","JsiSkNativeBufferFactory","createVideo","throwNotImplementedOnRNWeb","JsiSkottieFactory","JsiSkApi","CanvasKit","Point","x","y","Float32Array","of","RuntimeShaderBuilder","_","RRectXY","rect","rx","ry","RSXform","scos","ssin","tx","ty","RSXformFromRadians","scale","r","px","py","s","Math","sin","c","cos","ContourMeasureIter","path","forceClosed","resScale","p","pathFromValue","iter","delete","Paint","paint","setAntiAlias","PictureRecorder","Picture","Path","PathBuilder","Matrix","matrix","identity","ColorFilter","Font","typeface","size","undefined","fromValue","Typeface","MaskFilter","RuntimeEffect","ImageFilter","Shader","PathEffect","bind","Data","Image","AnimatedImage","SVG","TextBlob","XYWHRect","width","height","Surface","TypefaceFontProvider","FontMgr","ParagraphBuilder","NativeBuffer","Skottie","Video","Context","_surface","_width","_height","Recorder","getNativeDevice"],"sources":["JsiSkia.ts"],"sourcesContent":["import type { CanvasKit } from \"canvaskit-wasm\";\n\nimport type {\n JsiRecorder,\n SkContourMeasureIter,\n Skia,\n SkiaContext,\n SkPath,\n SkRect,\n SkRuntimeEffect,\n SkRuntimeShaderBuilder,\n SkTypeface,\n} from \"../types\";\n\nimport { JsiSkPoint } from \"./JsiSkPoint\";\nimport { JsiSkPaint } from \"./JsiSkPaint\";\nimport { JsiSkRect } from \"./JsiSkRect\";\nimport { Color } from \"./JsiSkColor\";\nimport { JsiSkSurfaceFactory } from \"./JsiSkSurfaceFactory\";\nimport { JsiSkRRect } from \"./JsiSkRRect\";\nimport { JsiSkRSXform } from \"./JsiSkRSXform\";\nimport { JsiSkContourMeasureIter } from \"./JsiSkContourMeasureIter\";\nimport { JsiSkPictureRecorder } from \"./JsiSkPictureRecorder\";\nimport { JsiSkPictureFactory } from \"./JsiSkPictureFactory\";\nimport { JsiSkPathFactory } from \"./JsiSkPathFactory\";\nimport { JsiSkPathBuilderFactory } from \"./JsiSkPathBuilderFactory\";\nimport { JsiSkMatrix } from \"./JsiSkMatrix\";\nimport { JsiSkColorFilterFactory } from \"./JsiSkColorFilterFactory\";\nimport { JsiSkTypefaceFactory } from \"./JsiSkTypefaceFactory\";\nimport { JsiSkMaskFilterFactory } from \"./JsiSkMaskFilterFactory\";\nimport { JsiSkRuntimeEffectFactory } from \"./JsiSkRuntimeEffectFactory\";\nimport { JsiSkImageFilterFactory } from \"./JsiSkImageFilterFactory\";\nimport { JsiSkShaderFactory } from \"./JsiSkShaderFactory\";\nimport { JsiSkPathEffectFactory } from \"./JsiSkPathEffectFactory\";\nimport { JsiSkDataFactory } from \"./JsiSkDataFactory\";\nimport { JsiSkImageFactory } from \"./JsiSkImageFactory\";\nimport { JsiSkSVGFactory } from \"./JsiSkSVGFactory\";\nimport { JsiSkTextBlobFactory } from \"./JsiSkTextBlobFactory\";\nimport { JsiSkFont } from \"./JsiSkFont\";\nimport { MakeVertices } from \"./JsiSkVerticesFactory\";\nimport { JsiSkPath } from \"./JsiSkPath\";\nimport { JsiSkTypeface } from \"./JsiSkTypeface\";\nimport { JsiSkTypefaceFontProviderFactory } from \"./JsiSkTypefaceFontProviderFactory\";\nimport { JsiSkFontMgrFactory } from \"./JsiSkFontMgrFactory\";\nimport { JsiSkAnimatedImageFactory } from \"./JsiSkAnimatedImageFactory\";\nimport { JsiSkParagraphBuilderFactory } from \"./JsiSkParagraphBuilderFactory\";\nimport { JsiSkNativeBufferFactory } from \"./JsiSkNativeBufferFactory\";\nimport { createVideo } from \"./JsiVideo\";\nimport { throwNotImplementedOnRNWeb } from \"./Host\";\nimport { JsiSkottieFactory } from \"./JsiSkottieFactory\";\n\nexport const JsiSkApi = (CanvasKit: CanvasKit): Skia => ({\n Point: (x: number, y: number) =>\n new JsiSkPoint(CanvasKit, Float32Array.of(x, y)),\n RuntimeShaderBuilder: (_: SkRuntimeEffect) => {\n return throwNotImplementedOnRNWeb<SkRuntimeShaderBuilder>();\n },\n RRectXY: (rect: SkRect, rx: number, ry: number) =>\n new JsiSkRRect(CanvasKit, rect, rx, ry),\n RSXform: (scos: number, ssin: number, tx: number, ty: number) =>\n new JsiSkRSXform(CanvasKit, Float32Array.of(scos, ssin, tx, ty)),\n RSXformFromRadians: (\n scale: number,\n r: number,\n tx: number,\n ty: number,\n px: number,\n py: number\n ) => {\n const s = Math.sin(r) * scale;\n const c = Math.cos(r) * scale;\n return new JsiSkRSXform(\n CanvasKit,\n Float32Array.of(c, s, tx - c * px + s * py, ty - s * px - c * py)\n );\n },\n Color,\n ContourMeasureIter: (\n path: SkPath,\n forceClosed: boolean,\n resScale: number\n ): SkContourMeasureIter =>\n (() => {\n const p = JsiSkPath.pathFromValue(path);\n const iter = new JsiSkContourMeasureIter(\n CanvasKit,\n new CanvasKit.ContourMeasureIter(p, forceClosed, resScale)\n );\n p.delete();\n return iter;\n })(),\n Paint: () => {\n const paint = new JsiSkPaint(CanvasKit, new CanvasKit.Paint());\n paint.setAntiAlias(true);\n return paint;\n },\n PictureRecorder: () =>\n new JsiSkPictureRecorder(CanvasKit, new CanvasKit.PictureRecorder()),\n Picture: new JsiSkPictureFactory(CanvasKit),\n Path: new JsiSkPathFactory(CanvasKit),\n PathBuilder: new JsiSkPathBuilderFactory(CanvasKit),\n Matrix: (matrix?: readonly number[]) =>\n new JsiSkMatrix(\n CanvasKit,\n matrix\n ? Float32Array.of(...matrix)\n : Float32Array.of(...CanvasKit.Matrix.identity())\n ),\n ColorFilter: new JsiSkColorFilterFactory(CanvasKit),\n Font: (typeface?: SkTypeface, size?: number) =>\n new JsiSkFont(\n CanvasKit,\n new CanvasKit.Font(\n typeface === undefined ? null : JsiSkTypeface.fromValue(typeface),\n size\n )\n ),\n Typeface: new JsiSkTypefaceFactory(CanvasKit),\n MaskFilter: new JsiSkMaskFilterFactory(CanvasKit),\n RuntimeEffect: new JsiSkRuntimeEffectFactory(CanvasKit),\n ImageFilter: new JsiSkImageFilterFactory(CanvasKit),\n Shader: new JsiSkShaderFactory(CanvasKit),\n PathEffect: new JsiSkPathEffectFactory(CanvasKit),\n MakeVertices: MakeVertices.bind(null, CanvasKit),\n Data: new JsiSkDataFactory(CanvasKit),\n Image: new JsiSkImageFactory(CanvasKit),\n AnimatedImage: new JsiSkAnimatedImageFactory(CanvasKit),\n SVG: new JsiSkSVGFactory(CanvasKit),\n TextBlob: new JsiSkTextBlobFactory(CanvasKit),\n XYWHRect: (x: number, y: number, width: number, height: number) => {\n return new JsiSkRect(CanvasKit, CanvasKit.XYWHRect(x, y, width, height));\n },\n Surface: new JsiSkSurfaceFactory(CanvasKit),\n TypefaceFontProvider: new JsiSkTypefaceFontProviderFactory(CanvasKit),\n FontMgr: new JsiSkFontMgrFactory(CanvasKit),\n ParagraphBuilder: new JsiSkParagraphBuilderFactory(CanvasKit),\n NativeBuffer: new JsiSkNativeBufferFactory(CanvasKit),\n Skottie: new JsiSkottieFactory(CanvasKit),\n Video: createVideo.bind(null, CanvasKit),\n Context: (_surface: bigint, _width: number, _height: number) => {\n return throwNotImplementedOnRNWeb<SkiaContext>();\n },\n Recorder: () => {\n return throwNotImplementedOnRNWeb<JsiRecorder>();\n },\n getNativeDevice: () => {\n return throwNotImplementedOnRNWeb<bigint>();\n },\n});\n"],"mappings":"AAcA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,KAAK,QAAQ,cAAc;AACpC,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,kBAAkB,QAAQ,sBAAsB;AACzD,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,iBAAiB,QAAQ,qBAAqB;AACvD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,gCAAgC,QAAQ,oCAAoC;AACrF,SAASC,mBAAmB,QAAQ,uBAAuB;AAC3D,SAASC,yBAAyB,QAAQ,6BAA6B;AACvE,SAASC,4BA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OAAO,EAAE,IAAI5E,mBAAmB,CAACQ,SAAS,CAAC;EAC3CqE,gBAAgB,EAAE,IAAI3E,4BAA4B,CAACM,SAAS,CAAC;EAC7DsE,YAAY,EAAE,IAAI3E,wBAAwB,CAACK,SAAS,CAAC;EACrDuE,OAAO,EAAE,IAAIzE,iBAAiB,CAACE,SAAS,CAAC;EACzCwE,KAAK,EAAE5E,WAAW,CAAC6D,IAAI,CAAC,IAAI,EAAEzD,SAAS,CAAC;EACxCyE,OAAO,EAAEA,CAACC,QAAgB,EAAEC,MAAc,EAAEC,OAAe,KAAK;IAC9D,OAAO/E,0BAA0B,CAAc,CAAC;EAClD,CAAC;EACDgF,QAAQ,EAAEA,CAAA,KAAM;IACd,OAAOhF,0BAA0B,CAAc,CAAC;EAClD,CAAC;EACDiF,eAAe,EAAEA,CAAA,KAAM;IACrB,OAAOjF,0BAA0B,CAAS,CAAC;EAC7C;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
2
2
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
3
3
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
4
4
|
import Rea from "../external/reanimated/ReanimatedProxy";
|
|
5
|
-
import { HAS_REANIMATED_3 } from "../external/reanimated/renderHelpers";
|
|
5
|
+
import { HAS_REANIMATED_3, HAS_REANIMATED_4, REANIMATED_VERSION_MAJOR } from "../external/reanimated/renderHelpers";
|
|
6
6
|
import { ReanimatedRecorder } from "./Recorder/ReanimatedRecorder";
|
|
7
7
|
import { Container, StaticContainer } from "./StaticContainer";
|
|
8
8
|
import { visit } from "./Recorder/Visitor";
|
|
@@ -73,10 +73,29 @@ class NativeReanimatedContainer extends Container {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
+
let hasWarnedAboutReanimatedSupport = false;
|
|
77
|
+
const reanimatedSupportError = () => {
|
|
78
|
+
if (REANIMATED_VERSION_MAJOR !== null && REANIMATED_VERSION_MAJOR >= 4) {
|
|
79
|
+
return "React Native Skia requires react-native-worklets >= 0.7.0 for its " + "Reanimated integration on native platforms. Reanimated 4 is " + "installed, but react-native-worklets is missing or too old. " + "Please install or upgrade react-native-worklets.";
|
|
80
|
+
}
|
|
81
|
+
return "React Native Skia requires Reanimated 4 (react-native-worklets >= " + "0.7.0) for its Reanimated integration on native platforms. " + "Reanimated 3 is not supported anymore: Skia objects cannot be used " + "inside worklets or shared values with it. " + "Please upgrade to react-native-reanimated >= 4.0.0.";
|
|
82
|
+
};
|
|
76
83
|
export const createContainer = (Skia, nativeId) => {
|
|
77
|
-
if (
|
|
84
|
+
if (HAS_REANIMATED_4 && nativeId !== -1) {
|
|
78
85
|
return new NativeReanimatedContainer(Skia, nativeId);
|
|
79
86
|
} else {
|
|
87
|
+
if (HAS_REANIMATED_3 && !HAS_REANIMATED_4) {
|
|
88
|
+
const message = reanimatedSupportError();
|
|
89
|
+
if (__DEV__) {
|
|
90
|
+
// Fail loudly in development — a silent fallback to static rendering
|
|
91
|
+
// would only be noticed as frozen animations.
|
|
92
|
+
throw new Error(message);
|
|
93
|
+
}
|
|
94
|
+
if (!hasWarnedAboutReanimatedSupport) {
|
|
95
|
+
hasWarnedAboutReanimatedSupport = true;
|
|
96
|
+
console.error(`${message} Falling back to static rendering (animations will not run).`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
80
99
|
return new StaticContainer(Skia, nativeId);
|
|
81
100
|
}
|
|
82
101
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Rea","HAS_REANIMATED_3","ReanimatedRecorder","Container","StaticContainer","visit","SkiaViewApi","globalThis","nativeDrawOnscreen","nativeId","recorder","picture","play","setJsiProperty","NativeReanimatedContainer","constructor","Skia","_defineProperty","Picture","MakePicture","unmount","mapperId","stopMapper","redraw","unmounted","root","sharedValues","getSharedValues","sharedRecorder","getRecorder","runOnUI","length","startMapper","applyUpdates","createContainer"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkPicture } from \"../skia/types\";\nimport {
|
|
1
|
+
{"version":3,"names":["Rea","HAS_REANIMATED_3","HAS_REANIMATED_4","REANIMATED_VERSION_MAJOR","ReanimatedRecorder","Container","StaticContainer","visit","SkiaViewApi","globalThis","nativeDrawOnscreen","nativeId","recorder","picture","play","setJsiProperty","NativeReanimatedContainer","constructor","Skia","_defineProperty","Picture","MakePicture","unmount","mapperId","stopMapper","redraw","unmounted","root","sharedValues","getSharedValues","sharedRecorder","getRecorder","runOnUI","length","startMapper","applyUpdates","hasWarnedAboutReanimatedSupport","reanimatedSupportError","createContainer","message","__DEV__","Error","console","error"],"sources":["Container.native.ts"],"sourcesContent":["import Rea from \"../external/reanimated/ReanimatedProxy\";\nimport type { Skia, SkPicture } from \"../skia/types\";\nimport {\n HAS_REANIMATED_3,\n HAS_REANIMATED_4,\n REANIMATED_VERSION_MAJOR,\n} from \"../external/reanimated/renderHelpers\";\nimport type { JsiRecorder } from \"../skia/types/Recorder\";\n\nimport { ReanimatedRecorder } from \"./Recorder/ReanimatedRecorder\";\nimport { Container, StaticContainer } from \"./StaticContainer\";\nimport { visit } from \"./Recorder/Visitor\";\n\nimport \"../skia/NativeSetup\";\nimport \"../views/api\";\n\n// create local reference for `strictGlobal` option in Worklets\nconst { SkiaViewApi } = globalThis;\n\nconst nativeDrawOnscreen = (\n nativeId: number,\n recorder: JsiRecorder,\n picture: SkPicture\n) => {\n \"worklet\";\n\n //const start = performance.now();\n recorder.play(picture);\n //const end = performance.now();\n //console.log(\"Recording time: \", end - start);\n SkiaViewApi.setJsiProperty(nativeId, \"picture\", picture);\n};\n\nclass NativeReanimatedContainer extends Container {\n private mapperId: number | null = null;\n private picture: SkPicture;\n\n constructor(\n Skia: Skia,\n private nativeId: number\n ) {\n super(Skia);\n this.picture = Skia.Picture.MakePicture(null)!;\n }\n\n unmount() {\n super.unmount();\n if (this.mapperId !== null) {\n // The mapper closure retains the recorder and its resources (e.g.\n // images) on the UI runtime and keeps updating the picture of an\n // unmounted view — stop it or it leaks for the lifetime of the app.\n Rea.stopMapper(this.mapperId);\n this.mapperId = null;\n }\n }\n\n redraw() {\n if (this.mapperId !== null) {\n Rea.stopMapper(this.mapperId);\n this.mapperId = null;\n }\n if (this.unmounted) {\n return;\n }\n const recorder = new ReanimatedRecorder(this.Skia);\n const { nativeId, picture } = this;\n visit(recorder, this.root);\n const sharedValues = recorder.getSharedValues();\n const sharedRecorder = recorder.getRecorder();\n // Draw first frame\n Rea.runOnUI(() => {\n \"worklet\";\n nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n })();\n // Animate\n if (sharedValues.length > 0) {\n this.mapperId = Rea.startMapper(() => {\n \"worklet\";\n sharedRecorder.applyUpdates(sharedValues);\n nativeDrawOnscreen(nativeId, sharedRecorder, picture);\n }, sharedValues);\n }\n }\n}\n\nlet hasWarnedAboutReanimatedSupport = false;\n\nconst reanimatedSupportError = () => {\n if (REANIMATED_VERSION_MAJOR !== null && REANIMATED_VERSION_MAJOR >= 4) {\n return (\n \"React Native Skia requires react-native-worklets >= 0.7.0 for its \" +\n \"Reanimated integration on native platforms. Reanimated 4 is \" +\n \"installed, but react-native-worklets is missing or too old. \" +\n \"Please install or upgrade react-native-worklets.\"\n );\n }\n return (\n \"React Native Skia requires Reanimated 4 (react-native-worklets >= \" +\n \"0.7.0) for its Reanimated integration on native platforms. \" +\n \"Reanimated 3 is not supported anymore: Skia objects cannot be used \" +\n \"inside worklets or shared values with it. \" +\n \"Please upgrade to react-native-reanimated >= 4.0.0.\"\n );\n};\n\nexport const createContainer = (Skia: Skia, nativeId: number) => {\n if (HAS_REANIMATED_4 && nativeId !== -1) {\n return new NativeReanimatedContainer(Skia, nativeId);\n } else {\n if (HAS_REANIMATED_3 && !HAS_REANIMATED_4) {\n const message = reanimatedSupportError();\n if (__DEV__) {\n // Fail loudly in development — a silent fallback to static rendering\n // would only be noticed as frozen animations.\n throw new Error(message);\n }\n if (!hasWarnedAboutReanimatedSupport) {\n hasWarnedAboutReanimatedSupport = true;\n console.error(\n `${message} Falling back to static rendering (animations will not run).`\n );\n }\n }\n return new StaticContainer(Skia, nativeId);\n }\n};\n"],"mappings":";;;AAAA,OAAOA,GAAG,MAAM,wCAAwC;AAExD,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,wBAAwB,QACnB,sCAAsC;AAG7C,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,SAAS,EAAEC,eAAe,QAAQ,mBAAmB;AAC9D,SAASC,KAAK,QAAQ,oBAAoB;AAE1C,OAAO,qBAAqB;AAC5B,OAAO,cAAc;;AAErB;AACA,MAAM;EAAEC;AAAY,CAAC,GAAGC,UAAU;AAElC,MAAMC,kBAAkB,GAAGA,CACzBC,QAAgB,EAChBC,QAAqB,EACrBC,OAAkB,KACf;EACH,SAAS;;EAET;EACAD,QAAQ,CAACE,IAAI,CAACD,OAAO,CAAC;EACtB;EACA;EACAL,WAAW,CAACO,cAAc,CAACJ,QAAQ,EAAE,SAAS,EAAEE,OAAO,CAAC;AAC1D,CAAC;AAED,MAAMG,yBAAyB,SAASX,SAAS,CAAC;EAIhDY,WAAWA,CACTC,IAAU,EACFP,QAAgB,EACxB;IACA,KAAK,CAACO,IAAI,CAAC;IAAC,KAFJP,QAAgB,GAAhBA,QAAgB;IAAAQ,eAAA,mBALQ,IAAI;IAAAA,eAAA;IAQpC,IAAI,CAACN,OAAO,GAAGK,IAAI,CAACE,OAAO,CAACC,WAAW,CAAC,IAAI,CAAE;EAChD;EAEAC,OAAOA,CAAA,EAAG;IACR,KAAK,CAACA,OAAO,CAAC,CAAC;IACf,IA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BAAwB,KAAK,IAAI,IAAIA,wBAAwB,IAAI,CAAC,EAAE;IACtE,OACE,oEAAoE,GACpE,8DAA8D,GAC9D,8DAA8D,GAC9D,kDAAkD;EAEtD;EACA,OACE,oEAAoE,GACpE,6DAA6D,GAC7D,qEAAqE,GACrE,4CAA4C,GAC5C,qDAAqD;AAEzD,CAAC;AAED,OAAO,MAAMmC,eAAe,GAAGA,CAACpB,IAAU,EAAEP,QAAgB,KAAK;EAC/D,IAAIT,gBAAgB,IAAIS,QAAQ,KAAK,CAAC,CAAC,EAAE;IACvC,OAAO,IAAIK,yBAAyB,CAACE,IAAI,EAAEP,QAAQ,CAAC;EACtD,CAAC,MAAM;IACL,IAAIV,gBAAgB,IAAI,CAACC,gBAAgB,EAAE;MACzC,MAAMqC,OAAO,GAAGF,sBAAsB,CAAC,CAAC;MACxC,IAAIG,OAAO,EAAE;QACX;QACA;QACA,MAAM,IAAIC,KAAK,CAACF,OAAO,CAAC;MAC1B;MACA,IAAI,CAACH,+BAA+B,EAAE;QACpCA,+BAA+B,GAAG,IAAI;QACtCM,OAAO,CAACC,KAAK,CACX,GAAGJ,OAAO,8DACZ,CAAC;MACH;IACF;IACA,OAAO,IAAIjC,eAAe,CAACY,IAAI,EAAEP,QAAQ,CAAC;EAC5C;AACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./SkiaPictureView\";\nexport * from \"./types\";\nexport * from \"./
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./SkiaPictureView\";\nexport * from \"./types\";\nexport * from \"./formats\";\n"],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,SAAS;AACvB,cAAc,WAAW","ignoreList":[]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export const __esModule: boolean;
|
|
2
2
|
export function Mock(CanvasKit: any): {
|
|
3
3
|
Canvas: typeof import("react-native").View;
|
|
4
|
-
WebGPUCanvas: typeof import("react-native").View;
|
|
5
4
|
getPreferredHighBitDepthCanvasFormat: () => string;
|
|
6
5
|
SkiaPictureView: typeof import("react-native").View;
|
|
7
6
|
JsiSkImage: typeof _JsiSkImage.JsiSkImage;
|
|
@@ -6,8 +6,8 @@ export class JsiSkImageFactory extends _Host.Host {
|
|
|
6
6
|
MakeImageFromEncoded(encoded: any): _JsiSkImage.JsiSkImage | null;
|
|
7
7
|
MakeImageFromNativeTextureUnstable(): jest.Mock<any, any, any>;
|
|
8
8
|
MakeImage(info: any, data: any, bytesPerRow: any): _JsiSkImage.JsiSkImage | null;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
MakeImageFromNativeTexture(_pointer: any): jest.Mock<any, any, any>;
|
|
10
|
+
MakeNativeTextureFromImage(_image: any): jest.Mock<any, any, any>;
|
|
11
11
|
}
|
|
12
12
|
import _Host = require("./Host");
|
|
13
13
|
import _JsiSkImage = require("./JsiSkImage");
|
|
@@ -37,8 +37,7 @@ export function JsiSkApi(CanvasKit: any): {
|
|
|
37
37
|
Video: (url?: any) => Promise<any>;
|
|
38
38
|
Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
|
|
39
39
|
Recorder: () => jest.Mock<any, any, any>;
|
|
40
|
-
|
|
41
|
-
hasDevice: () => boolean;
|
|
40
|
+
getNativeDevice: () => jest.Mock<any, any, any>;
|
|
42
41
|
};
|
|
43
42
|
import _JsiSkPoint = require("./JsiSkPoint");
|
|
44
43
|
import _JsiSkRRect = require("./JsiSkRRect");
|
|
@@ -1 +1,16 @@
|
|
|
1
1
|
export let HAS_REANIMATED_3: boolean;
|
|
2
|
+
/**
|
|
3
|
+
* True when the worklets-based Reanimated integration is available
|
|
4
|
+
* (Reanimated 4 with react-native-worklets providing
|
|
5
|
+
* registerCustomSerializable). Skia objects use the JSI NativeState pattern
|
|
6
|
+
* and can only be transferred to worklet runtimes through a custom
|
|
7
|
+
* serializer, so on native the Reanimated integration requires Reanimated 4 —
|
|
8
|
+
* Reanimated 3 is not supported.
|
|
9
|
+
*/
|
|
10
|
+
export let HAS_REANIMATED_4: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Major version of the installed react-native-reanimated package, or null if
|
|
13
|
+
* it is not installed. Used to give actionable diagnostics when the
|
|
14
|
+
* integration cannot be enabled.
|
|
15
|
+
*/
|
|
16
|
+
export let REANIMATED_VERSION_MAJOR: null;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export function Mock(CanvasKit: any): {
|
|
2
2
|
Canvas: typeof import("react-native").View;
|
|
3
|
-
WebGPUCanvas: typeof import("react-native").View;
|
|
4
3
|
getPreferredHighBitDepthCanvasFormat: () => string;
|
|
5
4
|
SkiaPictureView: typeof import("react-native").View;
|
|
6
5
|
JsiSkImage: typeof JsiSkImage;
|
|
@@ -307,7 +306,6 @@ export function Mock(CanvasKit: any): {
|
|
|
307
306
|
isNativeBufferAddr: (buffer: any) => buffer is BigInt;
|
|
308
307
|
isNativeBufferWeb: (buffer: any) => boolean;
|
|
309
308
|
isNativeBufferNode: (buffer: any) => buffer is ArrayBuffer;
|
|
310
|
-
installWebGPU: any;
|
|
311
309
|
LineBreakType: {};
|
|
312
310
|
VerticalTextAlign: {};
|
|
313
311
|
ResizePolicy: {};
|
|
@@ -36,6 +36,5 @@ export const Skia: {
|
|
|
36
36
|
Video: (url?: any) => Promise<any>;
|
|
37
37
|
Context: (_surface: any, _width: any, _height: any) => jest.Mock<any, any, any>;
|
|
38
38
|
Recorder: () => jest.Mock<any, any, any>;
|
|
39
|
-
|
|
40
|
-
hasDevice: () => boolean;
|
|
39
|
+
getNativeDevice: () => jest.Mock<any, any, any>;
|
|
41
40
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function registerSkiaWorkletSerialization(): void;
|