@shopify/react-native-skia 2.10.0 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/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 +64 -96
- 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/jsi/EnumMapper.h +2 -2
- package/cpp/jsi/JSIConverter.h +2 -33
- package/cpp/jsi/NativeObject.h +24 -19
- package/cpp/jsi/Promise.cpp +2 -2
- package/cpp/jsi/Promise.h +2 -2
- 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/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/package.json +3 -4
- 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/JsiSkPath.h
CHANGED
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
#include <algorithm>
|
|
4
4
|
#include <memory>
|
|
5
|
+
#include <optional>
|
|
5
6
|
#include <set>
|
|
6
7
|
#include <string>
|
|
7
8
|
#include <utility>
|
|
9
|
+
#include <variant>
|
|
8
10
|
#include <vector>
|
|
9
11
|
|
|
10
12
|
#include <jsi/jsi.h>
|
|
11
13
|
|
|
14
|
+
#include "JsiSkConverters.h"
|
|
12
15
|
#include "JsiSkMatrix.h"
|
|
13
16
|
#include "JsiSkNativeObjects.h"
|
|
14
17
|
#include "JsiSkPoint.h"
|
|
@@ -77,338 +80,233 @@ private:
|
|
|
77
80
|
SkPath asPath() const { return getObject()->snapshot(); }
|
|
78
81
|
|
|
79
82
|
public:
|
|
80
|
-
// Mutable building methods (deprecated)
|
|
83
|
+
// Mutable building methods (deprecated) — chainable, and they take the
|
|
84
|
+
// runtime for the JS console deprecation warning.
|
|
81
85
|
|
|
82
|
-
|
|
86
|
+
void moveTo(jsi::Runtime &runtime, double x, double y) {
|
|
83
87
|
warnDeprecatedPathMethod(runtime, "moveTo",
|
|
84
88
|
"Use Skia.PathBuilder.Make().moveTo() instead.");
|
|
85
|
-
SkScalar x = arguments[0].asNumber();
|
|
86
|
-
SkScalar y = arguments[1].asNumber();
|
|
87
89
|
getObject()->moveTo(x, y);
|
|
88
|
-
return thisValue.getObject(runtime);
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
void rMoveTo(jsi::Runtime &runtime, double x, double y) {
|
|
92
93
|
warnDeprecatedPathMethod(runtime, "rMoveTo",
|
|
93
94
|
"Use Skia.PathBuilder.Make().rMoveTo() instead.");
|
|
94
|
-
SkScalar
|
|
95
|
-
SkScalar y = arguments[1].asNumber();
|
|
96
|
-
getObject()->rMoveTo({x, y});
|
|
97
|
-
return thisValue.getObject(runtime);
|
|
95
|
+
getObject()->rMoveTo({static_cast<SkScalar>(x), static_cast<SkScalar>(y)});
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
|
|
98
|
+
void lineTo(jsi::Runtime &runtime, double x, double y) {
|
|
101
99
|
warnDeprecatedPathMethod(runtime, "lineTo",
|
|
102
100
|
"Use Skia.PathBuilder.Make().lineTo() instead.");
|
|
103
|
-
SkScalar x = arguments[0].asNumber();
|
|
104
|
-
SkScalar y = arguments[1].asNumber();
|
|
105
101
|
getObject()->lineTo(x, y);
|
|
106
|
-
return thisValue.getObject(runtime);
|
|
107
102
|
}
|
|
108
103
|
|
|
109
|
-
|
|
104
|
+
void rLineTo(jsi::Runtime &runtime, double x, double y) {
|
|
110
105
|
warnDeprecatedPathMethod(runtime, "rLineTo",
|
|
111
106
|
"Use Skia.PathBuilder.Make().rLineTo() instead.");
|
|
112
|
-
SkScalar x = arguments[0].asNumber();
|
|
113
|
-
SkScalar y = arguments[1].asNumber();
|
|
114
107
|
getObject()->rLineTo(x, y);
|
|
115
|
-
return thisValue.getObject(runtime);
|
|
116
108
|
}
|
|
117
109
|
|
|
118
|
-
|
|
110
|
+
void quadTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
111
|
+
double y2) {
|
|
119
112
|
warnDeprecatedPathMethod(runtime, "quadTo",
|
|
120
113
|
"Use Skia.PathBuilder.Make().quadTo() instead.");
|
|
121
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
122
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
123
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
124
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
125
114
|
getObject()->quadTo(x1, y1, x2, y2);
|
|
126
|
-
return thisValue.getObject(runtime);
|
|
127
115
|
}
|
|
128
116
|
|
|
129
|
-
|
|
117
|
+
void rQuadTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
118
|
+
double y2) {
|
|
130
119
|
warnDeprecatedPathMethod(runtime, "rQuadTo",
|
|
131
120
|
"Use Skia.PathBuilder.Make().rQuadTo() instead.");
|
|
132
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
133
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
134
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
135
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
136
121
|
getObject()->rQuadTo(x1, y1, x2, y2);
|
|
137
|
-
return thisValue.getObject(runtime);
|
|
138
122
|
}
|
|
139
123
|
|
|
140
|
-
|
|
124
|
+
void conicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
125
|
+
double y2, double w) {
|
|
141
126
|
warnDeprecatedPathMethod(runtime, "conicTo",
|
|
142
127
|
"Use Skia.PathBuilder.Make().conicTo() instead.");
|
|
143
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
144
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
145
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
146
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
147
|
-
SkScalar w = arguments[4].asNumber();
|
|
148
128
|
getObject()->conicTo(x1, y1, x2, y2, w);
|
|
149
|
-
return thisValue.getObject(runtime);
|
|
150
129
|
}
|
|
151
130
|
|
|
152
|
-
|
|
131
|
+
void rConicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
132
|
+
double y2, double w) {
|
|
153
133
|
warnDeprecatedPathMethod(runtime, "rConicTo",
|
|
154
134
|
"Use Skia.PathBuilder.Make().rConicTo() instead.");
|
|
155
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
156
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
157
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
158
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
159
|
-
SkScalar w = arguments[4].asNumber();
|
|
160
135
|
getObject()->rConicTo(x1, y1, x2, y2, w);
|
|
161
|
-
return thisValue.getObject(runtime);
|
|
162
136
|
}
|
|
163
137
|
|
|
164
|
-
|
|
138
|
+
void cubicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
139
|
+
double y2, double x3, double y3) {
|
|
165
140
|
warnDeprecatedPathMethod(runtime, "cubicTo",
|
|
166
141
|
"Use Skia.PathBuilder.Make().cubicTo() instead.");
|
|
167
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
168
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
169
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
170
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
171
|
-
SkScalar x3 = arguments[4].asNumber();
|
|
172
|
-
SkScalar y3 = arguments[5].asNumber();
|
|
173
142
|
getObject()->cubicTo(x1, y1, x2, y2, x3, y3);
|
|
174
|
-
return thisValue.getObject(runtime);
|
|
175
143
|
}
|
|
176
144
|
|
|
177
|
-
|
|
145
|
+
void rCubicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
146
|
+
double y2, double x3, double y3) {
|
|
178
147
|
warnDeprecatedPathMethod(runtime, "rCubicTo",
|
|
179
148
|
"Use Skia.PathBuilder.Make().rCubicTo() instead.");
|
|
180
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
181
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
182
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
183
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
184
|
-
SkScalar x3 = arguments[4].asNumber();
|
|
185
|
-
SkScalar y3 = arguments[5].asNumber();
|
|
186
149
|
getObject()->rCubicTo(x1, y1, x2, y2, x3, y3);
|
|
187
|
-
return thisValue.getObject(runtime);
|
|
188
150
|
}
|
|
189
151
|
|
|
190
|
-
|
|
152
|
+
void close(jsi::Runtime &runtime) {
|
|
191
153
|
warnDeprecatedPathMethod(runtime, "close",
|
|
192
154
|
"Use Skia.PathBuilder.Make().close() instead.");
|
|
193
155
|
getObject()->close();
|
|
194
|
-
return thisValue.getObject(runtime);
|
|
195
156
|
}
|
|
196
157
|
|
|
197
|
-
|
|
158
|
+
void reset(jsi::Runtime &runtime) {
|
|
198
159
|
warnDeprecatedPathMethod(runtime, "reset",
|
|
199
160
|
"Use Skia.PathBuilder.Make().reset() instead.");
|
|
200
161
|
getObject()->reset();
|
|
201
|
-
return thisValue.getObject(runtime);
|
|
202
162
|
}
|
|
203
163
|
|
|
204
|
-
|
|
164
|
+
void rewind(jsi::Runtime &runtime) {
|
|
205
165
|
warnDeprecatedPathMethod(runtime, "rewind",
|
|
206
166
|
"Use Skia.PathBuilder.Make().reset() instead.");
|
|
207
167
|
getObject()->reset();
|
|
208
|
-
return thisValue.getObject(runtime);
|
|
209
168
|
}
|
|
210
169
|
|
|
211
|
-
|
|
170
|
+
void addPath(jsi::Runtime &runtime, std::shared_ptr<SkPathBuilder> src,
|
|
171
|
+
JsiOptional<std::shared_ptr<SkMatrix>> matrix,
|
|
172
|
+
JsiOptional<bool> extend) {
|
|
212
173
|
warnDeprecatedPathMethod(runtime, "addPath",
|
|
213
174
|
"Use Skia.PathBuilder.Make().addPath() instead.");
|
|
214
|
-
auto src = JsiSkPath::fromValue(runtime, arguments[0]);
|
|
215
175
|
auto srcPath = src->snapshot();
|
|
216
|
-
auto
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
auto extend = count > 2 && arguments[2].getBool();
|
|
221
|
-
auto mode =
|
|
222
|
-
extend ? SkPath::kExtend_AddPathMode : SkPath::kAppend_AddPathMode;
|
|
223
|
-
if (matrix) {
|
|
224
|
-
getObject()->addPath(srcPath, *matrix, mode);
|
|
176
|
+
auto mode = extend.has_value() && *extend ? SkPath::kExtend_AddPathMode
|
|
177
|
+
: SkPath::kAppend_AddPathMode;
|
|
178
|
+
if (matrix.has_value()) {
|
|
179
|
+
getObject()->addPath(srcPath, **matrix, mode);
|
|
225
180
|
} else {
|
|
226
181
|
getObject()->addPath(srcPath, mode);
|
|
227
182
|
}
|
|
228
|
-
return thisValue.getObject(runtime);
|
|
229
183
|
}
|
|
230
184
|
|
|
231
|
-
|
|
185
|
+
void addArc(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
|
|
186
|
+
double start, double sweep) {
|
|
232
187
|
warnDeprecatedPathMethod(runtime, "addArc",
|
|
233
188
|
"Use Skia.PathBuilder.Make().addArc() instead.");
|
|
234
|
-
auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
|
|
235
|
-
auto start = arguments[1].asNumber();
|
|
236
|
-
auto sweep = arguments[2].asNumber();
|
|
237
189
|
getObject()->addArc(*rect, start, sweep);
|
|
238
|
-
return thisValue.getObject(runtime);
|
|
239
190
|
}
|
|
240
191
|
|
|
241
|
-
|
|
192
|
+
void addOval(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
|
|
193
|
+
JsiOptional<bool> isCCW, JsiOptional<double> startIndex) {
|
|
242
194
|
warnDeprecatedPathMethod(
|
|
243
195
|
runtime, "addOval",
|
|
244
196
|
"Use Skia.Path.Oval() or Skia.PathBuilder.Make().addOval() instead.");
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
auto direction = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
250
|
-
getObject()->addOval(*rect, direction, startIndex);
|
|
251
|
-
return thisValue.getObject(runtime);
|
|
197
|
+
getObject()->addOval(*rect, toDirection(isCCW),
|
|
198
|
+
startIndex.has_value()
|
|
199
|
+
? static_cast<unsigned>(*startIndex)
|
|
200
|
+
: 1);
|
|
252
201
|
}
|
|
253
202
|
|
|
254
|
-
|
|
203
|
+
void addRect(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
|
|
204
|
+
JsiOptional<bool> isCCW) {
|
|
255
205
|
warnDeprecatedPathMethod(
|
|
256
206
|
runtime, "addRect",
|
|
257
207
|
"Use Skia.Path.Rect() or Skia.PathBuilder.Make().addRect() instead.");
|
|
258
|
-
|
|
259
|
-
auto isCCW = count > 1 && arguments[1].getBool();
|
|
260
|
-
auto direction = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
261
|
-
getObject()->addRect(*rect, direction);
|
|
262
|
-
return thisValue.getObject(runtime);
|
|
208
|
+
getObject()->addRect(*rect, toDirection(isCCW));
|
|
263
209
|
}
|
|
264
210
|
|
|
265
|
-
|
|
211
|
+
void addRRect(jsi::Runtime &runtime, std::shared_ptr<SkRRect> rrect,
|
|
212
|
+
JsiOptional<bool> isCCW) {
|
|
266
213
|
warnDeprecatedPathMethod(
|
|
267
214
|
runtime, "addRRect",
|
|
268
215
|
"Use Skia.Path.RRect() or Skia.PathBuilder.Make().addRRect() instead.");
|
|
269
|
-
|
|
270
|
-
auto isCCW = count > 1 && arguments[1].getBool();
|
|
271
|
-
auto direction = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
272
|
-
getObject()->addRRect(*rrect, direction);
|
|
273
|
-
return thisValue.getObject(runtime);
|
|
216
|
+
getObject()->addRRect(*rrect, toDirection(isCCW));
|
|
274
217
|
}
|
|
275
218
|
|
|
276
|
-
|
|
219
|
+
void addCircle(jsi::Runtime &runtime, double x, double y, double r) {
|
|
277
220
|
warnDeprecatedPathMethod(
|
|
278
221
|
runtime, "addCircle",
|
|
279
222
|
"Use Skia.Path.Circle() or Skia.PathBuilder.Make().addCircle() "
|
|
280
223
|
"instead.");
|
|
281
|
-
SkScalar x = arguments[0].asNumber();
|
|
282
|
-
SkScalar y = arguments[1].asNumber();
|
|
283
|
-
SkScalar r = arguments[2].asNumber();
|
|
284
224
|
getObject()->addCircle(x, y, r);
|
|
285
|
-
return thisValue.getObject(runtime);
|
|
286
225
|
}
|
|
287
226
|
|
|
288
|
-
|
|
227
|
+
void addPoly(jsi::Runtime &runtime, std::vector<SkPoint> points,
|
|
228
|
+
bool close) {
|
|
289
229
|
warnDeprecatedPathMethod(
|
|
290
230
|
runtime, "addPoly",
|
|
291
231
|
"Use Skia.Path.Polygon() or Skia.PathBuilder.Make().addPoly() "
|
|
292
232
|
"instead.");
|
|
293
|
-
auto jsiPoints = arguments[0].asObject(runtime).asArray(runtime);
|
|
294
|
-
auto close = arguments[1].getBool();
|
|
295
|
-
auto pointsSize = static_cast<int>(jsiPoints.size(runtime));
|
|
296
|
-
std::vector<SkPoint> points;
|
|
297
|
-
points.reserve(pointsSize);
|
|
298
|
-
for (int i = 0; i < pointsSize; i++) {
|
|
299
|
-
auto pt =
|
|
300
|
-
JsiSkPoint::fromValue(runtime, jsiPoints.getValueAtIndex(runtime, i));
|
|
301
|
-
points.push_back(*pt);
|
|
302
|
-
}
|
|
303
233
|
getObject()->addPolygon(SkSpan<const SkPoint>(points.data(), points.size()),
|
|
304
234
|
close);
|
|
305
|
-
return thisValue.getObject(runtime);
|
|
306
235
|
}
|
|
307
236
|
|
|
308
|
-
|
|
237
|
+
void arcToOval(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
|
|
238
|
+
double start, double sweep, bool forceMoveTo) {
|
|
309
239
|
warnDeprecatedPathMethod(
|
|
310
240
|
runtime, "arcToOval",
|
|
311
241
|
"Use Skia.PathBuilder.Make().arcToOval() instead.");
|
|
312
|
-
auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
|
|
313
|
-
auto start = arguments[1].asNumber();
|
|
314
|
-
auto sweep = arguments[2].asNumber();
|
|
315
|
-
auto forceMoveTo = arguments[3].getBool();
|
|
316
242
|
getObject()->arcTo(*rect, start, sweep, forceMoveTo);
|
|
317
|
-
return thisValue.getObject(runtime);
|
|
318
243
|
}
|
|
319
244
|
|
|
320
|
-
|
|
245
|
+
void arcToRotated(jsi::Runtime &runtime, double rx, double ry,
|
|
246
|
+
double xAxisRotate, bool useSmallArc, bool isCCW, double x,
|
|
247
|
+
double y) {
|
|
321
248
|
warnDeprecatedPathMethod(
|
|
322
249
|
runtime, "arcToRotated",
|
|
323
250
|
"Use Skia.PathBuilder.Make().arcToRotated() instead.");
|
|
324
|
-
SkScalar rx = arguments[0].asNumber();
|
|
325
|
-
SkScalar ry = arguments[1].asNumber();
|
|
326
|
-
SkScalar xAxisRotate = arguments[2].asNumber();
|
|
327
|
-
auto useSmallArc = arguments[3].getBool();
|
|
328
|
-
auto isCCW = arguments[4].getBool();
|
|
329
|
-
SkScalar x = arguments[5].asNumber();
|
|
330
|
-
SkScalar y = arguments[6].asNumber();
|
|
331
251
|
auto arcSize = useSmallArc ? SkPathBuilder::kSmall_ArcSize
|
|
332
252
|
: SkPathBuilder::kLarge_ArcSize;
|
|
333
253
|
auto sweep = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
334
254
|
getObject()->arcTo(SkPoint::Make(rx, ry), xAxisRotate, arcSize, sweep,
|
|
335
255
|
SkPoint::Make(x, y));
|
|
336
|
-
return thisValue.getObject(runtime);
|
|
337
256
|
}
|
|
338
257
|
|
|
339
|
-
|
|
258
|
+
void rArcTo(jsi::Runtime &runtime, double rx, double ry, double xAxisRotate,
|
|
259
|
+
bool useSmallArc, bool isCCW, double dx, double dy) {
|
|
340
260
|
warnDeprecatedPathMethod(runtime, "rArcTo",
|
|
341
261
|
"Use Skia.PathBuilder.Make().rArcTo() instead.");
|
|
342
|
-
SkScalar rx = arguments[0].asNumber();
|
|
343
|
-
SkScalar ry = arguments[1].asNumber();
|
|
344
|
-
SkScalar xAxisRotate = arguments[2].asNumber();
|
|
345
|
-
auto useSmallArc = arguments[3].getBool();
|
|
346
|
-
auto isCCW = arguments[4].getBool();
|
|
347
|
-
SkScalar dx = arguments[5].asNumber();
|
|
348
|
-
SkScalar dy = arguments[6].asNumber();
|
|
349
262
|
auto arcSize = useSmallArc ? SkPathBuilder::kSmall_ArcSize
|
|
350
263
|
: SkPathBuilder::kLarge_ArcSize;
|
|
351
264
|
auto sweep = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
352
265
|
SkVector dxdy(dx, dy);
|
|
353
266
|
SkPoint r(rx, ry);
|
|
354
267
|
getObject()->rArcTo(r, xAxisRotate, arcSize, sweep, dxdy);
|
|
355
|
-
return thisValue.getObject(runtime);
|
|
356
268
|
}
|
|
357
269
|
|
|
358
|
-
|
|
270
|
+
void arcToTangent(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
271
|
+
double y2, double r) {
|
|
359
272
|
warnDeprecatedPathMethod(
|
|
360
273
|
runtime, "arcToTangent",
|
|
361
274
|
"Use Skia.PathBuilder.Make().arcToTangent() instead.");
|
|
362
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
363
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
364
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
365
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
366
|
-
SkScalar r = arguments[4].asNumber();
|
|
367
275
|
getObject()->arcTo(SkPoint::Make(x1, y1), SkPoint::Make(x2, y2), r);
|
|
368
|
-
return thisValue.getObject(runtime);
|
|
369
276
|
}
|
|
370
277
|
|
|
371
|
-
|
|
278
|
+
void setFillType(jsi::Runtime &runtime, double ft) {
|
|
372
279
|
warnDeprecatedPathMethod(
|
|
373
280
|
runtime, "setFillType",
|
|
374
281
|
"Use Skia.PathBuilder.Make().setFillType() instead.");
|
|
375
|
-
auto ft = arguments[0].asNumber();
|
|
376
282
|
getObject()->setFillType(static_cast<SkPathFillType>(static_cast<int>(ft)));
|
|
377
|
-
return thisValue.getObject(runtime);
|
|
378
283
|
}
|
|
379
284
|
|
|
380
|
-
|
|
285
|
+
void setIsVolatile(jsi::Runtime &runtime, bool v) {
|
|
381
286
|
warnDeprecatedPathMethod(
|
|
382
287
|
runtime, "setIsVolatile",
|
|
383
288
|
"Use Skia.PathBuilder.Make().setIsVolatile() instead.");
|
|
384
|
-
auto v = arguments[0].getBool();
|
|
385
289
|
getObject()->setIsVolatile(v);
|
|
386
|
-
return thisValue.getObject(runtime);
|
|
387
290
|
}
|
|
388
291
|
|
|
389
292
|
// Mutable transform methods (deprecated)
|
|
390
293
|
|
|
391
|
-
|
|
294
|
+
void transform(jsi::Runtime &runtime, std::shared_ptr<SkMatrix> m3) {
|
|
392
295
|
warnDeprecatedPathMethod(
|
|
393
296
|
runtime, "transform",
|
|
394
297
|
"Use Skia.PathBuilder.Make().transform() instead.");
|
|
395
|
-
|
|
396
|
-
getObject()->transform(m3);
|
|
397
|
-
return thisValue.getObject(runtime);
|
|
298
|
+
getObject()->transform(*m3);
|
|
398
299
|
}
|
|
399
300
|
|
|
400
|
-
|
|
301
|
+
void offset(jsi::Runtime &runtime, double dx, double dy) {
|
|
401
302
|
warnDeprecatedPathMethod(runtime, "offset",
|
|
402
303
|
"Use Skia.PathBuilder.Make().offset() instead.");
|
|
403
|
-
SkScalar dx = arguments[0].asNumber();
|
|
404
|
-
SkScalar dy = arguments[1].asNumber();
|
|
405
304
|
getObject()->offset(dx, dy);
|
|
406
|
-
return thisValue.getObject(runtime);
|
|
407
305
|
}
|
|
408
306
|
|
|
409
307
|
// Mutable path operations (deprecated)
|
|
410
308
|
|
|
411
|
-
|
|
309
|
+
void simplify(jsi::Runtime &runtime) {
|
|
412
310
|
warnDeprecatedPathMethod(runtime, "simplify",
|
|
413
311
|
"Use Skia.Path.Simplify(path) instead.");
|
|
414
312
|
auto path = asPath();
|
|
@@ -416,25 +314,22 @@ public:
|
|
|
416
314
|
if (result.has_value()) {
|
|
417
315
|
*getObject() = SkPathBuilder(result.value());
|
|
418
316
|
}
|
|
419
|
-
return thisValue.getObject(runtime);
|
|
420
317
|
}
|
|
421
318
|
|
|
422
|
-
|
|
319
|
+
void op(jsi::Runtime &runtime, std::shared_ptr<SkPathBuilder> path2,
|
|
320
|
+
double pathOp) {
|
|
423
321
|
warnDeprecatedPathMethod(runtime, "op",
|
|
424
322
|
"Use Skia.Path.MakeFromOp() instead.");
|
|
425
|
-
auto path2 = JsiSkPath::fromValue(runtime, arguments[0]);
|
|
426
|
-
auto pathOp =
|
|
427
|
-
static_cast<SkPathOp>(static_cast<int>(arguments[1].asNumber()));
|
|
428
323
|
auto p1 = asPath();
|
|
429
324
|
auto p2 = path2->snapshot();
|
|
430
|
-
auto result =
|
|
325
|
+
auto result =
|
|
326
|
+
::Op(p1, p2, static_cast<SkPathOp>(static_cast<int>(pathOp)));
|
|
431
327
|
if (result.has_value()) {
|
|
432
328
|
*getObject() = SkPathBuilder(result.value());
|
|
433
329
|
}
|
|
434
|
-
return thisValue.getObject(runtime);
|
|
435
330
|
}
|
|
436
331
|
|
|
437
|
-
|
|
332
|
+
void makeAsWinding(jsi::Runtime &runtime) {
|
|
438
333
|
warnDeprecatedPathMethod(runtime, "makeAsWinding",
|
|
439
334
|
"Use Skia.Path.AsWinding(path) instead.");
|
|
440
335
|
auto path = asPath();
|
|
@@ -442,17 +337,14 @@ public:
|
|
|
442
337
|
if (result.has_value()) {
|
|
443
338
|
*getObject() = SkPathBuilder(result.value());
|
|
444
339
|
}
|
|
445
|
-
return thisValue.getObject(runtime);
|
|
446
340
|
}
|
|
447
341
|
|
|
448
|
-
|
|
342
|
+
void dash(jsi::Runtime &runtime, double on, double off, double phase) {
|
|
449
343
|
warnDeprecatedPathMethod(
|
|
450
344
|
runtime, "dash", "Use Skia.Path.Dash(path, on, off, phase) instead.");
|
|
451
345
|
auto path = asPath();
|
|
452
|
-
SkScalar
|
|
453
|
-
|
|
454
|
-
auto phase = arguments[2].asNumber();
|
|
455
|
-
SkScalar intervals[] = {on, off};
|
|
346
|
+
SkScalar intervals[] = {static_cast<SkScalar>(on),
|
|
347
|
+
static_cast<SkScalar>(off)};
|
|
456
348
|
auto pe = SkDashPathEffect::Make(SkSpan(intervals, 2), phase);
|
|
457
349
|
if (pe) {
|
|
458
350
|
SkStrokeRec rec(SkStrokeRec::InitStyle::kHairline_InitStyle);
|
|
@@ -461,9 +353,9 @@ public:
|
|
|
461
353
|
*getObject() = std::move(resultBuilder);
|
|
462
354
|
}
|
|
463
355
|
}
|
|
464
|
-
return thisValue.getObject(runtime);
|
|
465
356
|
}
|
|
466
357
|
|
|
358
|
+
// Stays raw: the options object is read leniently property by property.
|
|
467
359
|
JSI_HOST_FUNCTION(stroke) {
|
|
468
360
|
warnDeprecatedPathMethod(runtime, "stroke",
|
|
469
361
|
"Use Skia.Path.Stroke(path, opts) instead.");
|
|
@@ -505,16 +397,14 @@ public:
|
|
|
505
397
|
return thisValue.getObject(runtime);
|
|
506
398
|
}
|
|
507
399
|
|
|
508
|
-
|
|
400
|
+
void trim(jsi::Runtime &runtime, double startValue, double endValue,
|
|
401
|
+
bool isComplement) {
|
|
509
402
|
warnDeprecatedPathMethod(
|
|
510
403
|
runtime, "trim",
|
|
511
404
|
"Use Skia.Path.Trim(path, start, end, isComplement) instead.");
|
|
512
405
|
auto path = asPath();
|
|
513
|
-
float start =
|
|
514
|
-
|
|
515
|
-
float end =
|
|
516
|
-
std::clamp(static_cast<float>(arguments[1].asNumber()), 0.0f, 1.0f);
|
|
517
|
-
auto isComplement = arguments[2].getBool();
|
|
406
|
+
float start = std::clamp(static_cast<float>(startValue), 0.0f, 1.0f);
|
|
407
|
+
float end = std::clamp(static_cast<float>(endValue), 0.0f, 1.0f);
|
|
518
408
|
auto mode = isComplement ? SkTrimPathEffect::Mode::kInverted
|
|
519
409
|
: SkTrimPathEffect::Mode::kNormal;
|
|
520
410
|
auto pe = SkTrimPathEffect::Make(start, end, mode);
|
|
@@ -525,106 +415,77 @@ public:
|
|
|
525
415
|
*getObject() = std::move(resultBuilder);
|
|
526
416
|
}
|
|
527
417
|
}
|
|
528
|
-
return thisValue.getObject(runtime);
|
|
529
418
|
}
|
|
530
419
|
|
|
531
420
|
// Query methods
|
|
532
421
|
|
|
533
|
-
|
|
422
|
+
std::shared_ptr<JsiSkRect> computeTightBounds() {
|
|
534
423
|
auto path = asPath();
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
std::make_shared<JsiSkRect>(getContext(), result));
|
|
424
|
+
return std::make_shared<JsiSkRect>(getContext(),
|
|
425
|
+
path.computeTightBounds());
|
|
538
426
|
}
|
|
539
427
|
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
std::make_shared<JsiSkRect>(getContext(), result));
|
|
428
|
+
std::shared_ptr<JsiSkRect> getBounds() {
|
|
429
|
+
return std::make_shared<JsiSkRect>(getContext(),
|
|
430
|
+
getObject()->computeBounds());
|
|
544
431
|
}
|
|
545
432
|
|
|
546
|
-
|
|
547
|
-
auto x = arguments[0].asNumber();
|
|
548
|
-
auto y = arguments[1].asNumber();
|
|
549
|
-
return jsi::Value(asPath().contains(x, y));
|
|
550
|
-
}
|
|
433
|
+
bool contains(double x, double y) { return asPath().contains(x, y); }
|
|
551
434
|
|
|
552
|
-
|
|
553
|
-
auto fillType = getObject()->fillType();
|
|
554
|
-
return jsi::Value(static_cast<int>(fillType));
|
|
555
|
-
}
|
|
435
|
+
int getFillType() { return static_cast<int>(getObject()->fillType()); }
|
|
556
436
|
|
|
557
|
-
|
|
437
|
+
bool isVolatile() { return asPath().isVolatile(); }
|
|
558
438
|
|
|
559
|
-
|
|
560
|
-
auto index = arguments[0].asNumber();
|
|
439
|
+
std::shared_ptr<JsiSkPoint> getPoint(int index) {
|
|
561
440
|
auto point = asPath().getPoint(index);
|
|
562
|
-
return
|
|
563
|
-
std::make_shared<JsiSkPoint>(getContext(), point));
|
|
441
|
+
return std::make_shared<JsiSkPoint>(getContext(), point);
|
|
564
442
|
}
|
|
565
443
|
|
|
566
|
-
|
|
444
|
+
bool isEmpty() { return getObject()->isEmpty(); }
|
|
567
445
|
|
|
568
|
-
|
|
569
|
-
auto points = asPath().countPoints();
|
|
570
|
-
return jsi::Value(points);
|
|
571
|
-
}
|
|
446
|
+
int countPoints() { return asPath().countPoints(); }
|
|
572
447
|
|
|
573
|
-
|
|
448
|
+
SkPoint getLastPt() {
|
|
574
449
|
auto last = getObject()->getLastPt();
|
|
575
|
-
|
|
576
|
-
if (last.has_value()) {
|
|
577
|
-
point.setProperty(runtime, "x", static_cast<double>(last->fX));
|
|
578
|
-
point.setProperty(runtime, "y", static_cast<double>(last->fY));
|
|
579
|
-
} else {
|
|
580
|
-
point.setProperty(runtime, "x", 0.0);
|
|
581
|
-
point.setProperty(runtime, "y", 0.0);
|
|
582
|
-
}
|
|
583
|
-
return point;
|
|
450
|
+
return last.value_or(SkPoint::Make(0, 0));
|
|
584
451
|
}
|
|
585
452
|
|
|
586
|
-
|
|
453
|
+
std::string toSVGString() {
|
|
587
454
|
auto path = asPath();
|
|
588
455
|
auto s = SkParsePath::ToSVGString(path);
|
|
589
|
-
return
|
|
456
|
+
return std::string(s.c_str());
|
|
590
457
|
}
|
|
591
458
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
return jsi::Value(p1->snapshot() == p2->snapshot());
|
|
459
|
+
bool equals(std::shared_ptr<SkPathBuilder> p1,
|
|
460
|
+
std::shared_ptr<SkPathBuilder> p2) {
|
|
461
|
+
return p1->snapshot() == p2->snapshot();
|
|
596
462
|
}
|
|
597
463
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
return makeJsiObject(runtime,
|
|
601
|
-
std::make_shared<JsiSkPath>(getContext(), path));
|
|
464
|
+
std::shared_ptr<JsiSkPath> copy() {
|
|
465
|
+
return std::make_shared<JsiSkPath>(getContext(), asPath());
|
|
602
466
|
}
|
|
603
467
|
|
|
604
|
-
|
|
605
|
-
auto path2 = JsiSkPath::fromValue(runtime, arguments[0]);
|
|
468
|
+
bool isInterpolatable(std::shared_ptr<SkPathBuilder> path2) {
|
|
606
469
|
auto p1 = asPath();
|
|
607
470
|
auto p2 = path2->snapshot();
|
|
608
471
|
return p1.isInterpolatable(p2);
|
|
609
472
|
}
|
|
610
473
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
auto weight = arguments[1].asNumber();
|
|
474
|
+
std::variant<std::nullptr_t, std::shared_ptr<JsiSkPath>>
|
|
475
|
+
interpolate(std::shared_ptr<SkPathBuilder> path2, double weight) {
|
|
614
476
|
auto p1 = asPath();
|
|
615
477
|
auto p2 = path2->snapshot();
|
|
616
478
|
SkPath result;
|
|
617
479
|
auto succeed = p1.interpolate(p2, weight, &result);
|
|
618
480
|
if (!succeed) {
|
|
619
|
-
return
|
|
481
|
+
return nullptr;
|
|
620
482
|
}
|
|
621
|
-
return
|
|
622
|
-
runtime, std::make_shared<JsiSkPath>(getContext(), std::move(result)));
|
|
483
|
+
return std::make_shared<JsiSkPath>(getContext(), std::move(result));
|
|
623
484
|
}
|
|
624
485
|
|
|
625
|
-
|
|
486
|
+
std::vector<std::vector<double>> toCmds() {
|
|
626
487
|
auto path = asPath();
|
|
627
|
-
std::vector<
|
|
488
|
+
std::vector<std::vector<double>> cmds;
|
|
628
489
|
SkPoint pts[4];
|
|
629
490
|
SkPath::Iter iter(path, false);
|
|
630
491
|
SkPath::Verb verb;
|
|
@@ -632,141 +493,141 @@ public:
|
|
|
632
493
|
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
|
|
633
494
|
switch (verb) {
|
|
634
495
|
case SkPath::kMove_Verb: {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[0].y()));
|
|
639
|
-
cmdList.push_back(std::move(cmd));
|
|
496
|
+
cmds.push_back({static_cast<double>(MOVE),
|
|
497
|
+
static_cast<double>(pts[0].x()),
|
|
498
|
+
static_cast<double>(pts[0].y())});
|
|
640
499
|
break;
|
|
641
500
|
}
|
|
642
501
|
case SkPath::kLine_Verb: {
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[1].y()));
|
|
647
|
-
cmdList.push_back(std::move(cmd));
|
|
502
|
+
cmds.push_back({static_cast<double>(LINE),
|
|
503
|
+
static_cast<double>(pts[1].x()),
|
|
504
|
+
static_cast<double>(pts[1].y())});
|
|
648
505
|
break;
|
|
649
506
|
}
|
|
650
507
|
case SkPath::kQuad_Verb: {
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
cmd.setValueAtIndex(runtime, 3, static_cast<double>(pts[2].x()));
|
|
656
|
-
cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
|
|
657
|
-
cmdList.push_back(std::move(cmd));
|
|
508
|
+
cmds.push_back(
|
|
509
|
+
{static_cast<double>(QUAD), static_cast<double>(pts[1].x()),
|
|
510
|
+
static_cast<double>(pts[1].y()), static_cast<double>(pts[2].x()),
|
|
511
|
+
static_cast<double>(pts[2].y())});
|
|
658
512
|
break;
|
|
659
513
|
}
|
|
660
514
|
case SkPath::kConic_Verb: {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
|
|
667
|
-
cmd.setValueAtIndex(runtime, 5,
|
|
668
|
-
static_cast<double>(iter.conicWeight()));
|
|
669
|
-
cmdList.push_back(std::move(cmd));
|
|
515
|
+
cmds.push_back(
|
|
516
|
+
{static_cast<double>(CONIC), static_cast<double>(pts[1].x()),
|
|
517
|
+
static_cast<double>(pts[1].y()), static_cast<double>(pts[2].x()),
|
|
518
|
+
static_cast<double>(pts[2].y()),
|
|
519
|
+
static_cast<double>(iter.conicWeight())});
|
|
670
520
|
break;
|
|
671
521
|
}
|
|
672
522
|
case SkPath::kCubic_Verb: {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
|
|
679
|
-
cmd.setValueAtIndex(runtime, 5, static_cast<double>(pts[3].x()));
|
|
680
|
-
cmd.setValueAtIndex(runtime, 6, static_cast<double>(pts[3].y()));
|
|
681
|
-
cmdList.push_back(std::move(cmd));
|
|
523
|
+
cmds.push_back(
|
|
524
|
+
{static_cast<double>(CUBIC), static_cast<double>(pts[1].x()),
|
|
525
|
+
static_cast<double>(pts[1].y()), static_cast<double>(pts[2].x()),
|
|
526
|
+
static_cast<double>(pts[2].y()), static_cast<double>(pts[3].x()),
|
|
527
|
+
static_cast<double>(pts[3].y())});
|
|
682
528
|
break;
|
|
683
529
|
}
|
|
684
530
|
case SkPath::kClose_Verb: {
|
|
685
|
-
|
|
686
|
-
cmd.setValueAtIndex(runtime, 0, static_cast<double>(CLOSE));
|
|
687
|
-
cmdList.push_back(std::move(cmd));
|
|
531
|
+
cmds.push_back({static_cast<double>(CLOSE)});
|
|
688
532
|
break;
|
|
689
533
|
}
|
|
690
534
|
default:
|
|
691
535
|
break;
|
|
692
536
|
}
|
|
693
537
|
}
|
|
694
|
-
|
|
695
|
-
// Create the jsi::Array with the exact size
|
|
696
|
-
auto cmds = jsi::Array(runtime, cmdList.size());
|
|
697
|
-
for (size_t i = 0; i < cmdList.size(); ++i) {
|
|
698
|
-
cmds.setValueAtIndex(runtime, i, cmdList[i]);
|
|
699
|
-
}
|
|
700
|
-
|
|
701
538
|
return cmds;
|
|
702
539
|
}
|
|
703
540
|
|
|
704
541
|
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
705
542
|
installCommon(runtime, prototype);
|
|
706
543
|
// Mutable building methods
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
544
|
+
installChainableMethodWithRuntime(runtime, prototype, "moveTo",
|
|
545
|
+
&JsiSkPath::moveTo);
|
|
546
|
+
installChainableMethodWithRuntime(runtime, prototype, "rMoveTo",
|
|
547
|
+
&JsiSkPath::rMoveTo);
|
|
548
|
+
installChainableMethodWithRuntime(runtime, prototype, "lineTo",
|
|
549
|
+
&JsiSkPath::lineTo);
|
|
550
|
+
installChainableMethodWithRuntime(runtime, prototype, "rLineTo",
|
|
551
|
+
&JsiSkPath::rLineTo);
|
|
552
|
+
installChainableMethodWithRuntime(runtime, prototype, "quadTo",
|
|
553
|
+
&JsiSkPath::quadTo);
|
|
554
|
+
installChainableMethodWithRuntime(runtime, prototype, "rQuadTo",
|
|
555
|
+
&JsiSkPath::rQuadTo);
|
|
556
|
+
installChainableMethodWithRuntime(runtime, prototype, "conicTo",
|
|
557
|
+
&JsiSkPath::conicTo);
|
|
558
|
+
installChainableMethodWithRuntime(runtime, prototype, "rConicTo",
|
|
559
|
+
&JsiSkPath::rConicTo);
|
|
560
|
+
installChainableMethodWithRuntime(runtime, prototype, "cubicTo",
|
|
561
|
+
&JsiSkPath::cubicTo);
|
|
562
|
+
installChainableMethodWithRuntime(runtime, prototype, "rCubicTo",
|
|
563
|
+
&JsiSkPath::rCubicTo);
|
|
564
|
+
installChainableMethodWithRuntime(runtime, prototype, "close",
|
|
565
|
+
&JsiSkPath::close);
|
|
566
|
+
installChainableMethodWithRuntime(runtime, prototype, "reset",
|
|
567
|
+
&JsiSkPath::reset);
|
|
568
|
+
installChainableMethodWithRuntime(runtime, prototype, "rewind",
|
|
569
|
+
&JsiSkPath::rewind);
|
|
570
|
+
installChainableMethodWithRuntime(runtime, prototype, "addPath",
|
|
571
|
+
&JsiSkPath::addPath);
|
|
572
|
+
installChainableMethodWithRuntime(runtime, prototype, "addArc",
|
|
573
|
+
&JsiSkPath::addArc);
|
|
574
|
+
installChainableMethodWithRuntime(runtime, prototype, "addOval",
|
|
575
|
+
&JsiSkPath::addOval);
|
|
576
|
+
installChainableMethodWithRuntime(runtime, prototype, "addRect",
|
|
577
|
+
&JsiSkPath::addRect);
|
|
578
|
+
installChainableMethodWithRuntime(runtime, prototype, "addRRect",
|
|
579
|
+
&JsiSkPath::addRRect);
|
|
580
|
+
installChainableMethodWithRuntime(runtime, prototype, "addCircle",
|
|
581
|
+
&JsiSkPath::addCircle);
|
|
582
|
+
installChainableMethodWithRuntime(runtime, prototype, "addPoly",
|
|
583
|
+
&JsiSkPath::addPoly);
|
|
584
|
+
installChainableMethodWithRuntime(runtime, prototype, "arcToOval",
|
|
585
|
+
&JsiSkPath::arcToOval);
|
|
586
|
+
installChainableMethodWithRuntime(runtime, prototype, "arcToRotated",
|
|
587
|
+
&JsiSkPath::arcToRotated);
|
|
588
|
+
installChainableMethodWithRuntime(runtime, prototype, "rArcTo",
|
|
589
|
+
&JsiSkPath::rArcTo);
|
|
590
|
+
installChainableMethodWithRuntime(runtime, prototype, "arcToTangent",
|
|
591
|
+
&JsiSkPath::arcToTangent);
|
|
592
|
+
installChainableMethodWithRuntime(runtime, prototype, "setFillType",
|
|
593
|
+
&JsiSkPath::setFillType);
|
|
594
|
+
installChainableMethodWithRuntime(runtime, prototype, "setIsVolatile",
|
|
595
|
+
&JsiSkPath::setIsVolatile);
|
|
737
596
|
// Mutable transform methods
|
|
738
|
-
|
|
739
|
-
|
|
597
|
+
installChainableMethodWithRuntime(runtime, prototype, "transform",
|
|
598
|
+
&JsiSkPath::transform);
|
|
599
|
+
installChainableMethodWithRuntime(runtime, prototype, "offset",
|
|
600
|
+
&JsiSkPath::offset);
|
|
740
601
|
// Mutable path operations
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
602
|
+
installChainableMethodWithRuntime(runtime, prototype, "simplify",
|
|
603
|
+
&JsiSkPath::simplify);
|
|
604
|
+
installChainableMethodWithRuntime(runtime, prototype, "op",
|
|
605
|
+
&JsiSkPath::op);
|
|
606
|
+
installChainableMethodWithRuntime(runtime, prototype, "makeAsWinding",
|
|
607
|
+
&JsiSkPath::makeAsWinding);
|
|
608
|
+
installChainableMethodWithRuntime(runtime, prototype, "dash",
|
|
609
|
+
&JsiSkPath::dash);
|
|
746
610
|
installHostMethod(runtime, prototype, "stroke", &JsiSkPath::stroke);
|
|
747
|
-
|
|
611
|
+
installChainableMethodWithRuntime(runtime, prototype, "trim",
|
|
612
|
+
&JsiSkPath::trim);
|
|
748
613
|
// Query methods
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
&JsiSkPath::isInterpolatable);
|
|
767
|
-
installHostMethod(runtime, prototype, "interpolate",
|
|
768
|
-
&JsiSkPath::interpolate);
|
|
769
|
-
installHostMethod(runtime, prototype, "toCmds", &JsiSkPath::toCmds);
|
|
614
|
+
installMethod(runtime, prototype, "computeTightBounds",
|
|
615
|
+
&JsiSkPath::computeTightBounds);
|
|
616
|
+
installMethod(runtime, prototype, "getBounds", &JsiSkPath::getBounds);
|
|
617
|
+
installMethod(runtime, prototype, "contains", &JsiSkPath::contains);
|
|
618
|
+
installMethod(runtime, prototype, "getFillType", &JsiSkPath::getFillType);
|
|
619
|
+
installMethod(runtime, prototype, "isVolatile", &JsiSkPath::isVolatile);
|
|
620
|
+
installMethod(runtime, prototype, "getPoint", &JsiSkPath::getPoint);
|
|
621
|
+
installMethod(runtime, prototype, "isEmpty", &JsiSkPath::isEmpty);
|
|
622
|
+
installMethod(runtime, prototype, "countPoints", &JsiSkPath::countPoints);
|
|
623
|
+
installMethod(runtime, prototype, "getLastPt", &JsiSkPath::getLastPt);
|
|
624
|
+
installMethod(runtime, prototype, "toSVGString", &JsiSkPath::toSVGString);
|
|
625
|
+
installMethod(runtime, prototype, "equals", &JsiSkPath::equals);
|
|
626
|
+
installMethod(runtime, prototype, "copy", &JsiSkPath::copy);
|
|
627
|
+
installMethod(runtime, prototype, "isInterpolatable",
|
|
628
|
+
&JsiSkPath::isInterpolatable);
|
|
629
|
+
installMethod(runtime, prototype, "interpolate", &JsiSkPath::interpolate);
|
|
630
|
+
installMethod(runtime, prototype, "toCmds", &JsiSkPath::toCmds);
|
|
770
631
|
}
|
|
771
632
|
|
|
772
633
|
JsiSkPath(std::shared_ptr<RNSkPlatformContext> context, SkPathBuilder builder)
|
|
@@ -810,6 +671,12 @@ public:
|
|
|
810
671
|
return makeJsiObject(runtime,
|
|
811
672
|
std::make_shared<JsiSkPath>(context, std::move(path)));
|
|
812
673
|
}
|
|
674
|
+
|
|
675
|
+
private:
|
|
676
|
+
static SkPathDirection toDirection(const JsiOptional<bool> &isCCW) {
|
|
677
|
+
return isCCW.has_value() && *isCCW ? SkPathDirection::kCCW
|
|
678
|
+
: SkPathDirection::kCW;
|
|
679
|
+
}
|
|
813
680
|
};
|
|
814
681
|
|
|
815
682
|
} // namespace RNSkia
|