@shopify/react-native-skia 2.13.0 → 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.
Files changed (124) hide show
  1. package/android/CMakeLists.txt +2 -0
  2. package/android/cpp/jni/include/JniSkiaPictureView.h +16 -15
  3. package/android/cpp/rnskia-android/OpenGLContext.h +1 -1
  4. package/android/cpp/rnskia-android/gl/Surface.h +1 -1
  5. package/apple/RNSkApplePlatformContext.h +3 -4
  6. package/apple/RNSkiaModule.h +11 -3
  7. package/apple/RNSkiaModule.mm +46 -19
  8. package/apple/SkiaPictureView.mm +2 -2
  9. package/apple/SkiaUIView.h +0 -1
  10. package/apple/SkiaUIView.mm +1 -1
  11. package/apple/ViewScreenshotService.h +2 -2
  12. package/apple/ViewScreenshotService.mm +5 -4
  13. package/cpp/api/JsiSkImage.h +1 -1
  14. package/cpp/api/JsiSkImageFilter.h +3 -1
  15. package/cpp/api/JsiSkParagraph.h +2 -1
  16. package/cpp/api/JsiSkParagraphBuilder.h +1 -1
  17. package/cpp/api/JsiSkParagraphBuilderFactory.h +1 -1
  18. package/cpp/api/JsiSkPath.h +11 -435
  19. package/cpp/api/JsiSkPathBuilder.h +11 -4
  20. package/cpp/api/JsiSkPictureRecorder.h +2 -1
  21. package/cpp/api/JsiSkShader.h +3 -1
  22. package/cpp/api/JsiSkSkottie.h +29 -28
  23. package/cpp/api/JsiSkStrutStyle.h +1 -1
  24. package/cpp/api/JsiSkSurfaceFactory.h +41 -0
  25. package/cpp/api/recorder/Command.h +1 -1
  26. package/cpp/api/recorder/Convertor.h +153 -132
  27. package/cpp/api/recorder/DataTypes.h +12 -12
  28. package/cpp/api/recorder/DrawingCtx.h +1 -1
  29. package/cpp/api/recorder/ImageFit.h +8 -5
  30. package/cpp/api/recorder/JsiRecorder.h +14 -31
  31. package/cpp/api/recorder/Paint.h +3 -3
  32. package/cpp/api/recorder/RNRecorder.h +56 -0
  33. package/cpp/api/third_party/base64.cpp +1 -1
  34. package/cpp/jsi/JSICache.cpp +23 -0
  35. package/cpp/jsi/JSICache.h +28 -1
  36. package/cpp/jsi/NativeObject.h +36 -7
  37. package/cpp/jsi/ViewProperty.cpp +23 -0
  38. package/cpp/jsi/ViewProperty.h +31 -10
  39. package/cpp/rnskia/RNDawnContext.h +34 -1
  40. package/cpp/rnskia/RNSkJsiViewApi.h +69 -2
  41. package/cpp/rnskia/RNSkPictureView.cpp +58 -0
  42. package/cpp/rnskia/RNSkPictureView.h +110 -24
  43. package/lib/commonjs/Platform/IPlatform.js.map +1 -1
  44. package/lib/commonjs/animation/functions/interpolate.js.map +1 -1
  45. package/lib/commonjs/animation/functions/interpolatePaths.js +18 -0
  46. package/lib/commonjs/animation/functions/interpolatePaths.js.map +1 -1
  47. package/lib/commonjs/skia/core/Image.js.map +1 -1
  48. package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  49. package/lib/commonjs/skia/types/Path/Path.d.ts +2 -336
  50. package/lib/commonjs/skia/types/Path/Path.js.map +1 -1
  51. package/lib/commonjs/skia/types/Recorder.d.ts +10 -0
  52. package/lib/commonjs/skia/types/Recorder.js.map +1 -1
  53. package/lib/commonjs/skia/types/Shader/Shader.js.map +1 -1
  54. package/lib/commonjs/skia/types/Surface/SurfaceFactory.d.ts +16 -0
  55. package/lib/commonjs/skia/types/Surface/SurfaceFactory.js.map +1 -1
  56. package/lib/commonjs/skia/web/JsiSkPath.d.ts +4 -38
  57. package/lib/commonjs/skia/web/JsiSkPath.js +3 -275
  58. package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
  59. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  60. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js +3 -0
  61. package/lib/commonjs/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  62. package/lib/commonjs/sksg/Container.native.d.ts +15 -1
  63. package/lib/commonjs/sksg/Container.native.js +34 -33
  64. package/lib/commonjs/sksg/Container.native.js.map +1 -1
  65. package/lib/commonjs/specs/NativeSkiaModule.web.js +4 -0
  66. package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
  67. package/lib/commonjs/views/types.d.ts +9 -0
  68. package/lib/commonjs/views/types.js.map +1 -1
  69. package/lib/module/Platform/IPlatform.js.map +1 -1
  70. package/lib/module/animation/functions/interpolate.js.map +1 -1
  71. package/lib/module/animation/functions/interpolatePaths.js +18 -0
  72. package/lib/module/animation/functions/interpolatePaths.js.map +1 -1
  73. package/lib/module/skia/core/Image.js.map +1 -1
  74. package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
  75. package/lib/module/skia/types/Path/Path.d.ts +2 -336
  76. package/lib/module/skia/types/Path/Path.js.map +1 -1
  77. package/lib/module/skia/types/Recorder.d.ts +10 -0
  78. package/lib/module/skia/types/Recorder.js.map +1 -1
  79. package/lib/module/skia/types/Shader/Shader.js.map +1 -1
  80. package/lib/module/skia/types/Surface/SurfaceFactory.d.ts +16 -0
  81. package/lib/module/skia/types/Surface/SurfaceFactory.js.map +1 -1
  82. package/lib/module/skia/web/JsiSkPath.d.ts +4 -38
  83. package/lib/module/skia/web/JsiSkPath.js +4 -276
  84. package/lib/module/skia/web/JsiSkPath.js.map +1 -1
  85. package/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  86. package/lib/module/skia/web/JsiSkSurfaceFactory.js +4 -1
  87. package/lib/module/skia/web/JsiSkSurfaceFactory.js.map +1 -1
  88. package/lib/module/sksg/Container.native.d.ts +15 -1
  89. package/lib/module/sksg/Container.native.js +34 -33
  90. package/lib/module/sksg/Container.native.js.map +1 -1
  91. package/lib/module/specs/NativeSkiaModule.web.js +4 -0
  92. package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
  93. package/lib/module/views/types.d.ts +9 -0
  94. package/lib/module/views/types.js.map +1 -1
  95. package/lib/typescript/lib/commonjs/skia/web/JsiSkPath.d.ts +1 -35
  96. package/lib/typescript/lib/commonjs/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
  97. package/lib/typescript/lib/commonjs/sksg/Container.native.d.ts +15 -1
  98. package/lib/typescript/lib/module/skia/web/JsiSkPath.d.ts +3 -37
  99. package/lib/typescript/lib/module/skia/web/JsiSkSurfaceFactory.d.ts +1 -0
  100. package/lib/typescript/lib/module/sksg/Container.native.d.ts +15 -1
  101. package/lib/typescript/src/skia/types/Path/Path.d.ts +2 -336
  102. package/lib/typescript/src/skia/types/Recorder.d.ts +10 -0
  103. package/lib/typescript/src/skia/types/Surface/SurfaceFactory.d.ts +16 -0
  104. package/lib/typescript/src/skia/web/JsiSkPath.d.ts +4 -38
  105. package/lib/typescript/src/skia/web/JsiSkSurfaceFactory.d.ts +2 -1
  106. package/lib/typescript/src/sksg/Container.native.d.ts +15 -1
  107. package/lib/typescript/src/views/types.d.ts +9 -0
  108. package/package.json +2 -2
  109. package/src/Platform/IPlatform.ts +1 -4
  110. package/src/animation/functions/interpolate.ts +1 -4
  111. package/src/animation/functions/interpolatePaths.ts +24 -0
  112. package/src/skia/core/Image.ts +1 -2
  113. package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +2 -5
  114. package/src/skia/types/Path/Path.ts +2 -420
  115. package/src/skia/types/Recorder.ts +10 -0
  116. package/src/skia/types/Shader/Shader.ts +1 -5
  117. package/src/skia/types/Surface/SurfaceFactory.ts +17 -0
  118. package/src/skia/web/JsiSkPath.ts +4 -495
  119. package/src/skia/web/JsiSkSurfaceFactory.ts +6 -2
  120. package/src/sksg/Container.native.ts +34 -37
  121. package/src/specs/NativeSkiaModule.web.ts +4 -0
  122. package/src/views/types.ts +13 -0
  123. package/apple/SkiaManager.h +0 -23
  124. package/apple/SkiaManager.mm +0 -63
