Re: Layered stroke / fill
Lockert Fredrick <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAPBD81VUqLMOLU_18JFB-uw6apzZt-D9TKZ1F5fFKKHqwtO+QQ@mail.gmail.com> |
On 19 August 2012 21:51, Uli Schlachter <[email protected]> wrote: > Try swapping the calls to stroke and fill: > > cr->fill_preserve(); > cr->set_source_rgb(1.0, 1.0, 1.0); > cr->stroke(); > > The fill() will otherweise erase part of the earlier stroke(). Swapping the two calls, results in the stroke not being drawn (or filled over, since the stroke does not appear), thus that would give an undesired effect. The original problem was solved by drawing the rectangles individually (which is quite obvious), as suggested by Chris Wilson. cr->save(); if(mMouseDown) { cr->rectangle(mRect.left, mRect.top, mRect.right, mRect.bottom); cr->set_source_rgb(0.0, 0.0, 0.0); cr->stroke_preserve(); cr->set_source_rgb(1.0, 1.0, 1.0); cr->fill(); } for(int i = 0; (unsigned)i < mRects.size(); ++i) { cr->rectangle(mRects[i].left, mRects[i].top, mRects[i].right, mRects[i].bottom); cr->set_source_rgb(0.0, 0.0, 0.0); cr->stroke_preserve(); cr->set_source_rgb(1.0, 1.0, 1.0); cr->fill(); } cr->restore(); Thus they no longer "merge" into each other and give the desired effect. Thanks for your suggestion though, Uli. I really do appreciate it. - Fredrick -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo