[cairo] Filling a region area

Andrej Mitrovic andrej.mitrovich at gmail.com
Wed Sep 21 13:17:32 PDT 2011


If I want to draw inside of the boundary of some region, is it
expected for me to retrieve all the rectangles from a region manually
(via numRectangles && getRectangle) and then use cairo_rectangle, or
is there a more efficient way of doing this (maybe a mask?).

Basically I'm trying to draw to a clipped area not occupied by a child
widget. I have a nice D wrapper library for this and the following
works great for me (win32 and D specific):

auto boundRect = m.ps.rcPaint;  // win32 invalid window area RECT
auto clipRegion = Region(Rect!int(boundRect));
clipRegion -= child.clip;  // subtract from child clip rectangle

foreach (rect; clipRegion.getRectangles())

But I was wondering if this is the right approach or if there's a
better way to do this. (setting aside issues not specific to cairo).

More information about the cairo mailing list