*/
SK_API sk_path_t* sk_path_clone(const sk_path_t* cpath);
+/* Iterators */
SK_API sk_path_iterator_t* sk_path_create_iter (sk_path_t *cpath, int forceClose);
SK_API sk_path_verb_t sk_path_iter_next (sk_path_iterator_t *iterator, sk_point_t points [4], int doConsumeDegenerates, int exact);
SK_API int sk_path_iter_is_closed_contour (sk_path_iterator_t *iterator);
+SK_API void sk_path_iter_destroy (sk_path_iterator_t *iterator);
+
+/* Raw iterators */
+SK_API sk_path_rawiterator_t* sk_path_create_rawiter (sk_path_t *cpath);
+
+SK_API sk_path_verb_t sk_path_rawiter_peek (sk_path_rawiterator_t *iterator);
+
+SK_API sk_path_verb_t sk_path_rawiter_next (sk_path_rawiterator_t *iterator);
+
+SK_API float sk_path_rawiter_conic_weight (sk_path_rawiterator_t *iterator);
+
+SK_API void sk_path_rawiter_destroy (sk_path_rawiterator_t *iterator);
/* Paths */
+/**
+ Adds the @other path to the @cpath by appending a @dx, @dy offset to each node, using the specified adding mode in @add_mode
+ */
SK_API void sk_path_add_path_offset (sk_path_t* cpath, sk_path_t* other, float dx, float dy, sk_path_add_mode_t add_mode);
+/**
+ Adds the @other path to the @cpath by applying the @matrix transformation on the @other, using the specified adding mode in @add_mode
+ */
SK_API void sk_path_add_path_matrix (sk_path_t* cpath, sk_path_t* other, sk_matrix_t *matrix, sk_path_add_mode_t add_mode);
+/**
+ Adds the @other path to the @cpath using the specified adding mode in @add_mode
+ */
SK_API void sk_path_add_path (sk_path_t* cpath, sk_path_t* other, sk_path_add_mode_t add_mode);
SK_API void sk_path_add_path_reverse (sk_path_t* cpath, sk_path_t* other);
} sk_path_verb_t;
typedef struct sk_path_iterator_t sk_path_iterator_t;
+typedef struct sk_path_rawiterator_t sk_path_rawiterator_t;
typedef enum {
APPEND_ADD_MODE,
return AsPathIter(iterator)->isClosedContour ();
}
+void sk_path_iter_destroy (sk_path_iterator_t *iterator)
+{
+ delete AsPathIter (iterator);
+}
+
+sk_path_rawiterator_t* sk_path_create_rawiter (sk_path_t *cpath)
+{
+ SkPath::RawIter* iter = new SkPath::RawIter(AsPath(*cpath));
+ return ToPathRawIter(iter);
+}
+
+sk_path_verb_t sk_path_rawiter_next (sk_path_rawiterator_t *iterator, sk_point_t points [4])
+{
+ SkPath::RawIter *iter = AsPathRawIter(iterator);
+ SkPoint *pts = AsPoint(points);
+ SkPath::Verb verb = iter->next(pts);
+ return (sk_path_verb_t)verb;
+}
+
+sk_path_verb_t sk_path_rawiter_peek (sk_path_rawiterator_t *iterator)
+{
+ return (sk_path_verb_t) AsPathRawIter(iterator)->peek ();
+}
+
+float sk_path_rawiter_conic_weight (sk_path_rawiterator_t *iterator)
+{
+ return AsPathRawIter(iterator)->conicWeight ();
+}
+
+void sk_path_rawiter_destroy (sk_path_rawiterator_t *iterator)
+{
+ delete AsPathRawIter (iterator);
+}
+
#if __cplusplus >= 199711L
static_assert (SkPath::kAppend_AddPathMode == APPEND_ADD_MODE, "ABI changed, you must write a enumeration mapper for SkPath::AddPathMode to sk_path_add_mode_t");
static_assert (SkPath::kExtend_AddPathMode == EXTEND_ADD_MODE, "ABI changed, you must write a enumeration mapper for SkPath::AddPathMode to sk_path_add_mode_t");
static inline sk_path_iterator_t* ToPathIter(SkPath::Iter* iter) {
return reinterpret_cast<sk_path_iterator_t*>(iter);
}
+
+static inline SkPath::RawIter* AsPathRawIter(sk_path_rawiterator_t* iter) {
+ return reinterpret_cast<SkPath::RawIter*>(iter);
+}
+
+static inline sk_path_rawiterator_t* ToPathRawIter(SkPath::RawIter* iter) {
+ return reinterpret_cast<sk_path_rawiterator_t*>(iter);
+}
#endif