@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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.JsiSkPath = void 0;
|
|
6
|
+
exports.toMatrix3x3 = exports.JsiSkPath = void 0;
|
|
7
7
|
var _types = require("../types");
|
|
8
8
|
var _Host = require("./Host");
|
|
9
9
|
var _JsiSkPoint = require("./JsiSkPoint");
|
|
@@ -18,216 +18,407 @@ const CommandCount = {
|
|
|
18
18
|
[_types.PathVerb.Cubic]: 7,
|
|
19
19
|
[_types.PathVerb.Close]: 1
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
|
|
22
|
+
// Track which deprecation warnings have been shown to avoid spam
|
|
23
|
+
const shownDeprecationWarnings = new Set();
|
|
24
|
+
const warnDeprecatedPathMethod = (methodName, suggestion) => {
|
|
25
|
+
if (shownDeprecationWarnings.has(methodName)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
shownDeprecationWarnings.add(methodName);
|
|
29
|
+
console.warn(`[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`);
|
|
30
|
+
};
|
|
31
|
+
const toMatrix3x3 = m => {
|
|
32
|
+
let matrix = m instanceof _JsiSkMatrix.JsiSkMatrix ? Array.from(_JsiSkMatrix.JsiSkMatrix.fromValue(m)) : m;
|
|
33
|
+
if (matrix.length === 16) {
|
|
34
|
+
matrix = [matrix[0], matrix[1], matrix[3], matrix[4], matrix[5], matrix[7], matrix[12], matrix[13], matrix[15]];
|
|
35
|
+
} else if (matrix.length !== 9) {
|
|
36
|
+
throw new Error(`Invalid matrix length: ${matrix.length}`);
|
|
37
|
+
}
|
|
38
|
+
return matrix;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* SkPath wraps a CK PathBuilder internally, providing both mutable building
|
|
43
|
+
* methods and immutable query methods. Use snapshot() internally to get
|
|
44
|
+
* an immutable CK Path for read-only operations.
|
|
45
|
+
*/
|
|
46
|
+
exports.toMatrix3x3 = toMatrix3x3;
|
|
22
47
|
class JsiSkPath extends _Host.HostObject {
|
|
23
48
|
constructor(CanvasKit, ref) {
|
|
24
49
|
super(CanvasKit, ref, "Path");
|
|
25
50
|
}
|
|
51
|
+
|
|
52
|
+
/** Returns an immutable CK Path snapshot for read-only operations. */
|
|
53
|
+
asPath() {
|
|
54
|
+
return this.ref.snapshot();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Extract an immutable CK Path from a JsiSkPath value (for CK interop). */
|
|
58
|
+
static pathFromValue(value) {
|
|
59
|
+
return JsiSkPath.fromValue(value).snapshot();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ---- Mutable building methods (deprecated) ----
|
|
63
|
+
|
|
26
64
|
addPath(src, matrix, extend = false) {
|
|
27
|
-
|
|
65
|
+
warnDeprecatedPathMethod("addPath", "Use Skia.PathBuilder.Make().addPath() instead.");
|
|
66
|
+
const srcBuilder = JsiSkPath.fromValue(src);
|
|
67
|
+
const srcPath = srcBuilder.snapshot();
|
|
68
|
+
const args = [srcPath, ...(matrix ? _JsiSkMatrix.JsiSkMatrix.fromValue(matrix) : []), extend];
|
|
28
69
|
this.ref.addPath(...args);
|
|
70
|
+
srcPath.delete();
|
|
29
71
|
return this;
|
|
30
72
|
}
|
|
31
73
|
addArc(oval, startAngleInDegrees, sweepAngleInDegrees) {
|
|
74
|
+
warnDeprecatedPathMethod("addArc", "Use Skia.PathBuilder.Make().addArc() instead.");
|
|
32
75
|
this.ref.addArc(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, oval), startAngleInDegrees, sweepAngleInDegrees);
|
|
33
76
|
return this;
|
|
34
77
|
}
|
|
35
78
|
addOval(oval, isCCW, startIndex) {
|
|
79
|
+
warnDeprecatedPathMethod("addOval", "Use Skia.Path.Oval() or Skia.PathBuilder.Make().addOval() instead.");
|
|
36
80
|
this.ref.addOval(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, oval), isCCW, startIndex);
|
|
37
81
|
return this;
|
|
38
82
|
}
|
|
39
|
-
countPoints() {
|
|
40
|
-
return this.ref.countPoints();
|
|
41
|
-
}
|
|
42
83
|
addPoly(points, close) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
moveTo(x, y) {
|
|
47
|
-
this.ref.moveTo(x, y);
|
|
48
|
-
return this;
|
|
49
|
-
}
|
|
50
|
-
lineTo(x, y) {
|
|
51
|
-
this.ref.lineTo(x, y);
|
|
84
|
+
warnDeprecatedPathMethod("addPoly", "Use Skia.Path.Polygon() or Skia.PathBuilder.Make().addPoly() instead.");
|
|
85
|
+
this.ref.addPolygon(points.map(p => Array.from(_JsiSkPoint.JsiSkPoint.fromValue(p))).flat(), close);
|
|
52
86
|
return this;
|
|
53
87
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
offset(dx, dy) {
|
|
59
|
-
this.ref.offset(dx, dy);
|
|
88
|
+
addRect(rect, isCCW) {
|
|
89
|
+
warnDeprecatedPathMethod("addRect", "Use Skia.Path.Rect() or Skia.PathBuilder.Make().addRect() instead.");
|
|
90
|
+
this.ref.addRect(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, rect), isCCW);
|
|
60
91
|
return this;
|
|
61
92
|
}
|
|
62
|
-
|
|
63
|
-
|
|
93
|
+
addRRect(rrect, isCCW) {
|
|
94
|
+
warnDeprecatedPathMethod("addRRect", "Use Skia.Path.RRect() or Skia.PathBuilder.Make().addRRect() instead.");
|
|
95
|
+
this.ref.addRRect(_JsiSkRRect.JsiSkRRect.fromValue(this.CanvasKit, rrect), isCCW);
|
|
64
96
|
return this;
|
|
65
97
|
}
|
|
66
|
-
|
|
67
|
-
|
|
98
|
+
addCircle(x, y, r) {
|
|
99
|
+
warnDeprecatedPathMethod("addCircle", "Use Skia.Path.Circle() or Skia.PathBuilder.Make().addCircle() instead.");
|
|
100
|
+
this.ref.addCircle(x, y, r);
|
|
68
101
|
return this;
|
|
69
102
|
}
|
|
70
|
-
|
|
71
|
-
|
|
103
|
+
moveTo(x, y) {
|
|
104
|
+
warnDeprecatedPathMethod("moveTo", "Use Skia.PathBuilder.Make().moveTo() instead.");
|
|
105
|
+
this.ref.moveTo(x, y);
|
|
72
106
|
return this;
|
|
73
107
|
}
|
|
74
108
|
rMoveTo(x, y) {
|
|
109
|
+
warnDeprecatedPathMethod("rMoveTo", "Use Skia.PathBuilder.Make().rMoveTo() instead.");
|
|
75
110
|
this.ref.rMoveTo(x, y);
|
|
76
111
|
return this;
|
|
77
112
|
}
|
|
113
|
+
lineTo(x, y) {
|
|
114
|
+
warnDeprecatedPathMethod("lineTo", "Use Skia.PathBuilder.Make().lineTo() instead.");
|
|
115
|
+
this.ref.lineTo(x, y);
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
78
118
|
rLineTo(x, y) {
|
|
119
|
+
warnDeprecatedPathMethod("rLineTo", "Use Skia.PathBuilder.Make().rLineTo() instead.");
|
|
79
120
|
this.ref.rLineTo(x, y);
|
|
80
121
|
return this;
|
|
81
122
|
}
|
|
123
|
+
quadTo(x1, y1, x2, y2) {
|
|
124
|
+
warnDeprecatedPathMethod("quadTo", "Use Skia.PathBuilder.Make().quadTo() instead.");
|
|
125
|
+
this.ref.quadTo(x1, y1, x2, y2);
|
|
126
|
+
return this;
|
|
127
|
+
}
|
|
82
128
|
rQuadTo(x1, y1, x2, y2) {
|
|
129
|
+
warnDeprecatedPathMethod("rQuadTo", "Use Skia.PathBuilder.Make().rQuadTo() instead.");
|
|
83
130
|
this.ref.rQuadTo(x1, y1, x2, y2);
|
|
84
131
|
return this;
|
|
85
132
|
}
|
|
86
|
-
|
|
87
|
-
|
|
133
|
+
conicTo(x1, y1, x2, y2, w) {
|
|
134
|
+
warnDeprecatedPathMethod("conicTo", "Use Skia.PathBuilder.Make().conicTo() instead.");
|
|
135
|
+
this.ref.conicTo(x1, y1, x2, y2, w);
|
|
88
136
|
return this;
|
|
89
137
|
}
|
|
90
|
-
|
|
91
|
-
|
|
138
|
+
rConicTo(x1, y1, x2, y2, w) {
|
|
139
|
+
warnDeprecatedPathMethod("rConicTo", "Use Skia.PathBuilder.Make().rConicTo() instead.");
|
|
140
|
+
this.ref.rConicTo(x1, y1, x2, y2, w);
|
|
92
141
|
return this;
|
|
93
142
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return result === null ? result : this;
|
|
143
|
+
cubicTo(cpx1, cpy1, cpx2, cpy2, x, y) {
|
|
144
|
+
warnDeprecatedPathMethod("cubicTo", "Use Skia.PathBuilder.Make().cubicTo() instead.");
|
|
145
|
+
this.ref.cubicTo(cpx1, cpy1, cpx2, cpy2, x, y);
|
|
146
|
+
return this;
|
|
147
|
+
}
|
|
148
|
+
rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y) {
|
|
149
|
+
warnDeprecatedPathMethod("rCubicTo", "Use Skia.PathBuilder.Make().rCubicTo() instead.");
|
|
150
|
+
this.ref.rCubicTo(cpx1, cpy1, cpx2, cpy2, x, y);
|
|
151
|
+
return this;
|
|
104
152
|
}
|
|
105
153
|
close() {
|
|
154
|
+
warnDeprecatedPathMethod("close", "Use Skia.PathBuilder.Make().close() instead.");
|
|
106
155
|
this.ref.close();
|
|
107
156
|
return this;
|
|
108
157
|
}
|
|
109
158
|
reset() {
|
|
110
|
-
|
|
159
|
+
warnDeprecatedPathMethod("reset", "Use Skia.PathBuilder.Make().reset() instead.");
|
|
160
|
+
// CK PathBuilder has no reset — recreate
|
|
161
|
+
const newBuilder = new this.CanvasKit.PathBuilder();
|
|
162
|
+
if (this.ref !== null && typeof this.ref === "object" && "delete" in this.ref && typeof this.ref.delete === "function") {
|
|
163
|
+
this.ref.delete();
|
|
164
|
+
}
|
|
165
|
+
this.ref = newBuilder;
|
|
111
166
|
return this;
|
|
112
167
|
}
|
|
113
168
|
rewind() {
|
|
114
|
-
|
|
115
|
-
return this;
|
|
116
|
-
}
|
|
117
|
-
computeTightBounds() {
|
|
118
|
-
return new _JsiSkRect.JsiSkRect(this.CanvasKit, this.ref.computeTightBounds());
|
|
169
|
+
warnDeprecatedPathMethod("rewind", "Use Skia.PathBuilder.Make().reset() instead.");
|
|
170
|
+
return this.reset();
|
|
119
171
|
}
|
|
120
172
|
arcToOval(oval, startAngleInDegrees, sweepAngleInDegrees, forceMoveTo) {
|
|
173
|
+
warnDeprecatedPathMethod("arcToOval", "Use Skia.PathBuilder.Make().arcToOval() instead.");
|
|
121
174
|
this.ref.arcToOval(_JsiSkRect.JsiSkRect.fromValue(this.CanvasKit, oval), startAngleInDegrees, sweepAngleInDegrees, forceMoveTo);
|
|
122
175
|
return this;
|
|
123
176
|
}
|
|
124
177
|
arcToRotated(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, x, y) {
|
|
178
|
+
warnDeprecatedPathMethod("arcToRotated", "Use Skia.PathBuilder.Make().arcToRotated() instead.");
|
|
125
179
|
this.ref.arcToRotated(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, x, y);
|
|
126
180
|
return this;
|
|
127
181
|
}
|
|
182
|
+
rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy) {
|
|
183
|
+
warnDeprecatedPathMethod("rArcTo", "Use Skia.PathBuilder.Make().rArcTo() instead.");
|
|
184
|
+
this.ref.rArcTo(rx, ry, xAxisRotateInDegrees, useSmallArc, isCCW, dx, dy);
|
|
185
|
+
return this;
|
|
186
|
+
}
|
|
128
187
|
arcToTangent(x1, y1, x2, y2, radius) {
|
|
188
|
+
warnDeprecatedPathMethod("arcToTangent", "Use Skia.PathBuilder.Make().arcToTangent() instead.");
|
|
129
189
|
this.ref.arcToTangent(x1, y1, x2, y2, radius);
|
|
130
190
|
return this;
|
|
131
191
|
}
|
|
132
|
-
|
|
133
|
-
|
|
192
|
+
setFillType(fill) {
|
|
193
|
+
warnDeprecatedPathMethod("setFillType", "Use Skia.PathBuilder.Make().setFillType() instead.");
|
|
194
|
+
this.ref.setFillType((0, _Host.getEnum)(this.CanvasKit, "FillType", fill));
|
|
134
195
|
return this;
|
|
135
196
|
}
|
|
136
|
-
|
|
137
|
-
|
|
197
|
+
setIsVolatile(_volatile) {
|
|
198
|
+
warnDeprecatedPathMethod("setIsVolatile", "Use Skia.PathBuilder.Make().setIsVolatile() instead.");
|
|
199
|
+
// Not supported in CK PathBuilder — no-op
|
|
200
|
+
return this;
|
|
138
201
|
}
|
|
139
|
-
|
|
140
|
-
|
|
202
|
+
|
|
203
|
+
// ---- Mutable path operations (deprecated) ----
|
|
204
|
+
|
|
205
|
+
offset(dx, dy) {
|
|
206
|
+
warnDeprecatedPathMethod("offset", "Use Skia.PathBuilder.Make().offset() instead.");
|
|
207
|
+
this.ref.offset(dx, dy);
|
|
208
|
+
return this;
|
|
141
209
|
}
|
|
142
|
-
|
|
143
|
-
|
|
210
|
+
transform(m) {
|
|
211
|
+
warnDeprecatedPathMethod("transform", "Use Skia.PathBuilder.Make().transform() instead.");
|
|
212
|
+
const matrix = toMatrix3x3(m);
|
|
213
|
+
this.ref.transform(matrix);
|
|
144
214
|
return this;
|
|
145
215
|
}
|
|
146
|
-
|
|
147
|
-
|
|
216
|
+
makeAsWinding() {
|
|
217
|
+
warnDeprecatedPathMethod("makeAsWinding", "Use Skia.Path.AsWinding(path) instead.");
|
|
218
|
+
const path = this.asPath();
|
|
219
|
+
const result = path.makeAsWinding();
|
|
220
|
+
path.delete();
|
|
221
|
+
if (result === null) {
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
const old = this.ref;
|
|
225
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
226
|
+
result.delete();
|
|
227
|
+
old.delete();
|
|
228
|
+
return this;
|
|
148
229
|
}
|
|
149
|
-
|
|
150
|
-
|
|
230
|
+
simplify() {
|
|
231
|
+
warnDeprecatedPathMethod("simplify", "Use Skia.Path.Simplify(path) instead.");
|
|
232
|
+
const path = this.asPath();
|
|
233
|
+
const result = path.makeSimplified();
|
|
234
|
+
path.delete();
|
|
235
|
+
if (result === null) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
const old = this.ref;
|
|
239
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
240
|
+
result.delete();
|
|
241
|
+
old.delete();
|
|
242
|
+
return true;
|
|
151
243
|
}
|
|
152
|
-
|
|
153
|
-
|
|
244
|
+
op(path, op) {
|
|
245
|
+
warnDeprecatedPathMethod("op", "Use Skia.Path.MakeFromOp() instead.");
|
|
246
|
+
const self = this.asPath();
|
|
247
|
+
const other = JsiSkPath.fromValue(path).snapshot();
|
|
248
|
+
const result = self.makeCombined(other, (0, _Host.getEnum)(this.CanvasKit, "PathOp", op));
|
|
249
|
+
self.delete();
|
|
250
|
+
other.delete();
|
|
251
|
+
if (result === null) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
const old = this.ref;
|
|
255
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
256
|
+
result.delete();
|
|
257
|
+
old.delete();
|
|
258
|
+
return true;
|
|
154
259
|
}
|
|
155
|
-
|
|
156
|
-
|
|
260
|
+
dash(on, off, phase) {
|
|
261
|
+
warnDeprecatedPathMethod("dash", "Use Skia.Path.Dash(path, on, off, phase) instead.");
|
|
262
|
+
const path = this.asPath();
|
|
263
|
+
const result = path.makeDashed(on, off, phase);
|
|
264
|
+
path.delete();
|
|
265
|
+
if (result === null) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
const old = this.ref;
|
|
269
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
270
|
+
result.delete();
|
|
271
|
+
old.delete();
|
|
272
|
+
return true;
|
|
157
273
|
}
|
|
158
|
-
|
|
159
|
-
|
|
274
|
+
stroke(opts) {
|
|
275
|
+
warnDeprecatedPathMethod("stroke", "Use Skia.Path.Stroke(path, opts) instead.");
|
|
276
|
+
const path = this.asPath();
|
|
277
|
+
const result = path.makeStroked(opts === undefined ? undefined : {
|
|
278
|
+
width: opts.width,
|
|
279
|
+
// eslint-disable-next-line camelcase
|
|
280
|
+
miter_limit: opts.miter_limit,
|
|
281
|
+
precision: opts.precision,
|
|
282
|
+
join: (0, _Host.optEnum)(this.CanvasKit, "StrokeJoin", opts.join),
|
|
283
|
+
cap: (0, _Host.optEnum)(this.CanvasKit, "StrokeCap", opts.cap)
|
|
284
|
+
});
|
|
285
|
+
path.delete();
|
|
286
|
+
if (result === null) {
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
const old = this.ref;
|
|
290
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
291
|
+
result.delete();
|
|
292
|
+
old.delete();
|
|
160
293
|
return this;
|
|
161
294
|
}
|
|
162
|
-
|
|
163
|
-
|
|
295
|
+
trim(start, stop, isComplement) {
|
|
296
|
+
warnDeprecatedPathMethod("trim", "Use Skia.Path.Trim(path, start, end, isComplement) instead.");
|
|
297
|
+
const startT = Math.min(Math.max(start, 0), 1);
|
|
298
|
+
const stopT = Math.min(Math.max(stop, 0), 1);
|
|
299
|
+
if (startT === 0 && stopT === 1 && !isComplement) {
|
|
300
|
+
return this;
|
|
301
|
+
}
|
|
302
|
+
const path = this.asPath();
|
|
303
|
+
const result = path.makeTrimmed(startT, stopT, isComplement);
|
|
304
|
+
path.delete();
|
|
305
|
+
if (result === null) {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
const old = this.ref;
|
|
309
|
+
this.ref = new this.CanvasKit.PathBuilder(result);
|
|
310
|
+
result.delete();
|
|
311
|
+
old.delete();
|
|
164
312
|
return this;
|
|
165
313
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
314
|
+
|
|
315
|
+
// ---- Query methods (use snapshot for read-only) ----
|
|
316
|
+
|
|
317
|
+
countPoints() {
|
|
318
|
+
return this.ref.countPoints();
|
|
319
|
+
}
|
|
320
|
+
computeTightBounds() {
|
|
321
|
+
const path = this.asPath();
|
|
322
|
+
const result = new _JsiSkRect.JsiSkRect(this.CanvasKit, path.computeTightBounds());
|
|
323
|
+
path.delete();
|
|
324
|
+
return result;
|
|
325
|
+
}
|
|
326
|
+
contains(x, y) {
|
|
327
|
+
const path = this.asPath();
|
|
328
|
+
const result = path.contains(x, y);
|
|
329
|
+
path.delete();
|
|
330
|
+
return result;
|
|
331
|
+
}
|
|
332
|
+
copy() {
|
|
333
|
+
const path = this.asPath();
|
|
334
|
+
const result = new JsiSkPath(this.CanvasKit, new this.CanvasKit.PathBuilder(path));
|
|
335
|
+
path.delete();
|
|
336
|
+
return result;
|
|
337
|
+
}
|
|
338
|
+
equals(other) {
|
|
339
|
+
const p1 = this.asPath();
|
|
340
|
+
const p2 = JsiSkPath.fromValue(other).snapshot();
|
|
341
|
+
const result = p1.equals(p2);
|
|
342
|
+
p1.delete();
|
|
343
|
+
p2.delete();
|
|
344
|
+
return result;
|
|
345
|
+
}
|
|
346
|
+
getBounds() {
|
|
347
|
+
return new _JsiSkRect.JsiSkRect(this.CanvasKit, this.ref.getBounds());
|
|
348
|
+
}
|
|
349
|
+
getFillType() {
|
|
350
|
+
const path = this.asPath();
|
|
351
|
+
const result = path.getFillType().value;
|
|
352
|
+
path.delete();
|
|
353
|
+
return result;
|
|
169
354
|
}
|
|
170
355
|
getPoint(index) {
|
|
171
|
-
|
|
356
|
+
const path = this.asPath();
|
|
357
|
+
const result = new _JsiSkPoint.JsiSkPoint(this.CanvasKit, path.getPoint(index));
|
|
358
|
+
path.delete();
|
|
359
|
+
return result;
|
|
172
360
|
}
|
|
173
361
|
isEmpty() {
|
|
174
362
|
return this.ref.isEmpty();
|
|
175
363
|
}
|
|
176
364
|
isVolatile() {
|
|
177
|
-
return
|
|
178
|
-
}
|
|
179
|
-
addCircle(x, y, r) {
|
|
180
|
-
this.ref.addCircle(x, y, r);
|
|
181
|
-
return this;
|
|
365
|
+
return false;
|
|
182
366
|
}
|
|
183
367
|
getLastPt() {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
368
|
+
const count = this.ref.countPoints();
|
|
369
|
+
if (count === 0) {
|
|
370
|
+
return {
|
|
371
|
+
x: 0,
|
|
372
|
+
y: 0
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
const path = this.asPath();
|
|
376
|
+
const pt = path.getPoint(count - 1);
|
|
377
|
+
path.delete();
|
|
378
|
+
return {
|
|
379
|
+
x: pt[0],
|
|
380
|
+
y: pt[1]
|
|
381
|
+
};
|
|
191
382
|
}
|
|
192
383
|
toSVGString() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const stopT = pinT(stop);
|
|
198
|
-
if (startT === 0 && stopT === 1) {
|
|
199
|
-
return this;
|
|
200
|
-
}
|
|
201
|
-
const result = this.ref.trim(startT, stopT, isComplement);
|
|
202
|
-
return result === null ? result : this;
|
|
384
|
+
const path = this.asPath();
|
|
385
|
+
const result = path.toSVGString();
|
|
386
|
+
path.delete();
|
|
387
|
+
return result;
|
|
203
388
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
this.ref.transform(matrix);
|
|
212
|
-
return this;
|
|
389
|
+
isInterpolatable(path2) {
|
|
390
|
+
const p1 = this.asPath();
|
|
391
|
+
const p2 = JsiSkPath.fromValue(path2).snapshot();
|
|
392
|
+
const result = this.CanvasKit.Path.CanInterpolate(p1, p2);
|
|
393
|
+
p1.delete();
|
|
394
|
+
p2.delete();
|
|
395
|
+
return result;
|
|
213
396
|
}
|
|
214
|
-
interpolate(end,
|
|
215
|
-
const
|
|
397
|
+
interpolate(end, weight, output) {
|
|
398
|
+
const p1 = this.asPath();
|
|
399
|
+
const p2 = JsiSkPath.fromValue(end).snapshot();
|
|
400
|
+
const path = this.CanvasKit.Path.MakeFromPathInterpolation(p1, p2, weight);
|
|
401
|
+
p1.delete();
|
|
402
|
+
p2.delete();
|
|
216
403
|
if (path === null) {
|
|
217
404
|
return null;
|
|
218
405
|
}
|
|
219
406
|
if (output) {
|
|
220
|
-
|
|
407
|
+
const outRef = output;
|
|
408
|
+
const old = outRef.ref;
|
|
409
|
+
outRef.ref = new this.CanvasKit.PathBuilder(path);
|
|
410
|
+
path.delete();
|
|
411
|
+
old.delete();
|
|
221
412
|
return output;
|
|
222
|
-
} else {
|
|
223
|
-
return new JsiSkPath(this.CanvasKit, path);
|
|
224
413
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return
|
|
414
|
+
const result = new JsiSkPath(this.CanvasKit, new this.CanvasKit.PathBuilder(path));
|
|
415
|
+
path.delete();
|
|
416
|
+
return result;
|
|
228
417
|
}
|
|
229
418
|
toCmds() {
|
|
230
|
-
const
|
|
419
|
+
const path = this.asPath();
|
|
420
|
+
const cmds = path.toCmds();
|
|
421
|
+
path.delete();
|
|
231
422
|
const result = cmds.reduce((acc, cmd, i) => {
|
|
232
423
|
if (i === 0) {
|
|
233
424
|
acc.push([]);
|