[cairo] Clipping To Gdk Region

Carl Worth cworth at east.isi.edu
Mon May 3 03:28:18 PDT 2004

On Fri, 30 Apr 2004 15:20:14 -0400, Andrew Johnson wrote:
> I can get the rectangles via gdk_region_get_rectangles, however I cannot
> see any fast and easy way to apply this directly to the surface. If I
> had the xrender handle actually being used I could simply create a new
> xregion and apply it, then free on done, but I am not seeing anyway to
> handle this in the current api. 

You should have the Xlib handle for the Drawable of the target, since
you had to have that to create the cairo surface. Does it give you what
you need?

The current API hides the fact that a Render Picture is used, but we can
add an API to create a cairo surface from a Picture rather than a
Drawable if that is necessary.

We have also discussed adding a cairo API to clip surface output to a
list of rectangles, (most likely specified as a pixman_region_t). But we
didn't have consensus on a clean API for this.

Finally, in the meantime, Graydon Hoare has added code to cairo_clip to
automatically detect rectangles in the path and implement them via
direct clipping on the underlying surface (eg. the Drawable). So, you
may be able to get some of what you want that way, (although that would
require a useless conversion from device space coodinates to user space
and then back again).


More information about the cairo mailing list