@@ -4,11 +4,8 @@ export abstract class CanvasKitWebGLBuffer {}
4
4
 
5
5
  export type NativeBuffer<
6
6
  T extends
7
- | bigint
8
- | ArrayBuffer
9
- | CanvasImageSource
10
- | CanvasKitWebGLBuffer
11
- | unknown = unknown,
7
+ bigint | ArrayBuffer | CanvasImageSource | CanvasKitWebGLBuffer | unknown =
8
+ unknown,
12
9
  > = T;
13
10
 
14
11
  export type NativeBufferAddr = NativeBuffer<bigint>;
@@ -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
  /**
@@ -53,210 +51,11 @@ export const isPath = (obj: SkJSIInstance<string> | null): obj is SkPath => {
53
51
  };
54
52
 
55
53
  export interface SkPath extends SkJSIInstance<"Path"> {
56
- /**
57
- * Appends arc to Path, as the start of new contour. Arc added is part of ellipse
58
- * bounded by oval, from startAngle through sweepAngle. Both startAngle and
59
- * sweepAngle are measured in degrees, where zero degrees is aligned with the
60
- * positive x-axis, and positive sweeps extends arc clockwise.
61
- * Returns the modified path for easier chaining.
62
- * @param oval
63
- * @param startAngle
64
- * @param sweepAngle
65
- */
66
- addArc(
67
- oval: SkRect,
68
- startAngleInDegrees: number,
69
- sweepAngleInDegrees: number
70
- ): SkPath;
71
-
72
- /**
73
- * Adds oval to Path, appending kMove_Verb, four kConic_Verb, and kClose_Verb.
74
- * Oval is upright ellipse bounded by Rect oval with radii equal to half oval width
75
- * and half oval height. Oval begins at start and continues clockwise by default.
76
- * Returns the modified path for easier chaining.
77
- * @param oval
78
- * @param isCCW - if the path should be drawn counter-clockwise or not
79
- * @param startIndex - index of initial point of ellipse
80
- */
81
- addOval(oval: SkRect, isCCW?: boolean, startIndex?: number): SkPath;
82
-
83
54
  /**
84
55
  * Returns the number of points in this path. Initially zero.
85
56
  */
