@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
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { SkFont } from "../Font";
|
|
2
|
+
import type { SkRect } from "../Rect";
|
|
3
|
+
import type { SkPoint } from "../Point";
|
|
4
|
+
import type { InputRRect } from "../RRect";
|
|
2
5
|
|
|
3
|
-
import type { SkPath, PathOp, PathCommand } from "./Path";
|
|
6
|
+
import type { SkPath, PathOp, PathCommand, StrokeOpts } from "./Path";
|
|
4
7
|
|
|
5
8
|
export interface PathFactory {
|
|
6
9
|
Make(): SkPath;
|
|
@@ -31,4 +34,108 @@ export interface PathFactory {
|
|
|
31
34
|
* Converts the text to a path with the given font at location x / y.
|
|
32
35
|
*/
|
|
33
36
|
MakeFromText(text: string, x: number, y: number, font: SkFont): SkPath | null;
|
|
37
|
+
|
|
38
|
+
// Static shape factories
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates a path containing a rectangle.
|
|
42
|
+
* @param rect - the rectangle
|
|
43
|
+
* @param isCCW - if true, draws counter-clockwise
|
|
44
|
+
*/
|
|
45
|
+
Rect(rect: SkRect, isCCW?: boolean): SkPath;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates a path containing an oval (ellipse).
|
|
49
|
+
* @param rect - bounds of the oval
|
|
50
|
+
* @param isCCW - if true, draws counter-clockwise
|
|
51
|
+
* @param startIndex - index of initial point
|
|
52
|
+
*/
|
|
53
|
+
Oval(rect: SkRect, isCCW?: boolean, startIndex?: number): SkPath;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Creates a path containing a circle.
|
|
57
|
+
* @param x - center x
|
|
58
|
+
* @param y - center y
|
|
59
|
+
* @param r - radius
|
|
60
|
+
*/
|
|
61
|
+
Circle(x: number, y: number, r: number): SkPath;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Creates a path containing a rounded rectangle.
|
|
65
|
+
* @param rrect - the rounded rectangle
|
|
66
|
+
* @param isCCW - if true, draws counter-clockwise
|
|
67
|
+
*/
|
|
68
|
+
RRect(rrect: InputRRect, isCCW?: boolean): SkPath;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Creates a path containing a line segment.
|
|
72
|
+
* @param p1 - start point
|
|
73
|
+
* @param p2 - end point
|
|
74
|
+
*/
|
|
75
|
+
Line(p1: SkPoint, p2: SkPoint): SkPath;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Creates a path containing a polygon from the given points.
|
|
79
|
+
* @param points - array of points
|
|
80
|
+
* @param close - if true, close the polygon
|
|
81
|
+
*/
|
|
82
|
+
Polygon(points: SkPoint[], close: boolean): SkPath;
|
|
83
|
+
|
|
84
|
+
// Static path operations
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Creates a new stroked path from the input path.
|
|
88
|
+
* @param path - source path to stroke
|
|
89
|
+
* @param opts - stroke options (width, cap, join, miter_limit, precision)
|
|
90
|
+
* @returns stroked path or null if operation fails
|
|
91
|
+
*/
|
|
92
|
+
Stroke(path: SkPath, opts?: StrokeOpts): SkPath | null;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Creates a trimmed path from the input path.
|
|
96
|
+
* @param path - source path
|
|
97
|
+
* @param start - start of trim (0-1)
|
|
98
|
+
* @param end - end of trim (0-1)
|
|
99
|
+
* @param isComplement - if true, returns the complement
|
|
100
|
+
* @returns trimmed path or null if operation fails
|
|
101
|
+
*/
|
|
102
|
+
Trim(
|
|
103
|
+
path: SkPath,
|
|
104
|
+
start: number,
|
|
105
|
+
end: number,
|
|
106
|
+
isComplement: boolean
|
|
107
|
+
): SkPath | null;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Simplifies the path to non-overlapping contours.
|
|
111
|
+
* @param path - source path
|
|
112
|
+
* @returns simplified path or null if operation fails
|
|
113
|
+
*/
|
|
114
|
+
Simplify(path: SkPath): SkPath | null;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Creates a dashed version of the path.
|
|
118
|
+
* @param path - source path
|
|
119
|
+
* @param on - length of dash
|
|
120
|
+
* @param off - length of gap
|
|
121
|
+
* @param phase - offset into dash pattern
|
|
122
|
+
* @returns dashed path or null if operation fails
|
|
123
|
+
*/
|
|
124
|
+
Dash(path: SkPath, on: number, off: number, phase: number): SkPath | null;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Creates a path with Winding fill type.
|
|
128
|
+
* @param path - source path
|
|
129
|
+
* @returns path with winding fill or null if operation fails
|
|
130
|
+
*/
|
|
131
|
+
AsWinding(path: SkPath): SkPath | null;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Interpolates between two paths.
|
|
135
|
+
* @param start - starting path
|
|
136
|
+
* @param end - ending path
|
|
137
|
+
* @param weight - interpolation weight (0 = start, 1 = end)
|
|
138
|
+
* @returns interpolated path or null if paths are not interpolatable
|
|
139
|
+
*/
|
|
140
|
+
Interpolate(start: SkPath, end: SkPath, weight: number): SkPath | null;
|
|
34
141
|
}
|
package/src/skia/types/Skia.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ImageFilterFactory } from "./ImageFilter";
|
|
2
|
-
import type { PathFactory } from "./Path";
|
|
2
|
+
import type { PathFactory, PathBuilderFactory } from "./Path";
|
|
3
3
|
import type { ColorFilterFactory } from "./ColorFilter";
|
|
4
4
|
import type { SkFont, FontMgrFactory } from "./Font";
|
|
5
5
|
import type { SkTypeface, TypefaceFactory } from "./Typeface";
|
|
@@ -67,6 +67,7 @@ export interface Skia {
|
|
|
67
67
|
PictureRecorder: () => SkPictureRecorder;
|
|
68
68
|
Picture: PictureFactory;
|
|
69
69
|
Path: PathFactory;
|
|
70
|
+
PathBuilder: PathBuilderFactory;
|
|
70
71
|
Matrix: (matrix?: readonly number[]) => SkMatrix;
|
|
71
72
|
ColorFilter: ColorFilterFactory;
|
|
72
73
|
Font: (typeface?: SkTypeface, size?: number) => SkFont;
|
package/src/skia/web/Host.ts
CHANGED
|
@@ -64,7 +64,13 @@ export const getEnum = (
|
|
|
64
64
|
if (typeof e !== "function") {
|
|
65
65
|
throw new Error(`${name} is not an number`);
|
|
66
66
|
}
|
|
67
|
-
const result = Object.values(e).find(
|
|
67
|
+
const result = Object.values(e).find(
|
|
68
|
+
(entry) =>
|
|
69
|
+
entry !== null &&
|
|
70
|
+
typeof entry === "object" &&
|
|
71
|
+
"value" in entry &&
|
|
72
|
+
entry.value === v
|
|
73
|
+
);
|
|
68
74
|
if (!result) {
|
|
69
75
|
throw new Error(
|
|
70
76
|
`Enum ${name} does not have value ${v} on React Native Web`
|
|
@@ -272,7 +272,9 @@ export class JsiSkCanvas
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
drawPath(path: SkPath, paint: SkPaint) {
|
|
275
|
-
|
|
275
|
+
const p = JsiSkPath.pathFromValue(path);
|
|
276
|
+
this.ref.drawPath(p, JsiSkPaint.fromValue(paint));
|
|
277
|
+
p.delete();
|
|
276
278
|
}
|
|
277
279
|
|
|
278
280
|
drawText(str: string, x: number, y: number, paint: SkPaint, font: SkFont) {
|
|
@@ -369,11 +371,9 @@ export class JsiSkCanvas
|
|
|
369
371
|
}
|
|
370
372
|
|
|
371
373
|
clipPath(path: SkPath, op: ClipOp, doAntiAlias: boolean) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
doAntiAlias
|
|
376
|
-
);
|
|
374
|
+
const p = JsiSkPath.pathFromValue(path);
|
|
375
|
+
this.ref.clipPath(p, getEnum(this.CanvasKit, "PathOp", op), doAntiAlias);
|
|
376
|
+
p.delete();
|
|
377
377
|
}
|
|
378
378
|
|
|
379
379
|
clipRect(rect: SkRect, op: ClipOp, doAntiAlias: boolean) {
|
|
@@ -23,10 +23,10 @@ export class JsiSkContourMeasure
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
getSegment(startD: number, stopD: number, startWithMoveTo: boolean) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
26
|
+
const segment = this.ref.getSegment(startD, stopD, startWithMoveTo);
|
|
27
|
+
const builder = new this.CanvasKit.PathBuilder(segment);
|
|
28
|
+
segment.delete();
|
|
29
|
+
return new JsiSkPath(this.CanvasKit, builder);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
isClosed() {
|