[cairo] Re: Using ADD operator to prevent seams

Owen Taylor otaylor at redhat.com
Fri Mar 18 10:43:18 PST 2005

Here's a fully automatic, though perhaps computationally infeasible
algorithm. :-)

The basic idea is to split the image into non-overlapping components,
draw each individually and then ADD them together.

Say, that the image we want to draw is constructed as:

  initialize dest to fully transparent
  for i (1...N):
     fill(dest, path[i], source[i])

We iterate over all combinations of the N objects:

  initialize dest to fully transparent
  for s (subsets([1...N])):
     initialize mask to fully opaque
     for i (1...N):
        if i in S:
          fill(path[i]) operator = IN_REVERSE
          fill(path[i]) operator = OUT_REVERSE

     initialize tmp to fully transparent
     for i (1...n):
        if i in S:


Given a efficient means of computing the subsets where mask
is non-empty, it might even be feasible, at least for
non-pathological images.


More information about the cairo mailing list