Filling a region area

Andrej Mitrovic <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAJ85NXDPVuQ-itMdNUZk6fn48eO+bTQqUj63H4K04cE2sezorQ@mail.gmail.com>
Hello,

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())
{
    ctx.rectangle(cast(Rect!double)rect);
    ctx.fill();
}

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).
--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.