86
57
  countPoints(): number;
87
58
 
88
- /**
89
- * Adds contour created from array of n points, adding (count - 1) line segments.
90
- * Contour added starts at pts[0], then adds a line for every additional point
91
- * in pts array. If close is true, appends kClose_Verb to Path, connecting
92
- * pts[count - 1] and pts[0].
93
- * Returns the modified path for easier chaining.
94
- * @param points
95
- * @param close - if true, will add a line connecting last point to the first point.
96
- */
97
- addPoly(points: SkPoint[], close: boolean): SkPath;
98
-
99
- /** Adds beginning of contour at SkPoint (x, y).
100
-
101
- @param x x-axis value of contour start
102
- @param y y-axis value of contour start
103
- @return reference to SkPath
104
-
105
- example: https://fiddle.skia.org/c/@Path_moveTo
106
- */
107
- moveTo(x: number, y: number): SkPath;
108
- /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is
109
- kClose_Verb, last point is set to (0, 0) before adding line.
110
-
111
- lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed.
112
- lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array.
113
-
114
- @param x end of added line on x-axis
115
- @param y end of added line on y-axis
116
- @return reference to SkPath
117
-
118
- example: https://fiddle.skia.org/c/@Path_lineTo
119
- */
120
- lineTo(x: number, y: number): SkPath;
121
-
122
- /**
123
- * Returns a new path that covers the same area as the original path, but with the
124
- * Winding FillType. This may re-draw some contours in the path as counter-clockwise
125
- * instead of clockwise to achieve that effect. If such a transformation cannot
126
- * be done, null is returned.
127
- */
128
- makeAsWinding(): SkPath | null;
129
-
130
- /**
131
- * Translates all the points in the path by dx, dy.
132
- * @param dx
133
- * @param dy
134
- */
135
- offset(dx: number, dy: number): SkPath;
136
-
137
- /**
138
- * Relative version of arcToRotated.
139
- * @param rx
140
- * @param ry
141
- * @param xAxisRotate
142
- * @param useSmallArc
143
- * @param isCCW
144
- * @param dx
145
- * @param dy
146
- */
147
- rArcTo(
148
- rx: number,
149
- ry: number,
150
- xAxisRotateInDegrees: number,
151
- useSmallArc: boolean,
152
- isCCW: boolean,
153
- dx: number,
154
- dy: number
155
- ): SkPath;
156
-
157
- /**
158
- * Relative version of conicTo.
159
- * @param dx1
160
- * @param dy1
161
- * @param dx2
162
- * @param dy2
163
- * @param w
164
- */
165
- rConicTo(
166
- dx1: number,
167
- dy1: number,
168
- dx2: number,
169
- dy2: number,
170
- w: number
171
- ): SkPath;
172
-
173
- /**
174
- * Relative version of cubicTo.
175
- * @param cpx1
176
- * @param cpy1
177
- * @param cpx2
178
- * @param cpy2
179
- * @param x
180
- * @param y
181
- */
182
- rCubicTo(
183
- cpx1: number,
184
- cpy1: number,
185
- cpx2: number,
186
- cpy2: number,
187
- x: number,
188
- y: number
189
- ): SkPath;
190
-
191
- /**
192
- * Relative version of moveTo.
193
- * @param x
194
- * @param y
195
- */
196
- rMoveTo(x: number, y: number): SkPath;
197
-
198
- /**
199
- * Relative version of lineTo.
200
- * @param x
201
- * @param y
202
- */
203
- rLineTo(x: number, y: number): SkPath;
204
-
205
- /**
206
- * Relative version of quadTo.
207
- * @param x1
208
- * @param y1
209
- * @param x2
210
- * @param y2
211
- */
212
- rQuadTo(x1: number, y1: number, x2: number, y2: number): SkPath;
213
-
214
- /**
215
- * Sets FillType, the rule used to fill Path.
216
- * @param fill
217
- */
218
- setFillType(fill: FillType): SkPath;
219
-
220
- /**
221
- * Specifies whether Path is volatile; whether it will be altered or discarded
222
- * by the caller after it is drawn. Path by default have volatile set false.
223
- *
224
- * Mark animating or temporary paths as volatile to improve performance.
225
- * Mark unchanging Path non-volatile to improve repeated rendering.
226
- * @param volatile
227
- */
228
- setIsVolatile(volatile: boolean): SkPath;
229
-
230
- /**
231
- * Turns this path into the filled equivalent of the stroked path. Returns false if the operation
232
- * fails (e.g. the path is a hairline).
233
- * @param opts - describe how stroked path should look.
234
- * If such a transformation cannot be done, null is returned.
235
- */
236
- stroke(opts?: StrokeOpts): null | SkPath;
237
-
238
- /**
239
- * Appends CLOSE_VERB to Path. A closed contour connects the first and last point
240
- * with a line, forming a continuous loop.
241
- */
242
- close(): SkPath;
243
-
244
- /**
245
- * Sets Path to its initial state.
246
- * Removes verb array, point array, and weights, and sets FillType to Winding.
247
- * Internal storage associated with Path is released
248
- */
249
- reset(): SkPath;
250
-
251
- /**
252
- * Sets Path to its initial state.
253
- * Removes verb array, point array, and weights, and sets FillType to Winding.
254
- * Internal storage associated with Path is *not* released.
255
- * Use rewind() instead of reset() if Path storage will be reused and performance
256
- * is critical.
257
- */
258
- rewind(): SkPath;
259
-
260
59
  /**
261
60
  * Returns minimum and maximum axes values of the lines and curves in Path.
262
61
  * Returns (0, 0, 0, 0) if Path contains no points.
@@ -270,81 +69,6 @@ export interface SkPath extends SkJSIInstance<"Path"> {
270
69
  */
