summaryrefslogtreecommitdiff
path: root/src/cairo.c
diff options
context:
space:
mode:
authorBrian Ewins <Brian.Ewins@gmail.com>2007-11-16 22:43:43 +0000
committerCarl Worth <cworth@cworth.org>2008-01-21 12:04:32 -0800
commit4177208be63caa3128eaf07428f3d4617fcd18e0 (patch)
tree2b0bdbf8f4c1ee8dc199deb5302d61aae3571ac5 /src/cairo.c
parentd923457c0f40c9b34ee75d4d47b9bd0c3edfe669 (diff)
[cairo] Add cairo_path_extents()
This new function gets the extents of the current path, whether or not they would be inked by a 'fill'. It differs from cairo_fill_extents() when the area enclosed by the path is 0. Includes documentation and updated test.
Diffstat (limited to 'src/cairo.c')
-rw-r--r--src/cairo.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/cairo.c b/src/cairo.c
index 4a7aec11..42411cee 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -1870,6 +1870,36 @@ cairo_close_path (cairo_t *cr)
slim_hidden_def(cairo_close_path);
/**
+ * cairo_path_extents:
+ * @cr: a cairo context
+ * @x1: left of the resulting extents
+ * @y1: top of the resulting extents
+ * @x2: right of the resulting extents
+ * @y2: bottom of the resulting extents
+ *
+ * Computes a bounding box in user coordinates covering the points
+ * on the current path. If the current path is empty,
+ * returns an empty rectangle (0,0, 0,0). Stroke parameters,
+ * surface dimensions and clipping are not taken into account. This
+ * will be the same as the value returned by cairo_fill_extents()
+ * unless the area enclosed by the path is empty.
+ *
+ * Since: 1.6
+ **/
+void
+cairo_path_extents (cairo_t *cr,
+ double *x1, double *y1, double *x2, double *y2)
+{
+ if (cr->status)
+ return;
+
+ _cairo_gstate_path_extents (cr->gstate,
+ cr->path,
+ x1, y1, x2, y2);
+}
+slim_hidden_def (cairo_path_extents);
+
+/**
* cairo_paint:
* @cr: a cairo context
*