[Cairo] Rectangle-based clipping for surfaces

Carl Worth cworth at east.isi.edu
Tue Oct 28 18:24:36 PST 2003


On Oct 22, Thomas Hunger wrote:
 > This function is useful if there is an external expose_event (because a part 
 > of the window was exposed or similar). But what if I draw some stuff on a 
 > surface and want to have the exact pixel size of the bounding box,  for 
 > example to raise an expose_event in the first place (mark an area
 > dirty)? 

Good point. PostScript provides a pathbbox operator that gives this
kind of information.

And some users may need more information than the
bounding-box. Another useful function would be a way to get the exact
region of pixels enclosed by the current path.

Obviously this could be exported via the libpixregion datatype, (or
its newly proposed name pixman_region_t).

So maybe something like:

	pixman_region_t *
	cairo_current_path_region (cairo_t *cr);

	void
	cairo_current_path_bounds (cairo_t *cr,
				   int *x, int *y,
			           int *width, int *height);

Or, we could throw a struct in here to simplify this if that makes
sense.

To get the most out of these functions, we'll also need the equivalent
of PostScript's strokepath operator, (which replaces the current path
with it's stroked outline --- that is strokepath/fill gives the same
result as stroke).

I don't like the name cairo_stroke_path, so I have already proposed:

	void
	cairo_outline_path (cairo_t *cr);

-Carl




More information about the cairo mailing list