271
70
  computeTightBounds(): SkRect;
272
71
 
273
- /**
274
- * Appends arc to Path. Arc added is part of ellipse
275
- * bounded by oval, from startAngle through sweepAngle. Both startAngle and
276
- * sweepAngle are measured in degrees, where zero degrees is aligned with the
277
- * positive x-axis, and positive sweeps extends arc clockwise.
278
- * Returns the modified path for easier chaining.
279
- * @param oval
280
- * @param startAngleInDegrees
281
- * @param sweepAngleInDegrees
282
- * @param forceMoveTo
283
- */
284
- arcToOval(
285
- oval: SkRect,
286
- startAngleInDegrees: number,
287
- sweepAngleInDegrees: number,
288
- forceMoveTo: boolean
289
- ): SkPath;
290
-
291
- /**
292
- * Appends arc to Path. Arc is implemented by one or more conics weighted to
293
- * describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc
294
- * curves from last Path Point to (x, y), choosing one of four possible routes:
295
- * clockwise or counterclockwise, and smaller or larger. See SkPath.h for more details.
296
- * Returns the modified path for easier chaining.
297
- * @param rx
298
- * @param ry
299
- * @param xAxisRotate
300
- * @param useSmallArc
301
- * @param isCCW
302
- * @param x
303
- * @param y
304
- */
305
- arcToRotated(
306
- rx: number,
307
- ry: number,
308
- xAxisRotateInDegrees: number,
309
- useSmallArc: boolean,
310
- isCCW: boolean,
311
- x: number,
312
- y: number
313
- ): SkPath;
314
-
315
- /**
316
- * Appends arc to Path, after appending line if needed. Arc is implemented by conic
317
- * weighted to describe part of circle. Arc is contained by tangent from
318
- * last Path point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc
319
- * is part of circle sized to radius, positioned so it touches both tangent lines.
320
- * Returns the modified path for easier chaining.
321
- * @param x1
322
- * @param y1
323
- * @param x2
324
- * @param y2
325
- * @param radius
326
- */
327
- arcToTangent(
328
- x1: number,
329
- y1: number,
330
- x2: number,
331
- y2: number,
332
- radius: number
333
- ): SkPath;
334
-
335
- /**
336
- * Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w.
337
- * If Path is empty, or path is closed, the last point is set to (0, 0)
338
- * before adding conic.
339
- * Returns the modified path for easier chaining.
340
- * @param x1
341
- * @param y1
342
- * @param x2
343
- * @param y2
344
- * @param w
345
- */
346
- conicTo(x1: number, y1: number, x2: number, y2: number, w: number): SkPath;
347
-
348
72
  /**
349
73
  * Returns true if the point (x, y) is contained by Path, taking into
350
74
  * account FillType.
@@ -358,35 +82,6 @@ export interface SkPath extends SkJSIInstance<"Path"> {
358
82
  */
