[cairo] [RFC] cairo_path_extents()

Jonathan Watt jwatt at jwatt.org
Thu Nov 22 00:11:51 PST 2007


Baz wrote:
> Behdad suggested adding a cairo_path_extents() call to meet their
> need; to me this sounds like a better option than special-casing
> stroke_extents or fill_extents for hairlines. The proposed api is:
>
> void        cairo_path_extents (cairo_t *cr,
>                                              double *x1,
>                                              double *y1,
>                                              double *x2,
>                                              double *y2);
>
> "Computes a bounding box in user coordinates covering the all 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."

s/the all/all the/

> The implementation of this looks quite easy, following Carl's
> suggestion in the bug report, I've thrown together a
> _cairo_path_fixed_interpret_flat() that takes a tolerance instead of a
> curve_to (not even tried to compile this yet):
> http://paste.lisp.org/display/50946 (flattening code lifted from
> cairo-path.c; this fits into cairo-path-fixed.c). Combined with
> cairo-path-bounds.c, this gives us the desired extents without
> tesselating.
>
> Thoughts?

Sounds great! When is this going to make it in to cairo? ;-)

Jonathan


More information about the cairo mailing list