[cairo] 2 clipping questions

Tim Teulings rael at edge.ping.de
Wed Apr 25 23:26:39 PDT 2007


Two questions regarding clipping:

In my GUI library I make use of subtracting clipping. This means, that
if I have a drawing area of 1000x1000 I can define a clipping region of
example 200,200-800,800 and then define an subtracting clipping region
of 400,400-600,600. If I now fill the entire drawing region I get
rectangular ring. This is help if you have a hierarchical gadget
structure and want the parent gadget to fill its background without
drawing into the region of its children (this could be worked around of
course by doing multiple manual partial drawing around the children but
using clipping makes things of course simpler).

Subtractive clipping seams to be available for all major drawing systems
(X11, Win32, Mac OS X) but not for cairo. Is this true? Are there plans
to change this?

Recently I started to support Gtk theming. For this I directly copy
image data from a pixmap into a cairo surface using XCopyArea. It seams
however that if I directly access the OS drawable in this way the
clipping defined on the cairo level for this surface is not honored. Is
this possible? Is there an easy workaround for this? Must I fall back to
reading the clipping rectangles from cairo and manually apply them on
the X11 level using X11 clipping functions (the other solution would be
to make sure that source and target are cairo surfaces and do the
copying on the cairo level).


More information about the cairo mailing list