359
83
  copy(): SkPath;
360
84
 
361
- /**
362
- * Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at
363
- * (x3, y3). If Path is empty, or path is closed, the last point is set to
364
- * (0, 0) before adding cubic.
365
- * @param cpx1
366
- * @param cpy1
367
- * @param cpx2
368
- * @param cpy2
369
- * @param x
370
- * @param y
371
- */
372
- cubicTo(
373
- cpx1: number,
374
- cpy1: number,
375
- cpx2: number,
376
- cpy2: number,
377
- x: number,
378
- y: number
379
- ): SkPath;
380
-
381
- /**
382
- * Changes this path to be the dashed version of itself. This is the same effect as creating
383
- * a DashPathEffect and calling filterPath on this path.
384
- * @param on
385
- * @param off
386
- * @param phase
387
- */
388
- dash(on: number, off: number, phase: number): boolean;
389
-
390
85
  /**
391
86
  * Returns true if other path is equal to this path.
392
87
  * @param other
@@ -405,58 +100,6 @@ export interface SkPath extends SkJSIInstance<"Path"> {
405
100
  */
406
101
  getFillType(): FillType;
407
102
 
408
- /**
409
- Adds quad from last point towards (x1, y1), to (x2, y2).
410
-
411
- If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) before adding quad.
412
-
413
- Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; then appends kQuad_Verb to verb array;
414
- and (x1, y1), (x2, y2) to SkPoint array.
415
-
416
- Parameters
417
- x1 control SkPoint of quad on x-axis
418
- y1 control SkPoint of quad on y-axis
419
- x2 end SkPoint of quad on x-axis
420
- y2 end SkPoint of quad on y-axis
421
- Returns
422
- reference to SkPath
423
- example: https://fiddle.skia.org/c/@Path_quadTo
424
- */
425
- quadTo(x1: number, y1: number, x2: number, y2: number): SkPath;
426
-
427
- /**
428
- * Adds Rect to Path, appending kMove_Verb, three kLine_Verb, and kClose_Verb,
429
- * starting with top-left corner of Rect; followed by top-right, bottom-right,
430
- * and bottom-left if isCCW is false; or followed by bottom-left,
431
- * bottom-right, and top-right if isCCW is true.
432
- * Returns the modified path for easier chaining.
433
- * @param rect
434
- * @param isCCW
435
- */
436
- addRect(rect: SkRect, isCCW?: boolean): SkPath;
437
-
438
- /**
439
- * Adds rrect to Path, creating a new closed contour.
440
- * Returns the modified path for easier chaining.
441
- * @param rrect
442
- * @param isCCW
443
- */
444
- addRRect(rrect: InputRRect, isCCW?: boolean): SkPath;
445
-
446
- /** Appends src to SkPath, transformed by matrix. Transformed curves may have
447
- different verbs, SkPoint, and conic weights.
448
-
449
- If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic
450
- weights are added unaltered. If mode is kExtend_AddPathMode, add line
451
- before appending verbs, SkPoint, and conic weights.
452
-
453
- @param src SkPath verbs, SkPoint, and conic weights to add
454
- @param matrix transform applied to src
455
- @param extend extends path with line if true
456
- @return reference to SkPath
457
- */
458
- addPath(src: SkPath, matrix?: SkMatrix, extend?: boolean): SkPath;
459
-
460
103
  /**
461
104
  * Returns the Point at index in Point array. Valid range for index is
462
105
  * 0 to countPoints() - 1.
@@ -477,73 +120,13 @@ export interface SkPath extends SkJSIInstance<"Path"> {
477
120
  */
