[C API] Add SkPath APIs to add sub-paths
authorMiguel de Icaza <miguel@gnome.org>
Sun, 3 Jul 2016 04:27:23 +0000 (00:27 -0400)
committerMiguel de Icaza <miguel@gnome.org>
Sun, 3 Jul 2016 04:27:23 +0000 (00:27 -0400)
include/c/xamarin/sk_x_path.h
include/c/xamarin/sk_x_types.h
src/c/xamarin/sk_x_path.cpp

index d8363ade3b7ed5f97983e66ec152e080dc97c470..7469ef4ce92208f36aa21d79268077e82cdc76a4 100644 (file)
@@ -85,7 +85,15 @@ SK_API float sk_path_iter_conic_weight (sk_path_iterator_t *iterator);
 SK_API int sk_path_iter_is_close_line (sk_path_iterator_t *iterator);
 
 SK_API int sk_path_iter_is_closed_contour (sk_path_iterator_t *iterator);
-       
+
+
+/* Paths */
+
+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);
+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);
+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_C_PLUS_PLUS_END_GUARD
 
 #endif
index e3a9c69ff58f5c675e89c76023fb4c089c75a1a2..aeaff9acab84211ecb91988cebdd028f482fd0e3 100644 (file)
@@ -235,6 +235,11 @@ typedef enum {
 
 typedef struct sk_path_iterator_t sk_path_iterator_t;
 
+typedef enum {
+       APPEND_ADD_MODE,
+       EXTEND_ADD_MODE,
+} sk_path_add_mode_t;
+       
 SK_C_PLUS_PLUS_END_GUARD
 
 #endif
index c36d2d153108b96ff61b84109a6b604427f4d14d..e753c6e0773cf296a87c7f23d3e73b0e8ff90d89 100644 (file)
@@ -122,3 +122,32 @@ int sk_path_iter_is_closed_contour (sk_path_iterator_t *iterator)
 {
     return AsPathIter(iterator)->isClosedContour ();
 }
+
+#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");
+#endif
+
+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)
+{
+    as_path (cpath)->addPath (AsPath (*other), dx, dy, (SkPath::AddPathMode) add_mode);
+}
+
+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)
+{
+    SkMatrix skmatrix;
+    from_c(matrix, &skmatrix);
+    as_path (cpath)->addPath (AsPath (*other), skmatrix, (SkPath::AddPathMode) add_mode);
+}
+
+void sk_path_add_path (sk_path_t* cpath, sk_path_t* other, sk_path_add_mode_t add_mode)
+{
+    as_path (cpath)->addPath (AsPath (*other), (SkPath::AddPathMode) add_mode);
+}
+
+void sk_path_add_path_reverse (sk_path_t* cpath, sk_path_t* other)
+{
+    as_path (cpath)->reverseAddPath (AsPath (*other));
+}
+
+