diff --git a/gsk/gskpath.h b/gsk/gskpath.h index 3553719ee7..2bc531c4bd 100644 --- a/gsk/gskpath.h +++ b/gsk/gskpath.h @@ -193,6 +193,30 @@ gboolean gsk_path_foreach_intersection (GskPath GskPathIntersectionFunc func, gpointer user_data); +GDK_AVAILABLE_IN_4_14 +GskPath * gsk_path_union (GskPath *first, + GskPath *second, + GskFillRule fill_rule); + +GDK_AVAILABLE_IN_4_14 +GskPath * gsk_path_intersection (GskPath *first, + GskPath *second, + GskFillRule fill_rule); + +GDK_AVAILABLE_IN_4_14 +GskPath * gsk_path_difference (GskPath *first, + GskPath *second, + GskFillRule fill_rule); + +GDK_AVAILABLE_IN_4_14 +GskPath * gsk_path_symmetric_difference (GskPath *first, + GskPath *second, + GskFillRule fill_rule); + +GDK_AVAILABLE_IN_4_14 +GskPath * gsk_path_simplify (GskPath *self, + GskFillRule fill_rule); + G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskPath, gsk_path_unref) G_END_DECLS diff --git a/gsk/gskpathops.c b/gsk/gskpathops.c index ca62348916..fb4e7ff8c8 100644 --- a/gsk/gskpathops.c +++ b/gsk/gskpathops.c @@ -1708,5 +1708,111 @@ gsk_path_op (GskPathOp operation, } /* }}} */ +/* {{{ Pathops API */ + +/** + * gsk_path_simplify: + * @self: a `GskPath` + * @fill_rule: a `GskFillRule` + * + * Create a new path that describes the same area as @self, + * without overlapping contours. + * + * Returns: a new `GskPath` + * + * Since: 4.14 + */ +GskPath * +gsk_path_simplify (GskPath *self, + GskFillRule fill_rule) +{ + return gsk_path_op (GSK_PATH_OP_SIMPLIFY, fill_rule, self, NULL); +} + +/** + * gsk_path_union: + * @first: a `GskPath` + * @second: a `GskPath` + * @fill_rule: a `GskFillRule` + * + * Create a new path that describes the union of the areas + * of the given paths. + * + * Returns: a new `GskPath` + * + * Since: 4.14 + */ +GskPath * +gsk_path_union (GskPath *first, + GskPath *second, + GskFillRule fill_rule) +{ + return gsk_path_op (GSK_PATH_OP_UNION, fill_rule, first, second); +} + +/** + * gsk_path_intersection: + * @first: a `GskPath` + * @second: a `GskPath` + * @fill_rule: a `GskFillRule` + * + * Create a new path that describes the intersection of the areas + * of the given paths. + * + * Returns: a new `GskPath` + * + * Since: 4.14 + */ +GskPath * +gsk_path_intersection (GskPath *first, + GskPath *second, + GskFillRule fill_rule) +{ + return gsk_path_op (GSK_PATH_OP_INTERSECTION, fill_rule, first, second); +} + +/** + * gsk_path_difference: + * @first: a `GskPath` + * @second: a `GskPath` + * @fill_rule: a `GskFillRule` + * + * Create a new path that describes the difference of the areas + * of the given paths. + * + * Returns: a new `GskPath` + * + * Since: 4.14 + */ +GskPath * +gsk_path_difference (GskPath *first, + GskPath *second, + GskFillRule fill_rule) +{ + return gsk_path_op (GSK_PATH_OP_DIFFERENCE, fill_rule, first, second); +} + +/** + * gsk_path_symmetric_difference: + * @first: a `GskPath` + * @second: a `GskPath` + * @fill_rule: a `GskFillRule` + * + * Create a new path that describes the symmetric difference + * of the areas of the given paths. + * + * Returns: a new `GskPath` + * + * Since: 4.14 + */ +GskPath * +gsk_path_symmetric_difference (GskPath *first, + GskPath *second, + GskFillRule fill_rule) +{ + return gsk_path_op (GSK_PATH_OP_XOR, fill_rule, first, second); +} + +/* }}}} */ /* vim:set foldmethod=marker expandtab: */