478
121
  isVolatile(): boolean;
479
122
 
480
- /** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb,
481
- four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing
482
- clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction.
483
-
484
- Has no effect if radius is zero or negative.
485
-
486
- @param x center of circle
487
- @param y center of circle
488
- @param radius distance from center to edge
489
- @return reference to SkPath
490
- */
491
- addCircle(x: number, y: number, r: number): SkPath;
492
-
493
123
  getLastPt(): { x: number; y: number };
494
124
 
495
- /** Set this path to the result of applying the Op to this path and the
496
- specified path: this = (this op operand).
497
- The resulting path will be constructed from non-overlapping contours.
498
- The curve order is reduced where possible so that cubics may be turned
499
- into quadratics, and quadratics maybe turned into lines.
500
-
501
- Returns true if operation was able to produce a result;
502
- otherwise, result is unmodified.
503
-
504
- @param path The second path (for difference, the subtrahend)
505
- @param op The operator to apply.
506
- @param result The product of the operands. The result may be one of the
507
- inputs.
508
- @return True if the operation succeeded.
509
- */
510
- op(path: SkPath, op: PathOp): boolean;
511
-
512
- /** Set this path to a set of non-overlapping contours that describe the
513
- same area as the original path.
514
- The curve order is reduced where possible so that cubics may
515
- be turned into quadratics, and quadratics maybe turned into lines.
516
-
517
- Returns true if operation was able to produce a result;
518
- otherwise, result is unmodified.
519
-
520
- @param result The simplified path. The result may be the input.
521
- @return True if simplification succeeded.
522
- */
523
- simplify(): boolean;
524
-
525
125
  /**
526
126
  * Returns this path as an SVG string.
527
127
  */
