diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | cairomm/context.cc | 7 | ||||
-rw-r--r-- | cairomm/context.h | 30 | ||||
-rw-r--r-- | configure.in | 2 |
4 files changed, 44 insertions, 1 deletions
@@ -1,5 +1,11 @@ 2008-01-30 Jonathon Jongsma <jjongsma@gnome.org> + * configure.in: bump cairo requirement to 1.5.8 + * cairomm/context.cc: + * cairomm/context.h: add get_path_extents function, new in 1.5.8 + +2008-01-30 Jonathon Jongsma <jjongsma@gnome.org> + * configure.in: enable people with CAIROMM_DEVEL variable set to explicitly deisable automated tests * m4/ax_boost_unit_test_framework.m4: update to slightly newer boost diff --git a/cairomm/context.cc b/cairomm/context.cc index a4b60e9..c4fdc65 100644 --- a/cairomm/context.cc +++ b/cairomm/context.cc @@ -728,6 +728,13 @@ Path* Context::copy_path() const return new Path(cresult, true /* take ownership */); //The caller must delete it. } +void Context::get_path_extents(double& x1, double& y1, double& x2, double& y2) const +{ + cairo_path_extents(m_cobject, &x1, &y1, &x2, &y2); + check_object_status_and_throw_exception(*this); +} + + Path* Context::copy_path_flat() const { cairo_path_t* cresult = cairo_copy_path_flat(const_cast<cairo_t*>(m_cobject)); diff --git a/cairomm/context.h b/cairomm/context.h index 6c47e3b..44375ca 100644 --- a/cairomm/context.h +++ b/cairomm/context.h @@ -809,6 +809,36 @@ public: */ Path* copy_path() const; +/** + * Computes a bounding box in user-space coordinates covering the points on + * the current path. If the current path is empty, returns an empty rectangle + * ((0,0), (0,0)). Stroke parameters, fill rule, surface dimensions and + * clipping are not taken into account. + * + * Contrast with fill_extents() and stroke_extents() which return the extents + * of only the area that would be "inked" by the corresponding drawing + * operations. + * + * The result of path_extents() is defined as equivalent to the limit of + * stroke_extents() with Cairo::LINE_CAP_ROUND as the line width approaches + * 0.0, (but never reaching the empty-rectangle returned by stroke_extents() + * for a line width of 0.0). + * + * Specifically, this means that zero-area sub-paths such as + * move_to();line_to() segments, (even degenerate cases where the coordinates + * to both calls are identical), will be considered as contributing to the + * extents. However, a lone move_to() will not contribute to the results of + * path_extents(). + * + * @param x1 left of the resulting extents + * @param y1 top of the resulting extents + * @param x2 right of the resulting extents + * @param y2 bottom of the resulting extents + * + * @since 1.6 + **/ + void get_path_extents(double& x1, double& y1, double& x2, double& y2) const; + /** Gets a flattened copy of the current path and returns it to the user * * @todo See cairo_path_data_t for hints on how to iterate over the returned diff --git a/configure.in b/configure.in index d03feca..366c66a 100644 --- a/configure.in +++ b/configure.in @@ -102,7 +102,7 @@ fi AC_CHECK_HEADERS(string list map, , exit) -PKG_CHECK_MODULES(CAIROMM, cairo >= 1.5) +PKG_CHECK_MODULES(CAIROMM, cairo >= 1.5.8) AC_ARG_ENABLE(tests, AC_HELP_STRING([--enable-tests=yes|no], |