[cairo] operators

Bill Spitzak spitzak at gmail.com
Tue Jul 28 14:23:35 PDT 2009


Petr Kobalíček wrote:

> But the thing I'm interested in is correct formula. Shouldn't be the
> formula this:
>    ((src OP dest) IN mask) OVER dest

No. Obvious example is if OP is CLEAR, then the above would do nothing, 
since it would compite a clear image over the destination.

LERP_mask is a shortcut for saying the following (I think...):

  ((src OP dest) IN mask) PLUS (dest OUT mask)

That may be what you are thinking of.

> We can stay at the glyph rendering formula (SRC OVER + MASK). In
> pixman is (I hope) this:
>    (src IN mask) OVER dest
> And I think that here is no reason to change it, how different it will
> be if it will be changed to:
>    ((src OVER dest) LERP_mask dest

For all the operators where transparent source means no change to the 
destination, the definitions are identical. This includes OVER, so the 
behavior of that won't change:

   ((src OVER dest) LERP_mask dest)
	== (s + d*(1-a))*m + d*(1-m)
	== s*m + d*(m-a*m) + d*(1-m)
	== s*m + d*(1-a*m)
	== (src IN mask) OVER dest



More information about the cairo mailing list