[cairo] [RFC] Cairo operators expressed in shader syntax
Carl Worth
cworth at cworth.org
Wed May 16 21:39:49 EEST 2007
On Tue, 15 May 2007 10:33:24 +0100, Bill Spitzak wrote:
> This is not as complicated as everybody is making out. ALL(*) cairo
> operators are equivalent to:
>
> (src OP dest) * mask + dest * (1-mask).
That's not correct, (not for IN, OUT, DEST_IN, nor DEST_ATOP in
addition to SATURATE).
I'm looking forward to getting the math nicely documented soon so we
can stop revisiting it in threads like this.
Here's Owen's original description that led to the current
implementation:
http://article.gmane.org/gmane.comp.lib.cairo/4791
And here's the crux of what he wrote:
So, the proposal here is to logically divide the operators into
4 groups by what definition we use:
OVER, ATOP, DEST, DEST_OVER, DEST_OUT, XOR, ADD
All definitions equivalent
SOURCE, CLEAR
(mask IN clip) ? src OP dest : dest
IN, OUT, DEST_IN, DEST_ATOP
clip ? (src IN mask) OP dest : dest
SATURATE
(src IN mask IN clip) OP dest
And yes, it is quite ugly that we basically have 3 different
fundamental equations. And it can be quite confusing that for the most
common (and default) operator of OVER, the 3 equations yield identical
results.
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://cairographics.org/archives/cairo/attachments/20070516/3f60dc69/attachment.pgp
More information about the cairo
mailing list