@shopify/react-native-skia 2.5.5 → 2.6.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 +0 -1
- package/android/cpp/jni/JniWebGPUView.cpp +3 -3
- package/android/cpp/rnskia-android/OpenGLContext.h +4 -5
- package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +1 -1
- package/apple/MetalContext.h +5 -6
- package/apple/MetalWindowContext.mm +3 -4
- package/apple/RNSkApplePlatformContext.h +1 -1
- package/apple/RNSkApplePlatformContext.mm +4 -3
- package/apple/SkiaCVPixelBufferUtils.h +1 -1
- package/apple/SkiaCVPixelBufferUtils.mm +31 -30
- package/apple/SkiaPlatformContext.mm +2 -2
- package/apple/SkiaUIView.mm +1 -1
- package/apple/SkiaWebGPUView.mm +8 -4
- package/apple/WebGPUMetalView.h +1 -1
- package/apple/WebGPUMetalView.mm +1 -1
- package/cpp/api/CustomBlendModes.h +1 -0
- package/cpp/api/JsiSkApi.h +4 -0
- package/cpp/api/JsiSkCanvas.h +2 -2
- package/cpp/api/JsiSkColor.h +8 -4
- package/cpp/api/JsiSkContourMeasure.h +4 -3
- package/cpp/api/JsiSkContourMeasureIter.h +1 -1
- package/cpp/api/JsiSkImage.h +17 -9
- package/cpp/api/JsiSkParagraphBuilder.h +14 -1
- package/cpp/api/JsiSkPath.h +475 -357
- package/cpp/api/JsiSkPathBuilder.h +415 -0
- package/cpp/api/JsiSkPathBuilderFactory.h +53 -0
- package/cpp/api/JsiSkPathEffectFactory.h +3 -2
- package/cpp/api/JsiSkPathFactory.h +287 -20
- package/cpp/api/JsiSkShader.h +1 -1
- package/cpp/api/JsiSkShaderFactory.h +50 -26
- package/cpp/api/JsiSkSurfaceFactory.h +2 -1
- package/cpp/api/recorder/DataTypes.h +1 -1
- package/cpp/api/recorder/Drawings.h +11 -9
- package/cpp/api/recorder/Shaders.h +77 -22
- package/cpp/jsi2/JSIConverter.h +1 -1
- package/cpp/rnskia/RNDawnContext.h +29 -9
- package/cpp/rnskia/RNDawnUtils.h +112 -113
- package/cpp/rnskia/RNDawnWindowContext.h +1 -1
- package/cpp/rnskia/RNSkManager.cpp +5 -4
- package/cpp/rnskia/RNSkPlatformContext.h +2 -2
- package/cpp/rnwgpu/api/GPU.cpp +21 -0
- package/cpp/rnwgpu/api/GPUCanvasContext.cpp +1 -1
- package/cpp/rnwgpu/api/GPUCanvasContext.h +2 -2
- package/cpp/rnwgpu/api/GPUFeatures.h +0 -9
- package/cpp/rnwgpu/api/GPUTexture.h +14 -2
- package/cpp/rnwgpu/api/GPUUncapturedErrorEvent.h +3 -4
- package/cpp/rnwgpu/api/RNWebGPU.h +1 -1
- package/cpp/rnwgpu/api/descriptors/Unions.h +0 -15
- package/cpp/skia/include/android/SkImageAndroid.h +7 -2
- package/cpp/skia/include/android/vk/AndroidVulkanMemoryAllocator.h +31 -0
- package/cpp/skia/include/codec/SkCodec.h +42 -15
- package/cpp/skia/include/config/SkUserConfig.h +8 -0
- package/cpp/skia/include/core/SkBitmap.h +0 -5
- package/cpp/skia/include/core/SkCanvas.h +2 -39
- package/cpp/skia/include/core/SkColor.h +12 -0
- package/cpp/skia/include/core/SkColorSpace.h +9 -0
- package/cpp/skia/include/core/SkContourMeasure.h +1 -5
- package/cpp/skia/include/core/SkData.h +8 -0
- package/cpp/skia/include/core/SkFont.h +1 -55
- package/cpp/skia/include/core/SkFontArguments.h +15 -0
- package/cpp/skia/include/core/SkGraphics.h +0 -5
- package/cpp/skia/include/core/SkImage.h +0 -4
- package/cpp/skia/include/core/SkImageGenerator.h +1 -4
- package/cpp/skia/include/core/SkMatrix.h +0 -37
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +11 -911
- package/cpp/skia/include/core/SkPathBuilder.h +42 -32
- package/cpp/skia/include/core/SkPathEffect.h +0 -9
- package/cpp/skia/include/core/SkPathMeasure.h +1 -4
- package/cpp/skia/include/core/SkPathUtils.h +0 -10
- package/cpp/skia/include/core/SkRect.h +0 -12
- package/cpp/skia/include/core/SkRegion.h +1 -6
- package/cpp/skia/include/core/SkSerialProcs.h +4 -5
- package/cpp/skia/include/core/SkSurfaceProps.h +6 -0
- package/cpp/skia/include/core/SkTextBlob.h +0 -22
- package/cpp/skia/include/core/SkTypeface.h +14 -32
- package/cpp/skia/include/core/SkTypes.h +0 -8
- package/cpp/skia/include/docs/SkPDFDocument.h +19 -17
- package/cpp/skia/include/effects/SkDashPathEffect.h +0 -6
- package/cpp/skia/include/effects/SkGradient.h +206 -0
- package/cpp/skia/include/effects/SkHighContrastFilter.h +2 -2
- package/cpp/skia/include/gpu/GpuTypes.h +2 -0
- package/cpp/skia/include/gpu/ganesh/GrBackendSemaphore.h +5 -35
- package/cpp/skia/include/gpu/ganesh/GrBackendSurface.h +7 -106
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +0 -11
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +0 -9
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSemaphore.h +20 -0
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DBackendSurface.h +59 -0
- package/cpp/skia/include/gpu/ganesh/d3d/GrD3DDirectContext.h +28 -0
- package/cpp/skia/include/gpu/ganesh/gl/GrGLFunctions.h +4 -1
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +4 -20
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +32 -46
- package/cpp/skia/include/gpu/graphite/Recorder.h +1 -1
- package/cpp/skia/include/gpu/graphite/Surface.h +31 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +3 -10
- package/cpp/skia/include/gpu/graphite/dawn/DawnGraphiteTypes.h +3 -3
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +1 -1
- package/cpp/skia/include/gpu/graphite/precompile/PrecompileShader.h +6 -6
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +5 -3
- package/cpp/skia/include/gpu/graphite/vk/precompile/VulkanPrecompileShader.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/VulkanPreferredFeatures.h +8 -0
- package/cpp/skia/include/private/SkEncodedInfo.h +43 -105
- package/cpp/skia/include/private/SkHdrMetadata.h +165 -2
- package/cpp/skia/include/private/SkPathRef.h +0 -457
- package/cpp/skia/include/private/base/SkFeatures.h +4 -0
- package/cpp/skia/include/private/base/SkFloatingPoint.h +1 -2
- package/cpp/skia/include/private/base/SkLoadUserConfig.h +2 -1
- package/cpp/skia/include/private/base/SkLog.h +68 -0
- package/cpp/skia/include/private/base/SkLogPriority.h +35 -0
- package/cpp/skia/include/private/base/SkMacros.h +9 -0
- package/cpp/skia/include/private/base/SkTArray.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +10 -24
- package/cpp/skia/include/utils/SkEventTracer.h +5 -7
- package/cpp/skia/modules/skottie/include/TextShaper.h +0 -7
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +6 -20
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +0 -6
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +4 -19
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +2 -3
- package/cpp/skia/modules/skunicode/include/SkUnicode_icu.h +18 -0
- package/cpp/skia/modules/skunicode/include/SkUnicode_libgrapheme.h +19 -0
- package/cpp/skia/src/base/SkMathPriv.h +27 -132
- package/lib/commonjs/animation/functions/interpolatePaths.d.ts +1 -1
- package/lib/commonjs/animation/functions/interpolatePaths.js +5 -4
- package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.d.ts +11 -2
- package/lib/commonjs/external/reanimated/interpolators.js +21 -4
- package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
- package/lib/commonjs/skia/types/Path/PathBuilder.d.ts +201 -0
- package/lib/commonjs/skia/types/Path/PathBuilder.js +6 -0
- package/lib/commonjs/skia/types/Path/PathBuilder.js.map +1 -0
- package/lib/commonjs/skia/types/Path/PathBuilderFactory.d.ts +13 -0
- package/lib/commonjs/skia/types/Path/PathBuilderFactory.js +6 -0
- package/lib/commonjs/skia/types/Path/PathBuilderFactory.js.map +1 -0
- package/lib/commonjs/skia/types/Path/PathFactory.d.ts +87 -1
- package/lib/commonjs/skia/types/Path/PathFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Path/index.d.ts +2 -0
- package/lib/commonjs/skia/types/Path/index.js +22 -0
- package/lib/commonjs/skia/types/Path/index.js.map +1 -1
- package/lib/commonjs/skia/types/Skia.d.ts +2 -1
- package/lib/commonjs/skia/types/Skia.js.map +1 -1
- package/lib/commonjs/skia/web/Host.js +1 -3
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +6 -2
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js +4 -1
- package/lib/commonjs/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +42 -30
- package/lib/commonjs/skia/web/JsiSkPath.js +302 -111
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +45 -0
- package/lib/commonjs/skia/web/JsiSkPathBuilder.js +192 -0
- package/lib/commonjs/skia/web/JsiSkPathBuilder.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkPathBuilderFactory.d.ts +9 -0
- package/lib/commonjs/skia/web/JsiSkPathBuilderFactory.js +26 -0
- package/lib/commonjs/skia/web/JsiSkPathBuilderFactory.js.map +1 -0
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +6 -2
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +13 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +140 -5
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +8 -1
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js +18 -6
- package/lib/commonjs/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -2
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js +2 -3
- package/lib/commonjs/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +2 -2
- package/lib/commonjs/specs/WebGPUViewNativeComponent.js +2 -3
- package/lib/commonjs/specs/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js +2 -0
- package/lib/commonjs/specs/WebGPUViewNativeComponent.web.js.map +1 -1
- package/lib/module/animation/functions/interpolatePaths.d.ts +1 -1
- package/lib/module/animation/functions/interpolatePaths.js +5 -4
- package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.d.ts +11 -2
- package/lib/module/external/reanimated/interpolators.js +21 -4
- package/lib/module/external/reanimated/interpolators.js.map +1 -1
- package/lib/module/skia/types/Path/PathBuilder.d.ts +201 -0
- package/lib/module/skia/types/Path/PathBuilder.js +2 -0
- package/lib/module/skia/types/Path/PathBuilder.js.map +1 -0
- package/lib/module/skia/types/Path/PathBuilderFactory.d.ts +13 -0
- package/lib/module/skia/types/Path/PathBuilderFactory.js +2 -0
- package/lib/module/skia/types/Path/PathBuilderFactory.js.map +1 -0
- package/lib/module/skia/types/Path/PathFactory.d.ts +87 -1
- package/lib/module/skia/types/Path/PathFactory.js.map +1 -1
- package/lib/module/skia/types/Path/index.d.ts +2 -0
- package/lib/module/skia/types/Path/index.js +2 -0
- package/lib/module/skia/types/Path/index.js.map +1 -1
- package/lib/module/skia/types/Skia.d.ts +2 -1
- package/lib/module/skia/types/Skia.js.map +1 -1
- package/lib/module/skia/web/Host.js +1 -3
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +6 -2
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkContourMeasure.js +4 -1
- package/lib/module/skia/web/JsiSkContourMeasure.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +42 -30
- package/lib/module/skia/web/JsiSkPath.js +300 -110
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathBuilder.d.ts +45 -0
- package/lib/module/skia/web/JsiSkPathBuilder.js +186 -0
- package/lib/module/skia/web/JsiSkPathBuilder.js.map +1 -0
- package/lib/module/skia/web/JsiSkPathBuilderFactory.d.ts +9 -0
- package/lib/module/skia/web/JsiSkPathBuilderFactory.js +19 -0
- package/lib/module/skia/web/JsiSkPathBuilderFactory.js.map +1 -0
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +6 -2
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.d.ts +13 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +141 -6
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +8 -1
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Drawing.js +18 -6
- package/lib/module/sksg/Recorder/commands/Drawing.js.map +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +2 -2
- package/lib/module/specs/SkiaPictureViewNativeComponent.js +1 -1
- package/lib/module/specs/SkiaPictureViewNativeComponent.js.map +1 -1
- package/lib/module/specs/WebGPUViewNativeComponent.d.ts +2 -2
- package/lib/module/specs/WebGPUViewNativeComponent.js +1 -1
- package/lib/module/specs/WebGPUViewNativeComponent.js.map +1 -1
- package/lib/module/specs/WebGPUViewNativeComponent.web.js +2 -0
- package/lib/module/specs/WebGPUViewNativeComponent.web.js.map +1 -1
- package/lib/typescript/lib/commonjs/animation/functions/interpolatePaths.d.ts +1 -1
- package/lib/typescript/lib/commonjs/external/reanimated/interpolators.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/types/Path/PathBuilder.d.ts +1 -0
- package/lib/typescript/lib/commonjs/skia/types/Path/PathBuilderFactory.d.ts +1 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPath.d.ts +33 -25
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathBuilder.d.ts +46 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathBuilderFactory.d.ts +7 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +12 -0
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +2 -0
- package/lib/typescript/lib/commonjs/specs/SkiaPictureViewNativeComponent.d.ts +2 -1
- package/lib/typescript/lib/commonjs/specs/WebGPUViewNativeComponent.d.ts +2 -1
- package/lib/typescript/lib/module/animation/functions/interpolatePaths.d.ts +1 -1
- package/lib/typescript/lib/module/external/reanimated/interpolators.d.ts +1 -1
- package/lib/typescript/lib/module/mock/index.d.ts +1 -1
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Path/PathBuilder.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Path/PathBuilderFactory.d.ts +1 -0
- package/lib/typescript/lib/module/skia/types/Path/index.d.ts +2 -0
- package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +38 -25
- package/lib/typescript/lib/module/skia/web/JsiSkPathBuilder.d.ts +45 -0
- package/lib/typescript/lib/module/skia/web/JsiSkPathBuilderFactory.d.ts +6 -0
- package/lib/typescript/lib/module/skia/web/JsiSkPathFactory.d.ts +12 -0
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +2 -0
- package/lib/typescript/lib/module/specs/SkiaPictureViewNativeComponent.d.ts +1 -1
- package/lib/typescript/lib/module/specs/WebGPUViewNativeComponent.d.ts +1 -1
- package/lib/typescript/src/animation/functions/interpolatePaths.d.ts +1 -1
- package/lib/typescript/src/external/reanimated/interpolators.d.ts +11 -2
- package/lib/typescript/src/skia/types/Path/PathBuilder.d.ts +201 -0
- package/lib/typescript/src/skia/types/Path/PathBuilderFactory.d.ts +13 -0
- package/lib/typescript/src/skia/types/Path/PathFactory.d.ts +87 -1
- package/lib/typescript/src/skia/types/Path/index.d.ts +2 -0
- package/lib/typescript/src/skia/types/Skia.d.ts +2 -1
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +42 -30
- package/lib/typescript/src/skia/web/JsiSkPathBuilder.d.ts +45 -0
- package/lib/typescript/src/skia/web/JsiSkPathBuilderFactory.d.ts +9 -0
- package/lib/typescript/src/skia/web/JsiSkPathFactory.d.ts +13 -1
- package/lib/typescript/src/specs/SkiaPictureViewNativeComponent.d.ts +2 -2
- package/lib/typescript/src/specs/WebGPUViewNativeComponent.d.ts +2 -2
- package/package.json +7 -6
- package/scripts/install-libs.js +16 -6
- package/src/animation/functions/interpolatePaths.ts +5 -6
- package/src/external/reanimated/interpolators.ts +25 -5
- package/src/skia/types/Path/PathBuilder.ts +303 -0
- package/src/skia/types/Path/PathBuilderFactory.ts +15 -0
- package/src/skia/types/Path/PathFactory.ts +108 -1
- package/src/skia/types/Path/index.ts +2 -0
- package/src/skia/types/Skia.ts +2 -1
- package/src/skia/web/Host.ts +7 -1
- package/src/skia/web/JsiSkCanvas.ts +6 -6
- package/src/skia/web/JsiSkContourMeasure.ts +4 -4
- package/src/skia/web/JsiSkPath.ts +451 -168
- package/src/skia/web/JsiSkPathBuilder.ts +293 -0
- package/src/skia/web/JsiSkPathBuilderFactory.ts +32 -0
- package/src/skia/web/JsiSkPathEffectFactory.ts +6 -2
- package/src/skia/web/JsiSkPathFactory.ts +231 -8
- package/src/skia/web/JsiSkia.ts +11 -8
- package/src/sksg/Recorder/commands/Drawing.ts +20 -7
- package/src/specs/SkiaPictureViewNativeComponent.ts +1 -2
- package/src/specs/WebGPUViewNativeComponent.ts +2 -2
- package/src/specs/WebGPUViewNativeComponent.web.ts +2 -0
- package/cpp/skia/include/effects/SkGradientShader.h +0 -359
- package/cpp/skia/include/gpu/graphite/LogPriority.h +0 -36
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { CanvasKit, PathBuilder as CKPathBuilder } from "canvaskit-wasm";
|
|
2
|
+
import type { FillType, InputMatrix, InputRRect, SkMatrix, SkPath, SkPathBuilder, SkPoint, SkRect } from "../types";
|
|
3
|
+
import { HostObject } from "./Host";
|
|
4
|
+
/**
|
|
5
|
+
* Web implementation of SkPathBuilder using CanvasKit's native PathBuilder.
|
|
6
|
+
*/
|
|
7
|
+
export declare class JsiSkPathBuilder extends HostObject<CKPathBuilder, "PathBuilder"> implements SkPathBuilder {
|
|
8
|
+
constructor(CanvasKit: CanvasKit, ref: CKPathBuilder);
|
|
9
|
+
moveTo(x: number, y: number): this;
|
|
10
|
+
rMoveTo(x: number, y: number): this;
|
|
11
|
+
lineTo(x: number, y: number): this;
|
|
12
|
+
rLineTo(x: number, y: number): this;
|
|
13
|
+
quadTo(x1: number, y1: number, x2: number, y2: number): this;
|
|
14
|
+
rQuadTo(x1: number, y1: number, x2: number, y2: number): this;
|
|
15
|
+
conicTo(x1: number, y1: number, x2: number, y2: number, w: number): this;
|
|
16
|
+
rConicTo(x1: number, y1: number, x2: number, y2: number, w: number): this;
|
|
17
|
+
cubicTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): this;
|
|
18
|
+
rCubicTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): this;
|
|
19
|
+
close(): this;
|
|
20
|
+
arcToOval(oval: SkRect, startAngleInDegrees: number, sweepAngleInDegrees: number, forceMoveTo: boolean): this;
|
|
21
|
+
arcToRotated(rx: number, ry: number, xAxisRotateInDegrees: number, useSmallArc: boolean, isCCW: boolean, x: number, y: number): this;
|
|
22
|
+
rArcTo(rx: number, ry: number, xAxisRotateInDegrees: number, useSmallArc: boolean, isCCW: boolean, dx: number, dy: number): this;
|
|
23
|
+
arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number): this;
|
|
24
|
+
addRect(rect: SkRect, isCCW?: boolean): this;
|
|
25
|
+
addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): this;
|
|
26
|
+
addArc(oval: SkRect, startAngleInDegrees: number, sweepAngleInDegrees: number): this;
|
|
27
|
+
addRRect(rrect: InputRRect, isCCW?: boolean): this;
|
|
28
|
+
addCircle(x: number, y: number, r: number, _isCCW?: boolean): this;
|
|
29
|
+
addPoly(points: SkPoint[], close: boolean): this;
|
|
30
|
+
addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): this;
|
|
31
|
+
setFillType(fill: FillType): this;
|
|
32
|
+
setIsVolatile(_isVolatile: boolean): this;
|
|
33
|
+
reset(): this;
|
|
34
|
+
offset(dx: number, dy: number): this;
|
|
35
|
+
transform(m: InputMatrix): this;
|
|
36
|
+
computeBounds(): SkRect;
|
|
37
|
+
isEmpty(): boolean;
|
|
38
|
+
getLastPt(): {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
};
|
|
42
|
+
countPoints(): number;
|
|
43
|
+
build(): SkPath;
|
|
44
|
+
detach(): SkPath;
|
|
45
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CanvasKit } from "canvaskit-wasm";
|
|
2
|
+
import type { PathBuilderFactory, SkPath } from "../types";
|
|
3
|
+
import { Host } from "./Host";
|
|
4
|
+
import { JsiSkPathBuilder } from "./JsiSkPathBuilder";
|
|
5
|
+
export declare class JsiSkPathBuilderFactory extends Host implements PathBuilderFactory {
|
|
6
|
+
constructor(CanvasKit: CanvasKit);
|
|
7
|
+
Make(): JsiSkPathBuilder;
|
|
8
|
+
MakeFromPath(path: SkPath): JsiSkPathBuilder;
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CanvasKit } from "canvaskit-wasm";
|
|
2
|
-
import type { PathCommand, PathOp, SkFont, SkPath } from "../types";
|
|
2
|
+
import type { InputRRect, PathCommand, PathOp, SkFont, SkPath, SkPoint, SkRect, StrokeOpts } from "../types";
|
|
3
3
|
import type { PathFactory } from "../types/Path/PathFactory";
|
|
4
4
|
import { Host } from "./Host";
|
|
5
5
|
import { JsiSkPath } from "./JsiSkPath";
|
|
@@ -10,4 +10,16 @@ export declare class JsiSkPathFactory extends Host implements PathFactory {
|
|
|
10
10
|
MakeFromOp(one: SkPath, two: SkPath, op: PathOp): JsiSkPath | null;
|
|
11
11
|
MakeFromCmds(cmds: PathCommand[]): JsiSkPath | null;
|
|
12
12
|
MakeFromText(_text: string, _x: number, _y: number, _font: SkFont): SkPath;
|
|
13
|
+
Rect(rect: SkRect, isCCW?: boolean): JsiSkPath;
|
|
14
|
+
Oval(rect: SkRect, isCCW?: boolean, startIndex?: number): JsiSkPath;
|
|
15
|
+
Circle(x: number, y: number, r: number): JsiSkPath;
|
|
16
|
+
RRect(rrect: InputRRect, isCCW?: boolean): JsiSkPath;
|
|
17
|
+
Line(p1: SkPoint, p2: SkPoint): JsiSkPath;
|
|
18
|
+
Polygon(points: SkPoint[], close: boolean): JsiSkPath;
|
|
19
|
+
Stroke(srcPath: SkPath, opts?: StrokeOpts): JsiSkPath | null;
|
|
20
|
+
Trim(srcPath: SkPath, start: number, end: number, isComplement: boolean): JsiSkPath | null;
|
|
21
|
+
Simplify(srcPath: SkPath): JsiSkPath | null;
|
|
22
|
+
Dash(srcPath: SkPath, on: number, off: number, phase: number): JsiSkPath | null;
|
|
23
|
+
AsWinding(srcPath: SkPath): JsiSkPath | null;
|
|
24
|
+
Interpolate(start: SkPath, end: SkPath, weight: number): JsiSkPath | null;
|
|
13
25
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ViewProps } from "react-native";
|
|
2
2
|
import type { WithDefault } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
3
|
export interface NativeProps extends ViewProps {
|
|
4
4
|
debug?: boolean;
|
|
@@ -7,5 +7,5 @@ export interface NativeProps extends ViewProps {
|
|
|
7
7
|
androidWarmup?: boolean;
|
|
8
8
|
pointerEvents?: WithDefault<"auto" | "none" | "box-none" | "box-only", "auto">;
|
|
9
9
|
}
|
|
10
|
-
declare const _default: import("react-native
|
|
10
|
+
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
11
11
|
export default _default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
2
1
|
import type { ViewProps } from "react-native";
|
|
2
|
+
import type { Int32 } from "react-native/Libraries/Types/CodegenTypes";
|
|
3
3
|
export interface NativeProps extends ViewProps {
|
|
4
4
|
contextId: Int32;
|
|
5
5
|
transparent: boolean;
|
|
6
6
|
}
|
|
7
|
-
declare const _default: import("react-native
|
|
7
|
+
declare const _default: import("react-native").HostComponent<NativeProps>;
|
|
8
8
|
export default _default;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"setup-skia-web": "scripts/setup-canvaskit.js"
|
|
10
10
|
},
|
|
11
11
|
"title": "React Native Skia",
|
|
12
|
-
"version": "2.
|
|
12
|
+
"version": "2.6.1",
|
|
13
13
|
"description": "High-performance React Native Graphics using Skia",
|
|
14
14
|
"main": "lib/module/index.js",
|
|
15
15
|
"react-native": "src/index.ts",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"build-skia": "tsx ./scripts/build-skia.ts",
|
|
49
49
|
"copy-skia-headers": "tsx ./scripts/copy-skia-headers.ts",
|
|
50
50
|
"install-skia-graphite": "tsx ./scripts/install-skia-graphite.ts",
|
|
51
|
+
"install-skia": "node scripts/install-libs.js",
|
|
51
52
|
"clang-format": "yarn clang-format-ios && yarn clang-format-android && yarn clang-format-common",
|
|
52
53
|
"clang-format-ios": "find apple/ -iname '*.h' -o -iname '*.mm' -o -iname '*.cpp' | xargs clang-format -i",
|
|
53
54
|
"clang-format-android": "find android/cpp/ -iname '*.h' -o -iname '*.m' -o -iname '*.cpp' | xargs clang-format -i",
|
|
@@ -127,11 +128,11 @@
|
|
|
127
128
|
"ws": "8.18.0"
|
|
128
129
|
},
|
|
129
130
|
"dependencies": {
|
|
130
|
-
"canvaskit-wasm": "0.
|
|
131
|
-
"react-native-skia-android": "
|
|
132
|
-
"react-native-skia-apple-ios": "
|
|
133
|
-
"react-native-skia-apple-macos": "
|
|
134
|
-
"react-native-skia-apple-tvos": "
|
|
131
|
+
"canvaskit-wasm": "0.41.0",
|
|
132
|
+
"react-native-skia-android": "147.0.0",
|
|
133
|
+
"react-native-skia-apple-ios": "147.0.0",
|
|
134
|
+
"react-native-skia-apple-macos": "147.0.0",
|
|
135
|
+
"react-native-skia-apple-tvos": "147.0.0",
|
|
135
136
|
"react-reconciler": "0.31.0"
|
|
136
137
|
},
|
|
137
138
|
"eslintIgnore": [
|
package/scripts/install-libs.js
CHANGED
|
@@ -19,9 +19,13 @@ function copySync(src, dest, options) {
|
|
|
19
19
|
const basePath = wildcardSplit[0];
|
|
20
20
|
const files = fs.readdirSync(basePath);
|
|
21
21
|
files
|
|
22
|
-
.filter(file => file.endsWith(wildcardSplit[1]))
|
|
22
|
+
.filter((file) => file.endsWith(wildcardSplit[1]))
|
|
23
23
|
.forEach((file) => {
|
|
24
|
-
return fs.cpSync(
|
|
24
|
+
return fs.cpSync(
|
|
25
|
+
path.join(basePath, file),
|
|
26
|
+
path.join(dest, file),
|
|
27
|
+
options
|
|
28
|
+
);
|
|
25
29
|
});
|
|
26
30
|
}
|
|
27
31
|
|
|
@@ -69,8 +73,12 @@ fs.rmSync(path.join(libsDir, "tvos"), { recursive: true, force: true });
|
|
|
69
73
|
fs.mkdirSync(path.join(libsDir, "ios"), { recursive: true });
|
|
70
74
|
fs.mkdirSync(path.join(libsDir, "macos"), { recursive: true });
|
|
71
75
|
|
|
72
|
-
copySync(iosPackage +
|
|
73
|
-
|
|
76
|
+
copySync(iosPackage + "/libs/*.xcframework", path.join(libsDir, "ios"), {
|
|
77
|
+
recursive: true,
|
|
78
|
+
});
|
|
79
|
+
copySync(macosPackage + "/libs/*.xcframework", path.join(libsDir, "macos"), {
|
|
80
|
+
recursive: true,
|
|
81
|
+
});
|
|
74
82
|
|
|
75
83
|
// Handle tvOS (non-Graphite only)
|
|
76
84
|
if (!useGraphite) {
|
|
@@ -80,7 +88,9 @@ if (!useGraphite) {
|
|
|
80
88
|
);
|
|
81
89
|
console.log("-- Skia tvOS package: " + tvosPackage);
|
|
82
90
|
fs.mkdirSync(path.join(libsDir, "tvos"), { recursive: true });
|
|
83
|
-
copySync(tvosPackage +
|
|
91
|
+
copySync(tvosPackage + "/libs/*.xcframework", path.join(libsDir, "tvos"), {
|
|
92
|
+
recursive: true,
|
|
93
|
+
});
|
|
84
94
|
} catch (e) {
|
|
85
95
|
console.log("-- tvOS package not found, skipping");
|
|
86
96
|
}
|
|
@@ -118,6 +128,6 @@ console.log("-- Skia Android package: " + androidPackage);
|
|
|
118
128
|
// Copy Android libs (per-ABI static libraries)
|
|
119
129
|
const androidDest = path.join(libsDir, "android");
|
|
120
130
|
fs.rmSync(androidDest, { recursive: true, force: true });
|
|
121
|
-
copySync(androidSrcLibs, androidDest, {recursive: true});
|
|
131
|
+
copySync(androidSrcLibs, androidDest, { recursive: true });
|
|
122
132
|
|
|
123
133
|
console.log("-- Copied Android libs to libs/android/");
|
|
@@ -9,12 +9,12 @@ const lerp = (
|
|
|
9
9
|
from: number,
|
|
10
10
|
to: number,
|
|
11
11
|
p1: SkPath,
|
|
12
|
-
p2: SkPath
|
|
13
|
-
output?: SkPath
|
|
12
|
+
p2: SkPath
|
|
14
13
|
) => {
|
|
15
14
|
"worklet";
|
|
16
15
|
const t = (value - from) / (to - from);
|
|
17
|
-
|
|
16
|
+
// interpolate returns a new path (immutable operation)
|
|
17
|
+
return p2.interpolate(p1, t)!;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -38,7 +38,7 @@ export const interpolatePaths = (
|
|
|
38
38
|
input: number[],
|
|
39
39
|
outputRange: SkPath[],
|
|
40
40
|
options?: ExtrapolationType,
|
|
41
|
-
|
|
41
|
+
_output?: SkPath
|
|
42
42
|
) => {
|
|
43
43
|
"worklet";
|
|
44
44
|
const extrapolation = validateInterpolationOptions(options);
|
|
@@ -86,7 +86,6 @@ export const interpolatePaths = (
|
|
|
86
86
|
input[i],
|
|
87
87
|
input[i + 1],
|
|
88
88
|
outputRange[i],
|
|
89
|
-
outputRange[i + 1]
|
|
90
|
-
output
|
|
89
|
+
outputRange[i + 1]
|
|
91
90
|
);
|
|
92
91
|
};
|
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
} from "react-native-reanimated";
|
|
6
6
|
import { useCallback, useMemo } from "react";
|
|
7
7
|
|
|
8
|
-
import type { SkPath, SkPoint } from "../../skia/types";
|
|
8
|
+
import type { SkPath, SkPathBuilder, SkPoint } from "../../skia/types";
|
|
9
9
|
import { interpolatePaths, interpolateVector } from "../../animation";
|
|
10
10
|
import { Skia } from "../../skia";
|
|
11
11
|
import { isOnMainThread } from "../../renderer/Offscreen";
|
|
@@ -20,15 +20,35 @@ export const notifyChange = <T>(value: SharedValue<T>) => {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Hook for creating animated paths using PathBuilder.
|
|
25
|
+
* The callback receives a mutable PathBuilder that can be used to construct the path.
|
|
26
|
+
* The resulting immutable SkPath is stored in a shared value.
|
|
27
|
+
*
|
|
28
|
+
* @param cb - Callback that receives the PathBuilder to construct the path
|
|
29
|
+
* @param init - Optional initial path to add to the builder
|
|
30
|
+
* @param transform - Optional transform function applied to the built path
|
|
31
|
+
*/
|
|
32
|
+
export const usePathValue = (
|
|
33
|
+
cb: (builder: SkPathBuilder) => void,
|
|
34
|
+
init?: SkPath,
|
|
35
|
+
transform?: (path: SkPath) => SkPath
|
|
36
|
+
) => {
|
|
37
|
+
const builderInit = useMemo(() => Skia.PathBuilder.Make(), []);
|
|
24
38
|
const pathInit = useMemo(() => Skia.Path.Make(), []);
|
|
39
|
+
const builder = Rea.useSharedValue(builderInit);
|
|
25
40
|
const path = Rea.useSharedValue(pathInit);
|
|
26
41
|
Rea.useDerivedValue(() => {
|
|
27
|
-
|
|
42
|
+
builder.value.reset();
|
|
28
43
|
if (init !== undefined) {
|
|
29
|
-
|
|
44
|
+
builder.value.addPath(init);
|
|
45
|
+
}
|
|
46
|
+
cb(builder.value);
|
|
47
|
+
let result = builder.value.build();
|
|
48
|
+
if (transform !== undefined) {
|
|
49
|
+
result = transform(result);
|
|
30
50
|
}
|
|
31
|
-
|
|
51
|
+
path.value = result;
|
|
32
52
|
notifyChange(path);
|
|
33
53
|
});
|
|
34
54
|
return path;
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import type { SkRect } from "../Rect";
|
|
2
|
+
import type { SkPoint } from "../Point";
|
|
3
|
+
import type { InputRRect } from "../RRect";
|
|
4
|
+
import type { InputMatrix, SkMatrix } from "../Matrix";
|
|
5
|
+
import type { SkJSIInstance } from "../JsiInstance";
|
|
6
|
+
|
|
7
|
+
import type { FillType, SkPath } from "./Path";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* SkPathBuilder is a mutable builder for constructing SkPath objects.
|
|
11
|
+
* Once construction is complete, call build() or detach() to get the immutable SkPath.
|
|
12
|
+
*/
|
|
13
|
+
export interface SkPathBuilder extends SkJSIInstance<"PathBuilder"> {
|
|
14
|
+
// Movement methods
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Adds beginning of contour at point (x, y).
|
|
18
|
+
* @param x - x-axis value of contour start
|
|
19
|
+
* @param y - y-axis value of contour start
|
|
20
|
+
* @returns reference to this PathBuilder for chaining
|
|
21
|
+
*/
|
|
22
|
+
moveTo(x: number, y: number): SkPathBuilder;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Adds beginning of contour relative to the last point.
|
|
26
|
+
* @param x - offset from last point on x-axis
|
|
27
|
+
* @param y - offset from last point on y-axis
|
|
28
|
+
* @returns reference to this PathBuilder for chaining
|
|
29
|
+
*/
|
|
30
|
+
rMoveTo(x: number, y: number): SkPathBuilder;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Adds line from last point to (x, y).
|
|
34
|
+
* @param x - end of line on x-axis
|
|
35
|
+
* @param y - end of line on y-axis
|
|
36
|
+
* @returns reference to this PathBuilder for chaining
|
|
37
|
+
*/
|
|
38
|
+
lineTo(x: number, y: number): SkPathBuilder;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Adds line from last point, relative to last point.
|
|
42
|
+
* @param x - offset from last point on x-axis
|
|
43
|
+
* @param y - offset from last point on y-axis
|
|
44
|
+
* @returns reference to this PathBuilder for chaining
|
|
45
|
+
*/
|
|
46
|
+
rLineTo(x: number, y: number): SkPathBuilder;
|
|
47
|
+
|
|
48
|
+
// Curve methods
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Adds quad from last point towards (x1, y1), to (x2, y2).
|
|
52
|
+
*/
|
|
53
|
+
quadTo(x1: number, y1: number, x2: number, y2: number): SkPathBuilder;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Relative version of quadTo.
|
|
57
|
+
*/
|
|
58
|
+
rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPathBuilder;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.
|
|
62
|
+
*/
|
|
63
|
+
conicTo(
|
|
64
|
+
x1: number,
|
|
65
|
+
y1: number,
|
|
66
|
+
x2: number,
|
|
67
|
+
y2: number,
|
|
68
|
+
w: number
|
|
69
|
+
): SkPathBuilder;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Relative version of conicTo.
|
|
73
|
+
*/
|
|
74
|
+
rConicTo(
|
|
75
|
+
x1: number,
|
|
76
|
+
y1: number,
|
|
77
|
+
x2: number,
|
|
78
|
+
y2: number,
|
|
79
|
+
w: number
|
|
80
|
+
): SkPathBuilder;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at (x3, y3).
|
|
84
|
+
*/
|
|
85
|
+
cubicTo(
|
|
86
|
+
x1: number,
|
|
87
|
+
y1: number,
|
|
88
|
+
x2: number,
|
|
89
|
+
y2: number,
|
|
90
|
+
x3: number,
|
|
91
|
+
y3: number
|
|
92
|
+
): SkPathBuilder;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Relative version of cubicTo.
|
|
96
|
+
*/
|
|
97
|
+
rCubicTo(
|
|
98
|
+
x1: number,
|
|
99
|
+
y1: number,
|
|
100
|
+
x2: number,
|
|
101
|
+
y2: number,
|
|
102
|
+
x3: number,
|
|
103
|
+
y3: number
|
|
104
|
+
): SkPathBuilder;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Appends CLOSE_VERB to the builder, connecting first and last points.
|
|
108
|
+
*/
|
|
109
|
+
close(): SkPathBuilder;
|
|
110
|
+
|
|
111
|
+
// Arc methods
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Appends arc to the builder. Arc is part of ellipse bounded by oval.
|
|
115
|
+
* @param oval - bounds of ellipse containing arc
|
|
116
|
+
* @param startAngleInDegrees - starting angle of arc in degrees
|
|
117
|
+
* @param sweepAngleInDegrees - sweep, in degrees. Positive is clockwise
|
|
118
|
+
* @param forceMoveTo - true to start a new contour with arc
|
|
119
|
+
*/
|
|
120
|
+
arcToOval(
|
|
121
|
+
oval: SkRect,
|
|
122
|
+
startAngleInDegrees: number,
|
|
123
|
+
sweepAngleInDegrees: number,
|
|
124
|
+
forceMoveTo: boolean
|
|
125
|
+
): SkPathBuilder;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Appends arc to the builder with SVG-style parameters.
|
|
129
|
+
* @param rx - x-radius of ellipse
|
|
130
|
+
* @param ry - y-radius of ellipse
|
|
131
|
+
* @param xAxisRotateInDegrees - rotation of ellipse
|
|
132
|
+
* @param useSmallArc - if true, use smaller of two arcs
|
|
133
|
+
* @param isCCW - if true, arc sweeps counter-clockwise
|
|
134
|
+
* @param x - end point x
|
|
135
|
+
* @param y - end point y
|
|
136
|
+
*/
|
|
137
|
+
arcToRotated(
|
|
138
|
+
rx: number,
|
|
139
|
+
ry: number,
|
|
140
|
+
xAxisRotateInDegrees: number,
|
|
141
|
+
useSmallArc: boolean,
|
|
142
|
+
isCCW: boolean,
|
|
143
|
+
x: number,
|
|
144
|
+
y: number
|
|
145
|
+
): SkPathBuilder;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Relative version of arcToRotated.
|
|
149
|
+
*/
|
|
150
|
+
rArcTo(
|
|
151
|
+
rx: number,
|
|
152
|
+
ry: number,
|
|
153
|
+
xAxisRotateInDegrees: number,
|
|
154
|
+
useSmallArc: boolean,
|
|
155
|
+
isCCW: boolean,
|
|
156
|
+
dx: number,
|
|
157
|
+
dy: number
|
|
158
|
+
): SkPathBuilder;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Appends arc to the builder, tangent to two lines.
|
|
162
|
+
* @param x1 - x of first tangent point
|
|
163
|
+
* @param y1 - y of first tangent point
|
|
164
|
+
* @param x2 - x of second tangent point
|
|
165
|
+
* @param y2 - y of second tangent point
|
|
166
|
+
* @param radius - arc radius
|
|
167
|
+
*/
|
|
168
|
+
arcToTangent(
|
|
169
|
+
x1: number,
|
|
170
|
+
y1: number,
|
|
171
|
+
x2: number,
|
|
172
|
+
y2: number,
|
|
173
|
+
radius: number
|
|
174
|
+
): SkPathBuilder;
|
|
175
|
+
|
|
176
|
+
// Shape methods
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Adds Rect to the builder.
|
|
180
|
+
* @param rect - rectangle to add
|
|
181
|
+
* @param isCCW - if true, draws counter-clockwise
|
|
182
|
+
*/
|
|
183
|
+
addRect(rect: SkRect, isCCW?: boolean): SkPathBuilder;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Adds oval to the builder.
|
|
187
|
+
* @param oval - bounds of ellipse
|
|
188
|
+
* @param isCCW - if true, draws counter-clockwise
|
|
189
|
+
* @param startIndex - index of initial point
|
|
190
|
+
*/
|
|
191
|
+
addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): SkPathBuilder;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Appends arc to the builder as a new contour.
|
|
195
|
+
* @param oval - bounds of ellipse
|
|
196
|
+
* @param startAngleInDegrees - starting angle
|
|
197
|
+
* @param sweepAngleInDegrees - sweep angle
|
|
198
|
+
*/
|
|
199
|
+
addArc(
|
|
200
|
+
oval: SkRect,
|
|
201
|
+
startAngleInDegrees: number,
|
|
202
|
+
sweepAngleInDegrees: number
|
|
203
|
+
): SkPathBuilder;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Adds rounded rectangle to the builder.
|
|
207
|
+
* @param rrect - rounded rectangle to add
|
|
208
|
+
* @param isCCW - if true, draws counter-clockwise
|
|
209
|
+
*/
|
|
210
|
+
addRRect(rrect: InputRRect, isCCW?: boolean): SkPathBuilder;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Adds circle to the builder.
|
|
214
|
+
* @param x - center x
|
|
215
|
+
* @param y - center y
|
|
216
|
+
* @param r - radius
|
|
217
|
+
* @param isCCW - if true, draws counter-clockwise
|
|
218
|
+
*/
|
|
219
|
+
addCircle(x: number, y: number, r: number, isCCW?: boolean): SkPathBuilder;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Adds polygon to the builder from array of points.
|
|
223
|
+
* @param points - array of points
|
|
224
|
+
* @param close - if true, close the polygon
|
|
225
|
+
*/
|
|
226
|
+
addPoly(points: SkPoint[], close: boolean): SkPathBuilder;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Adds the path to the builder.
|
|
230
|
+
* @param src - path to add
|
|
231
|
+
* @param matrix - optional transform matrix
|
|
232
|
+
* @param extend - if true, extend rather than append
|
|
233
|
+
*/
|
|
234
|
+
addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): SkPathBuilder;
|
|
235
|
+
|
|
236
|
+
// Configuration methods
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Sets the fill type for the path.
|
|
240
|
+
* @param fill - fill type to set
|
|
241
|
+
*/
|
|
242
|
+
setFillType(fill: FillType): SkPathBuilder;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Sets whether the path is volatile (temporary/animating).
|
|
246
|
+
* @param isVolatile - true if path will be altered frequently
|
|
247
|
+
*/
|
|
248
|
+
setIsVolatile(isVolatile: boolean): SkPathBuilder;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Resets the builder to empty state.
|
|
252
|
+
*/
|
|
253
|
+
reset(): SkPathBuilder;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Translates all points in the builder.
|
|
257
|
+
* @param dx - translation in x
|
|
258
|
+
* @param dy - translation in y
|
|
259
|
+
*/
|
|
260
|
+
offset(dx: number, dy: number): SkPathBuilder;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Transforms all points in the builder by the matrix.
|
|
264
|
+
* @param m - transformation matrix
|
|
265
|
+
*/
|
|
266
|
+
transform(m: InputMatrix): SkPathBuilder;
|
|
267
|
+
|
|
268
|
+
// Query methods
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Returns the bounds of the path being built.
|
|
272
|
+
*/
|
|
273
|
+
computeBounds(): SkRect;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Returns true if the builder has no verbs.
|
|
277
|
+
*/
|
|
278
|
+
isEmpty(): boolean;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Returns the last point added to the builder.
|
|
282
|
+
*/
|
|
283
|
+
getLastPt(): { x: number; y: number };
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Returns the number of points in the builder.
|
|
287
|
+
*/
|
|
288
|
+
countPoints(): number;
|
|
289
|
+
|
|
290
|
+
// Build methods
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Returns a new SkPath with the current builder state.
|
|
294
|
+
* The builder is NOT reset and can continue to be used.
|
|
295
|
+
*/
|
|
296
|
+
build(): SkPath;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Returns a new SkPath with the current builder state and resets the builder.
|
|
300
|
+
* More efficient than build() when you're done with this builder.
|
|
301
|
+
*/
|
|
302
|
+
detach(): SkPath;
|
|
303
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SkPath } from "./Path";
|
|
2
|
+
import type { SkPathBuilder } from "./PathBuilder";
|
|
3
|
+
|
|
4
|
+
export interface PathBuilderFactory {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new empty PathBuilder.
|
|
7
|
+
*/
|
|
8
|
+
Make(): SkPathBuilder;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new PathBuilder initialized with the given path's contents.
|
|
12
|
+
* @param path - path to copy into the builder
|
|
13
|
+
*/
|
|
14
|
+
MakeFromPath(path: SkPath): SkPathBuilder;
|
|
15
|
+
}
|