@shopify/react-native-skia 2.5.5 → 2.6.0
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/cpp/api/CustomBlendModes.h +1 -0
- package/cpp/api/JsiSkApi.h +4 -0
- package/cpp/api/JsiSkCanvas.h +2 -2
- package/cpp/api/JsiSkContourMeasureIter.h +1 -1
- package/cpp/api/JsiSkPath.h +483 -355
- package/cpp/api/JsiSkPathBuilder.h +415 -0
- package/cpp/api/JsiSkPathBuilderFactory.h +53 -0
- package/cpp/api/JsiSkPathEffectFactory.h +2 -2
- package/cpp/api/JsiSkPathFactory.h +274 -3
- package/cpp/api/recorder/DataTypes.h +1 -1
- package/cpp/api/recorder/Drawings.h +6 -2
- package/cpp/rnskia/RNDawnContext.h +21 -0
- package/cpp/rnskia/RNDawnUtils.h +115 -113
- 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 +3 -2
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CanvasKit,
|
|
1
|
+
import type { CanvasKit, PathBuilder as CKPathBuilder } from "canvaskit-wasm";
|
|
2
2
|
|
|
3
3
|
import { PathVerb } from "../types";
|
|
4
4
|
import type {
|
|
@@ -29,20 +29,84 @@ const CommandCount = {
|
|
|
29
29
|
[PathVerb.Close]: 1,
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
// Track which deprecation warnings have been shown to avoid spam
|
|
33
|
+
const shownDeprecationWarnings = new Set<string>();
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const warnDeprecatedPathMethod = (
|
|
36
|
+
methodName: string,
|
|
37
|
+
suggestion: string
|
|
38
|
+
): void => {
|
|
39
|
+
if (shownDeprecationWarnings.has(methodName)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
shownDeprecationWarnings.add(methodName);
|
|
43
|
+
console.warn(
|
|
44
|
+
`[react-native-skia] SkPath.${methodName}() is deprecated and will be removed in a future release. ${suggestion} See migration guide: https://shopify.github.io/react-native-skia/docs/shapes/path-migration`
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const toMatrix3x3 = (m: InputMatrix): number[] => {
|
|
49
|
+
let matrix =
|
|
50
|
+
m instanceof JsiSkMatrix
|
|
51
|
+
? Array.from(JsiSkMatrix.fromValue<Float32Array>(m))
|
|
52
|
+
: (m as Exclude<InputMatrix, SkMatrix>);
|
|
53
|
+
if (matrix.length === 16) {
|
|
54
|
+
matrix = [
|
|
55
|
+
matrix[0],
|
|
56
|
+
matrix[1],
|
|
57
|
+
matrix[3],
|
|
58
|
+
matrix[4],
|
|
59
|
+
matrix[5],
|
|
60
|
+
matrix[7],
|
|
61
|
+
matrix[12],
|
|
62
|
+
matrix[13],
|
|
63
|
+
matrix[15],
|
|
64
|
+
];
|
|
65
|
+
} else if (matrix.length !== 9) {
|
|
66
|
+
throw new Error(`Invalid matrix length: ${matrix.length}`);
|
|
67
|
+
}
|
|
68
|
+
return matrix as number[];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* SkPath wraps a CK PathBuilder internally, providing both mutable building
|
|
73
|
+
* methods and immutable query methods. Use snapshot() internally to get
|
|
74
|
+
* an immutable CK Path for read-only operations.
|
|
75
|
+
*/
|
|
76
|
+
export class JsiSkPath
|
|
77
|
+
extends HostObject<CKPathBuilder, "Path">
|
|
78
|
+
implements SkPath
|
|
79
|
+
{
|
|
80
|
+
constructor(CanvasKit: CanvasKit, ref: CKPathBuilder) {
|
|
36
81
|
super(CanvasKit, ref, "Path");
|
|
37
82
|
}
|
|
38
83
|
|
|
84
|
+
/** Returns an immutable CK Path snapshot for read-only operations. */
|
|
85
|
+
private asPath() {
|
|
86
|
+
return this.ref.snapshot();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Extract an immutable CK Path from a JsiSkPath value (for CK interop). */
|
|
90
|
+
static pathFromValue(value: SkPath) {
|
|
91
|
+
return JsiSkPath.fromValue<CKPathBuilder>(value).snapshot();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ---- Mutable building methods (deprecated) ----
|
|
95
|
+
|
|
39
96
|
addPath(src: SkPath, matrix?: SkMatrix, extend = false) {
|
|
97
|
+
warnDeprecatedPathMethod(
|
|
98
|
+
"addPath",
|
|
99
|
+
"Use Skia.PathBuilder.Make().addPath() instead."
|
|
100
|
+
);
|
|
101
|
+
const srcBuilder = JsiSkPath.fromValue<CKPathBuilder>(src);
|
|
102
|
+
const srcPath = srcBuilder.snapshot();
|
|
40
103
|
const args = [
|
|
41
|
-
|
|
104
|
+
srcPath,
|
|
42
105
|
...(matrix ? JsiSkMatrix.fromValue<Float32Array>(matrix) : []),
|
|
43
106
|
extend,
|
|
44
107
|
];
|
|
45
108
|
this.ref.addPath(...args);
|
|
109
|
+
srcPath.delete();
|
|
46
110
|
return this;
|
|
47
111
|
}
|
|
48
112
|
|
|
@@ -51,6 +115,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
51
115
|
startAngleInDegrees: number,
|
|
52
116
|
sweepAngleInDegrees: number
|
|
53
117
|
) {
|
|
118
|
+
warnDeprecatedPathMethod(
|
|
119
|
+
"addArc",
|
|
120
|
+
"Use Skia.PathBuilder.Make().addArc() instead."
|
|
121
|
+
);
|
|
54
122
|
this.ref.addArc(
|
|
55
123
|
JsiSkRect.fromValue(this.CanvasKit, oval),
|
|
56
124
|
startAngleInDegrees,
|
|
@@ -60,6 +128,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
60
128
|
}
|
|
61
129
|
|
|
62
130
|
addOval(oval: SkRect, isCCW?: boolean, startIndex?: number) {
|
|
131
|
+
warnDeprecatedPathMethod(
|
|
132
|
+
"addOval",
|
|
133
|
+
"Use Skia.Path.Oval() or Skia.PathBuilder.Make().addOval() instead."
|
|
134
|
+
);
|
|
63
135
|
this.ref.addOval(
|
|
64
136
|
JsiSkRect.fromValue(this.CanvasKit, oval),
|
|
65
137
|
isCCW,
|
|
@@ -68,126 +140,183 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
68
140
|
return this;
|
|
69
141
|
}
|
|
70
142
|
|
|
71
|
-
countPoints() {
|
|
72
|
-
return this.ref.countPoints();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
143
|
addPoly(points: SkPoint[], close: boolean) {
|
|
76
|
-
|
|
144
|
+
warnDeprecatedPathMethod(
|
|
145
|
+
"addPoly",
|
|
146
|
+
"Use Skia.Path.Polygon() or Skia.PathBuilder.Make().addPoly() instead."
|
|
147
|
+
);
|
|
148
|
+
this.ref.addPolygon(
|
|
77
149
|
points.map((p) => Array.from(JsiSkPoint.fromValue(p))).flat(),
|
|
78
150
|
close
|
|
79
151
|
);
|
|
80
152
|
return this;
|
|
81
153
|
}
|
|
82
154
|
|
|
83
|
-
|
|
84
|
-
|
|
155
|
+
addRect(rect: SkRect, isCCW?: boolean) {
|
|
156
|
+
warnDeprecatedPathMethod(
|
|
157
|
+
"addRect",
|
|
158
|
+
"Use Skia.Path.Rect() or Skia.PathBuilder.Make().addRect() instead."
|
|
159
|
+
);
|
|
160
|
+
this.ref.addRect(JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);
|
|
85
161
|
return this;
|
|
86
162
|
}
|
|
87
163
|
|
|
88
|
-
|
|
89
|
-
|
|
164
|
+
addRRect(rrect: InputRRect, isCCW?: boolean) {
|
|
165
|
+
warnDeprecatedPathMethod(
|
|
166
|
+
"addRRect",
|
|
167
|
+
"Use Skia.Path.RRect() or Skia.PathBuilder.Make().addRRect() instead."
|
|
168
|
+
);
|
|
169
|
+
this.ref.addRRect(JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);
|
|
90
170
|
return this;
|
|
91
171
|
}
|
|
92
172
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
this.ref.offset(dx, dy);
|
|
173
|
+
addCircle(x: number, y: number, r: number) {
|
|
174
|
+
warnDeprecatedPathMethod(
|
|
175
|
+
"addCircle",
|
|
176
|
+
"Use Skia.Path.Circle() or Skia.PathBuilder.Make().addCircle() instead."
|
|
177
|
+
);
|
|
178
|
+
this.ref.addCircle(x, y, r);
|
|
100
179
|
return this;
|
|
101
180
|
}
|
|
102
181
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
dx: number,
|
|
110
|
-
dy: number
|
|
111
|
-
) {
|
|
112
|
-
this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);
|
|
182
|
+
moveTo(x: number, y: number) {
|
|
183
|
+
warnDeprecatedPathMethod(
|
|
184
|
+
"moveTo",
|
|
185
|
+
"Use Skia.PathBuilder.Make().moveTo() instead."
|
|
186
|
+
);
|
|
187
|
+
this.ref.moveTo(x, y);
|
|
113
188
|
return this;
|
|
114
189
|
}
|
|
115
190
|
|
|
116
|
-
|
|
117
|
-
|
|
191
|
+
rMoveTo(x: number, y: number) {
|
|
192
|
+
warnDeprecatedPathMethod(
|
|
193
|
+
"rMoveTo",
|
|
194
|
+
"Use Skia.PathBuilder.Make().rMoveTo() instead."
|
|
195
|
+
);
|
|
196
|
+
this.ref.rMoveTo(x, y);
|
|
118
197
|
return this;
|
|
119
198
|
}
|
|
120
199
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
x
|
|
127
|
-
y: number
|
|
128
|
-
) {
|
|
129
|
-
this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);
|
|
200
|
+
lineTo(x: number, y: number) {
|
|
201
|
+
warnDeprecatedPathMethod(
|
|
202
|
+
"lineTo",
|
|
203
|
+
"Use Skia.PathBuilder.Make().lineTo() instead."
|
|
204
|
+
);
|
|
205
|
+
this.ref.lineTo(x, y);
|
|
130
206
|
return this;
|
|
131
207
|
}
|
|
132
208
|
|
|
133
|
-
|
|
134
|
-
|
|
209
|
+
rLineTo(x: number, y: number) {
|
|
210
|
+
warnDeprecatedPathMethod(
|
|
211
|
+
"rLineTo",
|
|
212
|
+
"Use Skia.PathBuilder.Make().rLineTo() instead."
|
|
213
|
+
);
|
|
214
|
+
this.ref.rLineTo(x, y);
|
|
135
215
|
return this;
|
|
136
216
|
}
|
|
137
217
|
|
|
138
|
-
|
|
139
|
-
|
|
218
|
+
quadTo(x1: number, y1: number, x2: number, y2: number) {
|
|
219
|
+
warnDeprecatedPathMethod(
|
|
220
|
+
"quadTo",
|
|
221
|
+
"Use Skia.PathBuilder.Make().quadTo() instead."
|
|
222
|
+
);
|
|
223
|
+
this.ref.quadTo(x1, y1, x2, y2);
|
|
140
224
|
return this;
|
|
141
225
|
}
|
|
142
226
|
|
|
143
227
|
rQuadTo(x1: number, y1: number, x2: number, y2: number) {
|
|
228
|
+
warnDeprecatedPathMethod(
|
|
229
|
+
"rQuadTo",
|
|
230
|
+
"Use Skia.PathBuilder.Make().rQuadTo() instead."
|
|
231
|
+
);
|
|
144
232
|
this.ref.rQuadTo(x1, y1, x2, y2);
|
|
145
233
|
return this;
|
|
146
234
|
}
|
|
147
235
|
|
|
148
|
-
|
|
149
|
-
|
|
236
|
+
conicTo(x1: number, y1: number, x2: number, y2: number, w: number) {
|
|
237
|
+
warnDeprecatedPathMethod(
|
|
238
|
+
"conicTo",
|
|
239
|
+
"Use Skia.PathBuilder.Make().conicTo() instead."
|
|
240
|
+
);
|
|
241
|
+
this.ref.conicTo(x1, y1, x2, y2, w);
|
|
150
242
|
return this;
|
|
151
243
|
}
|
|
152
244
|
|
|
153
|
-
|
|
154
|
-
|
|
245
|
+
rConicTo(x1: number, y1: number, x2: number, y2: number, w: number) {
|
|
246
|
+
warnDeprecatedPathMethod(
|
|
247
|
+
"rConicTo",
|
|
248
|
+
"Use Skia.PathBuilder.Make().rConicTo() instead."
|
|
249
|
+
);
|
|
250
|
+
this.ref.rConicTo(x1, y1, x2, y2, w);
|
|
155
251
|
return this;
|
|
156
252
|
}
|
|
157
253
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
254
|
+
cubicTo(
|
|
255
|
+
cpx1: number,
|
|
256
|
+
cpy1: number,
|
|
257
|
+
cpx2: number,
|
|
258
|
+
cpy2: number,
|
|
259
|
+
x: number,
|
|
260
|
+
y: number
|
|
261
|
+
) {
|
|
262
|
+
warnDeprecatedPathMethod(
|
|
263
|
+
"cubicTo",
|
|
264
|
+
"Use Skia.PathBuilder.Make().cubicTo() instead."
|
|
170
265
|
);
|
|
171
|
-
|
|
266
|
+
this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);
|
|
267
|
+
return this;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
rCubicTo(
|
|
271
|
+
cpx1: number,
|
|
272
|
+
cpy1: number,
|
|
273
|
+
cpx2: number,
|
|
274
|
+
cpy2: number,
|
|
275
|
+
x: number,
|
|
276
|
+
y: number
|
|
277
|
+
) {
|
|
278
|
+
warnDeprecatedPathMethod(
|
|
279
|
+
"rCubicTo",
|
|
280
|
+
"Use Skia.PathBuilder.Make().rCubicTo() instead."
|
|
281
|
+
);
|
|
282
|
+
this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);
|
|
283
|
+
return this;
|
|
172
284
|
}
|
|
173
285
|
|
|
174
286
|
close() {
|
|
287
|
+
warnDeprecatedPathMethod(
|
|
288
|
+
"close",
|
|
289
|
+
"Use Skia.PathBuilder.Make().close() instead."
|
|
290
|
+
);
|
|
175
291
|
this.ref.close();
|
|
176
292
|
return this;
|
|
177
293
|
}
|
|
178
294
|
|
|
179
295
|
reset() {
|
|
180
|
-
|
|
296
|
+
warnDeprecatedPathMethod(
|
|
297
|
+
"reset",
|
|
298
|
+
"Use Skia.PathBuilder.Make().reset() instead."
|
|
299
|
+
);
|
|
300
|
+
// CK PathBuilder has no reset — recreate
|
|
301
|
+
const newBuilder = new this.CanvasKit.PathBuilder();
|
|
302
|
+
if (
|
|
303
|
+
this.ref !== null &&
|
|
304
|
+
typeof this.ref === "object" &&
|
|
305
|
+
"delete" in this.ref &&
|
|
306
|
+
typeof this.ref.delete === "function"
|
|
307
|
+
) {
|
|
308
|
+
this.ref.delete();
|
|
309
|
+
}
|
|
310
|
+
this.ref = newBuilder;
|
|
181
311
|
return this;
|
|
182
312
|
}
|
|
183
313
|
|
|
184
314
|
rewind() {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return new JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());
|
|
315
|
+
warnDeprecatedPathMethod(
|
|
316
|
+
"rewind",
|
|
317
|
+
"Use Skia.PathBuilder.Make().reset() instead."
|
|
318
|
+
);
|
|
319
|
+
return this.reset();
|
|
191
320
|
}
|
|
192
321
|
|
|
193
322
|
arcToOval(
|
|
@@ -196,6 +325,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
196
325
|
sweepAngleInDegrees: number,
|
|
197
326
|
forceMoveTo: boolean
|
|
198
327
|
) {
|
|
328
|
+
warnDeprecatedPathMethod(
|
|
329
|
+
"arcToOval",
|
|
330
|
+
"Use Skia.PathBuilder.Make().arcToOval() instead."
|
|
331
|
+
);
|
|
199
332
|
this.ref.arcToOval(
|
|
200
333
|
JsiSkRect.fromValue(this.CanvasKit, oval),
|
|
201
334
|
startAngleInDegrees,
|
|
@@ -214,6 +347,10 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
214
347
|
x: number,
|
|
215
348
|
y: number
|
|
216
349
|
) {
|
|
350
|
+
warnDeprecatedPathMethod(
|
|
351
|
+
"arcToRotated",
|
|
352
|
+
"Use Skia.PathBuilder.Make().arcToRotated() instead."
|
|
353
|
+
);
|
|
217
354
|
this.ref.arcToRotated(
|
|
218
355
|
rx,
|
|
219
356
|
ry,
|
|
@@ -226,166 +363,312 @@ export class JsiSkPath extends HostObject<Path, "Path"> implements SkPath {
|
|
|
226
363
|
return this;
|
|
227
364
|
}
|
|
228
365
|
|
|
366
|
+
rArcTo(
|
|
367
|
+
rx: number,
|
|
368
|
+
ry: number,
|
|
369
|
+
xAxisRotateInDegrees: number,
|
|
370
|
+
useSmallArc: boolean,
|
|
371
|
+
isCCW: boolean,
|
|
372
|
+
dx: number,
|
|
373
|
+
dy: number
|
|
374
|
+
) {
|
|
375
|
+
warnDeprecatedPathMethod(
|
|
376
|
+
"rArcTo",
|
|
377
|
+
"Use Skia.PathBuilder.Make().rArcTo() instead."
|
|
378
|
+
);
|
|
379
|
+
this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);
|
|
380
|
+
return this;
|
|
381
|
+
}
|
|
382
|
+
|
|
229
383
|
arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number) {
|
|
384
|
+
warnDeprecatedPathMethod(
|
|
385
|
+
"arcToTangent",
|
|
386
|
+
"Use Skia.PathBuilder.Make().arcToTangent() instead."
|
|
387
|
+
);
|
|
230
388
|
this.ref.arcToTangent(x1, y1, x2, y2, radius);
|
|
231
389
|
return this;
|
|
232
390
|
}
|
|
233
391
|
|
|
234
|
-
|
|
235
|
-
|
|
392
|
+
setFillType(fill: FillType) {
|
|
393
|
+
warnDeprecatedPathMethod(
|
|
394
|
+
"setFillType",
|
|
395
|
+
"Use Skia.PathBuilder.Make().setFillType() instead."
|
|
396
|
+
);
|
|
397
|
+
this.ref.setFillType(getEnum(this.CanvasKit, "FillType", fill));
|
|
236
398
|
return this;
|
|
237
399
|
}
|
|
238
400
|
|
|
239
|
-
|
|
240
|
-
|
|
401
|
+
setIsVolatile(_volatile: boolean) {
|
|
402
|
+
warnDeprecatedPathMethod(
|
|
403
|
+
"setIsVolatile",
|
|
404
|
+
"Use Skia.PathBuilder.Make().setIsVolatile() instead."
|
|
405
|
+
);
|
|
406
|
+
// Not supported in CK PathBuilder — no-op
|
|
407
|
+
return this;
|
|
241
408
|
}
|
|
242
409
|
|
|
243
|
-
|
|
244
|
-
return new JsiSkPath(this.CanvasKit, this.ref.copy());
|
|
245
|
-
}
|
|
410
|
+
// ---- Mutable path operations (deprecated) ----
|
|
246
411
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
y: number
|
|
254
|
-
) {
|
|
255
|
-
this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);
|
|
412
|
+
offset(dx: number, dy: number) {
|
|
413
|
+
warnDeprecatedPathMethod(
|
|
414
|
+
"offset",
|
|
415
|
+
"Use Skia.PathBuilder.Make().offset() instead."
|
|
416
|
+
);
|
|
417
|
+
this.ref.offset(dx, dy);
|
|
256
418
|
return this;
|
|
257
419
|
}
|
|
258
420
|
|
|
259
|
-
|
|
260
|
-
|
|
421
|
+
transform(m: InputMatrix) {
|
|
422
|
+
warnDeprecatedPathMethod(
|
|
423
|
+
"transform",
|
|
424
|
+
"Use Skia.PathBuilder.Make().transform() instead."
|
|
425
|
+
);
|
|
426
|
+
const matrix = toMatrix3x3(m);
|
|
427
|
+
this.ref.transform(matrix);
|
|
428
|
+
return this;
|
|
261
429
|
}
|
|
262
430
|
|
|
263
|
-
|
|
264
|
-
|
|
431
|
+
makeAsWinding() {
|
|
432
|
+
warnDeprecatedPathMethod(
|
|
433
|
+
"makeAsWinding",
|
|
434
|
+
"Use Skia.Path.AsWinding(path) instead."
|
|
435
|
+
);
|
|
436
|
+
const path = this.asPath();
|
|
437
|
+
const result = path.makeAsWinding();
|
|
438
|
+
path.delete();
|
|
439
|
+
if (result === null) {
|
|
440
|
+
return null;
|
|
441
|
+
}
|
|
442
|
+
const old = this.ref;
|
|
443
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
444
|
+
result.delete();
|
|
445
|
+
old.delete();
|
|
446
|
+
return this;
|
|
265
447
|
}
|
|
266
448
|
|
|
267
|
-
|
|
268
|
-
|
|
449
|
+
simplify() {
|
|
450
|
+
warnDeprecatedPathMethod("simplify", "Use Skia.Path.Simplify(path) instead.");
|
|
451
|
+
const path = this.asPath();
|
|
452
|
+
const result = path.makeSimplified();
|
|
453
|
+
path.delete();
|
|
454
|
+
if (result === null) {
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
const old = this.ref;
|
|
458
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
459
|
+
result.delete();
|
|
460
|
+
old.delete();
|
|
461
|
+
return true;
|
|
269
462
|
}
|
|
270
463
|
|
|
271
|
-
|
|
272
|
-
|
|
464
|
+
op(path: SkPath, op: PathOp) {
|
|
465
|
+
warnDeprecatedPathMethod("op", "Use Skia.Path.MakeFromOp() instead.");
|
|
466
|
+
const self = this.asPath();
|
|
467
|
+
const other = JsiSkPath.fromValue<CKPathBuilder>(path).snapshot();
|
|
468
|
+
const result = self.makeCombined(
|
|
469
|
+
other,
|
|
470
|
+
getEnum(this.CanvasKit, "PathOp", op)
|
|
471
|
+
);
|
|
472
|
+
self.delete();
|
|
473
|
+
other.delete();
|
|
474
|
+
if (result === null) {
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
const old = this.ref;
|
|
478
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
479
|
+
result.delete();
|
|
480
|
+
old.delete();
|
|
481
|
+
return true;
|
|
273
482
|
}
|
|
274
483
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
484
|
+
dash(on: number, off: number, phase: number) {
|
|
485
|
+
warnDeprecatedPathMethod(
|
|
486
|
+
"dash",
|
|
487
|
+
"Use Skia.Path.Dash(path, on, off, phase) instead."
|
|
488
|
+
);
|
|
489
|
+
const path = this.asPath();
|
|
490
|
+
const result = path.makeDashed(on, off, phase);
|
|
491
|
+
path.delete();
|
|
492
|
+
if (result === null) {
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
const old = this.ref;
|
|
496
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
497
|
+
result.delete();
|
|
498
|
+
old.delete();
|
|
499
|
+
return true;
|
|
278
500
|
}
|
|
279
501
|
|
|
280
|
-
|
|
281
|
-
|
|
502
|
+
stroke(opts?: StrokeOpts) {
|
|
503
|
+
warnDeprecatedPathMethod("stroke", "Use Skia.Path.Stroke(path, opts) instead.");
|
|
504
|
+
const path = this.asPath();
|
|
505
|
+
const result = path.makeStroked(
|
|
506
|
+
opts === undefined
|
|
507
|
+
? undefined
|
|
508
|
+
: {
|
|
509
|
+
width: opts.width,
|
|
510
|
+
// eslint-disable-next-line camelcase
|
|
511
|
+
miter_limit: opts.miter_limit,
|
|
512
|
+
precision: opts.precision,
|
|
513
|
+
join: optEnum(this.CanvasKit, "StrokeJoin", opts.join),
|
|
514
|
+
cap: optEnum(this.CanvasKit, "StrokeCap", opts.cap),
|
|
515
|
+
}
|
|
516
|
+
);
|
|
517
|
+
path.delete();
|
|
518
|
+
if (result === null) {
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
const old = this.ref;
|
|
522
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
523
|
+
result.delete();
|
|
524
|
+
old.delete();
|
|
282
525
|
return this;
|
|
283
526
|
}
|
|
284
527
|
|
|
285
|
-
|
|
286
|
-
|
|
528
|
+
trim(start: number, stop: number, isComplement: boolean) {
|
|
529
|
+
warnDeprecatedPathMethod(
|
|
530
|
+
"trim",
|
|
531
|
+
"Use Skia.Path.Trim(path, start, end, isComplement) instead."
|
|
532
|
+
);
|
|
533
|
+
const startT = Math.min(Math.max(start, 0), 1);
|
|
534
|
+
const stopT = Math.min(Math.max(stop, 0), 1);
|
|
535
|
+
if (startT === 0 && stopT === 1 && !isComplement) {
|
|
536
|
+
return this;
|
|
537
|
+
}
|
|
538
|
+
const path = this.asPath();
|
|
539
|
+
const result = path.makeTrimmed(startT, stopT, isComplement);
|
|
540
|
+
path.delete();
|
|
541
|
+
if (result === null) {
|
|
542
|
+
return null;
|
|
543
|
+
}
|
|
544
|
+
const old = this.ref;
|
|
545
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
546
|
+
result.delete();
|
|
547
|
+
old.delete();
|
|
287
548
|
return this;
|
|
288
549
|
}
|
|
289
550
|
|
|
290
|
-
|
|
291
|
-
return new JsiSkPoint(this.CanvasKit, this.ref.getPoint(index));
|
|
292
|
-
}
|
|
551
|
+
// ---- Query methods (use snapshot for read-only) ----
|
|
293
552
|
|
|
294
|
-
|
|
295
|
-
return this.ref.
|
|
553
|
+
countPoints() {
|
|
554
|
+
return this.ref.countPoints();
|
|
296
555
|
}
|
|
297
556
|
|
|
298
|
-
|
|
299
|
-
|
|
557
|
+
computeTightBounds(): SkRect {
|
|
558
|
+
const path = this.asPath();
|
|
559
|
+
const result = new JsiSkRect(this.CanvasKit, path.computeTightBounds());
|
|
560
|
+
path.delete();
|
|
561
|
+
return result;
|
|
300
562
|
}
|
|
301
563
|
|
|
302
|
-
|
|
303
|
-
this.
|
|
304
|
-
|
|
564
|
+
contains(x: number, y: number) {
|
|
565
|
+
const path = this.asPath();
|
|
566
|
+
const result = path.contains(x, y);
|
|
567
|
+
path.delete();
|
|
568
|
+
return result;
|
|
305
569
|
}
|
|
306
570
|
|
|
307
|
-
|
|
308
|
-
|
|
571
|
+
copy() {
|
|
572
|
+
const path = this.asPath();
|
|
573
|
+
const result = new JsiSkPath(
|
|
309
574
|
this.CanvasKit,
|
|
310
|
-
this.
|
|
575
|
+
new this.CanvasKit.PathBuilder(path)
|
|
311
576
|
);
|
|
577
|
+
path.delete();
|
|
578
|
+
return result;
|
|
312
579
|
}
|
|
313
580
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
);
|
|
581
|
+
equals(other: SkPath) {
|
|
582
|
+
const p1 = this.asPath();
|
|
583
|
+
const p2 = JsiSkPath.fromValue<CKPathBuilder>(other).snapshot();
|
|
584
|
+
const result = p1.equals(p2);
|
|
585
|
+
p1.delete();
|
|
586
|
+
p2.delete();
|
|
587
|
+
return result;
|
|
319
588
|
}
|
|
320
589
|
|
|
321
|
-
|
|
322
|
-
return this.ref.
|
|
590
|
+
getBounds() {
|
|
591
|
+
return new JsiSkRect(this.CanvasKit, this.ref.getBounds());
|
|
323
592
|
}
|
|
324
593
|
|
|
325
|
-
|
|
326
|
-
|
|
594
|
+
getFillType(): FillType {
|
|
595
|
+
const path = this.asPath();
|
|
596
|
+
const result = path.getFillType().value;
|
|
597
|
+
path.delete();
|
|
598
|
+
return result;
|
|
327
599
|
}
|
|
328
600
|
|
|
329
|
-
|
|
330
|
-
const
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
335
|
-
const result = this.ref.trim(startT, stopT, isComplement);
|
|
336
|
-
return result === null ? result : this;
|
|
601
|
+
getPoint(index: number): SkPoint {
|
|
602
|
+
const path = this.asPath();
|
|
603
|
+
const result = new JsiSkPoint(this.CanvasKit, path.getPoint(index));
|
|
604
|
+
path.delete();
|
|
605
|
+
return result;
|
|
337
606
|
}
|
|
338
607
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
matrix[7],
|
|
352
|
-
matrix[12],
|
|
353
|
-
matrix[13],
|
|
354
|
-
matrix[15],
|
|
355
|
-
];
|
|
356
|
-
} else if (matrix.length !== 9) {
|
|
357
|
-
throw new Error(`Invalid matrix length: ${matrix.length}`);
|
|
608
|
+
isEmpty() {
|
|
609
|
+
return this.ref.isEmpty();
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
isVolatile() {
|
|
613
|
+
return false;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
getLastPt() {
|
|
617
|
+
const count = this.ref.countPoints();
|
|
618
|
+
if (count === 0) {
|
|
619
|
+
return { x: 0, y: 0 };
|
|
358
620
|
}
|
|
359
|
-
this.
|
|
360
|
-
|
|
621
|
+
const path = this.asPath();
|
|
622
|
+
const pt = path.getPoint(count - 1);
|
|
623
|
+
path.delete();
|
|
624
|
+
return { x: pt[0], y: pt[1] };
|
|
361
625
|
}
|
|
362
626
|
|
|
363
|
-
|
|
364
|
-
const path = this.
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
627
|
+
toSVGString() {
|
|
628
|
+
const path = this.asPath();
|
|
629
|
+
const result = path.toSVGString();
|
|
630
|
+
path.delete();
|
|
631
|
+
return result;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
isInterpolatable(path2: SkPath): boolean {
|
|
635
|
+
const p1 = this.asPath();
|
|
636
|
+
const p2 = JsiSkPath.fromValue<CKPathBuilder>(path2).snapshot();
|
|
637
|
+
const result = this.CanvasKit.Path.CanInterpolate(p1, p2);
|
|
638
|
+
p1.delete();
|
|
639
|
+
p2.delete();
|
|
640
|
+
return result;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
interpolate(end: SkPath, weight: number, output?: SkPath): SkPath | null {
|
|
644
|
+
const p1 = this.asPath();
|
|
645
|
+
const p2 = JsiSkPath.fromValue<CKPathBuilder>(end).snapshot();
|
|
646
|
+
const path = this.CanvasKit.Path.MakeFromPathInterpolation(p1, p2, weight);
|
|
647
|
+
p1.delete();
|
|
648
|
+
p2.delete();
|
|
369
649
|
if (path === null) {
|
|
370
650
|
return null;
|
|
371
651
|
}
|
|
372
652
|
if (output) {
|
|
373
|
-
|
|
653
|
+
const outRef = output as JsiSkPath;
|
|
654
|
+
const old = outRef.ref;
|
|
655
|
+
outRef.ref = new this.CanvasKit.PathBuilder(path);
|
|
656
|
+
path.delete();
|
|
657
|
+
old.delete();
|
|
374
658
|
return output;
|
|
375
|
-
} else {
|
|
376
|
-
return new JsiSkPath(this.CanvasKit, path);
|
|
377
659
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
return this.CanvasKit.Path.CanInterpolate(
|
|
382
|
-
this.ref,
|
|
383
|
-
JsiSkPath.fromValue(path2)
|
|
660
|
+
const result = new JsiSkPath(
|
|
661
|
+
this.CanvasKit,
|
|
662
|
+
new this.CanvasKit.PathBuilder(path)
|
|
384
663
|
);
|
|
664
|
+
path.delete();
|
|
665
|
+
return result;
|
|
385
666
|
}
|
|
386
667
|
|
|
387
668
|
toCmds() {
|
|
388
|
-
const
|
|
669
|
+
const path = this.asPath();
|
|
670
|
+
const cmds = path.toCmds();
|
|
671
|
+
path.delete();
|
|
389
672
|
const result = cmds.reduce<PathCommand[]>((acc, cmd, i) => {
|
|
390
673
|
if (i === 0) {
|
|
391
674
|
acc.push([]);
|