@shopify/react-native-skia 2.10.0 → 2.11.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +7 -41
- package/android/build.gradle +33 -0
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -2
- package/cpp/api/JsiNativeBuffer.h +14 -20
- package/cpp/api/JsiSkAnimatedImage.h +13 -16
- package/cpp/api/JsiSkAnimatedImageFactory.h +9 -7
- package/cpp/api/JsiSkApi.h +94 -90
- package/cpp/api/JsiSkCanvas.h +108 -251
- package/cpp/api/JsiSkColorFilterFactory.h +45 -63
- package/cpp/api/JsiSkContourMeasure.h +19 -29
- package/cpp/api/JsiSkContourMeasureIter.h +6 -6
- package/cpp/api/JsiSkConverters.h +410 -0
- package/cpp/api/JsiSkDataFactory.h +9 -15
- package/cpp/api/JsiSkFont.h +99 -180
- package/cpp/api/JsiSkFontMgr.h +19 -21
- package/cpp/api/JsiSkFontMgrFactory.h +4 -5
- package/cpp/api/JsiSkImage.h +66 -66
- package/cpp/api/JsiSkImageFactory.h +66 -63
- package/cpp/api/JsiSkImageFilterFactory.h +354 -608
- package/cpp/api/JsiSkImageInfo.h +10 -13
- package/cpp/api/JsiSkMaskFilterFactory.h +8 -11
- package/cpp/api/JsiSkMatrix.h +36 -73
- package/cpp/api/JsiSkNativeObjects.h +60 -92
- package/cpp/api/JsiSkPaint.h +73 -131
- package/cpp/api/JsiSkParagraph.h +36 -53
- package/cpp/api/JsiSkParagraphBuilder.h +36 -64
- package/cpp/api/JsiSkParagraphBuilderFactory.h +11 -16
- package/cpp/api/JsiSkPath.h +216 -349
- package/cpp/api/JsiSkPathBuilder.h +133 -269
- package/cpp/api/JsiSkPathBuilderFactory.h +11 -11
- package/cpp/api/JsiSkPathEffectFactory.h +52 -72
- package/cpp/api/JsiSkPathFactory.h +129 -195
- package/cpp/api/JsiSkPicture.h +12 -18
- package/cpp/api/JsiSkPictureRecorder.h +14 -15
- package/cpp/api/JsiSkPoint.h +4 -4
- package/cpp/api/JsiSkRRect.h +7 -8
- package/cpp/api/JsiSkRSXform.h +10 -23
- package/cpp/api/JsiSkRect.h +23 -31
- package/cpp/api/JsiSkRuntimeEffect.h +67 -83
- package/cpp/api/JsiSkRuntimeEffectFactory.h +6 -10
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +5 -14
- package/cpp/api/JsiSkSVG.h +4 -4
- package/cpp/api/JsiSkShaderFactory.h +153 -225
- package/cpp/api/JsiSkSkottie.h +104 -126
- package/cpp/api/JsiSkSurface.h +11 -14
- package/cpp/api/JsiSkSurfaceFactory.h +6 -7
- package/cpp/api/JsiSkTextBlobFactory.h +31 -54
- package/cpp/api/JsiSkTypeface.h +8 -12
- package/cpp/api/JsiSkTypefaceFactory.h +9 -7
- package/cpp/api/JsiSkTypefaceFontProvider.h +22 -23
- package/cpp/api/JsiSkTypefaceFontProviderFactory.h +5 -6
- package/cpp/api/JsiSkVertices.h +6 -8
- package/cpp/api/JsiSkiaContext.h +10 -11
- package/cpp/api/JsiVideo.h +31 -71
- package/cpp/dawn/include/dawn/dawn_proc.h +53 -0
- package/cpp/dawn/include/dawn/dawn_proc_table.h +330 -0
- package/cpp/dawn/include/dawn/dawn_thread_dispatch_proc.h +47 -0
- package/cpp/dawn/include/dawn/dawn_version.h +41 -0
- package/cpp/dawn/include/dawn/native/D3D11Backend.h +65 -0
- package/cpp/dawn/include/dawn/native/D3D12Backend.h +86 -0
- package/cpp/dawn/include/dawn/native/D3DBackend.h +56 -0
- package/cpp/dawn/include/dawn/native/DawnNative.h +369 -0
- package/cpp/dawn/include/dawn/native/MetalBackend.h +56 -0
- package/cpp/dawn/include/dawn/native/NullBackend.h +39 -0
- package/cpp/dawn/include/dawn/native/OpenGLBackend.h +89 -0
- package/cpp/dawn/include/dawn/native/VulkanBackend.h +183 -0
- package/cpp/dawn/include/dawn/native/WebGPUBackend.h +49 -0
- package/cpp/dawn/include/dawn/native/dawn_native_export.h +49 -0
- package/cpp/dawn/include/dawn/platform/DawnPlatform.h +210 -0
- package/cpp/dawn/include/dawn/platform/dawn_platform_export.h +49 -0
- package/cpp/dawn/include/dawn/replay/Replay.h +99 -0
- package/cpp/dawn/include/dawn/replay/dawn_replay_export.h +49 -0
- package/cpp/dawn/include/dawn/webgpu_cpp_print.h +2844 -0
- package/cpp/dawn/include/tint/tint.h +90 -0
- package/cpp/dawn/include/webgpu/webgpu.h +4987 -0
- package/cpp/dawn/include/webgpu/webgpu_cpp.h +10080 -0
- package/cpp/dawn/include/webgpu/webgpu_cpp_chained_struct.h +57 -0
- package/cpp/dawn/include/webgpu/webgpu_enum_class_bitmasks.h +161 -0
- package/cpp/dawn/include/webgpu/webgpu_glfw.h +88 -0
- package/cpp/jsi/JSIConverter.h +0 -31
- package/cpp/jsi/NativeObject.h +11 -6
- package/cpp/rnskia/RNDawnContext.h +18 -2
- package/cpp/rnskia/RNDawnInterop.cpp +19 -0
- package/cpp/rnskia/RNDawnUtils.h +18 -1
- package/cpp/rnskia/RNSkManager.cpp +5 -162
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h +2 -0
- package/cpp/skia/src/gpu/graphite/ContextOptionsPriv.h +45 -0
- package/cpp/skia/src/gpu/graphite/ResourceTypes.h +360 -0
- package/cpp/skia/src/gpu/graphite/TextureProxyView.h +105 -0
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- 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/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/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- 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/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/mock/index.d.ts +0 -1
- 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/mock/index.d.ts +0 -2
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -2
- 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/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/libs/.graphite +1 -0
- package/package.json +8 -9
- package/react-native-skia.podspec +38 -4
- package/src/mock/index.ts +0 -1
- 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/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/rnwgpu/ArrayBuffer.h +0 -116
- package/cpp/rnwgpu/Canvas.h +0 -52
- 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 -239
- 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 -613
- 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 -213
- 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/api/JsiSkCanvas.h
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#pragma once
|
|
2
2
|
|
|
3
3
|
#include <memory>
|
|
4
|
+
#include <string>
|
|
4
5
|
#include <utility>
|
|
5
6
|
#include <vector>
|
|
6
7
|
|
|
8
|
+
#include "JsiSkConverters.h"
|
|
7
9
|
#include "JsiSkFont.h"
|
|
8
10
|
#include "JsiSkImage.h"
|
|
9
11
|
#include "JsiSkImageInfo.h"
|
|
@@ -53,29 +55,21 @@ class JsiSkCanvas : public JsiSkNativeObject<JsiSkCanvas> {
|
|
|
53
55
|
public:
|
|
54
56
|
static constexpr const char *CLASS_NAME = "Canvas";
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[0]);
|
|
58
|
+
void drawPaint(std::shared_ptr<SkPaint> paint) {
|
|
58
59
|
_canvas->drawPaint(*paint);
|
|
59
|
-
return jsi::Value::undefined();
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
65
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
66
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
67
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[4]);
|
|
62
|
+
void drawLine(double x1, double y1, double x2, double y2,
|
|
63
|
+
std::shared_ptr<SkPaint> paint) {
|
|
68
64
|
_canvas->drawLine(x1, y1, x2, y2, *paint);
|
|
69
|
-
return jsi::Value::undefined();
|
|
70
65
|
}
|
|
71
66
|
|
|
72
|
-
|
|
73
|
-
auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
|
|
74
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
|
|
67
|
+
void drawRect(std::shared_ptr<SkRect> rect, std::shared_ptr<SkPaint> paint) {
|
|
75
68
|
_canvas->drawRect(*rect, *paint);
|
|
76
|
-
return jsi::Value::undefined();
|
|
77
69
|
}
|
|
78
70
|
|
|
71
|
+
// The drawImage* variants stay raw: they dispatch on exact argument counts
|
|
72
|
+
// (count == 4 / count == 6) with null-tolerant trailing paints.
|
|
79
73
|
JSI_HOST_FUNCTION(drawImage) {
|
|
80
74
|
auto image = JsiSkImage::fromValue(runtime, arguments[0]);
|
|
81
75
|
auto x = arguments[1].asNumber();
|
|
@@ -185,106 +179,55 @@ public:
|
|
|
185
179
|
return jsi::Value::undefined();
|
|
186
180
|
}
|
|
187
181
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
SkScalar cy = arguments[1].asNumber();
|
|
191
|
-
SkScalar radius = arguments[2].asNumber();
|
|
192
|
-
|
|
193
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[3]);
|
|
182
|
+
void drawCircle(double cx, double cy, double radius,
|
|
183
|
+
std::shared_ptr<SkPaint> paint) {
|
|
194
184
|
_canvas->drawCircle(cx, cy, radius, *paint);
|
|
195
|
-
|
|
196
|
-
return jsi::Value::undefined();
|
|
197
185
|
}
|
|
198
186
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
SkScalar startAngle = arguments[1].asNumber();
|
|
203
|
-
SkScalar sweepAngle = arguments[2].asNumber();
|
|
204
|
-
bool useCenter = arguments[3].getBool();
|
|
205
|
-
|
|
206
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[4]);
|
|
187
|
+
void drawArc(std::shared_ptr<SkRect> oval, double startAngle,
|
|
188
|
+
double sweepAngle, bool useCenter,
|
|
189
|
+
std::shared_ptr<SkPaint> paint) {
|
|
207
190
|
_canvas->drawArc(*oval, startAngle, sweepAngle, useCenter, *paint);
|
|
208
|
-
|
|
209
|
-
return jsi::Value::undefined();
|
|
210
191
|
}
|
|
211
192
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
|
|
215
|
-
|
|
193
|
+
void drawRRect(std::shared_ptr<SkRRect> rect,
|
|
194
|
+
std::shared_ptr<SkPaint> paint) {
|
|
216
195
|
_canvas->drawRRect(*rect, *paint);
|
|
217
|
-
|
|
218
|
-
return jsi::Value::undefined();
|
|
219
196
|
}
|
|
220
197
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[2]);
|
|
225
|
-
|
|
198
|
+
void drawDRRect(std::shared_ptr<SkRRect> outer,
|
|
199
|
+
std::shared_ptr<SkRRect> inner,
|
|
200
|
+
std::shared_ptr<SkPaint> paint) {
|
|
226
201
|
_canvas->drawDRRect(*outer, *inner, *paint);
|
|
227
|
-
|
|
228
|
-
return jsi::Value::undefined();
|
|
229
202
|
}
|
|
230
203
|
|
|
231
|
-
|
|
232
|
-
auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
|
|
233
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
|
|
234
|
-
|
|
204
|
+
void drawOval(std::shared_ptr<SkRect> rect, std::shared_ptr<SkPaint> paint) {
|
|
235
205
|
_canvas->drawOval(*rect, *paint);
|
|
236
|
-
|
|
237
|
-
return jsi::Value::undefined();
|
|
238
206
|
}
|
|
239
207
|
|
|
240
|
-
|
|
241
|
-
auto c = arguments[0].asNumber();
|
|
242
|
-
_canvas->restoreToCount(c);
|
|
243
|
-
return jsi::Value::undefined();
|
|
244
|
-
}
|
|
208
|
+
void restoreToCount(double c) { _canvas->restoreToCount(c); }
|
|
245
209
|
|
|
246
|
-
|
|
247
|
-
return static_cast<int>(_canvas->getSaveCount());
|
|
248
|
-
}
|
|
210
|
+
int getSaveCount() { return static_cast<int>(_canvas->getSaveCount()); }
|
|
249
211
|
|
|
250
|
-
|
|
251
|
-
return
|
|
252
|
-
|
|
212
|
+
std::shared_ptr<JsiSkMatrix> getTotalMatrix() {
|
|
213
|
+
return std::make_shared<JsiSkMatrix>(getContext(),
|
|
214
|
+
_canvas->getTotalMatrix());
|
|
253
215
|
}
|
|
254
216
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
std::vector<SkPoint> points;
|
|
258
|
-
|
|
259
|
-
auto jsiPoints = arguments[1].asObject(runtime).asArray(runtime);
|
|
260
|
-
auto pointsSize = jsiPoints.size(runtime);
|
|
261
|
-
|
|
217
|
+
void drawPoints(double pointMode, std::vector<SkPoint> points,
|
|
218
|
+
std::shared_ptr<SkPaint> paint) {
|
|
262
219
|
// Check if we have at least one point
|
|
263
|
-
if (
|
|
220
|
+
if (points.empty()) {
|
|
264
221
|
throw std::invalid_argument("Points array must not be empty");
|
|
265
222
|
}
|
|
266
|
-
|
|
267
|
-
points.reserve(pointsSize);
|
|
268
|
-
|
|
269
|
-
for (int i = 0; i < pointsSize; i++) {
|
|
270
|
-
std::shared_ptr<SkPoint> point = JsiSkPoint::fromValue(
|
|
271
|
-
runtime, jsiPoints.getValueAtIndex(runtime, i).asObject(runtime));
|
|
272
|
-
points.push_back(*point.get());
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[2]);
|
|
276
223
|
auto p = SkSpan(points.data(), points.size());
|
|
277
|
-
_canvas->drawPoints(
|
|
278
|
-
|
|
279
|
-
return jsi::Value::undefined();
|
|
224
|
+
_canvas->drawPoints(static_cast<SkCanvas::PointMode>(pointMode), p, *paint);
|
|
280
225
|
}
|
|
281
226
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
_canvas->drawVertices(vertices, blendMode, *paint);
|
|
287
|
-
return jsi::Value::undefined();
|
|
227
|
+
void drawVertices(sk_sp<SkVertices> vertices, double blendMode,
|
|
228
|
+
std::shared_ptr<SkPaint> paint) {
|
|
229
|
+
_canvas->drawVertices(vertices, static_cast<SkBlendMode>(blendMode),
|
|
230
|
+
*paint);
|
|
288
231
|
}
|
|
289
232
|
|
|
290
233
|
JSI_HOST_FUNCTION(drawPatch) {
|
|
@@ -352,118 +295,71 @@ public:
|
|
|
352
295
|
return jsi::Value::undefined();
|
|
353
296
|
}
|
|
354
297
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[1]);
|
|
358
|
-
|
|
298
|
+
void drawPath(std::shared_ptr<SkPathBuilder> path,
|
|
299
|
+
std::shared_ptr<SkPaint> paint) {
|
|
359
300
|
_canvas->drawPath(path->snapshot(), *paint);
|
|
360
|
-
|
|
361
|
-
return jsi::Value::undefined();
|
|
362
301
|
}
|
|
363
302
|
|
|
364
|
-
|
|
365
|
-
|
|
303
|
+
void drawText(std::string textVal, double x, double y,
|
|
304
|
+
std::shared_ptr<SkPaint> paint, std::shared_ptr<SkFont> font) {
|
|
366
305
|
auto text = textVal.c_str();
|
|
367
|
-
SkScalar x = arguments[1].asNumber();
|
|
368
|
-
SkScalar y = arguments[2].asNumber();
|
|
369
|
-
|
|
370
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[3]);
|
|
371
|
-
auto font = JsiSkFont::fromValue(runtime, arguments[4]);
|
|
372
|
-
|
|
373
306
|
_canvas->drawSimpleText(text, strlen(text), SkTextEncoding::kUTF8, x, y,
|
|
374
307
|
*font, *paint);
|
|
375
|
-
|
|
376
|
-
return jsi::Value::undefined();
|
|
377
308
|
}
|
|
378
309
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
SkScalar x = arguments[1].asNumber();
|
|
382
|
-
SkScalar y = arguments[2].asNumber();
|
|
383
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[3]);
|
|
310
|
+
void drawTextBlob(sk_sp<SkTextBlob> blob, double x, double y,
|
|
311
|
+
std::shared_ptr<SkPaint> paint) {
|
|
384
312
|
_canvas->drawTextBlob(blob, x, y, *paint);
|
|
385
|
-
return jsi::Value::undefined();
|
|
386
313
|
}
|
|
387
314
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
auto x = arguments[2].asNumber();
|
|
392
|
-
auto y = arguments[3].asNumber();
|
|
393
|
-
auto font = JsiSkFont::fromValue(runtime, arguments[4]);
|
|
394
|
-
auto paint = JsiSkPaint::fromValue(runtime, arguments[5]);
|
|
315
|
+
void drawGlyphs(std::vector<int> glyphIds, std::vector<SkPoint> positions,
|
|
316
|
+
double x, double y, std::shared_ptr<SkFont> font,
|
|
317
|
+
std::shared_ptr<SkPaint> paint) {
|
|
395
318
|
SkPoint origin = SkPoint::Make(x, y);
|
|
396
319
|
|
|
397
|
-
std::vector<SkPoint> positions;
|
|
398
|
-
int pointsSize = static_cast<int>(jsiPositions.size(runtime));
|
|
399
|
-
positions.reserve(pointsSize);
|
|
400
|
-
for (int i = 0; i < pointsSize; i++) {
|
|
401
|
-
std::shared_ptr<SkPoint> point = JsiSkPoint::fromValue(
|
|
402
|
-
runtime, jsiPositions.getValueAtIndex(runtime, i).asObject(runtime));
|
|
403
|
-
positions.push_back(*point.get());
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
std::vector<SkGlyphID> glyphs;
|
|
407
|
-
int glyphsSize = static_cast<int>(jsiGlyphs.size(runtime));
|
|
408
|
-
|
|
409
320
|
// Validate that glyphs and positions arrays have the same size
|
|
410
|
-
if (
|
|
321
|
+
if (glyphIds.size() != positions.size()) {
|
|
411
322
|
throw std::invalid_argument(
|
|
412
323
|
"Glyphs and positions arrays must have the same length");
|
|
413
324
|
}
|
|
414
325
|
|
|
415
|
-
glyphs
|
|
416
|
-
|
|
417
|
-
|
|
326
|
+
std::vector<SkGlyphID> glyphs;
|
|
327
|
+
glyphs.reserve(glyphIds.size());
|
|
328
|
+
for (auto glyph : glyphIds) {
|
|
329
|
+
glyphs.push_back(static_cast<SkGlyphID>(glyph));
|
|
418
330
|
}
|
|
419
331
|
|
|
420
332
|
auto g = SkSpan(glyphs.data(), glyphs.size());
|
|
421
333
|
auto p = SkSpan(positions.data(), positions.size());
|
|
422
334
|
_canvas->drawGlyphs(g, p, origin, *font, *paint);
|
|
423
|
-
|
|
424
|
-
return jsi::Value::undefined();
|
|
425
335
|
}
|
|
426
336
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
if (
|
|
430
|
-
|
|
431
|
-
auto w = arguments[1].asNumber();
|
|
432
|
-
auto h = arguments[2].asNumber();
|
|
433
|
-
svgdom->setContainerSize(SkSize::Make(w, h));
|
|
337
|
+
void drawSvg(sk_sp<SkSVGDOM> svgdom, JsiOptional<double> w,
|
|
338
|
+
JsiOptional<double> h) {
|
|
339
|
+
if (w.has_value() && h.has_value()) {
|
|
340
|
+
svgdom->setContainerSize(SkSize::Make(*w, *h));
|
|
434
341
|
} else {
|
|
435
342
|
auto canvasSize = _canvas->getBaseLayerSize();
|
|
436
343
|
svgdom->setContainerSize(SkSize::Make(canvasSize));
|
|
437
344
|
}
|
|
438
345
|
svgdom->render(_canvas);
|
|
439
|
-
return jsi::Value::undefined();
|
|
440
346
|
}
|
|
441
347
|
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
_canvas->clipPath(path->snapshot(), op, doAntiAlias);
|
|
447
|
-
return jsi::Value::undefined();
|
|
348
|
+
void clipPath(std::shared_ptr<SkPathBuilder> path, double op,
|
|
349
|
+
bool doAntiAlias) {
|
|
350
|
+
_canvas->clipPath(path->snapshot(), static_cast<SkClipOp>(op),
|
|
351
|
+
doAntiAlias);
|
|
448
352
|
}
|
|
449
353
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
auto op = (SkClipOp)arguments[1].asNumber();
|
|
453
|
-
auto doAntiAlias = arguments[2].getBool();
|
|
454
|
-
_canvas->clipRect(*rect, op, doAntiAlias);
|
|
455
|
-
return jsi::Value::undefined();
|
|
354
|
+
void clipRect(std::shared_ptr<SkRect> rect, double op, bool doAntiAlias) {
|
|
355
|
+
_canvas->clipRect(*rect, static_cast<SkClipOp>(op), doAntiAlias);
|
|
456
356
|
}
|
|
457
357
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
auto op = (SkClipOp)arguments[1].asNumber();
|
|
461
|
-
auto doAntiAlias = arguments[2].getBool();
|
|
462
|
-
_canvas->clipRRect(*rrect, op, doAntiAlias);
|
|
463
|
-
return jsi::Value::undefined();
|
|
358
|
+
void clipRRect(std::shared_ptr<SkRRect> rrect, double op, bool doAntiAlias) {
|
|
359
|
+
_canvas->clipRRect(*rrect, static_cast<SkClipOp>(op), doAntiAlias);
|
|
464
360
|
}
|
|
465
361
|
|
|
466
|
-
|
|
362
|
+
int save() { return _canvas->save(); }
|
|
467
363
|
|
|
468
364
|
JSI_HOST_FUNCTION(saveLayer) {
|
|
469
365
|
SkPaint *paint = (count >= 1 && !arguments[0].isUndefined())
|
|
@@ -482,67 +378,32 @@ public:
|
|
|
482
378
|
SkCanvas::SaveLayerRec(bounds, paint, backdrop, flags)));
|
|
483
379
|
}
|
|
484
380
|
|
|
485
|
-
|
|
486
|
-
_canvas->restore();
|
|
487
|
-
return jsi::Value::undefined();
|
|
488
|
-
}
|
|
381
|
+
void restore() { _canvas->restore(); }
|
|
489
382
|
|
|
490
|
-
|
|
491
|
-
SkScalar degrees = arguments[0].asNumber();
|
|
492
|
-
SkScalar rx = arguments[1].asNumber();
|
|
493
|
-
SkScalar ry = arguments[2].asNumber();
|
|
383
|
+
void rotate(double degrees, double rx, double ry) {
|
|
494
384
|
_canvas->rotate(degrees, rx, ry);
|
|
495
|
-
return jsi::Value::undefined();
|
|
496
385
|
}
|
|
497
386
|
|
|
498
|
-
|
|
499
|
-
SkScalar dx = arguments[0].asNumber();
|
|
500
|
-
SkScalar dy = arguments[1].asNumber();
|
|
501
|
-
_canvas->translate(dx, dy);
|
|
502
|
-
return jsi::Value::undefined();
|
|
503
|
-
}
|
|
387
|
+
void translate(double dx, double dy) { _canvas->translate(dx, dy); }
|
|
504
388
|
|
|
505
|
-
|
|
506
|
-
SkScalar sx = arguments[0].asNumber();
|
|
507
|
-
SkScalar sy = arguments[1].asNumber();
|
|
508
|
-
_canvas->scale(sx, sy);
|
|
509
|
-
return jsi::Value::undefined();
|
|
510
|
-
}
|
|
389
|
+
void scale(double sx, double sy) { _canvas->scale(sx, sy); }
|
|
511
390
|
|
|
512
|
-
|
|
513
|
-
SkScalar sx = arguments[0].asNumber();
|
|
514
|
-
SkScalar sy = arguments[1].asNumber();
|
|
515
|
-
_canvas->skew(sx, sy);
|
|
516
|
-
return jsi::Value::undefined();
|
|
517
|
-
}
|
|
391
|
+
void skew(double sx, double sy) { _canvas->skew(sx, sy); }
|
|
518
392
|
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
_canvas->drawColor(cl);
|
|
393
|
+
void drawColor(JsiColor cl, JsiOptional<double> mode) {
|
|
394
|
+
if (mode.has_value()) {
|
|
395
|
+
_canvas->drawColor(cl, static_cast<SkBlendMode>(*mode));
|
|
523
396
|
} else {
|
|
524
|
-
|
|
525
|
-
_canvas->drawColor(cl, mode);
|
|
397
|
+
_canvas->drawColor(cl);
|
|
526
398
|
}
|
|
527
|
-
return jsi::Value::undefined();
|
|
528
399
|
}
|
|
529
400
|
|
|
530
|
-
|
|
531
|
-
SkColor cl = JsiSkColor::fromValue(runtime, arguments[0]);
|
|
532
|
-
_canvas->clear(cl);
|
|
533
|
-
return jsi::Value::undefined();
|
|
534
|
-
}
|
|
401
|
+
void clear(JsiColor cl) { _canvas->clear(cl); }
|
|
535
402
|
|
|
536
|
-
|
|
537
|
-
auto matrix = JsiSkMatrix::fromValue(runtime, arguments[0]);
|
|
538
|
-
_canvas->concat(*matrix.get());
|
|
539
|
-
return jsi::Value::undefined();
|
|
540
|
-
}
|
|
403
|
+
void concat(std::shared_ptr<SkMatrix> matrix) { _canvas->concat(*matrix); }
|
|
541
404
|
|
|
542
|
-
|
|
543
|
-
auto picture = JsiSkPicture::fromValue(runtime, arguments[0]);
|
|
405
|
+
void drawPicture(sk_sp<SkPicture> picture) {
|
|
544
406
|
_canvas->drawPicture(picture);
|
|
545
|
-
return jsi::Value::undefined();
|
|
546
407
|
}
|
|
547
408
|
|
|
548
409
|
JSI_HOST_FUNCTION(drawAtlas) {
|
|
@@ -679,9 +540,9 @@ public:
|
|
|
679
540
|
}
|
|
680
541
|
|
|
681
542
|
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
543
|
+
installMethod(runtime, prototype, "drawPaint", &JsiSkCanvas::drawPaint);
|
|
544
|
+
installMethod(runtime, prototype, "drawLine", &JsiSkCanvas::drawLine);
|
|
545
|
+
installMethod(runtime, prototype, "drawRect", &JsiSkCanvas::drawRect);
|
|
685
546
|
installHostMethod(runtime, prototype, "drawImage", &JsiSkCanvas::drawImage);
|
|
686
547
|
installHostMethod(runtime, prototype, "drawImageRect",
|
|
687
548
|
&JsiSkCanvas::drawImageRect);
|
|
@@ -695,46 +556,42 @@ public:
|
|
|
695
556
|
&JsiSkCanvas::drawImageRectCubic);
|
|
696
557
|
installHostMethod(runtime, prototype, "drawImageRectOptions",
|
|
697
558
|
&JsiSkCanvas::drawImageRectOptions);
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
&JsiSkCanvas::getTotalMatrix);
|
|
711
|
-
installHostMethod(runtime, prototype, "drawPoints",
|
|
712
|
-
&JsiSkCanvas::drawPoints);
|
|
559
|
+
installMethod(runtime, prototype, "drawCircle", &JsiSkCanvas::drawCircle);
|
|
560
|
+
installMethod(runtime, prototype, "drawArc", &JsiSkCanvas::drawArc);
|
|
561
|
+
installMethod(runtime, prototype, "drawRRect", &JsiSkCanvas::drawRRect);
|
|
562
|
+
installMethod(runtime, prototype, "drawDRRect", &JsiSkCanvas::drawDRRect);
|
|
563
|
+
installMethod(runtime, prototype, "drawOval", &JsiSkCanvas::drawOval);
|
|
564
|
+
installMethod(runtime, prototype, "restoreToCount",
|
|
565
|
+
&JsiSkCanvas::restoreToCount);
|
|
566
|
+
installMethod(runtime, prototype, "getSaveCount",
|
|
567
|
+
&JsiSkCanvas::getSaveCount);
|
|
568
|
+
installMethod(runtime, prototype, "getTotalMatrix",
|
|
569
|
+
&JsiSkCanvas::getTotalMatrix);
|
|
570
|
+
installMethod(runtime, prototype, "drawPoints", &JsiSkCanvas::drawPoints);
|
|
713
571
|
installHostMethod(runtime, prototype, "drawPatch", &JsiSkCanvas::drawPatch);
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
installHostMethod(runtime, prototype, "save", &JsiSkCanvas::save);
|
|
572
|
+
installMethod(runtime, prototype, "drawPath", &JsiSkCanvas::drawPath);
|
|
573
|
+
installMethod(runtime, prototype, "drawVertices",
|
|
574
|
+
&JsiSkCanvas::drawVertices);
|
|
575
|
+
installMethod(runtime, prototype, "drawText", &JsiSkCanvas::drawText);
|
|
576
|
+
installMethod(runtime, prototype, "drawTextBlob",
|
|
577
|
+
&JsiSkCanvas::drawTextBlob);
|
|
578
|
+
installMethod(runtime, prototype, "drawGlyphs", &JsiSkCanvas::drawGlyphs);
|
|
579
|
+
installMethod(runtime, prototype, "drawSvg", &JsiSkCanvas::drawSvg);
|
|
580
|
+
installMethod(runtime, prototype, "clipPath", &JsiSkCanvas::clipPath);
|
|
581
|
+
installMethod(runtime, prototype, "clipRect", &JsiSkCanvas::clipRect);
|
|
582
|
+
installMethod(runtime, prototype, "clipRRect", &JsiSkCanvas::clipRRect);
|
|
583
|
+
installMethod(runtime, prototype, "save", &JsiSkCanvas::save);
|
|
727
584
|
installHostMethod(runtime, prototype, "saveLayer", &JsiSkCanvas::saveLayer);
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
585
|
+
installMethod(runtime, prototype, "restore", &JsiSkCanvas::restore);
|
|
586
|
+
installMethod(runtime, prototype, "rotate", &JsiSkCanvas::rotate);
|
|
587
|
+
installMethod(runtime, prototype, "translate", &JsiSkCanvas::translate);
|
|
588
|
+
installMethod(runtime, prototype, "scale", &JsiSkCanvas::scale);
|
|
589
|
+
installMethod(runtime, prototype, "skew", &JsiSkCanvas::skew);
|
|
590
|
+
installMethod(runtime, prototype, "drawColor", &JsiSkCanvas::drawColor);
|
|
591
|
+
installMethod(runtime, prototype, "clear", &JsiSkCanvas::clear);
|
|
592
|
+
installMethod(runtime, prototype, "concat", &JsiSkCanvas::concat);
|
|
593
|
+
installMethod(runtime, prototype, "drawPicture",
|
|
594
|
+
&JsiSkCanvas::drawPicture);
|
|
738
595
|
installHostMethod(runtime, prototype, "drawAtlas", &JsiSkCanvas::drawAtlas);
|
|
739
596
|
installHostMethod(runtime, prototype, "readPixels",
|
|
740
597
|
&JsiSkCanvas::readPixels);
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
#include "JsiSkColor.h"
|
|
4
4
|
#include "JsiSkColorFilter.h"
|
|
5
|
+
#include "JsiSkConverters.h"
|
|
5
6
|
#include "JsiSkNativeObjects.h"
|
|
6
7
|
#include <jsi/jsi.h>
|
|
7
8
|
#include <memory>
|
|
8
9
|
#include <utility>
|
|
10
|
+
#include <vector>
|
|
9
11
|
|
|
10
12
|
#pragma clang diagnostic push
|
|
11
13
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
|
@@ -24,87 +26,67 @@ class JsiSkColorFilterFactory
|
|
|
24
26
|
public:
|
|
25
27
|
static constexpr const char *CLASS_NAME = "ColorFilterFactory";
|
|
26
28
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (jsiMatrix.size(runtime) > i) {
|
|
32
|
-
matrix[i] = jsiMatrix.getValueAtIndex(runtime, i).asNumber();
|
|
33
|
-
}
|
|
29
|
+
std::shared_ptr<JsiSkColorFilter> MakeMatrix(std::vector<float> values) {
|
|
30
|
+
float matrix[20] = {0};
|
|
31
|
+
for (size_t i = 0; i < 20 && i < values.size(); i++) {
|
|
32
|
+
matrix[i] = values[i];
|
|
34
33
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
runtime, std::make_shared<JsiSkColorFilter>(
|
|
38
|
-
getContext(), SkColorFilters::Matrix(std::move(matrix))));
|
|
34
|
+
return std::make_shared<JsiSkColorFilter>(getContext(),
|
|
35
|
+
SkColorFilters::Matrix(matrix));
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return makeJsiObject(
|
|
46
|
-
runtime, std::make_shared<JsiSkColorFilter>(
|
|
47
|
-
getContext(), SkColorFilters::Blend(color, blend)));
|
|
38
|
+
std::shared_ptr<JsiSkColorFilter> MakeBlend(JsiColor color, double blend) {
|
|
39
|
+
return std::make_shared<JsiSkColorFilter>(
|
|
40
|
+
getContext(),
|
|
41
|
+
SkColorFilters::Blend(color, static_cast<SkBlendMode>(blend)));
|
|
48
42
|
}
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
runtime, std::make_shared<JsiSkColorFilter>(
|
|
56
|
-
getContext(), SkColorFilters::Compose(std::move(outer),
|
|
57
|
-
std::move(inner))));
|
|
44
|
+
std::shared_ptr<JsiSkColorFilter> MakeCompose(sk_sp<SkColorFilter> outer,
|
|
45
|
+
sk_sp<SkColorFilter> inner) {
|
|
46
|
+
return std::make_shared<JsiSkColorFilter>(
|
|
47
|
+
getContext(),
|
|
48
|
+
SkColorFilters::Compose(std::move(outer), std::move(inner)));
|
|
58
49
|
}
|
|
59
50
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return makeJsiObject(
|
|
66
|
-
runtime, std::make_shared<JsiSkColorFilter>(
|
|
67
|
-
getContext(),
|
|
68
|
-
SkColorFilters::Lerp(t, std::move(dst), std::move(src))));
|
|
51
|
+
std::shared_ptr<JsiSkColorFilter> MakeLerp(double t,
|
|
52
|
+
sk_sp<SkColorFilter> dst,
|
|
53
|
+
sk_sp<SkColorFilter> src) {
|
|
54
|
+
return std::make_shared<JsiSkColorFilter>(
|
|
55
|
+
getContext(), SkColorFilters::Lerp(t, std::move(dst), std::move(src)));
|
|
69
56
|
}
|
|
70
57
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
runtime, std::make_shared<JsiSkColorFilter>(
|
|
75
|
-
getContext(), SkColorFilters::SRGBToLinearGamma()));
|
|
58
|
+
std::shared_ptr<JsiSkColorFilter> MakeSRGBToLinearGamma() {
|
|
59
|
+
return std::make_shared<JsiSkColorFilter>(
|
|
60
|
+
getContext(), SkColorFilters::SRGBToLinearGamma());
|
|
76
61
|
}
|
|
77
62
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
runtime, std::make_shared<JsiSkColorFilter>(
|
|
82
|
-
getContext(), SkColorFilters::LinearToSRGBGamma()));
|
|
63
|
+
std::shared_ptr<JsiSkColorFilter> MakeLinearToSRGBGamma() {
|
|
64
|
+
return std::make_shared<JsiSkColorFilter>(
|
|
65
|
+
getContext(), SkColorFilters::LinearToSRGBGamma());
|
|
83
66
|
}
|
|
84
67
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
getContext(), SkLumaColorFilter::Make()));
|
|
68
|
+
std::shared_ptr<JsiSkColorFilter> MakeLumaColorFilter() {
|
|
69
|
+
return std::make_shared<JsiSkColorFilter>(getContext(),
|
|
70
|
+
SkLumaColorFilter::Make());
|
|
89
71
|
}
|
|
90
72
|
|
|
91
73
|
size_t getMemoryPressure() override { return 1024; }
|
|
92
74
|
|
|
93
75
|
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
76
|
+
installMethod(runtime, prototype, "MakeMatrix",
|
|
77
|
+
&JsiSkColorFilterFactory::MakeMatrix);
|
|
78
|
+
installMethod(runtime, prototype, "MakeBlend",
|
|
79
|
+
&JsiSkColorFilterFactory::MakeBlend);
|
|
80
|
+
installMethod(runtime, prototype, "MakeCompose",
|
|
81
|
+
&JsiSkColorFilterFactory::MakeCompose);
|
|
82
|
+
installMethod(runtime, prototype, "MakeLerp",
|
|
83
|
+
&JsiSkColorFilterFactory::MakeLerp);
|
|
84
|
+
installMethod(runtime, prototype, "MakeSRGBToLinearGamma",
|
|
85
|
+
&JsiSkColorFilterFactory::MakeSRGBToLinearGamma);
|
|
86
|
+
installMethod(runtime, prototype, "MakeLinearToSRGBGamma",
|
|
87
|
+
&JsiSkColorFilterFactory::MakeLinearToSRGBGamma);
|
|
88
|
+
installMethod(runtime, prototype, "MakeLumaColorFilter",
|
|
89
|
+
&JsiSkColorFilterFactory::MakeLumaColorFilter);
|
|
108
90
|
}
|
|
109
91
|
|
|
110
92
|
explicit JsiSkColorFilterFactory(std::shared_ptr<RNSkPlatformContext> context)
|