@shopify/react-native-skia 2.9.1 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +8 -46
- package/android/build.gradle +33 -0
- package/android/src/main/java/com/shopify/reactnative/skia/RNSkiaPackage.java +1 -2
- package/cpp/api/JsiNativeBuffer.h +23 -24
- package/cpp/api/JsiSkAnimatedImage.h +24 -25
- package/cpp/api/JsiSkAnimatedImageFactory.h +18 -17
- package/cpp/api/JsiSkApi.h +254 -96
- package/cpp/api/JsiSkCanvas.h +141 -266
- package/cpp/api/JsiSkColor.h +7 -5
- package/cpp/api/JsiSkColorFilter.h +15 -8
- package/cpp/api/JsiSkColorFilterFactory.h +49 -67
- package/cpp/api/JsiSkContourMeasure.h +31 -38
- package/cpp/api/JsiSkContourMeasureIter.h +20 -23
- package/cpp/api/JsiSkConverters.h +410 -0
- package/cpp/api/JsiSkData.h +13 -7
- package/cpp/api/JsiSkDataFactory.h +27 -32
- package/cpp/api/JsiSkFont.h +123 -192
- package/cpp/api/JsiSkFontMgr.h +33 -26
- package/cpp/api/JsiSkFontMgrFactory.h +12 -11
- package/cpp/api/JsiSkFontStyle.h +14 -12
- package/cpp/api/JsiSkImage.h +90 -79
- package/cpp/api/JsiSkImageFactory.h +93 -95
- package/cpp/api/JsiSkImageFilter.h +21 -11
- package/cpp/api/JsiSkImageFilterFactory.h +375 -629
- package/cpp/api/JsiSkImageInfo.h +25 -25
- package/cpp/api/JsiSkMaskFilter.h +21 -11
- package/cpp/api/JsiSkMaskFilterFactory.h +17 -17
- package/cpp/api/JsiSkMatrix.h +51 -88
- package/cpp/api/JsiSkNativeObjects.h +387 -0
- package/cpp/api/JsiSkPaint.h +104 -142
- package/cpp/api/JsiSkParagraph.h +54 -64
- package/cpp/api/JsiSkParagraphBuilder.h +43 -68
- package/cpp/api/JsiSkParagraphBuilderFactory.h +20 -24
- package/cpp/api/JsiSkPath.h +242 -350
- package/cpp/api/JsiSkPathBuilder.h +153 -273
- package/cpp/api/JsiSkPathBuilderFactory.h +19 -20
- package/cpp/api/JsiSkPathEffect.h +21 -11
- package/cpp/api/JsiSkPathEffectFactory.h +61 -80
- package/cpp/api/JsiSkPathFactory.h +148 -238
- package/cpp/api/JsiSkPicture.h +32 -27
- package/cpp/api/JsiSkPictureFactory.h +21 -26
- package/cpp/api/JsiSkPictureRecorder.h +27 -29
- package/cpp/api/JsiSkPoint.h +20 -23
- package/cpp/api/JsiSkRRect.h +24 -32
- package/cpp/api/JsiSkRSXform.h +31 -48
- package/cpp/api/JsiSkRect.h +40 -50
- package/cpp/api/JsiSkRuntimeEffect.h +85 -92
- package/cpp/api/JsiSkRuntimeEffectFactory.h +14 -18
- package/cpp/api/JsiSkRuntimeShaderBuilder.h +28 -30
- package/cpp/api/JsiSkSVG.h +15 -15
- package/cpp/api/JsiSkSVGFactory.h +17 -20
- package/cpp/api/JsiSkShader.h +15 -8
- package/cpp/api/JsiSkShaderFactory.h +159 -238
- package/cpp/api/JsiSkSkottie.h +131 -143
- package/cpp/api/JsiSkSurface.h +29 -32
- package/cpp/api/JsiSkSurfaceFactory.h +18 -20
- package/cpp/api/JsiSkTextBlob.h +15 -8
- package/cpp/api/JsiSkTextBlobFactory.h +40 -66
- package/cpp/api/JsiSkTypeface.h +25 -22
- package/cpp/api/JsiSkTypefaceFactory.h +17 -15
- package/cpp/api/JsiSkTypefaceFontProvider.h +43 -39
- package/cpp/api/JsiSkTypefaceFontProviderFactory.h +13 -12
- package/cpp/api/JsiSkVertices.h +23 -22
- package/cpp/api/JsiSkiaContext.h +22 -23
- package/cpp/api/JsiSkottieFactory.h +16 -17
- package/cpp/api/JsiVideo.h +43 -81
- package/cpp/api/recorder/Convertor.h +31 -61
- package/cpp/api/recorder/DataTypes.h +8 -16
- package/cpp/api/recorder/JsiRecorder.h +83 -55
- package/cpp/api/recorder/RNRecorder.h +1 -1
- package/cpp/jsi/BoxedNativeObject.h +146 -0
- package/cpp/{jsi2 → jsi}/EnumMapper.h +4 -1
- package/cpp/{jsi2 → jsi}/JSIConverter.h +0 -31
- package/cpp/{jsi2 → jsi}/NativeObject.h +131 -152
- package/cpp/jsi/RuntimeAwareCache.cpp +1 -1
- package/cpp/jsi/RuntimeAwareCache.h +26 -8
- package/cpp/jsi/ViewProperty.h +5 -11
- package/cpp/rnskia/RNDawnContext.h +18 -2
- package/cpp/rnskia/RNDawnInterop.cpp +19 -0
- package/cpp/rnskia/RNDawnUtils.h +18 -1
- package/cpp/rnskia/RNSkJsiViewApi.h +20 -11
- package/cpp/rnskia/RNSkManager.cpp +9 -168
- package/cpp/rnskia/RNSkPictureView.h +1 -1
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkaroundsAutogen.h +2 -0
- package/lib/commonjs/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/commonjs/external/reanimated/renderHelpers.js +30 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/mock/index.js +0 -1
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/skia/NativeSetup.js +4 -0
- package/lib/commonjs/skia/NativeSetup.js.map +1 -1
- package/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js +66 -0
- package/lib/commonjs/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/commonjs/skia/types/Image/ImageFactory.d.ts +15 -6
- package/lib/commonjs/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +5 -15
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/types/index.d.ts +0 -1
- package/lib/commonjs/skia/types/index.js +0 -11
- package/lib/commonjs/skia/types/index.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +1 -4
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/sksg/Container.native.js +20 -1
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/views/index.d.ts +0 -1
- package/lib/commonjs/views/index.js +0 -11
- package/lib/commonjs/views/index.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/module/external/reanimated/renderHelpers.js +29 -0
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/mock/index.js +0 -1
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/skia/NativeSetup.js +4 -0
- package/lib/module/skia/NativeSetup.js.map +1 -1
- package/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/module/skia/SkiaWorkletSerialization.js +59 -0
- package/lib/module/skia/SkiaWorkletSerialization.js.map +1 -0
- package/lib/module/skia/types/Image/ImageFactory.d.ts +15 -6
- package/lib/module/skia/types/Image/ImageFactory.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +5 -15
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/types/index.d.ts +0 -1
- package/lib/module/skia/types/index.js +0 -1
- package/lib/module/skia/types/index.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/module/skia/web/JsiSkImageFactory.js +2 -2
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +1 -4
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/sksg/Container.native.js +21 -2
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/views/index.d.ts +0 -1
- package/lib/module/views/index.js +0 -1
- package/lib/module/views/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/renderHelpers.d.ts +2 -0
- package/lib/typescript/lib/commonjs/mock/index.d.ts +0 -1
- package/lib/typescript/lib/commonjs/skia/SkiaWorkletSerialization.d.ts +2 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +1 -2
- package/lib/typescript/lib/module/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/lib/module/mock/index.d.ts +0 -2
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -2
- package/lib/typescript/lib/module/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/index.d.ts +0 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +1 -2
- package/lib/typescript/lib/module/views/index.d.ts +0 -1
- package/lib/typescript/src/external/reanimated/renderHelpers.d.ts +15 -0
- package/lib/typescript/src/skia/SkiaWorkletSerialization.d.ts +1 -0
- package/lib/typescript/src/skia/types/Image/ImageFactory.d.ts +15 -6
- package/lib/typescript/src/skia/types/Skia.d.ts +5 -15
- package/lib/typescript/src/skia/types/index.d.ts +0 -1
- package/lib/typescript/src/skia/web/JsiSkImageFactory.d.ts +2 -2
- package/lib/typescript/src/views/index.d.ts +0 -1
- package/package.json +8 -5
- package/react-native-skia.podspec +38 -5
- package/src/external/reanimated/renderHelpers.ts +30 -0
- package/src/mock/index.ts +0 -1
- package/src/skia/NativeSetup.ts +5 -0
- package/src/skia/SkiaWorkletSerialization.ts +67 -0
- package/src/skia/types/Image/ImageFactory.ts +15 -6
- package/src/skia/types/Skia.ts +5 -15
- package/src/skia/types/index.ts +0 -1
- package/src/skia/web/JsiSkImageFactory.ts +3 -3
- package/src/skia/web/JsiSkia.ts +2 -5
- package/src/sksg/Container.native.ts +40 -2
- package/src/views/index.ts +0 -1
- package/android/cpp/jni/JniWebGPUView.cpp +0 -112
- package/android/cpp/rnskia-android/SkiaPlatformContext.h +0 -26
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUSurfaceView.java +0 -43
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUTextureView.java +0 -50
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUView.java +0 -98
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewAPI.java +0 -19
- package/android/src/main/java/com/shopify/reactnative/skia/WebGPUViewManager.java +0 -58
- package/apple/RNWebGPUAppleNativeBuffer.mm +0 -33
- package/apple/SkiaPlatformContext.h +0 -20
- package/apple/SkiaPlatformContext.mm +0 -21
- package/apple/SkiaWebGPUView.mm +0 -81
- package/apple/WebGPUMetalView.mm +0 -136
- package/cpp/api/JsiSkHostObjects.h +0 -257
- package/cpp/jsi/JsiHostObject.cpp +0 -137
- package/cpp/jsi/JsiHostObject.h +0 -385
- package/cpp/rnwgpu/ArrayBuffer.h +0 -117
- package/cpp/rnwgpu/Canvas.h +0 -50
- package/cpp/rnwgpu/PlatformContext.h +0 -18
- package/cpp/rnwgpu/SurfaceRegistry.h +0 -605
- package/cpp/rnwgpu/api/AppleNativeBuffer.h +0 -22
- package/cpp/rnwgpu/api/Convertors.h +0 -783
- package/cpp/rnwgpu/api/External.h +0 -12
- package/cpp/rnwgpu/api/GPU.cpp +0 -162
- package/cpp/rnwgpu/api/GPU.h +0 -60
- package/cpp/rnwgpu/api/GPUAdapter.cpp +0 -240
- package/cpp/rnwgpu/api/GPUAdapter.h +0 -60
- package/cpp/rnwgpu/api/GPUAdapterInfo.h +0 -57
- package/cpp/rnwgpu/api/GPUBindGroup.cpp +0 -3
- package/cpp/rnwgpu/api/GPUBindGroup.h +0 -51
- package/cpp/rnwgpu/api/GPUBindGroupLayout.h +0 -52
- package/cpp/rnwgpu/api/GPUBuffer.cpp +0 -107
- package/cpp/rnwgpu/api/GPUBuffer.h +0 -88
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +0 -75
- package/cpp/rnwgpu/api/GPUCanvasContext.h +0 -70
- package/cpp/rnwgpu/api/GPUCommandBuffer.h +0 -45
- package/cpp/rnwgpu/api/GPUCommandEncoder.cpp +0 -179
- package/cpp/rnwgpu/api/GPUCommandEncoder.h +0 -111
- package/cpp/rnwgpu/api/GPUCompilationInfo.h +0 -79
- package/cpp/rnwgpu/api/GPUCompilationMessage.h +0 -36
- package/cpp/rnwgpu/api/GPUComputePassEncoder.cpp +0 -60
- package/cpp/rnwgpu/api/GPUComputePassEncoder.h +0 -85
- package/cpp/rnwgpu/api/GPUComputePipeline.cpp +0 -12
- package/cpp/rnwgpu/api/GPUComputePipeline.h +0 -60
- package/cpp/rnwgpu/api/GPUDevice.cpp +0 -614
- package/cpp/rnwgpu/api/GPUDevice.h +0 -258
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.cpp +0 -7
- package/cpp/rnwgpu/api/GPUDeviceLostInfo.h +0 -40
- package/cpp/rnwgpu/api/GPUError.h +0 -35
- package/cpp/rnwgpu/api/GPUExtent3D.h +0 -66
- package/cpp/rnwgpu/api/GPUExternalTexture.cpp +0 -139
- package/cpp/rnwgpu/api/GPUExternalTexture.h +0 -95
- package/cpp/rnwgpu/api/GPUFeatures.h +0 -203
- package/cpp/rnwgpu/api/GPUInternalError.h +0 -31
- package/cpp/rnwgpu/api/GPUOrigin2D.h +0 -55
- package/cpp/rnwgpu/api/GPUOrigin3D.h +0 -62
- package/cpp/rnwgpu/api/GPUOutOfMemoryError.h +0 -33
- package/cpp/rnwgpu/api/GPUPipelineLayout.h +0 -45
- package/cpp/rnwgpu/api/GPUQuerySet.cpp +0 -11
- package/cpp/rnwgpu/api/GPUQuerySet.h +0 -73
- package/cpp/rnwgpu/api/GPUQueue.cpp +0 -179
- package/cpp/rnwgpu/api/GPUQueue.h +0 -84
- package/cpp/rnwgpu/api/GPURenderBundle.h +0 -44
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.cpp +0 -131
- package/cpp/rnwgpu/api/GPURenderBundleEncoder.h +0 -110
- package/cpp/rnwgpu/api/GPURenderPassEncoder.cpp +0 -165
- package/cpp/rnwgpu/api/GPURenderPassEncoder.h +0 -130
- package/cpp/rnwgpu/api/GPURenderPipeline.cpp +0 -13
- package/cpp/rnwgpu/api/GPURenderPipeline.h +0 -61
- package/cpp/rnwgpu/api/GPUSampler.h +0 -44
- package/cpp/rnwgpu/api/GPUShaderModule.cpp +0 -56
- package/cpp/rnwgpu/api/GPUShaderModule.h +0 -66
- package/cpp/rnwgpu/api/GPUSharedFence.cpp +0 -80
- package/cpp/rnwgpu/api/GPUSharedFence.h +0 -53
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.cpp +0 -135
- package/cpp/rnwgpu/api/GPUSharedTextureMemory.h +0 -75
- package/cpp/rnwgpu/api/GPUSupportedLimits.cpp +0 -129
- package/cpp/rnwgpu/api/GPUSupportedLimits.h +0 -131
- package/cpp/rnwgpu/api/GPUTexture.cpp +0 -47
- package/cpp/rnwgpu/api/GPUTexture.h +0 -162
- package/cpp/rnwgpu/api/GPUTextureView.h +0 -44
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +0 -60
- package/cpp/rnwgpu/api/GPUValidationError.h +0 -32
- package/cpp/rnwgpu/api/ImageBitmap.h +0 -62
- package/cpp/rnwgpu/api/NativeBufferUtils.h +0 -87
- package/cpp/rnwgpu/api/RNWebGPU.h +0 -82
- package/cpp/rnwgpu/api/WebGPUConstants.h +0 -36
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupDescriptor.h +0 -64
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupEntry.h +0 -78
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUBindGroupLayoutEntry.h +0 -97
- package/cpp/rnwgpu/api/descriptors/GPUBlendComponent.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUBlendState.h +0 -52
- package/cpp/rnwgpu/api/descriptors/GPUBufferBinding.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUBufferBindingLayout.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUBufferDescriptor.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUBufferUsage.h +0 -39
- package/cpp/rnwgpu/api/descriptors/GPUCanvasConfiguration.h +0 -76
- package/cpp/rnwgpu/api/descriptors/GPUColor.h +0 -66
- package/cpp/rnwgpu/api/descriptors/GPUColorTargetState.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUColorWrite.h +0 -29
- package/cpp/rnwgpu/api/descriptors/GPUCommandBufferDescriptor.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPUCommandEncoderDescriptor.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPUComputePassDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUComputePassTimestampWrites.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUComputePipelineDescriptor.h +0 -67
- package/cpp/rnwgpu/api/descriptors/GPUDawnTogglesDescriptor.h +0 -56
- package/cpp/rnwgpu/api/descriptors/GPUDepthStencilState.h +0 -103
- package/cpp/rnwgpu/api/descriptors/GPUDeviceDescriptor.h +0 -109
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureBindingLayout.h +0 -38
- package/cpp/rnwgpu/api/descriptors/GPUExternalTextureDescriptor.h +0 -90
- package/cpp/rnwgpu/api/descriptors/GPUFragmentState.h +0 -73
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyBuffer.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyExternalImage.h +0 -63
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTexture.h +0 -65
- package/cpp/rnwgpu/api/descriptors/GPUImageCopyTextureTagged.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPUImageDataLayout.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPUMapMode.h +0 -22
- package/cpp/rnwgpu/api/descriptors/GPUMultisampleState.h +0 -54
- package/cpp/rnwgpu/api/descriptors/GPUPipelineLayoutDescriptor.h +0 -57
- package/cpp/rnwgpu/api/descriptors/GPUPrimitiveState.h +0 -69
- package/cpp/rnwgpu/api/descriptors/GPUProgrammableStage.h +0 -61
- package/cpp/rnwgpu/api/descriptors/GPUQuerySetDescriptor.h +0 -55
- package/cpp/rnwgpu/api/descriptors/GPUQueueDescriptor.h +0 -43
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleDescriptor.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPURenderBundleEncoderDescriptor.h +0 -80
- package/cpp/rnwgpu/api/descriptors/GPURenderPassColorAttachment.h +0 -81
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDepthStencilAttachment.h +0 -101
- package/cpp/rnwgpu/api/descriptors/GPURenderPassDescriptor.h +0 -92
- package/cpp/rnwgpu/api/descriptors/GPURenderPassTimestampWrites.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPURenderPipelineDescriptor.h +0 -103
- package/cpp/rnwgpu/api/descriptors/GPURequestAdapterOptions.h +0 -51
- package/cpp/rnwgpu/api/descriptors/GPUSamplerBindingLayout.h +0 -45
- package/cpp/rnwgpu/api/descriptors/GPUSamplerDescriptor.h +0 -110
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleCompilationHint.h +0 -60
- package/cpp/rnwgpu/api/descriptors/GPUShaderModuleDescriptor.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUShaderStage.h +0 -25
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceDescriptor.h +0 -58
- package/cpp/rnwgpu/api/descriptors/GPUSharedFenceState.h +0 -51
- package/cpp/rnwgpu/api/descriptors/GPUSharedTextureMemoryDescriptor.h +0 -73
- package/cpp/rnwgpu/api/descriptors/GPUStencilFaceState.h +0 -64
- package/cpp/rnwgpu/api/descriptors/GPUStorageTextureBindingLayout.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUTextureBindingLayout.h +0 -59
- package/cpp/rnwgpu/api/descriptors/GPUTextureDescriptor.h +0 -91
- package/cpp/rnwgpu/api/descriptors/GPUTextureUsage.h +0 -29
- package/cpp/rnwgpu/api/descriptors/GPUTextureViewDescriptor.h +0 -91
- package/cpp/rnwgpu/api/descriptors/GPUUncapturedErrorEventInit.h +0 -64
- package/cpp/rnwgpu/api/descriptors/GPUVertexAttribute.h +0 -53
- package/cpp/rnwgpu/api/descriptors/GPUVertexBufferLayout.h +0 -62
- package/cpp/rnwgpu/api/descriptors/GPUVertexState.h +0 -73
- package/cpp/rnwgpu/api/descriptors/Unions.h +0 -1969
- package/cpp/rnwgpu/async/AsyncTaskHandle.cpp +0 -214
- package/cpp/rnwgpu/async/AsyncTaskHandle.h +0 -58
- package/cpp/rnwgpu/async/RuntimeContext.cpp +0 -199
- package/cpp/rnwgpu/async/RuntimeContext.h +0 -134
- package/lib/commonjs/skia/types/WebGPU.d.ts +0 -184
- package/lib/commonjs/skia/types/WebGPU.js +0 -105
- package/lib/commonjs/skia/types/WebGPU.js.map +0 -1
- package/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +0 -8
- package/lib/commonjs/specs/WebGPUViewNativeComponent.js +0 -10
- package/lib/commonjs/specs/WebGPUViewNativeComponent.js.map +0 -1
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js +0 -103
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js.map +0 -1
- package/lib/commonjs/specs/utils.d.ts +0 -1
- package/lib/commonjs/specs/utils.js +0 -11
- package/lib/commonjs/specs/utils.js.map +0 -1
- package/lib/commonjs/views/WebGPUCanvas.d.ts +0 -33
- package/lib/commonjs/views/WebGPUCanvas.js +0 -79
- package/lib/commonjs/views/WebGPUCanvas.js.map +0 -1
- package/lib/commonjs/views/WebGPUCanvas.web.d.ts +0 -23
- package/lib/commonjs/views/WebGPUCanvas.web.js +0 -20
- package/lib/commonjs/views/WebGPUCanvas.web.js.map +0 -1
- package/lib/module/skia/types/WebGPU.d.ts +0 -184
- package/lib/module/skia/types/WebGPU.js +0 -99
- package/lib/module/skia/types/WebGPU.js.map +0 -1
- package/lib/module/specs/WebGPUViewNativeComponent.d.ts +0 -8
- package/lib/module/specs/WebGPUViewNativeComponent.js +0 -4
- package/lib/module/specs/WebGPUViewNativeComponent.js.map +0 -1
- package/lib/module/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
- package/lib/module/specs/WebGPUViewNativeComponent.web.js +0 -96
- package/lib/module/specs/WebGPUViewNativeComponent.web.js.map +0 -1
- package/lib/module/specs/utils.d.ts +0 -1
- package/lib/module/specs/utils.js +0 -5
- package/lib/module/specs/utils.js.map +0 -1
- package/lib/module/views/WebGPUCanvas.d.ts +0 -33
- package/lib/module/views/WebGPUCanvas.js +0 -70
- package/lib/module/views/WebGPUCanvas.js.map +0 -1
- package/lib/module/views/WebGPUCanvas.web.d.ts +0 -23
- package/lib/module/views/WebGPUCanvas.web.js +0 -12
- package/lib/module/views/WebGPUCanvas.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/skia/types/WebGPU.d.ts +0 -2
- package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +0 -4
- package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.web.d.ts +0 -3
- package/lib/typescript/lib/commonjs/specs/utils.d.ts +0 -2
- package/lib/typescript/lib/commonjs/views/WebGPUCanvas.d.ts +0 -6
- package/lib/typescript/lib/commonjs/views/WebGPUCanvas.web.d.ts +0 -6
- package/lib/typescript/lib/module/skia/types/WebGPU.d.ts +0 -31
- package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.d.ts +0 -2
- package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.web.d.ts +0 -2
- package/lib/typescript/lib/module/specs/utils.d.ts +0 -1
- package/lib/typescript/lib/module/views/WebGPUCanvas.d.ts +0 -7
- package/lib/typescript/lib/module/views/WebGPUCanvas.web.d.ts +0 -8
- package/lib/typescript/src/skia/types/WebGPU.d.ts +0 -184
- package/lib/typescript/src/specs/WebGPUViewNativeComponent.d.ts +0 -8
- package/lib/typescript/src/specs/WebGPUViewNativeComponent.web.d.ts +0 -8
- package/lib/typescript/src/specs/utils.d.ts +0 -1
- package/lib/typescript/src/views/WebGPUCanvas.d.ts +0 -33
- package/lib/typescript/src/views/WebGPUCanvas.web.d.ts +0 -23
- package/src/skia/types/WebGPU.ts +0 -226
- package/src/specs/WebGPUViewNativeComponent.ts +0 -11
- package/src/specs/WebGPUViewNativeComponent.web.ts +0 -110
- package/src/specs/utils.ts +0 -4
- package/src/views/WebGPUCanvas.tsx +0 -125
- package/src/views/WebGPUCanvas.web.tsx +0 -36
- /package/cpp/{jsi2 → jsi}/Promise.cpp +0 -0
- /package/cpp/{jsi2 → jsi}/Promise.h +0 -0
package/cpp/api/JsiSkPath.h
CHANGED
|
@@ -2,15 +2,18 @@
|
|
|
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
|
|
|
12
|
-
#include "
|
|
14
|
+
#include "JsiSkConverters.h"
|
|
13
15
|
#include "JsiSkMatrix.h"
|
|
16
|
+
#include "JsiSkNativeObjects.h"
|
|
14
17
|
#include "JsiSkPoint.h"
|
|
15
18
|
#include "JsiSkRRect.h"
|
|
16
19
|
#include "JsiSkRect.h"
|
|
@@ -61,7 +64,11 @@ inline void warnDeprecatedPathMethod(jsi::Runtime &runtime,
|
|
|
61
64
|
RNSkLogger::warnToJavascriptConsole(runtime, message);
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
class JsiSkPath
|
|
67
|
+
class JsiSkPath
|
|
68
|
+
: public JsiSkWrappingSharedPtrNativeObject<JsiSkPath, SkPathBuilder> {
|
|
69
|
+
public:
|
|
70
|
+
static constexpr const char *CLASS_NAME = "Path";
|
|
71
|
+
|
|
65
72
|
private:
|
|
66
73
|
static const int MOVE = 0;
|
|
67
74
|
static const int LINE = 1;
|
|
@@ -73,338 +80,233 @@ private:
|
|
|
73
80
|
SkPath asPath() const { return getObject()->snapshot(); }
|
|
74
81
|
|
|
75
82
|
public:
|
|
76
|
-
// Mutable building methods (deprecated)
|
|
83
|
+
// Mutable building methods (deprecated) — chainable, and they take the
|
|
84
|
+
// runtime for the JS console deprecation warning.
|
|
77
85
|
|
|
78
|
-
|
|
86
|
+
void moveTo(jsi::Runtime &runtime, double x, double y) {
|
|
79
87
|
warnDeprecatedPathMethod(runtime, "moveTo",
|
|
80
88
|
"Use Skia.PathBuilder.Make().moveTo() instead.");
|
|
81
|
-
SkScalar x = arguments[0].asNumber();
|
|
82
|
-
SkScalar y = arguments[1].asNumber();
|
|
83
89
|
getObject()->moveTo(x, y);
|
|
84
|
-
return thisValue.getObject(runtime);
|
|
85
90
|
}
|
|
86
91
|
|
|
87
|
-
|
|
92
|
+
void rMoveTo(jsi::Runtime &runtime, double x, double y) {
|
|
88
93
|
warnDeprecatedPathMethod(runtime, "rMoveTo",
|
|
89
94
|
"Use Skia.PathBuilder.Make().rMoveTo() instead.");
|
|
90
|
-
SkScalar
|
|
91
|
-
SkScalar y = arguments[1].asNumber();
|
|
92
|
-
getObject()->rMoveTo({x, y});
|
|
93
|
-
return thisValue.getObject(runtime);
|
|
95
|
+
getObject()->rMoveTo({static_cast<SkScalar>(x), static_cast<SkScalar>(y)});
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
|
|
98
|
+
void lineTo(jsi::Runtime &runtime, double x, double y) {
|
|
97
99
|
warnDeprecatedPathMethod(runtime, "lineTo",
|
|
98
100
|
"Use Skia.PathBuilder.Make().lineTo() instead.");
|
|
99
|
-
SkScalar x = arguments[0].asNumber();
|
|
100
|
-
SkScalar y = arguments[1].asNumber();
|
|
101
101
|
getObject()->lineTo(x, y);
|
|
102
|
-
return thisValue.getObject(runtime);
|
|
103
102
|
}
|
|
104
103
|
|
|
105
|
-
|
|
104
|
+
void rLineTo(jsi::Runtime &runtime, double x, double y) {
|
|
106
105
|
warnDeprecatedPathMethod(runtime, "rLineTo",
|
|
107
106
|
"Use Skia.PathBuilder.Make().rLineTo() instead.");
|
|
108
|
-
SkScalar x = arguments[0].asNumber();
|
|
109
|
-
SkScalar y = arguments[1].asNumber();
|
|
110
107
|
getObject()->rLineTo(x, y);
|
|
111
|
-
return thisValue.getObject(runtime);
|
|
112
108
|
}
|
|
113
109
|
|
|
114
|
-
|
|
110
|
+
void quadTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
111
|
+
double y2) {
|
|
115
112
|
warnDeprecatedPathMethod(runtime, "quadTo",
|
|
116
113
|
"Use Skia.PathBuilder.Make().quadTo() instead.");
|
|
117
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
118
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
119
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
120
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
121
114
|
getObject()->quadTo(x1, y1, x2, y2);
|
|
122
|
-
return thisValue.getObject(runtime);
|
|
123
115
|
}
|
|
124
116
|
|
|
125
|
-
|
|
117
|
+
void rQuadTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
118
|
+
double y2) {
|
|
126
119
|
warnDeprecatedPathMethod(runtime, "rQuadTo",
|
|
127
120
|
"Use Skia.PathBuilder.Make().rQuadTo() instead.");
|
|
128
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
129
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
130
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
131
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
132
121
|
getObject()->rQuadTo(x1, y1, x2, y2);
|
|
133
|
-
return thisValue.getObject(runtime);
|
|
134
122
|
}
|
|
135
123
|
|
|
136
|
-
|
|
124
|
+
void conicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
125
|
+
double y2, double w) {
|
|
137
126
|
warnDeprecatedPathMethod(runtime, "conicTo",
|
|
138
127
|
"Use Skia.PathBuilder.Make().conicTo() instead.");
|
|
139
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
140
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
141
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
142
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
143
|
-
SkScalar w = arguments[4].asNumber();
|
|
144
128
|
getObject()->conicTo(x1, y1, x2, y2, w);
|
|
145
|
-
return thisValue.getObject(runtime);
|
|
146
129
|
}
|
|
147
130
|
|
|
148
|
-
|
|
131
|
+
void rConicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
132
|
+
double y2, double w) {
|
|
149
133
|
warnDeprecatedPathMethod(runtime, "rConicTo",
|
|
150
134
|
"Use Skia.PathBuilder.Make().rConicTo() instead.");
|
|
151
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
152
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
153
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
154
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
155
|
-
SkScalar w = arguments[4].asNumber();
|
|
156
135
|
getObject()->rConicTo(x1, y1, x2, y2, w);
|
|
157
|
-
return thisValue.getObject(runtime);
|
|
158
136
|
}
|
|
159
137
|
|
|
160
|
-
|
|
138
|
+
void cubicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
139
|
+
double y2, double x3, double y3) {
|
|
161
140
|
warnDeprecatedPathMethod(runtime, "cubicTo",
|
|
162
141
|
"Use Skia.PathBuilder.Make().cubicTo() instead.");
|
|
163
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
164
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
165
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
166
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
167
|
-
SkScalar x3 = arguments[4].asNumber();
|
|
168
|
-
SkScalar y3 = arguments[5].asNumber();
|
|
169
142
|
getObject()->cubicTo(x1, y1, x2, y2, x3, y3);
|
|
170
|
-
return thisValue.getObject(runtime);
|
|
171
143
|
}
|
|
172
144
|
|
|
173
|
-
|
|
145
|
+
void rCubicTo(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
146
|
+
double y2, double x3, double y3) {
|
|
174
147
|
warnDeprecatedPathMethod(runtime, "rCubicTo",
|
|
175
148
|
"Use Skia.PathBuilder.Make().rCubicTo() instead.");
|
|
176
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
177
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
178
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
179
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
180
|
-
SkScalar x3 = arguments[4].asNumber();
|
|
181
|
-
SkScalar y3 = arguments[5].asNumber();
|
|
182
149
|
getObject()->rCubicTo(x1, y1, x2, y2, x3, y3);
|
|
183
|
-
return thisValue.getObject(runtime);
|
|
184
150
|
}
|
|
185
151
|
|
|
186
|
-
|
|
152
|
+
void close(jsi::Runtime &runtime) {
|
|
187
153
|
warnDeprecatedPathMethod(runtime, "close",
|
|
188
154
|
"Use Skia.PathBuilder.Make().close() instead.");
|
|
189
155
|
getObject()->close();
|
|
190
|
-
return thisValue.getObject(runtime);
|
|
191
156
|
}
|
|
192
157
|
|
|
193
|
-
|
|
158
|
+
void reset(jsi::Runtime &runtime) {
|
|
194
159
|
warnDeprecatedPathMethod(runtime, "reset",
|
|
195
160
|
"Use Skia.PathBuilder.Make().reset() instead.");
|
|
196
161
|
getObject()->reset();
|
|
197
|
-
return thisValue.getObject(runtime);
|
|
198
162
|
}
|
|
199
163
|
|
|
200
|
-
|
|
164
|
+
void rewind(jsi::Runtime &runtime) {
|
|
201
165
|
warnDeprecatedPathMethod(runtime, "rewind",
|
|
202
166
|
"Use Skia.PathBuilder.Make().reset() instead.");
|
|
203
167
|
getObject()->reset();
|
|
204
|
-
return thisValue.getObject(runtime);
|
|
205
168
|
}
|
|
206
169
|
|
|
207
|
-
|
|
170
|
+
void addPath(jsi::Runtime &runtime, std::shared_ptr<SkPathBuilder> src,
|
|
171
|
+
JsiOptional<std::shared_ptr<SkMatrix>> matrix,
|
|
172
|
+
JsiOptional<bool> extend) {
|
|
208
173
|
warnDeprecatedPathMethod(runtime, "addPath",
|
|
209
174
|
"Use Skia.PathBuilder.Make().addPath() instead.");
|
|
210
|
-
auto src = JsiSkPath::fromValue(runtime, arguments[0]);
|
|
211
175
|
auto srcPath = src->snapshot();
|
|
212
|
-
auto
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
auto extend = count > 2 && arguments[2].getBool();
|
|
217
|
-
auto mode =
|
|
218
|
-
extend ? SkPath::kExtend_AddPathMode : SkPath::kAppend_AddPathMode;
|
|
219
|
-
if (matrix) {
|
|
220
|
-
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);
|
|
221
180
|
} else {
|
|
222
181
|
getObject()->addPath(srcPath, mode);
|
|
223
182
|
}
|
|
224
|
-
return thisValue.getObject(runtime);
|
|
225
183
|
}
|
|
226
184
|
|
|
227
|
-
|
|
185
|
+
void addArc(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
|
|
186
|
+
double start, double sweep) {
|
|
228
187
|
warnDeprecatedPathMethod(runtime, "addArc",
|
|
229
188
|
"Use Skia.PathBuilder.Make().addArc() instead.");
|
|
230
|
-
auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
|
|
231
|
-
auto start = arguments[1].asNumber();
|
|
232
|
-
auto sweep = arguments[2].asNumber();
|
|
233
189
|
getObject()->addArc(*rect, start, sweep);
|
|
234
|
-
return thisValue.getObject(runtime);
|
|
235
190
|
}
|
|
236
191
|
|
|
237
|
-
|
|
192
|
+
void addOval(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
|
|
193
|
+
JsiOptional<bool> isCCW, JsiOptional<double> startIndex) {
|
|
238
194
|
warnDeprecatedPathMethod(
|
|
239
195
|
runtime, "addOval",
|
|
240
196
|
"Use Skia.Path.Oval() or Skia.PathBuilder.Make().addOval() instead.");
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
auto direction = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
246
|
-
getObject()->addOval(*rect, direction, startIndex);
|
|
247
|
-
return thisValue.getObject(runtime);
|
|
197
|
+
getObject()->addOval(*rect, toDirection(isCCW),
|
|
198
|
+
startIndex.has_value()
|
|
199
|
+
? static_cast<unsigned>(*startIndex)
|
|
200
|
+
: 1);
|
|
248
201
|
}
|
|
249
202
|
|
|
250
|
-
|
|
203
|
+
void addRect(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
|
|
204
|
+
JsiOptional<bool> isCCW) {
|
|
251
205
|
warnDeprecatedPathMethod(
|
|
252
206
|
runtime, "addRect",
|
|
253
207
|
"Use Skia.Path.Rect() or Skia.PathBuilder.Make().addRect() instead.");
|
|
254
|
-
|
|
255
|
-
auto isCCW = count > 1 && arguments[1].getBool();
|
|
256
|
-
auto direction = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
257
|
-
getObject()->addRect(*rect, direction);
|
|
258
|
-
return thisValue.getObject(runtime);
|
|
208
|
+
getObject()->addRect(*rect, toDirection(isCCW));
|
|
259
209
|
}
|
|
260
210
|
|
|
261
|
-
|
|
211
|
+
void addRRect(jsi::Runtime &runtime, std::shared_ptr<SkRRect> rrect,
|
|
212
|
+
JsiOptional<bool> isCCW) {
|
|
262
213
|
warnDeprecatedPathMethod(
|
|
263
214
|
runtime, "addRRect",
|
|
264
215
|
"Use Skia.Path.RRect() or Skia.PathBuilder.Make().addRRect() instead.");
|
|
265
|
-
|
|
266
|
-
auto isCCW = count > 1 && arguments[1].getBool();
|
|
267
|
-
auto direction = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
268
|
-
getObject()->addRRect(*rrect, direction);
|
|
269
|
-
return thisValue.getObject(runtime);
|
|
216
|
+
getObject()->addRRect(*rrect, toDirection(isCCW));
|
|
270
217
|
}
|
|
271
218
|
|
|
272
|
-
|
|
219
|
+
void addCircle(jsi::Runtime &runtime, double x, double y, double r) {
|
|
273
220
|
warnDeprecatedPathMethod(
|
|
274
221
|
runtime, "addCircle",
|
|
275
222
|
"Use Skia.Path.Circle() or Skia.PathBuilder.Make().addCircle() "
|
|
276
223
|
"instead.");
|
|
277
|
-
SkScalar x = arguments[0].asNumber();
|
|
278
|
-
SkScalar y = arguments[1].asNumber();
|
|
279
|
-
SkScalar r = arguments[2].asNumber();
|
|
280
224
|
getObject()->addCircle(x, y, r);
|
|
281
|
-
return thisValue.getObject(runtime);
|
|
282
225
|
}
|
|
283
226
|
|
|
284
|
-
|
|
227
|
+
void addPoly(jsi::Runtime &runtime, std::vector<SkPoint> points,
|
|
228
|
+
bool close) {
|
|
285
229
|
warnDeprecatedPathMethod(
|
|
286
230
|
runtime, "addPoly",
|
|
287
231
|
"Use Skia.Path.Polygon() or Skia.PathBuilder.Make().addPoly() "
|
|
288
232
|
"instead.");
|
|
289
|
-
auto jsiPoints = arguments[0].asObject(runtime).asArray(runtime);
|
|
290
|
-
auto close = arguments[1].getBool();
|
|
291
|
-
auto pointsSize = static_cast<int>(jsiPoints.size(runtime));
|
|
292
|
-
std::vector<SkPoint> points;
|
|
293
|
-
points.reserve(pointsSize);
|
|
294
|
-
for (int i = 0; i < pointsSize; i++) {
|
|
295
|
-
auto pt =
|
|
296
|
-
JsiSkPoint::fromValue(runtime, jsiPoints.getValueAtIndex(runtime, i));
|
|
297
|
-
points.push_back(*pt);
|
|
298
|
-
}
|
|
299
233
|
getObject()->addPolygon(SkSpan<const SkPoint>(points.data(), points.size()),
|
|
300
234
|
close);
|
|
301
|
-
return thisValue.getObject(runtime);
|
|
302
235
|
}
|
|
303
236
|
|
|
304
|
-
|
|
237
|
+
void arcToOval(jsi::Runtime &runtime, std::shared_ptr<SkRect> rect,
|
|
238
|
+
double start, double sweep, bool forceMoveTo) {
|
|
305
239
|
warnDeprecatedPathMethod(
|
|
306
240
|
runtime, "arcToOval",
|
|
307
241
|
"Use Skia.PathBuilder.Make().arcToOval() instead.");
|
|
308
|
-
auto rect = JsiSkRect::fromValue(runtime, arguments[0]);
|
|
309
|
-
auto start = arguments[1].asNumber();
|
|
310
|
-
auto sweep = arguments[2].asNumber();
|
|
311
|
-
auto forceMoveTo = arguments[3].getBool();
|
|
312
242
|
getObject()->arcTo(*rect, start, sweep, forceMoveTo);
|
|
313
|
-
return thisValue.getObject(runtime);
|
|
314
243
|
}
|
|
315
244
|
|
|
316
|
-
|
|
245
|
+
void arcToRotated(jsi::Runtime &runtime, double rx, double ry,
|
|
246
|
+
double xAxisRotate, bool useSmallArc, bool isCCW, double x,
|
|
247
|
+
double y) {
|
|
317
248
|
warnDeprecatedPathMethod(
|
|
318
249
|
runtime, "arcToRotated",
|
|
319
250
|
"Use Skia.PathBuilder.Make().arcToRotated() instead.");
|
|
320
|
-
SkScalar rx = arguments[0].asNumber();
|
|
321
|
-
SkScalar ry = arguments[1].asNumber();
|
|
322
|
-
SkScalar xAxisRotate = arguments[2].asNumber();
|
|
323
|
-
auto useSmallArc = arguments[3].getBool();
|
|
324
|
-
auto isCCW = arguments[4].getBool();
|
|
325
|
-
SkScalar x = arguments[5].asNumber();
|
|
326
|
-
SkScalar y = arguments[6].asNumber();
|
|
327
251
|
auto arcSize = useSmallArc ? SkPathBuilder::kSmall_ArcSize
|
|
328
252
|
: SkPathBuilder::kLarge_ArcSize;
|
|
329
253
|
auto sweep = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
330
254
|
getObject()->arcTo(SkPoint::Make(rx, ry), xAxisRotate, arcSize, sweep,
|
|
331
255
|
SkPoint::Make(x, y));
|
|
332
|
-
return thisValue.getObject(runtime);
|
|
333
256
|
}
|
|
334
257
|
|
|
335
|
-
|
|
258
|
+
void rArcTo(jsi::Runtime &runtime, double rx, double ry, double xAxisRotate,
|
|
259
|
+
bool useSmallArc, bool isCCW, double dx, double dy) {
|
|
336
260
|
warnDeprecatedPathMethod(runtime, "rArcTo",
|
|
337
261
|
"Use Skia.PathBuilder.Make().rArcTo() instead.");
|
|
338
|
-
SkScalar rx = arguments[0].asNumber();
|
|
339
|
-
SkScalar ry = arguments[1].asNumber();
|
|
340
|
-
SkScalar xAxisRotate = arguments[2].asNumber();
|
|
341
|
-
auto useSmallArc = arguments[3].getBool();
|
|
342
|
-
auto isCCW = arguments[4].getBool();
|
|
343
|
-
SkScalar dx = arguments[5].asNumber();
|
|
344
|
-
SkScalar dy = arguments[6].asNumber();
|
|
345
262
|
auto arcSize = useSmallArc ? SkPathBuilder::kSmall_ArcSize
|
|
346
263
|
: SkPathBuilder::kLarge_ArcSize;
|
|
347
264
|
auto sweep = isCCW ? SkPathDirection::kCCW : SkPathDirection::kCW;
|
|
348
265
|
SkVector dxdy(dx, dy);
|
|
349
266
|
SkPoint r(rx, ry);
|
|
350
267
|
getObject()->rArcTo(r, xAxisRotate, arcSize, sweep, dxdy);
|
|
351
|
-
return thisValue.getObject(runtime);
|
|
352
268
|
}
|
|
353
269
|
|
|
354
|
-
|
|
270
|
+
void arcToTangent(jsi::Runtime &runtime, double x1, double y1, double x2,
|
|
271
|
+
double y2, double r) {
|
|
355
272
|
warnDeprecatedPathMethod(
|
|
356
273
|
runtime, "arcToTangent",
|
|
357
274
|
"Use Skia.PathBuilder.Make().arcToTangent() instead.");
|
|
358
|
-
SkScalar x1 = arguments[0].asNumber();
|
|
359
|
-
SkScalar y1 = arguments[1].asNumber();
|
|
360
|
-
SkScalar x2 = arguments[2].asNumber();
|
|
361
|
-
SkScalar y2 = arguments[3].asNumber();
|
|
362
|
-
SkScalar r = arguments[4].asNumber();
|
|
363
275
|
getObject()->arcTo(SkPoint::Make(x1, y1), SkPoint::Make(x2, y2), r);
|
|
364
|
-
return thisValue.getObject(runtime);
|
|
365
276
|
}
|
|
366
277
|
|
|
367
|
-
|
|
278
|
+
void setFillType(jsi::Runtime &runtime, double ft) {
|
|
368
279
|
warnDeprecatedPathMethod(
|
|
369
280
|
runtime, "setFillType",
|
|
370
281
|
"Use Skia.PathBuilder.Make().setFillType() instead.");
|
|
371
|
-
auto ft = arguments[0].asNumber();
|
|
372
282
|
getObject()->setFillType(static_cast<SkPathFillType>(static_cast<int>(ft)));
|
|
373
|
-
return thisValue.getObject(runtime);
|
|
374
283
|
}
|
|
375
284
|
|
|
376
|
-
|
|
285
|
+
void setIsVolatile(jsi::Runtime &runtime, bool v) {
|
|
377
286
|
warnDeprecatedPathMethod(
|
|
378
287
|
runtime, "setIsVolatile",
|
|
379
288
|
"Use Skia.PathBuilder.Make().setIsVolatile() instead.");
|
|
380
|
-
auto v = arguments[0].getBool();
|
|
381
289
|
getObject()->setIsVolatile(v);
|
|
382
|
-
return thisValue.getObject(runtime);
|
|
383
290
|
}
|
|
384
291
|
|
|
385
292
|
// Mutable transform methods (deprecated)
|
|
386
293
|
|
|
387
|
-
|
|
294
|
+
void transform(jsi::Runtime &runtime, std::shared_ptr<SkMatrix> m3) {
|
|
388
295
|
warnDeprecatedPathMethod(
|
|
389
296
|
runtime, "transform",
|
|
390
297
|
"Use Skia.PathBuilder.Make().transform() instead.");
|
|
391
|
-
|
|
392
|
-
getObject()->transform(m3);
|
|
393
|
-
return thisValue.getObject(runtime);
|
|
298
|
+
getObject()->transform(*m3);
|
|
394
299
|
}
|
|
395
300
|
|
|
396
|
-
|
|
301
|
+
void offset(jsi::Runtime &runtime, double dx, double dy) {
|
|
397
302
|
warnDeprecatedPathMethod(runtime, "offset",
|
|
398
303
|
"Use Skia.PathBuilder.Make().offset() instead.");
|
|
399
|
-
SkScalar dx = arguments[0].asNumber();
|
|
400
|
-
SkScalar dy = arguments[1].asNumber();
|
|
401
304
|
getObject()->offset(dx, dy);
|
|
402
|
-
return thisValue.getObject(runtime);
|
|
403
305
|
}
|
|
404
306
|
|
|
405
307
|
// Mutable path operations (deprecated)
|
|
406
308
|
|
|
407
|
-
|
|
309
|
+
void simplify(jsi::Runtime &runtime) {
|
|
408
310
|
warnDeprecatedPathMethod(runtime, "simplify",
|
|
409
311
|
"Use Skia.Path.Simplify(path) instead.");
|
|
410
312
|
auto path = asPath();
|
|
@@ -412,25 +314,22 @@ public:
|
|
|
412
314
|
if (result.has_value()) {
|
|
413
315
|
*getObject() = SkPathBuilder(result.value());
|
|
414
316
|
}
|
|
415
|
-
return thisValue.getObject(runtime);
|
|
416
317
|
}
|
|
417
318
|
|
|
418
|
-
|
|
319
|
+
void op(jsi::Runtime &runtime, std::shared_ptr<SkPathBuilder> path2,
|
|
320
|
+
double pathOp) {
|
|
419
321
|
warnDeprecatedPathMethod(runtime, "op",
|
|
420
322
|
"Use Skia.Path.MakeFromOp() instead.");
|
|
421
|
-
auto path2 = JsiSkPath::fromValue(runtime, arguments[0]);
|
|
422
|
-
auto pathOp =
|
|
423
|
-
static_cast<SkPathOp>(static_cast<int>(arguments[1].asNumber()));
|
|
424
323
|
auto p1 = asPath();
|
|
425
324
|
auto p2 = path2->snapshot();
|
|
426
|
-
auto result =
|
|
325
|
+
auto result =
|
|
326
|
+
::Op(p1, p2, static_cast<SkPathOp>(static_cast<int>(pathOp)));
|
|
427
327
|
if (result.has_value()) {
|
|
428
328
|
*getObject() = SkPathBuilder(result.value());
|
|
429
329
|
}
|
|
430
|
-
return thisValue.getObject(runtime);
|
|
431
330
|
}
|
|
432
331
|
|
|
433
|
-
|
|
332
|
+
void makeAsWinding(jsi::Runtime &runtime) {
|
|
434
333
|
warnDeprecatedPathMethod(runtime, "makeAsWinding",
|
|
435
334
|
"Use Skia.Path.AsWinding(path) instead.");
|
|
436
335
|
auto path = asPath();
|
|
@@ -438,17 +337,14 @@ public:
|
|
|
438
337
|
if (result.has_value()) {
|
|
439
338
|
*getObject() = SkPathBuilder(result.value());
|
|
440
339
|
}
|
|
441
|
-
return thisValue.getObject(runtime);
|
|
442
340
|
}
|
|
443
341
|
|
|
444
|
-
|
|
342
|
+
void dash(jsi::Runtime &runtime, double on, double off, double phase) {
|
|
445
343
|
warnDeprecatedPathMethod(
|
|
446
344
|
runtime, "dash", "Use Skia.Path.Dash(path, on, off, phase) instead.");
|
|
447
345
|
auto path = asPath();
|
|
448
|
-
SkScalar
|
|
449
|
-
|
|
450
|
-
auto phase = arguments[2].asNumber();
|
|
451
|
-
SkScalar intervals[] = {on, off};
|
|
346
|
+
SkScalar intervals[] = {static_cast<SkScalar>(on),
|
|
347
|
+
static_cast<SkScalar>(off)};
|
|
452
348
|
auto pe = SkDashPathEffect::Make(SkSpan(intervals, 2), phase);
|
|
453
349
|
if (pe) {
|
|
454
350
|
SkStrokeRec rec(SkStrokeRec::InitStyle::kHairline_InitStyle);
|
|
@@ -457,9 +353,9 @@ public:
|
|
|
457
353
|
*getObject() = std::move(resultBuilder);
|
|
458
354
|
}
|
|
459
355
|
}
|
|
460
|
-
return thisValue.getObject(runtime);
|
|
461
356
|
}
|
|
462
357
|
|
|
358
|
+
// Stays raw: the options object is read leniently property by property.
|
|
463
359
|
JSI_HOST_FUNCTION(stroke) {
|
|
464
360
|
warnDeprecatedPathMethod(runtime, "stroke",
|
|
465
361
|
"Use Skia.Path.Stroke(path, opts) instead.");
|
|
@@ -501,16 +397,14 @@ public:
|
|
|
501
397
|
return thisValue.getObject(runtime);
|
|
502
398
|
}
|
|
503
399
|
|
|
504
|
-
|
|
400
|
+
void trim(jsi::Runtime &runtime, double startValue, double endValue,
|
|
401
|
+
bool isComplement) {
|
|
505
402
|
warnDeprecatedPathMethod(
|
|
506
403
|
runtime, "trim",
|
|
507
404
|
"Use Skia.Path.Trim(path, start, end, isComplement) instead.");
|
|
508
405
|
auto path = asPath();
|
|
509
|
-
float start =
|
|
510
|
-
|
|
511
|
-
float end =
|
|
512
|
-
std::clamp(static_cast<float>(arguments[1].asNumber()), 0.0f, 1.0f);
|
|
513
|
-
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);
|
|
514
408
|
auto mode = isComplement ? SkTrimPathEffect::Mode::kInverted
|
|
515
409
|
: SkTrimPathEffect::Mode::kNormal;
|
|
516
410
|
auto pe = SkTrimPathEffect::Make(start, end, mode);
|
|
@@ -521,112 +415,77 @@ public:
|
|
|
521
415
|
*getObject() = std::move(resultBuilder);
|
|
522
416
|
}
|
|
523
417
|
}
|
|
524
|
-
return thisValue.getObject(runtime);
|
|
525
418
|
}
|
|
526
419
|
|
|
527
420
|
// Query methods
|
|
528
421
|
|
|
529
|
-
|
|
422
|
+
std::shared_ptr<JsiSkRect> computeTightBounds() {
|
|
530
423
|
auto path = asPath();
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
534
|
-
runtime, hostObjectInstance, getContext());
|
|
424
|
+
return std::make_shared<JsiSkRect>(getContext(),
|
|
425
|
+
path.computeTightBounds());
|
|
535
426
|
}
|
|
536
427
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
541
|
-
runtime, hostObjectInstance, getContext());
|
|
428
|
+
std::shared_ptr<JsiSkRect> getBounds() {
|
|
429
|
+
return std::make_shared<JsiSkRect>(getContext(),
|
|
430
|
+
getObject()->computeBounds());
|
|
542
431
|
}
|
|
543
432
|
|
|
544
|
-
|
|
545
|
-
auto x = arguments[0].asNumber();
|
|
546
|
-
auto y = arguments[1].asNumber();
|
|
547
|
-
return jsi::Value(asPath().contains(x, y));
|
|
548
|
-
}
|
|
433
|
+
bool contains(double x, double y) { return asPath().contains(x, y); }
|
|
549
434
|
|
|
550
|
-
|
|
551
|
-
auto fillType = getObject()->fillType();
|
|
552
|
-
return jsi::Value(static_cast<int>(fillType));
|
|
553
|
-
}
|
|
435
|
+
int getFillType() { return static_cast<int>(getObject()->fillType()); }
|
|
554
436
|
|
|
555
|
-
|
|
437
|
+
bool isVolatile() { return asPath().isVolatile(); }
|
|
556
438
|
|
|
557
|
-
|
|
558
|
-
auto index = arguments[0].asNumber();
|
|
439
|
+
std::shared_ptr<JsiSkPoint> getPoint(int index) {
|
|
559
440
|
auto point = asPath().getPoint(index);
|
|
560
|
-
|
|
561
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
562
|
-
runtime, hostObjectInstance, getContext());
|
|
441
|
+
return std::make_shared<JsiSkPoint>(getContext(), point);
|
|
563
442
|
}
|
|
564
443
|
|
|
565
|
-
|
|
444
|
+
bool isEmpty() { return getObject()->isEmpty(); }
|
|
566
445
|
|
|
567
|
-
|
|
568
|
-
auto points = asPath().countPoints();
|
|
569
|
-
return jsi::Value(points);
|
|
570
|
-
}
|
|
446
|
+
int countPoints() { return asPath().countPoints(); }
|
|
571
447
|
|
|
572
|
-
|
|
448
|
+
SkPoint getLastPt() {
|
|
573
449
|
auto last = getObject()->getLastPt();
|
|
574
|
-
|
|
575
|
-
if (last.has_value()) {
|
|
576
|
-
point.setProperty(runtime, "x", static_cast<double>(last->fX));
|
|
577
|
-
point.setProperty(runtime, "y", static_cast<double>(last->fY));
|
|
578
|
-
} else {
|
|
579
|
-
point.setProperty(runtime, "x", 0.0);
|
|
580
|
-
point.setProperty(runtime, "y", 0.0);
|
|
581
|
-
}
|
|
582
|
-
return point;
|
|
450
|
+
return last.value_or(SkPoint::Make(0, 0));
|
|
583
451
|
}
|
|
584
452
|
|
|
585
|
-
|
|
453
|
+
std::string toSVGString() {
|
|
586
454
|
auto path = asPath();
|
|
587
455
|
auto s = SkParsePath::ToSVGString(path);
|
|
588
|
-
return
|
|
456
|
+
return std::string(s.c_str());
|
|
589
457
|
}
|
|
590
458
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
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();
|
|
595
462
|
}
|
|
596
463
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
auto hostObjectInstance = std::make_shared<JsiSkPath>(getContext(), path);
|
|
600
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
601
|
-
runtime, hostObjectInstance, getContext());
|
|
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
|
-
|
|
622
|
-
std::make_shared<JsiSkPath>(getContext(), std::move(result));
|
|
623
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
624
|
-
runtime, hostObjectInstance, getContext());
|
|
483
|
+
return std::make_shared<JsiSkPath>(getContext(), std::move(result));
|
|
625
484
|
}
|
|
626
485
|
|
|
627
|
-
|
|
486
|
+
std::vector<std::vector<double>> toCmds() {
|
|
628
487
|
auto path = asPath();
|
|
629
|
-
std::vector<
|
|
488
|
+
std::vector<std::vector<double>> cmds;
|
|
630
489
|
SkPoint pts[4];
|
|
631
490
|
SkPath::Iter iter(path, false);
|
|
632
491
|
SkPath::Verb verb;
|
|
@@ -634,120 +493,145 @@ public:
|
|
|
634
493
|
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
|
|
635
494
|
switch (verb) {
|
|
636
495
|
case SkPath::kMove_Verb: {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[0].y()));
|
|
641
|
-
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())});
|
|
642
499
|
break;
|
|
643
500
|
}
|
|
644
501
|
case SkPath::kLine_Verb: {
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
cmd.setValueAtIndex(runtime, 2, static_cast<double>(pts[1].y()));
|
|
649
|
-
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())});
|
|
650
505
|
break;
|
|
651
506
|
}
|
|
652
507
|
case SkPath::kQuad_Verb: {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
cmd.setValueAtIndex(runtime, 3, static_cast<double>(pts[2].x()));
|
|
658
|
-
cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
|
|
659
|
-
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())});
|
|
660
512
|
break;
|
|
661
513
|
}
|
|
662
514
|
case SkPath::kConic_Verb: {
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
|
|
669
|
-
cmd.setValueAtIndex(runtime, 5,
|
|
670
|
-
static_cast<double>(iter.conicWeight()));
|
|
671
|
-
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())});
|
|
672
520
|
break;
|
|
673
521
|
}
|
|
674
522
|
case SkPath::kCubic_Verb: {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
cmd.setValueAtIndex(runtime, 4, static_cast<double>(pts[2].y()));
|
|
681
|
-
cmd.setValueAtIndex(runtime, 5, static_cast<double>(pts[3].x()));
|
|
682
|
-
cmd.setValueAtIndex(runtime, 6, static_cast<double>(pts[3].y()));
|
|
683
|
-
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())});
|
|
684
528
|
break;
|
|
685
529
|
}
|
|
686
530
|
case SkPath::kClose_Verb: {
|
|
687
|
-
|
|
688
|
-
cmd.setValueAtIndex(runtime, 0, static_cast<double>(CLOSE));
|
|
689
|
-
cmdList.push_back(std::move(cmd));
|
|
531
|
+
cmds.push_back({static_cast<double>(CLOSE)});
|
|
690
532
|
break;
|
|
691
533
|
}
|
|
692
534
|
default:
|
|
693
535
|
break;
|
|
694
536
|
}
|
|
695
537
|
}
|
|
696
|
-
|
|
697
|
-
// Create the jsi::Array with the exact size
|
|
698
|
-
auto cmds = jsi::Array(runtime, cmdList.size());
|
|
699
|
-
for (size_t i = 0; i < cmdList.size(); ++i) {
|
|
700
|
-
cmds.setValueAtIndex(runtime, i, cmdList[i]);
|
|
701
|
-
}
|
|
702
|
-
|
|
703
538
|
return cmds;
|
|
704
539
|
}
|
|
705
540
|
|
|
706
|
-
|
|
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
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
541
|
+
static void definePrototype(jsi::Runtime &runtime, jsi::Object &prototype) {
|
|
542
|
+
installCommon(runtime, prototype);
|
|
543
|
+
// Mutable building methods
|
|
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);
|
|
596
|
+
// Mutable transform methods
|
|
597
|
+
installChainableMethodWithRuntime(runtime, prototype, "transform",
|
|
598
|
+
&JsiSkPath::transform);
|
|
599
|
+
installChainableMethodWithRuntime(runtime, prototype, "offset",
|
|
600
|
+
&JsiSkPath::offset);
|
|
601
|
+
// Mutable path operations
|
|
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);
|
|
610
|
+
installHostMethod(runtime, prototype, "stroke", &JsiSkPath::stroke);
|
|
611
|
+
installChainableMethodWithRuntime(runtime, prototype, "trim",
|
|
612
|
+
&JsiSkPath::trim);
|
|
613
|
+
// Query methods
|
|
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);
|
|
631
|
+
}
|
|
748
632
|
|
|
749
633
|
JsiSkPath(std::shared_ptr<RNSkPlatformContext> context, SkPathBuilder builder)
|
|
750
|
-
:
|
|
634
|
+
: JsiSkWrappingSharedPtrNativeObject<JsiSkPath, SkPathBuilder>(
|
|
751
635
|
std::move(context),
|
|
752
636
|
std::make_shared<SkPathBuilder>(std::move(builder))) {}
|
|
753
637
|
|
|
@@ -755,7 +639,7 @@ public:
|
|
|
755
639
|
JsiSkPath(std::shared_ptr<RNSkPlatformContext> context, const SkPath &path)
|
|
756
640
|
: JsiSkPath(std::move(context), SkPathBuilder(path)) {}
|
|
757
641
|
|
|
758
|
-
size_t getMemoryPressure()
|
|
642
|
+
size_t getMemoryPressure() override {
|
|
759
643
|
auto builder = getObject();
|
|
760
644
|
if (!builder)
|
|
761
645
|
return 0;
|
|
@@ -763,7 +647,13 @@ public:
|
|
|
763
647
|
return builder->snapshot().approximateBytesUsed();
|
|
764
648
|
}
|
|
765
649
|
|
|
766
|
-
|
|
650
|
+
/**
|
|
651
|
+
Returns the underlying object from a host object of this type
|
|
652
|
+
*/
|
|
653
|
+
static std::shared_ptr<SkPathBuilder> fromValue(jsi::Runtime &runtime,
|
|
654
|
+
const jsi::Value &obj) {
|
|
655
|
+
return objectFromValue(runtime, obj);
|
|
656
|
+
}
|
|
767
657
|
|
|
768
658
|
static SkPath pathFromValue(jsi::Runtime &runtime, const jsi::Value &obj) {
|
|
769
659
|
return fromValue(runtime, obj)->snapshot();
|
|
@@ -772,18 +662,20 @@ public:
|
|
|
772
662
|
static jsi::Value toValue(jsi::Runtime &runtime,
|
|
773
663
|
std::shared_ptr<RNSkPlatformContext> context,
|
|
774
664
|
const SkPath &path) {
|
|
775
|
-
|
|
776
|
-
return JSI_CREATE_HOST_OBJECT_WITH_MEMORY_PRESSURE(
|
|
777
|
-
runtime, hostObjectInstance, context);
|
|
665
|
+
return makeJsiObject(runtime, std::make_shared<JsiSkPath>(context, path));
|
|
778
666
|
}
|
|
779
667
|
|
|
780
668
|
static jsi::Value toValue(jsi::Runtime &runtime,
|
|
781
669
|
std::shared_ptr<RNSkPlatformContext> context,
|
|
782
670
|
SkPath &&path) {
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
671
|
+
return makeJsiObject(runtime,
|
|
672
|
+
std::make_shared<JsiSkPath>(context, std::move(path)));
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
private:
|
|
676
|
+
static SkPathDirection toDirection(const JsiOptional<bool> &isCCW) {
|
|
677
|
+
return isCCW.has_value() && *isCCW ? SkPathDirection::kCCW
|
|
678
|
+
: SkPathDirection::kCW;
|
|
787
679
|
}
|
|
788
680
|
};
|
|
789
681
|
|