528
128
  toSVGString(): string;
529
129
 
530
- /**
531
- * Take start and stop "t" values (values between 0...1), and modify this path such that
532
- * it is a subset of the original path.
533
- * The trim values apply to the entire path, so if it contains several contours, all of them
534
- * are including in the calculation.
535
- * Null is returned if either input value is NaN.
536
- * @param startT - a value in the range [0.0, 1.0]. 0.0 is the beginning of the path.
537
- * @param stopT - a value in the range [0.0, 1.0]. 1.0 is the end of the path.
538
- * @param isComplement
539
- */
540
- trim(startT: number, stopT: number, isComplement: boolean): null | SkPath;
541
-
542
- /**
543
- * Transforms the path by the specified matrix.
544
- */
545
- transform(m3: InputMatrix): SkPath;
546
-
547
130
  /**
548
131
  * Interpolates between Path with point array of equal size.
549
132
  * Copy verb array and weights to result, and set result path to a weighted
@@ -560,11 +143,10 @@ export interface SkPath extends SkJSIInstance<"Path"> {
560
143
  * @param ending path to interpolate with
561
144
  * @param weight contribution of this path, and
562
145
  * one minus contribution of ending path
563
- * @param output path to be replaced with the interpolated averages
564
- * @return Path replaced by interpolated averages or null if
146
+ * @return New path of interpolated averages or null if
565
147
  * not interpolatable
566
148
  * */
567
- interpolate(end: SkPath, weight: number, output?: SkPath): SkPath | null;
149
+ interpolate(end: SkPath, weight: number): SkPath | null;
568
150
 
569
151
  /** Returns true if Path contain equal verbs and equal weights.
570
152
  * @param compare path to compare
@@ -96,4 +96,14 @@ export interface JsiRecorder extends BaseRecorder {
96
96
  play(picture: SkPicture): void;
97
97
  applyUpdates(variables: SharedValue<unknown>[]): void;
98
98
  reset(): void;
99
+ /**
100
+ * Unique id of the native recording, used to tag the updates sent to the
101
+ * view that owns it.
102
+ */
103
+ getId(): number;
104
+ /**
105
+ * Releases the wrapper's reference to the native recorder. A recording
106
+ * that a view owns stays alive until the view replaces it or is torn down.
107
+ */
108
+ dispose(): void;
99
109
  }
@@ -8,11 +8,7 @@ export const isShader = (obj: SkJSIInstance<string> | null): obj is SkShader =>
8
8
  export type SkShader = SkJSIInstance<"Shader">;
9
9
 
10
10
  export type Uniform =
11
- | number
12
- | Vector
13
- | Float32Array
14
- | readonly Uniform[]
15
- | Uniform[];
11
+ number | Vector | Float32Array | readonly Uniform[] | Uniform[];
16
12
 
17
13
  export interface Uniforms {
18
14
  [name: string]: Uniform;
@@ -32,4 +32,21 @@ export interface SurfaceFactory {
32
32
  height: number,
33
33
  opts?: SurfaceOptions
34
34
  ) => SkSurface | null;
35
+
36
+ /**
37
+ * Creates a GPU backed surface that draws directly into a WebGPU texture
38
+ * (zero-copy). The texture must be created on Skia's device
39
+ * (importDevice(Skia.getNativeDevice())) with RENDER_ATTACHMENT usage; add
40
+ * TEXTURE_BINDING to sample what Skia drew from WebGPU after each flush().
41
+ * The surface holds its own reference to the texture and keeps it alive
42
+ * for its lifetime, so the caller may release the GPUTexture once the
43
+ * surface exists. Calling destroy() on the GPUTexture still invalidates
44
+ * the surface.
45
+ *
46
+ * Note: This method is only available when the Graphite backend is enabled.
47
+ *
48
+ * @param pointer - The WGPUTexture pointer (texture.nativePointer)
49
+ * @returns An SkSurface rendering into the texture, or throws if the texture is invalid
50
+ */
51
+ MakeFromNativeTexture: (pointer: bigint) => SkSurface;
35
52
  }