[cairo] operators

Petr Kobalíček kobalicek.petr at gmail.com
Tue Jul 28 13:26:42 PDT 2009


Hi list,

I read thread about changing behavior of compositing operators and I
think that all comments are on the right side. I'm working on my own
graphics library (http://code.google.com/p/fog) and currently I'm
implementing this stuff too. Only one thing I'm not sure is proposed
formula  (src OP dest) LERP_mask DEST. Is LERP correct operator for
compositing SRC and DST with mask?

I thing that nearly in all cases the new behavior makes sense, for
example in pixman is something like this (in pseudocode):

void composite_clear(dst, src, msk, count)
{
  for (int i = 0; i < count; i++) dst[i] = 0x00000000;
}

Note that this code completely ignores the mask and I think this is
wrong behavior (and probably unusable) and new formula looks good for
me at this point.

But the thing I'm interested in is correct formula. Shouldn't be the
formula this:
   ((src OP dest) IN mask) OVER dest
instead of this (suggested in mailing list)?
   ((src OP dest) LERP_mask) dest

Or, shouldn't be mask operator choosen individually for each
compositing operator? (for example in CompositeSrc the LEPR operator
makes sense for me and I used it).

Note that I'm interested in right behavior and I will be happy if Fog
library will be close to cairo.

--------------------------------------------------

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
?

Best regards
- Petr


More information about the cairo mailing list