[cairo] Negative clipping: solution for even-numbered overlaps of clipping regions?

Chris Wilson chris at chris-wilson.co.uk
Wed May 27 12:32:11 PDT 2009


On Wed, 2009-05-27 at 15:09 -0400, Behdad Esfahbod wrote:
> On 05/27/2009 10:18 AM, Benjamin Redelings I wrote:
> >  So ... Can anyone recommend another way of doing negative clipping?  :-)
> 
> This is unfortunately a limitation of cairo currently.  I can't think of any 
> workarounds right now.

When in doubt, construct the mask yourself...

Something along the lines of:
push_group (CONTENT_ALPHA)
set_source_rgba (0, 0, 0, 1)
  draw thin lines
set_source_rgba (0, 0, 0, 0) [or set_operator(CLEAR)]
  draw obscuring fat lines
pattern = pop_group ()
set_source_rgba (line_colour)
mask (pattern)

This may even be similar in speed to performing geometry clipping. ;-)
-ickle



More information about the cairo mailing list