Re: Layered stroke / fill
Chris Wilson <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <1345377368_635@CP5-2952> |
On Sun, 19 Aug 2012 20:44:28 +0900, Lockert Fredrick <[email protected]> wrote: > Greetings, > > I'm currently programming a very simple gtkmm/cairo application, where > the user can draw lines, circles, rectangles, etc, in real time. > > There's one problem I've got though, and I can't quite figure out how > to fix it. When the user draws out rectangles, they "merge" into each > other, rather then being painted on top of each other. I'm sure this > is an easy fix, but I couldn't find an answer after searching the web > and the documentation (probably used the wrong keywords...) Just stroke and fill each rectangle individually. Adding all rectangles to the path then calling stroke/fill operates on the union of that path. So, foreach (rect) { cr->rectangle(*rect) cr->set_source_rgb(*stroke_color) cr->stroke_preserve() cr->set_source_rgb(*fill_color) cr->fill() } -Chris -- Chris Wilson, Intel Open Source Technology Centre -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo