@shopify/react-native-skia 2.13.1 → 2.14.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/android/CMakeLists.txt +2 -0
- package/android/cpp/jni/include/JniSkiaPictureView.h +16 -15
- package/apple/RNSkApplePlatformContext.h +3 -4
- package/apple/RNSkiaModule.h +11 -3
- package/apple/RNSkiaModule.mm +46 -19
- package/apple/SkiaPictureView.mm +2 -2
- package/apple/SkiaUIView.h +0 -1
- package/apple/SkiaUIView.mm +1 -1
- package/apple/ViewScreenshotService.h +2 -2
- package/apple/ViewScreenshotService.mm +5 -4
- package/cpp/api/JsiSkPath.h +0 -431
- package/cpp/api/JsiSkSkottie.h +2 -3
- package/cpp/api/JsiSkStrutStyle.h +1 -1
- package/cpp/api/JsiSkSurfaceFactory.h +41 -0
- package/cpp/api/recorder/Convertor.h +152 -131
- package/cpp/api/recorder/DataTypes.h +11 -11
- package/cpp/api/recorder/ImageFit.h +8 -5
- package/cpp/api/recorder/JsiRecorder.h +9 -29
- package/cpp/api/recorder/Paint.h +3 -3
- package/cpp/api/recorder/RNRecorder.h +56 -0
- package/cpp/jsi/ViewProperty.cpp +23 -0
- package/cpp/jsi/ViewProperty.h +31 -10
- package/cpp/rnskia/RNDawnContext.h +33 -0
- package/cpp/rnskia/RNSkJsiViewApi.h +69 -2
- package/cpp/rnskia/RNSkPictureView.cpp +58 -0
- package/cpp/rnskia/RNSkPictureView.h +110 -24
- package/lib/commonjs/Platform/IPlatform.js.map +1 -1
- package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
- package/lib/commonjs/skia/core/Image.js.map +1 -1
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/commonjs/skia/types/Path/Path.d.ts +2 -336
- package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
- package/lib/commonjs/skia/types/Recorder.d.ts +10 -0
- package/lib/commonjs/skia/types/Recorder.js.map +1 -1
- package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +16 -0
- package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.d.ts +4 -38
- package/lib/commonjs/skia/web/JsiSkPath.js +3 -275
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +3 -0
- package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/commonjs/sksg/Container.native.d.ts +15 -1
- package/lib/commonjs/sksg/Container.native.js +34 -33
- package/lib/commonjs/sksg/Container.native.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.js +4 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/commonjs/views/types.d.ts +9 -0
- package/lib/commonjs/views/types.js.map +1 -1
- package/lib/module/Platform/IPlatform.js.map +1 -1
- package/lib/module/animation/functions/interpolate.js.map +1 -1
- package/lib/module/skia/core/Image.js.map +1 -1
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/module/skia/types/Path/Path.d.ts +2 -336
- package/lib/module/skia/types/Path/Path.js.map +1 -1
- package/lib/module/skia/types/Recorder.d.ts +10 -0
- package/lib/module/skia/types/Recorder.js.map +1 -1
- package/lib/module/skia/types/Shader/Shader.js.map +1 -1
- package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +16 -0
- package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.d.ts +4 -38
- package/lib/module/skia/web/JsiSkPath.js +4 -276
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js +4 -1
- package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
- package/lib/module/sksg/Container.native.d.ts +15 -1
- package/lib/module/sksg/Container.native.js +34 -33
- package/lib/module/sksg/Container.native.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.js +4 -0
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/module/views/types.d.ts +9 -0
- package/lib/module/views/types.js.map +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -35
- package/lib/typescript/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
- package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +15 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +3 -37
- package/lib/typescript/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
- package/lib/typescript/lib/module/sksg/Container.native.d.ts +15 -1
- package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -336
- package/lib/typescript/src/skia/types/Recorder.d.ts +10 -0
- package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +16 -0
- package/lib/typescript/src/skia/web/JsiSkPath.d.ts +4 -38
- package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
- package/lib/typescript/src/sksg/Container.native.d.ts +15 -1
- package/lib/typescript/src/views/types.d.ts +9 -0
- package/package.json +2 -2
- package/src/Platform/IPlatform.ts +1 -4
- package/src/animation/functions/interpolate.ts +1 -4
- package/src/skia/core/Image.ts +1 -2
- package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +2 -5
- package/src/skia/types/Path/Path.ts +2 -420
- package/src/skia/types/Recorder.ts +10 -0
- package/src/skia/types/Shader/Shader.ts +1 -5
- package/src/skia/types/Surface/SurfaceFactory.ts +17 -0
- package/src/skia/web/JsiSkPath.ts +4 -495
- package/src/skia/web/JsiSkSurfaceFactory.ts +6 -2
- package/src/sksg/Container.native.ts +34 -37
- package/src/specs/NativeSkiaModule.web.ts +4 -0
- package/src/views/types.ts +13 -0
- package/apple/SkiaManager.h +0 -23
- package/apple/SkiaManager.mm +0 -63
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { SkRect } from "../Rect";
|
|
2
2
|
import type { SkPoint } from "../Point";
|
|
3
|
-
import type { InputRRect } from "../RRect";
|
|
4
3
|
import type { StrokeJoin, StrokeCap } from "../Paint";
|
|
5
|
-
import type { InputMatrix, SkMatrix } from "../Matrix";
|
|
6
4
|
import type { SkJSIInstance } from "../JsiInstance";
|
|
7
5
|
/**
|
|
8
6
|
* Options used for Path.stroke(). If an option is omitted, a sensible default will be used.
|
|
@@ -43,166 +41,10 @@ export declare enum PathVerb {
|
|
|
43
41
|
export type PathCommand = number[];
|
|
44
42
|
export declare const isPath: (obj: SkJSIInstance<string> | null) => obj is SkPath;
|
|
45
43
|
export interface SkPath extends SkJSIInstance<"Path"> {
|
|
46
|
-
/**
|
|
47
|
-
* Appends arc to Path, as the start of new contour. Arc added is part of ellipse
|
|
48
|
-
* bounded by oval, from startAngle through sweepAngle. Both startAngle and
|
|
49
|
-
* sweepAngle are measured in degrees, where zero degrees is aligned with the
|
|
50
|
-
* positive x-axis, and positive sweeps extends arc clockwise.
|
|
51
|
-
* Returns the modified path for easier chaining.
|
|
52
|
-
* @param oval
|
|
53
|
-
* @param startAngle
|
|
54
|
-
* @param sweepAngle
|
|
55
|
-
*/
|
|
56
|
-
addArc(oval: SkRect, startAngleInDegrees: number, sweepAngleInDegrees: number): SkPath;
|
|
57
|
-
/**
|
|
58
|
-
* Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.
|
|
59
|
-
* Oval is upright ellipse bounded by Rect oval with radii equal to half oval width
|
|
60
|
-
* and half oval height. Oval begins at start and continues clockwise by default.
|
|
61
|
-
* Returns the modified path for easier chaining.
|
|
62
|
-
* @param oval
|
|
63
|
-
* @param isCCW - if the path should be drawn counter-clockwise or not
|
|
64
|
-
* @param startIndex - index of initial point of ellipse
|
|
65
|
-
*/
|
|
66
|
-
addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): SkPath;
|
|
67
44
|
/**
|
|
68
45
|
* Returns the number of points in this path. Initially zero.
|
|
69
46
|
*/
|
|
70
47
|
countPoints(): number;
|
|
71
|
-
/**
|
|
72
|
-
* Adds contour created from array of n points, adding (count - 1) line segments.
|
|
73
|
-
* Contour added starts at pts[0], then adds a line for every additional point
|
|
74
|
-
* in pts array. If close is true, appends kClose_Verb to Path, connecting
|
|
75
|
-
* pts[count - 1] and pts[0].
|
|
76
|
-
* Returns the modified path for easier chaining.
|
|
77
|
-
* @param points
|
|
78
|
-
* @param close - if true, will add a line connecting last point to the first point.
|
|
79
|
-
*/
|
|
80
|
-
addPoly(points: SkPoint[], close: boolean): SkPath;
|
|
81
|
-
/** Adds beginning of contour at SkPoint (x, y).
|
|
82
|
-
|
|
83
|
-
@param x x-axis value of contour start
|
|
84
|
-
@param y y-axis value of contour start
|
|
85
|
-
@return reference to SkPath
|
|
86
|
-
|
|
87
|
-
example: https://fiddle.skia.org/c/@Path_moveTo
|
|
88
|
-
*/
|
|
89
|
-
moveTo(x: number, y: number): SkPath;
|
|
90
|
-
/** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is
|
|
91
|
-
kClose_Verb, last point is set to (0, 0) before adding line.
|
|
92
|
-
|
|
93
|
-
lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.
|
|
94
|
-
lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.
|
|
95
|
-
|
|
96
|
-
@param x end of added line on x-axis
|
|
97
|
-
@param y end of added line on y-axis
|
|
98
|
-
@return reference to SkPath
|
|
99
|
-
|
|
100
|
-
example: https://fiddle.skia.org/c/@Path_lineTo
|
|
101
|
-
*/
|
|
102
|
-
lineTo(x: number, y: number): SkPath;
|
|
103
|
-
/**
|
|
104
|
-
* Returns a new path that covers the same area as the original path, but with the
|
|
105
|
-
* Winding FillType. This may re-draw some contours in the path as counter-clockwise
|
|
106
|
-
* instead of clockwise to achieve that effect. If such a transformation cannot
|
|
107
|
-
* be done, null is returned.
|
|
108
|
-
*/
|
|
109
|
-
makeAsWinding(): SkPath | null;
|
|
110
|
-
/**
|
|
111
|
-
* Translates all the points in the path by dx, dy.
|
|
112
|
-
* @param dx
|
|
113
|
-
* @param dy
|
|
114
|
-
*/
|
|
115
|
-
offset(dx: number, dy: number): SkPath;
|
|
116
|
-
/**
|
|
117
|
-
* Relative version of arcToRotated.
|
|
118
|
-
* @param rx
|
|
119
|
-
* @param ry
|
|
120
|
-
* @param xAxisRotate
|
|
121
|
-
* @param useSmallArc
|
|
122
|
-
* @param isCCW
|
|
123
|
-
* @param dx
|
|
124
|
-
* @param dy
|
|
125
|
-
*/
|
|
126
|
-
rArcTo(rx: number, ry: number, xAxisRotateInDegrees: number, useSmallArc: boolean, isCCW: boolean, dx: number, dy: number): SkPath;
|
|
127
|
-
/**
|
|
128
|
-
* Relative version of conicTo.
|
|
129
|
-
* @param dx1
|
|
130
|
-
* @param dy1
|
|
131
|
-
* @param dx2
|
|
132
|
-
* @param dy2
|
|
133
|
-
* @param w
|
|
134
|
-
*/
|
|
135
|
-
rConicTo(dx1: number, dy1: number, dx2: number, dy2: number, w: number): SkPath;
|
|
136
|
-
/**
|
|
137
|
-
* Relative version of cubicTo.
|
|
138
|
-
* @param cpx1
|
|
139
|
-
* @param cpy1
|
|
140
|
-
* @param cpx2
|
|
141
|
-
* @param cpy2
|
|
142
|
-
* @param x
|
|
143
|
-
* @param y
|
|
144
|
-
*/
|
|
145
|
-
rCubicTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number): SkPath;
|
|
146
|
-
/**
|
|
147
|
-
* Relative version of moveTo.
|
|
148
|
-
* @param x
|
|
149
|
-
* @param y
|
|
150
|
-
*/
|
|
151
|
-
rMoveTo(x: number, y: number): SkPath;
|
|
152
|
-
/**
|
|
153
|
-
* Relative version of lineTo.
|
|
154
|
-
* @param x
|
|
155
|
-
* @param y
|
|
156
|
-
*/
|
|
157
|
-
rLineTo(x: number, y: number): SkPath;
|
|
158
|
-
/**
|
|
159
|
-
* Relative version of quadTo.
|
|
160
|
-
* @param x1
|
|
161
|
-
* @param y1
|
|
162
|
-
* @param x2
|
|
163
|
-
* @param y2
|
|
164
|
-
*/
|
|
165
|
-
rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPath;
|
|
166
|
-
/**
|
|
167
|
-
* Sets FillType, the rule used to fill Path.
|
|
168
|
-
* @param fill
|
|
169
|
-
*/
|
|
170
|
-
setFillType(fill: FillType): SkPath;
|
|
171
|
-
/**
|
|
172
|
-
* Specifies whether Path is volatile; whether it will be altered or discarded
|
|
173
|
-
* by the caller after it is drawn. Path by default have volatile set false.
|
|
174
|
-
*
|
|
175
|
-
* Mark animating or temporary paths as volatile to improve performance.
|
|
176
|
-
* Mark unchanging Path non-volatile to improve repeated rendering.
|
|
177
|
-
* @param volatile
|
|
178
|
-
*/
|
|
179
|
-
setIsVolatile(volatile: boolean): SkPath;
|
|
180
|
-
/**
|
|
181
|
-
* Turns this path into the filled equivalent of the stroked path. Returns false if the operation
|
|
182
|
-
* fails (e.g. the path is a hairline).
|
|
183
|
-
* @param opts - describe how stroked path should look.
|
|
184
|
-
* If such a transformation cannot be done, null is returned.
|
|
185
|
-
*/
|
|
186
|
-
stroke(opts?: StrokeOpts): null | SkPath;
|
|
187
|
-
/**
|
|
188
|
-
* Appends CLOSE_VERB to Path. A closed contour connects the first and last point
|
|
189
|
-
* with a line, forming a continuous loop.
|
|
190
|
-
*/
|
|
191
|
-
close(): SkPath;
|
|
192
|
-
/**
|
|
193
|
-
* Sets Path to its initial state.
|
|
194
|
-
* Removes verb array, point array, and weights, and sets FillType to Winding.
|
|
195
|
-
* Internal storage associated with Path is released
|
|
196
|
-
*/
|
|
197
|
-
reset(): SkPath;
|
|
198
|
-
/**
|
|
199
|
-
* Sets Path to its initial state.
|
|
200
|
-
* Removes verb array, point array, and weights, and sets FillType to Winding.
|
|
201
|
-
* Internal storage associated with Path is *not* released.
|
|
202
|
-
* Use rewind() instead of reset() if Path storage will be reused and performance
|
|
203
|
-
* is critical.
|
|
204
|
-
*/
|
|
205
|
-
rewind(): SkPath;
|
|
206
48
|
/**
|
|
207
49
|
* Returns minimum and maximum axes values of the lines and curves in Path.
|
|
208
50
|
* Returns (0, 0, 0, 0) if Path contains no points.
|
|
@@ -215,58 +57,6 @@ export interface SkPath extends SkJSIInstance<"Path"> {
|
|
|
215
57
|
* and unlike getBounds(), does not cache the result.
|
|
216
58
|
*/
|
|
217
59
|
computeTightBounds(): SkRect;
|
|
218
|
-
/**
|
|
219
|
-
* Appends arc to Path. Arc added is part of ellipse
|
|
220
|
-
* bounded by oval, from startAngle through sweepAngle. Both startAngle and
|
|
221
|
-
* sweepAngle are measured in degrees, where zero degrees is aligned with the
|
|
222
|
-
* positive x-axis, and positive sweeps extends arc clockwise.
|
|
223
|
-
* Returns the modified path for easier chaining.
|
|
224
|
-
* @param oval
|
|
225
|
-
* @param startAngleInDegrees
|
|
226
|
-
* @param sweepAngleInDegrees
|
|
227
|
-
* @param forceMoveTo
|
|
228
|
-
*/
|
|
229
|
-
arcToOval(oval: SkRect, startAngleInDegrees: number, sweepAngleInDegrees: number, forceMoveTo: boolean): SkPath;
|
|
230
|
-
/**
|
|
231
|
-
* Appends arc to Path. Arc is implemented by one or more conics weighted to
|
|
232
|
-
* describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc
|
|
233
|
-
* curves from last Path Point to (x, y), choosing one of four possible routes:
|
|
234
|
-
* clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details.
|
|
235
|
-
* Returns the modified path for easier chaining.
|
|
236
|
-
* @param rx
|
|
237
|
-
* @param ry
|
|
238
|
-
* @param xAxisRotate
|
|
239
|
-
* @param useSmallArc
|
|
240
|
-
* @param isCCW
|
|
241
|
-
* @param x
|
|
242
|
-
* @param y
|
|
243
|
-
*/
|
|
244
|
-
arcToRotated(rx: number, ry: number, xAxisRotateInDegrees: number, useSmallArc: boolean, isCCW: boolean, x: number, y: number): SkPath;
|
|
245
|
-
/**
|
|
246
|
-
* Appends arc to Path, after appending line if needed. Arc is implemented by conic
|
|
247
|
-
* weighted to describe part of circle. Arc is contained by tangent from
|
|
248
|
-
* last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc
|
|
249
|
-
* is part of circle sized to radius, positioned so it touches both tangent lines.
|
|
250
|
-
* Returns the modified path for easier chaining.
|
|
251
|
-
* @param x1
|
|
252
|
-
* @param y1
|
|
253
|
-
* @param x2
|
|
254
|
-
* @param y2
|
|
255
|
-
* @param radius
|
|
256
|
-
*/
|
|
257
|
-
arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number): SkPath;
|
|
258
|
-
/**
|
|
259
|
-
* Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.
|
|
260
|
-
* If Path is empty, or path is closed, the last point is set to (0, 0)
|
|
261
|
-
* before adding conic.
|
|
262
|
-
* Returns the modified path for easier chaining.
|
|
263
|
-
* @param x1
|
|
264
|
-
* @param y1
|
|
265
|
-
* @param x2
|
|
266
|
-
* @param y2
|
|
267
|
-
* @param w
|
|
268
|
-
*/
|
|
269
|
-
conicTo(x1: number, y1: number, x2: number, y2: number, w: number): SkPath;
|
|
270
60
|
/**
|
|
271
61
|
* Returns true if the point (x, y) is contained by Path, taking into
|
|
272
62
|
* account FillType.
|
|
@@ -278,26 +68,6 @@ export interface SkPath extends SkJSIInstance<"Path"> {
|
|
|
278
68
|
* Returns a copy of this Path.
|
|
279
69
|
*/
|
|
280
70
|
copy(): SkPath;
|
|
281
|
-
/**
|
|
282
|
-
* Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at
|
|
283
|
-
* (x3, y3). If Path is empty, or path is closed, the last point is set to
|
|
284
|
-
* (0, 0) before adding cubic.
|
|
285
|
-
* @param cpx1
|
|
286
|
-
* @param cpy1
|
|
287
|
-
* @param cpx2
|
|
288
|
-
* @param cpy2
|
|
289
|
-
* @param x
|
|
290
|
-
* @param y
|
|
291
|
-
*/
|
|
292
|
-
cubicTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number): SkPath;
|
|
293
|
-
/**
|
|
294
|
-
* Changes this path to be the dashed version of itself. This is the same effect as creating
|
|
295
|
-
* a DashPathEffect and calling filterPath on this path.
|
|
296
|
-
* @param on
|
|
297
|
-
* @param off
|
|
298
|
-
* @param phase
|
|
299
|
-
*/
|
|
300
|
-
dash(on: number, off: number, phase: number): boolean;
|
|
301
71
|
/**
|
|
302
72
|
* Returns true if other path is equal to this path.
|
|
303
73
|
* @param other
|
|
@@ -313,54 +83,6 @@ export interface SkPath extends SkJSIInstance<"Path"> {
|
|
|
313
83
|
* Return the FillType for this path.
|
|
314
84
|
*/
|
|
315
85
|
getFillType(): FillType;
|
|
316
|
-
/**
|
|
317
|
-
Adds quad from last point towards (x1, y1), to (x2, y2).
|
|
318
|
-
|
|
319
|
-
If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) before adding quad.
|
|
320
|
-
|
|
321
|
-
Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; then appends kQuad_Verb to verb array;
|
|
322
|
-
and (x1, y1), (x2, y2) to SkPoint array.
|
|
323
|
-
|
|
324
|
-
Parameters
|
|
325
|
-
x1 control SkPoint of quad on x-axis
|
|
326
|
-
y1 control SkPoint of quad on y-axis
|
|
327
|
-
x2 end SkPoint of quad on x-axis
|
|
328
|
-
y2 end SkPoint of quad on y-axis
|
|
329
|
-
Returns
|
|
330
|
-
reference to SkPath
|
|
331
|
-
example: https://fiddle.skia.org/c/@Path_quadTo
|
|
332
|
-
*/
|
|
333
|
-
quadTo(x1: number, y1: number, x2: number, y2: number): SkPath;
|
|
334
|
-
/**
|
|
335
|
-
* Adds Rect to Path, appending kMove_Verb, three kLine_Verb, and kClose_Verb,
|
|
336
|
-
* starting with top-left corner of Rect; followed by top-right, bottom-right,
|
|
337
|
-
* and bottom-left if isCCW is false; or followed by bottom-left,
|
|
338
|
-
* bottom-right, and top-right if isCCW is true.
|
|
339
|
-
* Returns the modified path for easier chaining.
|
|
340
|
-
* @param rect
|
|
341
|
-
* @param isCCW
|
|
342
|
-
*/
|
|
343
|
-
addRect(rect: SkRect, isCCW?: boolean): SkPath;
|
|
344
|
-
/**
|
|
345
|
-
* Adds rrect to Path, creating a new closed contour.
|
|
346
|
-
* Returns the modified path for easier chaining.
|
|
347
|
-
* @param rrect
|
|
348
|
-
* @param isCCW
|
|
349
|
-
*/
|
|
350
|
-
addRRect(rrect: InputRRect, isCCW?: boolean): SkPath;
|
|
351
|
-
/** Appends src to SkPath, transformed by matrix. Transformed curves may have
|
|
352
|
-
different verbs, SkPoint, and conic weights.
|
|
353
|
-
|
|
354
|
-
If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic
|
|
355
|
-
weights are added unaltered. If mode is kExtend_AddPathMode, add line
|
|
356
|
-
before appending verbs, SkPoint, and conic weights.
|
|
357
|
-
|
|
358
|
-
@param src SkPath verbs, SkPoint, and conic weights to add
|
|
359
|
-
@param matrix transform applied to src
|
|
360
|
-
@param extend extends path with line if true
|
|
361
|
-
@return reference to SkPath
|
|
362
|
-
*/
|
|
363
|
-
addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): SkPath;
|
|
364
86
|
/**
|
|
365
87
|
* Returns the Point at index in Point array. Valid range for index is
|
|
366
88
|
* 0 to countPoints() - 1.
|
|
@@ -378,69 +100,14 @@ export interface SkPath extends SkJSIInstance<"Path"> {
|
|
|
378
100
|
* may not speed repeated drawing.
|
|
379
101
|
*/
|
|
380
102
|
isVolatile(): boolean;
|
|
381
|
-
/** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb,
|
|
382
|
-
four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing
|
|
383
|
-
clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.
|
|
384
|
-
|
|
385
|
-
Has no effect if radius is zero or negative.
|
|
386
|
-
|
|
387
|
-
@param x center of circle
|
|
388
|
-
@param y center of circle
|
|
389
|
-
@param radius distance from center to edge
|
|
390
|
-
@return reference to SkPath
|
|
391
|
-
*/
|
|
392
|
-
addCircle(x: number, y: number, r: number): SkPath;
|
|
393
103
|
getLastPt(): {
|
|
394
104
|
x: number;
|
|
395
105
|
y: number;
|
|
396
106
|
};
|
|
397
|
-
/** Set this path to the result of applying the Op to this path and the
|
|
398
|
-
specified path: this = (this op operand).
|
|
399
|
-
The resulting path will be constructed from non-overlapping contours.
|
|
400
|
-
The curve order is reduced where possible so that cubics may be turned
|
|
401
|
-
into quadratics, and quadratics maybe turned into lines.
|
|
402
|
-
|
|
403
|
-
Returns true if operation was able to produce a result;
|
|
404
|
-
otherwise, result is unmodified.
|
|
405
|
-
|
|
406
|
-
@param path The second path (for difference, the subtrahend)
|
|
407
|
-
@param op The operator to apply.
|
|
408
|
-
@param result The product of the operands. The result may be one of the
|
|
409
|
-
inputs.
|
|
410
|
-
@return True if the operation succeeded.
|
|
411
|
-
*/
|
|
412
|
-
op(path: SkPath, op: PathOp): boolean;
|
|
413
|
-
/** Set this path to a set of non-overlapping contours that describe the
|
|
414
|
-
same area as the original path.
|
|
415
|
-
The curve order is reduced where possible so that cubics may
|
|
416
|
-
be turned into quadratics, and quadratics maybe turned into lines.
|
|
417
|
-
|
|
418
|
-
Returns true if operation was able to produce a result;
|
|
419
|
-
otherwise, result is unmodified.
|
|
420
|
-
|
|
421
|
-
@param result The simplified path. The result may be the input.
|
|
422
|
-
@return True if simplification succeeded.
|
|
423
|
-
*/
|
|
424
|
-
simplify(): boolean;
|
|
425
107
|
/**
|
|
426
108
|
* Returns this path as an SVG string.
|
|
427
109
|
*/
|
|
428
110
|
toSVGString(): string;
|
|
429
|
-
/**
|
|
430
|
-
* Take start and stop "t" values (values between 0...1), and modify this path such that
|
|
431
|
-
* it is a subset of the original path.
|
|
432
|
-
* The trim values apply to the entire path, so if it contains several contours, all of them
|
|
433
|
-
* are including in the calculation.
|
|
434
|
-
* Null is returned if either input value is NaN.
|
|
435
|
-
* @param startT - a value in the range [0.0, 1.0]. 0.0 is the beginning of the path.
|
|
436
|
-
* @param stopT - a value in the range [0.0, 1.0]. 1.0 is the end of the path.
|
|
437
|
-
* @param isComplement
|
|
438
|
-
*/
|
|
439
|
-
trim(startT: number, stopT: number, isComplement: boolean): null | SkPath;
|
|
440
|
-
/**
|
|
441
|
-
* Transforms the path by the specified matrix.
|
|
442
|
-
*/
|
|
443
|
-
transform(m3: InputMatrix): SkPath;
|
|
444
111
|
/**
|
|
445
112
|
* Interpolates between Path with point array of equal size.
|
|
446
113
|
* Copy verb array and weights to result, and set result path to a weighted
|
|
@@ -457,11 +124,10 @@ export interface SkPath extends SkJSIInstance<"Path"> {
|
|
|
457
124
|
* @param ending path to interpolate with
|
|
458
125
|
* @param weight contribution of this path, and
|
|
459
126
|
* one minus contribution of ending path
|
|
460
|
-
* @
|
|
461
|
-
* @return Path replaced by interpolated averages or null if
|
|
127
|
+
* @return New path of interpolated averages or null if
|
|
462
128
|
* not interpolatable
|
|
463
129
|
* */
|
|
464
|
-
interpolate(end: SkPath, weight: number
|
|
130
|
+
interpolate(end: SkPath, weight: number): SkPath | null;
|
|
465
131
|
/** Returns true if Path contain equal verbs and equal weights.
|
|
466
132
|
* @param compare path to compare
|
|
467
133
|
* @return true if Path can be interpolated equivalent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FillType","PathOp","PathVerb","isPath","obj","__typename__"],"sources":["Path.ts"],"sourcesContent":["import type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { InputRRect } from \"../RRect\";\nimport type { StrokeJoin, StrokeCap } from \"../Paint\";\nimport type { InputMatrix, SkMatrix } from \"../Matrix\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\n/**\n * Options used for Path.stroke(). If an option is omitted, a sensible default will be used.\n */\nexport interface StrokeOpts {\n /** The width of the stroked lines. */\n width?: number;\n miter_limit?: number;\n /**\n * if > 1, increase precision, else if (0 < resScale < 1) reduce precision to\n * favor speed and size\n */\n precision?: number;\n join?: StrokeJoin;\n cap?: StrokeCap;\n}\n\nexport enum FillType {\n Winding,\n EvenOdd,\n InverseWinding,\n InverseEvenOdd,\n}\n\nexport enum PathOp {\n Difference, //!< subtract the op path from the first path\n Intersect, //!< intersect the two paths\n Union, //!< union (inclusive-or) the two paths\n XOR, //!< exclusive-or the two paths\n ReverseDifference,\n}\n\nexport enum PathVerb {\n Move,\n Line,\n Quad,\n Conic,\n Cubic,\n Close,\n}\n\nexport type PathCommand = number[];\n\nexport const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath => {\n \"worklet\";\n return obj !== null && obj.__typename__ === \"Path\";\n};\n\nexport interface SkPath extends SkJSIInstance<\"Path\"> {\n /**\n * Appends arc to Path, as the start of new contour. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngle\n * @param sweepAngle\n */\n addArc(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number\n ): SkPath;\n\n /**\n * Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.\n * Oval is upright ellipse bounded by Rect oval with radii equal to half oval width\n * and half oval height. Oval begins at start and continues clockwise by default.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param isCCW - if the path should be drawn counter-clockwise or not\n * @param startIndex - index of initial point of ellipse\n */\n addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): SkPath;\n\n /**\n * Returns the number of points in this path. Initially zero.\n */\n countPoints(): number;\n\n /**\n * Adds contour created from array of n points, adding (count - 1) line segments.\n * Contour added starts at pts[0], then adds a line for every additional point\n * in pts array. If close is true, appends kClose_Verb to Path, connecting\n * pts[count - 1] and pts[0].\n * Returns the modified path for easier chaining.\n * @param points\n * @param close - if true, will add a line connecting last point to the first point.\n */\n addPoly(points: SkPoint[], close: boolean): SkPath;\n\n /** Adds beginning of contour at SkPoint (x, y).\n\n @param x x-axis value of contour start\n @param y y-axis value of contour start\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_moveTo\n */\n moveTo(x: number, y: number): SkPath;\n /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is\n kClose_Verb, last point is set to (0, 0) before adding line.\n\n lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.\n lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.\n\n @param x end of added line on x-axis\n @param y end of added line on y-axis\n @return reference to SkPath\n\n example: https://fiddle.skia.org/c/@Path_lineTo\n */\n lineTo(x: number, y: number): SkPath;\n\n /**\n * Returns a new path that covers the same area as the original path, but with the\n * Winding FillType. This may re-draw some contours in the path as counter-clockwise\n * instead of clockwise to achieve that effect. If such a transformation cannot\n * be done, null is returned.\n */\n makeAsWinding(): SkPath | null;\n\n /**\n * Translates all the points in the path by dx, dy.\n * @param dx\n * @param dy\n */\n offset(dx: number, dy: number): SkPath;\n\n /**\n * Relative version of arcToRotated.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param dx\n * @param dy\n */\n rArcTo(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n dx: number,\n dy: number\n ): SkPath;\n\n /**\n * Relative version of conicTo.\n * @param dx1\n * @param dy1\n * @param dx2\n * @param dy2\n * @param w\n */\n rConicTo(\n dx1: number,\n dy1: number,\n dx2: number,\n dy2: number,\n w: number\n ): SkPath;\n\n /**\n * Relative version of cubicTo.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n rCubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Relative version of moveTo.\n * @param x\n * @param y\n */\n rMoveTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of lineTo.\n * @param x\n * @param y\n */\n rLineTo(x: number, y: number): SkPath;\n\n /**\n * Relative version of quadTo.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n */\n rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Sets FillType, the rule used to fill Path.\n * @param fill\n */\n setFillType(fill: FillType): SkPath;\n\n /**\n * Specifies whether Path is volatile; whether it will be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false.\n *\n * Mark animating or temporary paths as volatile to improve performance.\n * Mark unchanging Path non-volatile to improve repeated rendering.\n * @param volatile\n */\n setIsVolatile(volatile: boolean): SkPath;\n\n /**\n * Turns this path into the filled equivalent of the stroked path. Returns false if the operation\n * fails (e.g. the path is a hairline).\n * @param opts - describe how stroked path should look.\n * If such a transformation cannot be done, null is returned.\n */\n stroke(opts?: StrokeOpts): null | SkPath;\n\n /**\n * Appends CLOSE_VERB to Path. A closed contour connects the first and last point\n * with a line, forming a continuous loop.\n */\n close(): SkPath;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is released\n */\n reset(): SkPath;\n\n /**\n * Sets Path to its initial state.\n * Removes verb array, point array, and weights, and sets FillType to Winding.\n * Internal storage associated with Path is *not* released.\n * Use rewind() instead of reset() if Path storage will be reused and performance\n * is critical.\n */\n rewind(): SkPath;\n\n /**\n * Returns minimum and maximum axes values of the lines and curves in Path.\n * Returns (0, 0, 0, 0) if Path contains no points.\n * Returned bounds width and height may be larger or smaller than area affected\n * when Path is drawn.\n *\n * Behaves identically to getBounds() when Path contains\n * only lines. If Path contains curves, computed bounds includes\n * the maximum extent of the quad, conic, or cubic; is slower than getBounds();\n * and unlike getBounds(), does not cache the result.\n */\n computeTightBounds(): SkRect;\n\n /**\n * Appends arc to Path. Arc added is part of ellipse\n * bounded by oval, from startAngle through sweepAngle. Both startAngle and\n * sweepAngle are measured in degrees, where zero degrees is aligned with the\n * positive x-axis, and positive sweeps extends arc clockwise.\n * Returns the modified path for easier chaining.\n * @param oval\n * @param startAngleInDegrees\n * @param sweepAngleInDegrees\n * @param forceMoveTo\n */\n arcToOval(\n oval: SkRect,\n startAngleInDegrees: number,\n sweepAngleInDegrees: number,\n forceMoveTo: boolean\n ): SkPath;\n\n /**\n * Appends arc to Path. Arc is implemented by one or more conics weighted to\n * describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc\n * curves from last Path Point to (x, y), choosing one of four possible routes:\n * clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details.\n * Returns the modified path for easier chaining.\n * @param rx\n * @param ry\n * @param xAxisRotate\n * @param useSmallArc\n * @param isCCW\n * @param x\n * @param y\n */\n arcToRotated(\n rx: number,\n ry: number,\n xAxisRotateInDegrees: number,\n useSmallArc: boolean,\n isCCW: boolean,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Appends arc to Path, after appending line if needed. Arc is implemented by conic\n * weighted to describe part of circle. Arc is contained by tangent from\n * last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc\n * is part of circle sized to radius, positioned so it touches both tangent lines.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param radius\n */\n arcToTangent(\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n radius: number\n ): SkPath;\n\n /**\n * Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.\n * If Path is empty, or path is closed, the last point is set to (0, 0)\n * before adding conic.\n * Returns the modified path for easier chaining.\n * @param x1\n * @param y1\n * @param x2\n * @param y2\n * @param w\n */\n conicTo(x1: number, y1: number, x2: number, y2: number, w: number): SkPath;\n\n /**\n * Returns true if the point (x, y) is contained by Path, taking into\n * account FillType.\n * @param x\n * @param y\n */\n contains(x: number, y: number): boolean;\n\n /**\n * Returns a copy of this Path.\n */\n copy(): SkPath;\n\n /**\n * Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at\n * (x3, y3). If Path is empty, or path is closed, the last point is set to\n * (0, 0) before adding cubic.\n * @param cpx1\n * @param cpy1\n * @param cpx2\n * @param cpy2\n * @param x\n * @param y\n */\n cubicTo(\n cpx1: number,\n cpy1: number,\n cpx2: number,\n cpy2: number,\n x: number,\n y: number\n ): SkPath;\n\n /**\n * Changes this path to be the dashed version of itself. This is the same effect as creating\n * a DashPathEffect and calling filterPath on this path.\n * @param on\n * @param off\n * @param phase\n */\n dash(on: number, off: number, phase: number): boolean;\n\n /**\n * Returns true if other path is equal to this path.\n * @param other\n */\n equals(other: SkPath): boolean;\n\n /**\n * Returns minimum and maximum axes values of Point array.\n * Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may\n * be larger or smaller than area affected when Path is drawn.\n */\n getBounds(): SkRect;\n\n /**\n * Return the FillType for this path.\n */\n getFillType(): FillType;\n\n /**\n Adds quad from last point towards (x1, y1), to (x2, y2).\n\n If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) before adding quad.\n\n Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; then appends kQuad_Verb to verb array;\n and (x1, y1), (x2, y2) to SkPoint array.\n\n Parameters\n x1\tcontrol SkPoint of quad on x-axis\n y1\tcontrol SkPoint of quad on y-axis\n x2\tend SkPoint of quad on x-axis\n y2\tend SkPoint of quad on y-axis\n Returns\n reference to SkPath\n example: https://fiddle.skia.org/c/@Path_quadTo\n */\n quadTo(x1: number, y1: number, x2: number, y2: number): SkPath;\n\n /**\n * Adds Rect to Path, appending kMove_Verb, three kLine_Verb, and kClose_Verb,\n * starting with top-left corner of Rect; followed by top-right, bottom-right,\n * and bottom-left if isCCW is false; or followed by bottom-left,\n * bottom-right, and top-right if isCCW is true.\n * Returns the modified path for easier chaining.\n * @param rect\n * @param isCCW\n */\n addRect(rect: SkRect, isCCW?: boolean): SkPath;\n\n /**\n * Adds rrect to Path, creating a new closed contour.\n * Returns the modified path for easier chaining.\n * @param rrect\n * @param isCCW\n */\n addRRect(rrect: InputRRect, isCCW?: boolean): SkPath;\n\n /** Appends src to SkPath, transformed by matrix. Transformed curves may have\n different verbs, SkPoint, and conic weights.\n\n If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic\n weights are added unaltered. If mode is kExtend_AddPathMode, add line\n before appending verbs, SkPoint, and conic weights.\n\n @param src SkPath verbs, SkPoint, and conic weights to add\n @param matrix transform applied to src\n @param extend extends path with line if true\n @return reference to SkPath\n */\n addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): SkPath;\n\n /**\n * Returns the Point at index in Point array. Valid range for index is\n * 0 to countPoints() - 1.\n * @param index\n */\n getPoint(index: number): SkPoint;\n\n /**\n * Returns true if there are no verbs in the path.\n */\n isEmpty(): boolean;\n\n /**\n * Returns true if the path is volatile; it will not be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false, allowing\n * Surface to attach a cache of data which speeds repeated drawing. If true, Surface\n * may not speed repeated drawing.\n */\n isVolatile(): boolean;\n\n /** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb,\n four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing\n clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.\n\n Has no effect if radius is zero or negative.\n\n @param x center of circle\n @param y center of circle\n @param radius distance from center to edge \n @return reference to SkPath\n */\n addCircle(x: number, y: number, r: number): SkPath;\n\n getLastPt(): { x: number; y: number };\n\n /** Set this path to the result of applying the Op to this path and the\n specified path: this = (this op operand).\n The resulting path will be constructed from non-overlapping contours.\n The curve order is reduced where possible so that cubics may be turned\n into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param path The second path (for difference, the subtrahend)\n @param op The operator to apply.\n @param result The product of the operands. The result may be one of the\n inputs.\n @return True if the operation succeeded.\n */\n op(path: SkPath, op: PathOp): boolean;\n\n /** Set this path to a set of non-overlapping contours that describe the\n same area as the original path.\n The curve order is reduced where possible so that cubics may\n be turned into quadratics, and quadratics maybe turned into lines.\n\n Returns true if operation was able to produce a result;\n otherwise, result is unmodified.\n\n @param result The simplified path. The result may be the input.\n @return True if simplification succeeded.\n */\n simplify(): boolean;\n\n /**\n * Returns this path as an SVG string.\n */\n toSVGString(): string;\n\n /**\n * Take start and stop \"t\" values (values between 0...1), and modify this path such that\n * it is a subset of the original path.\n * The trim values apply to the entire path, so if it contains several contours, all of them\n * are including in the calculation.\n * Null is returned if either input value is NaN.\n * @param startT - a value in the range [0.0, 1.0]. 0.0 is the beginning of the path.\n * @param stopT - a value in the range [0.0, 1.0]. 1.0 is the end of the path.\n * @param isComplement\n */\n trim(startT: number, stopT: number, isComplement: boolean): null | SkPath;\n\n /**\n * Transforms the path by the specified matrix.\n */\n transform(m3: InputMatrix): SkPath;\n\n /**\n * Interpolates between Path with point array of equal size.\n * Copy verb array and weights to result, and set result path to a weighted\n * average of this path array and ending path.\n\n * weight is most useful when between zero (ending path) and\n one (this path); will work with values outside of this\n range.\n\n * interpolate() returns undefined if path is not\n * the same size as ending path. Call isInterpolatable() to check Path\n * compatibility prior to calling interpolate().\n\n * @param ending path to interpolate with\n * @param weight contribution of this path, and\n * one minus contribution of ending path\n * @param output path to be replaced with the interpolated averages\n * @return Path replaced by interpolated averages or null if \n * not interpolatable\n * */\n interpolate(end: SkPath, weight: number, output?: SkPath): SkPath | null;\n\n /** Returns true if Path contain equal verbs and equal weights.\n * @param compare path to compare\n * @return true if Path can be interpolated equivalent\n *\n * */\n isInterpolatable(compare: SkPath): boolean;\n\n /**\n * Serializes the contents of this path as a series of commands.\n */\n toCmds(): PathCommand[];\n}\n"],"mappings":"AAOA;AACA;AACA;;AAcA,WAAYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAOpB,WAAYC,MAAM,0BAANA,MAAM;EAANA,MAAM,CAANA,MAAM;EACJ;EADFA,MAAM,CAANA,MAAM;EAEL;EAFDA,MAAM,CAANA,MAAM;EAGT;EAHGA,MAAM,CAANA,MAAM;EAIX;EAJKA,MAAM,CAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAQlB,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAWpB,OAAO,MAAMC,MAAM,GAAIC,GAAiC,IAAoB;EAC1E,SAAS;;EACT,OAAOA,GAAG,KAAK,IAAI,IAAIA,GAAG,CAACC,YAAY,KAAK,MAAM;AACpD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["FillType","PathOp","PathVerb","isPath","obj","__typename__"],"sources":["Path.ts"],"sourcesContent":["import type { SkRect } from \"../Rect\";\nimport type { SkPoint } from \"../Point\";\nimport type { StrokeJoin, StrokeCap } from \"../Paint\";\nimport type { SkJSIInstance } from \"../JsiInstance\";\n\n/**\n * Options used for Path.stroke(). If an option is omitted, a sensible default will be used.\n */\nexport interface StrokeOpts {\n /** The width of the stroked lines. */\n width?: number;\n miter_limit?: number;\n /**\n * if > 1, increase precision, else if (0 < resScale < 1) reduce precision to\n * favor speed and size\n */\n precision?: number;\n join?: StrokeJoin;\n cap?: StrokeCap;\n}\n\nexport enum FillType {\n Winding,\n EvenOdd,\n InverseWinding,\n InverseEvenOdd,\n}\n\nexport enum PathOp {\n Difference, //!< subtract the op path from the first path\n Intersect, //!< intersect the two paths\n Union, //!< union (inclusive-or) the two paths\n XOR, //!< exclusive-or the two paths\n ReverseDifference,\n}\n\nexport enum PathVerb {\n Move,\n Line,\n Quad,\n Conic,\n Cubic,\n Close,\n}\n\nexport type PathCommand = number[];\n\nexport const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath => {\n \"worklet\";\n return obj !== null && obj.__typename__ === \"Path\";\n};\n\nexport interface SkPath extends SkJSIInstance<\"Path\"> {\n /**\n * Returns the number of points in this path. Initially zero.\n */\n countPoints(): number;\n\n /**\n * Returns minimum and maximum axes values of the lines and curves in Path.\n * Returns (0, 0, 0, 0) if Path contains no points.\n * Returned bounds width and height may be larger or smaller than area affected\n * when Path is drawn.\n *\n * Behaves identically to getBounds() when Path contains\n * only lines. If Path contains curves, computed bounds includes\n * the maximum extent of the quad, conic, or cubic; is slower than getBounds();\n * and unlike getBounds(), does not cache the result.\n */\n computeTightBounds(): SkRect;\n\n /**\n * Returns true if the point (x, y) is contained by Path, taking into\n * account FillType.\n * @param x\n * @param y\n */\n contains(x: number, y: number): boolean;\n\n /**\n * Returns a copy of this Path.\n */\n copy(): SkPath;\n\n /**\n * Returns true if other path is equal to this path.\n * @param other\n */\n equals(other: SkPath): boolean;\n\n /**\n * Returns minimum and maximum axes values of Point array.\n * Returns (0, 0, 0, 0) if Path contains no points. Returned bounds width and height may\n * be larger or smaller than area affected when Path is drawn.\n */\n getBounds(): SkRect;\n\n /**\n * Return the FillType for this path.\n */\n getFillType(): FillType;\n\n /**\n * Returns the Point at index in Point array. Valid range for index is\n * 0 to countPoints() - 1.\n * @param index\n */\n getPoint(index: number): SkPoint;\n\n /**\n * Returns true if there are no verbs in the path.\n */\n isEmpty(): boolean;\n\n /**\n * Returns true if the path is volatile; it will not be altered or discarded\n * by the caller after it is drawn. Path by default have volatile set false, allowing\n * Surface to attach a cache of data which speeds repeated drawing. If true, Surface\n * may not speed repeated drawing.\n */\n isVolatile(): boolean;\n\n getLastPt(): { x: number; y: number };\n\n /**\n * Returns this path as an SVG string.\n */\n toSVGString(): string;\n\n /**\n * Interpolates between Path with point array of equal size.\n * Copy verb array and weights to result, and set result path to a weighted\n * average of this path array and ending path.\n\n * weight is most useful when between zero (ending path) and\n one (this path); will work with values outside of this\n range.\n\n * interpolate() returns undefined if path is not\n * the same size as ending path. Call isInterpolatable() to check Path\n * compatibility prior to calling interpolate().\n\n * @param ending path to interpolate with\n * @param weight contribution of this path, and\n * one minus contribution of ending path\n * @return New path of interpolated averages or null if \n * not interpolatable\n * */\n interpolate(end: SkPath, weight: number): SkPath | null;\n\n /** Returns true if Path contain equal verbs and equal weights.\n * @param compare path to compare\n * @return true if Path can be interpolated equivalent\n *\n * */\n isInterpolatable(compare: SkPath): boolean;\n\n /**\n * Serializes the contents of this path as a series of commands.\n */\n toCmds(): PathCommand[];\n}\n"],"mappings":"AAKA;AACA;AACA;;AAcA,WAAYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAOpB,WAAYC,MAAM,0BAANA,MAAM;EAANA,MAAM,CAANA,MAAM;EACJ;EADFA,MAAM,CAANA,MAAM;EAEL;EAFDA,MAAM,CAANA,MAAM;EAGT;EAHGA,MAAM,CAANA,MAAM;EAIX;EAJKA,MAAM,CAANA,MAAM;EAAA,OAANA,MAAM;AAAA;AAQlB,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAWpB,OAAO,MAAMC,MAAM,GAAIC,GAAiC,IAAoB;EAC1E,SAAS;;EACT,OAAOA,GAAG,KAAK,IAAI,IAAIA,GAAG,CAACC,YAAY,KAAK,MAAM;AACpD,CAAC","ignoreList":[]}
|
|
@@ -51,4 +51,14 @@ export interface JsiRecorder extends BaseRecorder {
|
|
|
51
51
|
play(picture: SkPicture): void;
|
|
52
52
|
applyUpdates(variables: SharedValue<unknown>[]): void;
|
|
53
53
|
reset(): void;
|
|
54
|
+
/**
|
|
55
|
+
* Unique id of the native recording, used to tag the updates sent to the
|
|
56
|
+
* view that owns it.
|
|
57
|
+
*/
|
|
58
|
+
getId(): number;
|
|
59
|
+
/**
|
|
60
|
+
* Releases the wrapper's reference to the native recorder. A recording
|
|
61
|
+
* that a view owns stays alive until the view replaces it or is torn down.
|
|
62
|
+
*/
|
|
63
|
+
dispose(): void;
|
|
54
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n TextProps,\n AtlasProps,\n BlurMaskFilterProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n CTMProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n NodeType,\n OvalProps,\n PaintProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n VerticesProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>): void;\n restoreGroup(): void;\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;\n restorePaint(): void;\n restorePaintDeclaration(): void;\n materializePaint(): void;\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void;\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;\n composePathEffect(): void;\n composeColorFilter(): void;\n composeImageFilter(): void;\n saveCTM(props: AnimatedProps<CTMProps>): void;\n restoreCTM(): void;\n drawPaint(): void;\n saveLayer(): void;\n saveBackdropFilter(): void;\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ): void;\n drawImage(props: AnimatedProps<ImageProps>): void;\n drawCircle(props: AnimatedProps<CircleProps>): void;\n drawPoints(props: AnimatedProps<PointsProps>): void;\n drawPath(props: AnimatedProps<PathProps>): void;\n drawRect(props: AnimatedProps<RectProps>): void;\n drawRRect(props: AnimatedProps<RoundedRectProps>): void;\n drawOval(props: AnimatedProps<OvalProps>): void;\n drawLine(props: AnimatedProps<LineProps>): void;\n drawPatch(props: AnimatedProps<PatchProps>): void;\n drawVertices(props: AnimatedProps<VerticesProps>): void;\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void;\n drawText(props: AnimatedProps<TextProps>): void;\n drawTextPath(props: AnimatedProps<TextPathProps>): void;\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void;\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void;\n drawPicture(props: AnimatedProps<PictureProps>): void;\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;\n drawParagraph(props: AnimatedProps<ParagraphProps>): void;\n drawSkottie(props: AnimatedProps<SkottieProps>): void;\n drawAtlas(props: AnimatedProps<AtlasProps>): void;\n}\n\nexport interface JsiRecorder extends BaseRecorder {\n play(picture: SkPicture): void;\n applyUpdates(variables: SharedValue<unknown>[]): void;\n reset(): void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["Recorder.ts"],"sourcesContent":["import type { SharedValue } from \"react-native-reanimated\";\n\nimport type {\n TextProps,\n AtlasProps,\n BlurMaskFilterProps,\n BoxProps,\n BoxShadowProps,\n CircleProps,\n CTMProps,\n DiffRectProps,\n GlyphsProps,\n ImageProps,\n ImageSVGProps,\n LineProps,\n NodeType,\n OvalProps,\n PaintProps,\n ParagraphProps,\n PatchProps,\n PathProps,\n PictureProps,\n PointsProps,\n RectProps,\n RoundedRectProps,\n TextBlobProps,\n TextPathProps,\n VerticesProps,\n SkottieProps,\n DrawingNodeProps,\n} from \"../../dom/types\";\nimport type { AnimatedProps } from \"../../renderer/processors/Animations/Animations\";\n\nimport type { SkPicture } from \"./Picture\";\n\nexport interface BaseRecorder {\n saveGroup(props?: AnimatedProps<Pick<DrawingNodeProps, \"zIndex\">>): void;\n restoreGroup(): void;\n savePaint(props: AnimatedProps<PaintProps>, standalone: boolean): void;\n restorePaint(): void;\n restorePaintDeclaration(): void;\n materializePaint(): void;\n pushPathEffect(pathEffectType: NodeType, props: AnimatedProps<unknown>): void;\n pushImageFilter(\n imageFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushColorFilter(\n colorFilterType: NodeType,\n props: AnimatedProps<unknown>\n ): void;\n pushShader(\n shaderType: NodeType,\n props: AnimatedProps<unknown>,\n children: number\n ): void;\n pushBlurMaskFilter(props: AnimatedProps<BlurMaskFilterProps>): void;\n composePathEffect(): void;\n composeColorFilter(): void;\n composeImageFilter(): void;\n saveCTM(props: AnimatedProps<CTMProps>): void;\n restoreCTM(): void;\n drawPaint(): void;\n saveLayer(): void;\n saveBackdropFilter(): void;\n drawBox(\n boxProps: AnimatedProps<BoxProps>,\n shadows: {\n props: BoxShadowProps;\n animatedProps?: Record<string, SharedValue<unknown>>;\n }[]\n ): void;\n drawImage(props: AnimatedProps<ImageProps>): void;\n drawCircle(props: AnimatedProps<CircleProps>): void;\n drawPoints(props: AnimatedProps<PointsProps>): void;\n drawPath(props: AnimatedProps<PathProps>): void;\n drawRect(props: AnimatedProps<RectProps>): void;\n drawRRect(props: AnimatedProps<RoundedRectProps>): void;\n drawOval(props: AnimatedProps<OvalProps>): void;\n drawLine(props: AnimatedProps<LineProps>): void;\n drawPatch(props: AnimatedProps<PatchProps>): void;\n drawVertices(props: AnimatedProps<VerticesProps>): void;\n drawDiffRect(props: AnimatedProps<DiffRectProps>): void;\n drawText(props: AnimatedProps<TextProps>): void;\n drawTextPath(props: AnimatedProps<TextPathProps>): void;\n drawTextBlob(props: AnimatedProps<TextBlobProps>): void;\n drawGlyphs(props: AnimatedProps<GlyphsProps>): void;\n drawPicture(props: AnimatedProps<PictureProps>): void;\n drawImageSVG(props: AnimatedProps<ImageSVGProps>): void;\n drawParagraph(props: AnimatedProps<ParagraphProps>): void;\n drawSkottie(props: AnimatedProps<SkottieProps>): void;\n drawAtlas(props: AnimatedProps<AtlasProps>): void;\n}\n\nexport interface JsiRecorder extends BaseRecorder {\n play(picture: SkPicture): void;\n applyUpdates(variables: SharedValue<unknown>[]): void;\n reset(): void;\n /**\n * Unique id of the native recording, used to tag the updates sent to the\n * view that owns it.\n */\n getId(): number;\n /**\n * Releases the wrapper's reference to the native recorder. A recording\n * that a view owns stays alive until the view replaces it or is torn down.\n */\n dispose(): void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isShader","obj","__typename__","isVector","x","undefined","y","processValue","values","value","push","Array","isArray","forEach","v","Float32Array","processUniforms","source","uniforms","builder","result","uniformsCount","getUniformCount","i","name","getUniformName","Error","uniformValue","setUniform"],"sources":["Shader.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { Vector } from \"../Point\";\nimport type { SkRuntimeEffect, SkRuntimeShaderBuilder } from \"../RuntimeEffect\";\n\nexport const isShader = (obj: SkJSIInstance<string> | null): obj is SkShader =>\n obj !== null && obj.__typename__ === \"Shader\";\n\nexport type SkShader = SkJSIInstance<\"Shader\">;\n\nexport type Uniform =\n
|
|
1
|
+
{"version":3,"names":["isShader","obj","__typename__","isVector","x","undefined","y","processValue","values","value","push","Array","isArray","forEach","v","Float32Array","processUniforms","source","uniforms","builder","result","uniformsCount","getUniformCount","i","name","getUniformName","Error","uniformValue","setUniform"],"sources":["Shader.ts"],"sourcesContent":["import type { SkJSIInstance } from \"../JsiInstance\";\nimport type { Vector } from \"../Point\";\nimport type { SkRuntimeEffect, SkRuntimeShaderBuilder } from \"../RuntimeEffect\";\n\nexport const isShader = (obj: SkJSIInstance<string> | null): obj is SkShader =>\n obj !== null && obj.__typename__ === \"Shader\";\n\nexport type SkShader = SkJSIInstance<\"Shader\">;\n\nexport type Uniform =\n number | Vector | Float32Array | readonly Uniform[] | Uniform[];\n\nexport interface Uniforms {\n [name: string]: Uniform;\n}\n\nconst isVector = (obj: unknown): obj is Vector => {\n \"worklet\";\n // We have an issue to check property existence on JSI backed instances\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return (obj as any).x !== undefined && (obj as any).y !== undefined;\n};\n\nfunction processValue(values: number[], value: Uniform) {\n \"worklet\";\n if (typeof value === \"number\") {\n values.push(value);\n } else if (Array.isArray(value)) {\n value.forEach((v) => processValue(values, v));\n } else if (isVector(value)) {\n values.push(value.x, value.y);\n } else if (value instanceof Float32Array) {\n values.push(...value);\n }\n}\n\nexport const processUniforms = (\n source: SkRuntimeEffect,\n uniforms: Uniforms,\n builder?: SkRuntimeShaderBuilder\n) => {\n \"worklet\";\n const result: number[] = [];\n const uniformsCount = source.getUniformCount();\n for (let i = 0; i < uniformsCount; i++) {\n const name = source.getUniformName(i);\n const value = uniforms[name];\n if (value === undefined) {\n throw new Error(\n `The runtime effect has the uniform value \"${name}\" declared, but it is missing from the uniforms property of the Runtime effect.`\n );\n }\n if (builder === undefined) {\n processValue(result, value);\n } else {\n const uniformValue: number[] = [];\n processValue(uniformValue, value);\n builder.setUniform(name, uniformValue);\n result.push(...uniformValue);\n }\n }\n return result;\n};\n"],"mappings":"AAIA,OAAO,MAAMA,QAAQ,GAAIC,GAAiC,IACxDA,GAAG,KAAK,IAAI,IAAIA,GAAG,CAACC,YAAY,KAAK,QAAQ;AAW/C,MAAMC,QAAQ,GAAIF,GAAY,IAAoB;EAChD,SAAS;;EACT;EACA;EACA,OAAQA,GAAG,CAASG,CAAC,KAAKC,SAAS,IAAKJ,GAAG,CAASK,CAAC,KAAKD,SAAS;AACrE,CAAC;AAED,SAASE,YAAYA,CAACC,MAAgB,EAAEC,KAAc,EAAE;EACtD,SAAS;;EACT,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7BD,MAAM,CAACE,IAAI,CAACD,KAAK,CAAC;EACpB,CAAC,MAAM,IAAIE,KAAK,CAACC,OAAO,CAACH,KAAK,CAAC,EAAE;IAC/BA,KAAK,CAACI,OAAO,CAAEC,CAAC,IAAKP,YAAY,CAACC,MAAM,EAAEM,CAAC,CAAC,CAAC;EAC/C,CAAC,MAAM,IAAIX,QAAQ,CAACM,KAAK,CAAC,EAAE;IAC1BD,MAAM,CAACE,IAAI,CAACD,KAAK,CAACL,CAAC,EAAEK,KAAK,CAACH,CAAC,CAAC;EAC/B,CAAC,MAAM,IAAIG,KAAK,YAAYM,YAAY,EAAE;IACxCP,MAAM,CAACE,IAAI,CAAC,GAAGD,KAAK,CAAC;EACvB;AACF;AAEA,OAAO,MAAMO,eAAe,GAAGA,CAC7BC,MAAuB,EACvBC,QAAkB,EAClBC,OAAgC,KAC7B;EACH,SAAS;;EACT,MAAMC,MAAgB,GAAG,EAAE;EAC3B,MAAMC,aAAa,GAAGJ,MAAM,CAACK,eAAe,CAAC,CAAC;EAC9C,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGF,aAAa,EAAEE,CAAC,EAAE,EAAE;IACtC,MAAMC,IAAI,GAAGP,MAAM,CAACQ,cAAc,CAACF,CAAC,CAAC;IACrC,MAAMd,KAAK,GAAGS,QAAQ,CAACM,IAAI,CAAC;IAC5B,IAAIf,KAAK,KAAKJ,SAAS,EAAE;MACvB,MAAM,IAAIqB,KAAK,CACb,6CAA6CF,IAAI,iFACnD,CAAC;IACH;IACA,IAAIL,OAAO,KAAKd,SAAS,EAAE;MACzBE,YAAY,CAACa,MAAM,EAAEX,KAAK,CAAC;IAC7B,CAAC,MAAM;MACL,MAAMkB,YAAsB,GAAG,EAAE;MACjCpB,YAAY,CAACoB,YAAY,EAAElB,KAAK,CAAC;MACjCU,OAAO,CAACS,UAAU,CAACJ,IAAI,EAAEG,YAAY,CAAC;MACtCP,MAAM,CAACV,IAAI,CAAC,GAAGiB,YAAY,CAAC;IAC9B;EACF;EACA,OAAOP,MAAM;AACf,CAAC","ignoreList":[]}
|
|
@@ -23,4 +23,20 @@ export interface SurfaceFactory {
|
|
|
23
23
|
* @param opts - optional surface options (e.g. colorSpace: "display-p3" | "srgb").
|
|
24
24
|
*/
|
|
25
25
|
MakeOffscreen: (width: number, height: number, opts?: SurfaceOptions) => SkSurface | null;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a GPU backed surface that draws directly into a WebGPU texture
|
|
28
|
+
* (zero-copy). The texture must be created on Skia's device
|
|
29
|
+
* (importDevice(Skia.getNativeDevice())) with RENDER_ATTACHMENT usage; add
|
|
30
|
+
* TEXTURE_BINDING to sample what Skia drew from WebGPU after each flush().
|
|
31
|
+
* The surface holds its own reference to the texture and keeps it alive
|
|
32
|
+
* for its lifetime, so the caller may release the GPUTexture once the
|
|
33
|
+
* surface exists. Calling destroy() on the GPUTexture still invalidates
|
|
34
|
+
* the surface.
|
|
35
|
+
*
|
|
36
|
+
* Note: This method is only available when the Graphite backend is enabled.
|
|
37
|
+
*
|
|
38
|
+
* @param pointer - The WGPUTexture pointer (texture.nativePointer)
|
|
39
|
+
* @returns An SkSurface rendering into the texture, or throws if the texture is invalid
|
|
40
|
+
*/
|
|
41
|
+
MakeFromNativeTexture: (pointer: bigint) => SkSurface;
|
|
26
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ColorSpace","SRGB","DisplayP3"],"sources":["SurfaceFactory.ts"],"sourcesContent":["import type { SkSurface } from \"./Surface\";\n\nexport const ColorSpace = {\n SRGB: \"srgb\",\n DisplayP3: \"display-p3\",\n} as const;\n\nexport type ColorSpaceValue = (typeof ColorSpace)[keyof typeof ColorSpace];\n\nexport interface SurfaceOptions {\n colorSpace: ColorSpaceValue;\n}\n\nexport interface SurfaceFactory {\n /**\n * Returns a CPU backed surface with the given dimensions, an SRGB colorspace, Unpremul\n * alphaType and 8888 color type. The pixels belonging to this surface will be in memory and\n * not visible.\n * @param width - number of pixels of the width of the drawable area.\n * @param height - number of pixels of the height of the drawable area.\n */\n Make: (width: number, height: number) => SkSurface | null;\n\n /**\n * Creates a GPU backed surface.\n * @param width - number of pixels of the width of the drawable area.\n * @param height - number of pixels of the height of the drawable area.\n * @param opts - optional surface options (e.g. colorSpace: \"display-p3\" | \"srgb\").\n */\n MakeOffscreen: (\n width: number,\n height: number,\n opts?: SurfaceOptions\n ) => SkSurface | null;\n}\n"],"mappings":"AAEA,OAAO,MAAMA,UAAU,GAAG;EACxBC,IAAI,EAAE,MAAM;EACZC,SAAS,EAAE;AACb,CAAU","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["ColorSpace","SRGB","DisplayP3"],"sources":["SurfaceFactory.ts"],"sourcesContent":["import type { SkSurface } from \"./Surface\";\n\nexport const ColorSpace = {\n SRGB: \"srgb\",\n DisplayP3: \"display-p3\",\n} as const;\n\nexport type ColorSpaceValue = (typeof ColorSpace)[keyof typeof ColorSpace];\n\nexport interface SurfaceOptions {\n colorSpace: ColorSpaceValue;\n}\n\nexport interface SurfaceFactory {\n /**\n * Returns a CPU backed surface with the given dimensions, an SRGB colorspace, Unpremul\n * alphaType and 8888 color type. The pixels belonging to this surface will be in memory and\n * not visible.\n * @param width - number of pixels of the width of the drawable area.\n * @param height - number of pixels of the height of the drawable area.\n */\n Make: (width: number, height: number) => SkSurface | null;\n\n /**\n * Creates a GPU backed surface.\n * @param width - number of pixels of the width of the drawable area.\n * @param height - number of pixels of the height of the drawable area.\n * @param opts - optional surface options (e.g. colorSpace: \"display-p3\" | \"srgb\").\n */\n MakeOffscreen: (\n width: number,\n height: number,\n opts?: SurfaceOptions\n ) => SkSurface | null;\n\n /**\n * Creates a GPU backed surface that draws directly into a WebGPU texture\n * (zero-copy). The texture must be created on Skia's device\n * (importDevice(Skia.getNativeDevice())) with RENDER_ATTACHMENT usage; add\n * TEXTURE_BINDING to sample what Skia drew from WebGPU after each flush().\n * The surface holds its own reference to the texture and keeps it alive\n * for its lifetime, so the caller may release the GPUTexture once the\n * surface exists. Calling destroy() on the GPUTexture still invalidates\n * the surface.\n *\n * Note: This method is only available when the Graphite backend is enabled.\n *\n * @param pointer - The WGPUTexture pointer (texture.nativePointer)\n * @returns An SkSurface rendering into the texture, or throws if the texture is invalid\n */\n MakeFromNativeTexture: (pointer: bigint) => SkSurface;\n}\n"],"mappings":"AAEA,OAAO,MAAMA,UAAU,GAAG;EACxBC,IAAI,EAAE,MAAM;EACZC,SAAS,EAAE;AACb,CAAU","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { CanvasKit, PathBuilder as CKPathBuilder } from "canvaskit-wasm";
|
|
2
|
-
import type { FillType, PathCommand,
|
|
2
|
+
import type { FillType, PathCommand, SkPath, SkPoint, SkRect, InputMatrix } from "../types";
|
|
3
3
|
import { HostObject } from "./Host";
|
|
4
4
|
import { JsiSkRect } from "./JsiSkRect";
|
|
5
5
|
export declare const toMatrix3x3: (m: InputMatrix) => number[];
|
|
6
6
|
/**
|
|
7
|
-
* SkPath wraps a CK PathBuilder internally, providing
|
|
8
|
-
* methods
|
|
7
|
+
* SkPath wraps a CK PathBuilder internally, providing immutable query
|
|
8
|
+
* methods. Use snapshot() internally to get
|
|
9
9
|
* an immutable CK Path for read-only operations.
|
|
10
10
|
*/
|
|
11
11
|
export declare class JsiSkPath extends HostObject<CKPathBuilder, "Path"> implements SkPath {
|
|
@@ -14,40 +14,6 @@ export declare class JsiSkPath extends HostObject<CKPathBuilder, "Path"> impleme
|
|
|
14
14
|
private asPath;
|
|
15
15
|
/** Extract an immutable CK Path from a JsiSkPath value (for CK interop). */
|
|
16
16
|
static pathFromValue(value: SkPath): import("canvaskit-wasm").Path;
|
|
17
|
-
addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): this;
|
|
18
|
-
addArc(oval: SkRect, startAngleInDegrees: number, sweepAngleInDegrees: number): this;
|
|
19
|
-
addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): this;
|
|
20
|
-
addPoly(points: SkPoint[], close: boolean): this;
|
|
21
|
-
addRect(rect: SkRect, isCCW?: boolean): this;
|
|
22
|
-
addRRect(rrect: InputRRect, isCCW?: boolean): this;
|
|
23
|
-
addCircle(x: number, y: number, r: number): this;
|
|
24
|
-
moveTo(x: number, y: number): this;
|
|
25
|
-
rMoveTo(x: number, y: number): this;
|
|
26
|
-
lineTo(x: number, y: number): this;
|
|
27
|
-
rLineTo(x: number, y: number): this;
|
|
28
|
-
quadTo(x1: number, y1: number, x2: number, y2: number): this;
|
|
29
|
-
rQuadTo(x1: number, y1: number, x2: number, y2: number): this;
|
|
30
|
-
conicTo(x1: number, y1: number, x2: number, y2: number, w: number): this;
|
|
31
|
-
rConicTo(x1: number, y1: number, x2: number, y2: number, w: number): this;
|
|
32
|
-
cubicTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number): this;
|
|
33
|
-
rCubicTo(cpx1: number, cpy1: number, cpx2: number, cpy2: number, x: number, y: number): this;
|
|
34
|
-
close(): this;
|
|
35
|
-
reset(): this;
|
|
36
|
-
rewind(): this;
|
|
37
|
-
arcToOval(oval: SkRect, startAngleInDegrees: number, sweepAngleInDegrees: number, forceMoveTo: boolean): this;
|
|
38
|
-
arcToRotated(rx: number, ry: number, xAxisRotateInDegrees: number, useSmallArc: boolean, isCCW: boolean, x: number, y: number): this;
|
|
39
|
-
rArcTo(rx: number, ry: number, xAxisRotateInDegrees: number, useSmallArc: boolean, isCCW: boolean, dx: number, dy: number): this;
|
|
40
|
-
arcToTangent(x1: number, y1: number, x2: number, y2: number, radius: number): this;
|
|
41
|
-
setFillType(fill: FillType): this;
|
|
42
|
-
setIsVolatile(_volatile: boolean): this;
|
|
43
|
-
offset(dx: number, dy: number): this;
|
|
44
|
-
transform(m: InputMatrix): this;
|
|
45
|
-
makeAsWinding(): this | null;
|
|
46
|
-
simplify(): boolean;
|
|
47
|
-
op(path: SkPath, op: PathOp): boolean;
|
|
48
|
-
dash(on: number, off: number, phase: number): boolean;
|
|
49
|
-
stroke(opts?: StrokeOpts): this | null;
|
|
50
|
-
trim(start: number, stop: number, isComplement: boolean): this | null;
|
|
51
17
|
countPoints(): number;
|
|
52
18
|
computeTightBounds(): SkRect;
|
|
53
19
|
contains(x: number, y: number): boolean;
|
|
@@ -64,6 +30,6 @@ export declare class JsiSkPath extends HostObject<CKPathBuilder, "Path"> impleme
|
|
|
64
30
|
};
|
|
65
31
|
toSVGString(): string;
|
|
66
32
|
isInterpolatable(path2: SkPath): boolean;
|
|
67
|
-
interpolate(end: SkPath, weight: number
|
|
33
|
+
interpolate(end: SkPath, weight: number): SkPath | null;
|
|
68
34
|
toCmds(): PathCommand[];
|
|
69
35
|
}
|