11from ._skia.core cimport (
2+ SkArcSize,
23 SkLineCap,
34 SkLineJoin,
45 SkPath,
6+ SkPathBuilder,
57 SkPathFillType,
8+ SkPathIter,
9+ SkPathVerb,
610 SkPoint,
711 SkScalar,
8- kMove_Verb,
9- kLine_Verb,
10- kQuad_Verb,
11- kConic_Verb,
12- kCubic_Verb,
13- kClose_Verb,
14- kDone_Verb,
15- kSmall_ArcSize,
16- kLarge_ArcSize,
12+ SkSpan,
1713 SkPathDirection,
1814 SkMatrix,
1915)
@@ -27,6 +23,7 @@ from ._skia.pathops cimport (
2723 kReverseDifference_SkPathOp,
2824)
2925from libc.stdint cimport uint8_t, int32_t, uint32_t
26+ from libcpp.optional cimport optional
3027
3128
3229cpdef enum PathOp:
@@ -56,8 +53,8 @@ cpdef enum LineJoin:
5653
5754
5855cpdef enum ArcSize:
59- SMALL = kSmall_ArcSize
60- LARGE = kLarge_ArcSize
56+ SMALL = < uint32_t > SkArcSize. kSmall_ArcSize
57+ LARGE = < uint32_t > SkArcSize. kLarge_ArcSize
6158
6259
6360cpdef enum Direction:
@@ -97,10 +94,10 @@ cdef bint collinear(
9794
9895cdef class Path:
9996
100- cdef SkPath path
97+ cdef SkPathBuilder path
10198
10299 @staticmethod
103- cdef Path create(const SkPath & path)
100+ cdef Path create(const SkPathBuilder & path)
104101
105102 cpdef PathPen getPen(self , object glyphSet = * , bint allow_open_paths = * )
106103
@@ -200,13 +197,12 @@ cdef class Path:
200197
201198
202199cpdef enum PathVerb:
203- MOVE = kMove_Verb
204- LINE = kLine_Verb
205- QUAD = kQuad_Verb
206- CONIC = kConic_Verb # unsupported
207- CUBIC = kCubic_Verb
208- CLOSE = kClose_Verb
209- DONE = kDone_Verb # unused; we raise StopIteration instead
200+ MOVE = < uint8_t> SkPathVerb.kMove
201+ LINE = < uint8_t> SkPathVerb.kLine
202+ QUAD = < uint8_t> SkPathVerb.kQuad
203+ CONIC = < uint8_t> SkPathVerb.kConic # unsupported
204+ CUBIC = < uint8_t> SkPathVerb.kCubic
205+ CLOSE = < uint8_t> SkPathVerb.kClose
210206
211207
212208cdef uint8_t * POINTS_IN_VERB
@@ -219,20 +215,19 @@ cdef dict PEN_METHODS
219215cdef class RawPathIterator:
220216
221217 cdef Path path
222- cdef SkPath.RawIter iterator
218+ cdef optional[SkPathIter] iterator
223219
224220
225221cdef class SegmentPenIterator:
226222
227- cdef _SkPointArray pa
228- cdef SkPoint * pts
229- cdef _VerbArray va
230- cdef uint8_t * verbs
231- cdef uint8_t * verb_stop
223+ cdef Path path
224+ cdef const SkPoint * pts
225+ cdef const SkPathVerb * verbs
226+ cdef const SkPathVerb * verb_stop
232227 cdef SkPoint move_pt
233228 cdef bint closed
234229
235- cdef uint8_t peek (self )
230+ cdef bint nextIsClose (self )
236231
237232 cdef tuple _join_quadratic_segments(self )
238233
@@ -260,25 +255,7 @@ cdef class PathPen:
260255 cpdef addComponent(self , glyphName, transformation)
261256
262257
263- cdef double get_path_area(const SkPath& path) except ? - 1234567
264-
265-
266- cdef class _VerbArray:
267-
268- cdef uint8_t * data
269- cdef int count
270-
271- @staticmethod
272- cdef _VerbArray create(const SkPath& path)
273-
274-
275- cdef class _SkPointArray:
276-
277- cdef SkPoint * data
278- cdef int count
279-
280- @staticmethod
281- cdef _SkPointArray create(const SkPath& path)
258+ cdef double get_path_area(const SkPathBuilder& path) except ? - 1234567
282259
283260
284261cdef class _SkScalarArray:
@@ -290,13 +267,13 @@ cdef class _SkScalarArray:
290267 cdef _SkScalarArray create(object values)
291268
292269
293- cdef int pts_in_verb(unsigned v) except - 1
270+ cdef int pts_in_verb(SkPathVerb v) except - 1
294271
295272
296- cdef bint reverse_contour(SkPath & path) except False
273+ cdef bint reverse_contour(SkPathBuilder & path) except False
297274
298275
299- cdef int path_is_inside(const SkPath & self , const SkPath & other) except - 1
276+ cdef int path_is_inside(const SkPathBuilder & self , const SkPathBuilder & other) except - 1
300277
301278
302279cpdef int restore_starting_points(Path path, list points) except - 1
@@ -313,17 +290,17 @@ cdef int find_oncurve_point(
313290 SkScalar y,
314291 const SkPoint * pts,
315292 int pt_count,
316- const uint8_t * verbs,
293+ const SkPathVerb * verbs,
317294 int verb_count,
318295 int * pt_index,
319296 int * verb_index,
320297) except - 1
321298
322299
323- cdef int contour_is_closed(const uint8_t * verbs, int verb_count ) except - 1
300+ cdef int contour_is_closed(SkSpan[ const SkPathVerb] verbs) except - 1
324301
325302
326- cdef int set_contour_start_point(SkPath & path, SkScalar x, SkScalar y) except - 1
303+ cdef int set_contour_start_point(SkPathBuilder & path, SkScalar x, SkScalar y) except - 1
327304
328305
329306cdef int compute_conic_to_quad_pow2(
0 commit comments