[cairo] Avoiding seams with CAIRO_OPERATOR_SATURATE (the OpenGL way)

David Reveman davidr at novell.com
Fri Jun 10 15:45:42 PDT 2005

On Fri, 2005-06-10 at 12:25 -0700, Carl Worth wrote:
> On Sat, 11 Jun 2005 06:48:22 +1200, Robert O'Callahan wrote:
> > > 4) Draw all objects front to back, taking advantage of
> > 
> > I forgot about that one. What does CAIRO_OPERATOR_SATURATE do? Last I
> > checked this wasn't covered in any documentation.
> It's based on the behavior of the OpenGL blending factor
> GL_SRC_ALPHA_SATURATE, (or perhaps more specifically
> GL_SRC_ALPHA_SATURATE for the source and GL_ONE for the destination
> --- I would have to look at the equations involved to know for
> sure).

GL_SRC_ALPHA_SATURATE translates to blending factor:

F = min (ALPHA_source, 1 - ALPHA_dest)

As you can see, this is design for being used with a non-premultiplied
source. As RENDER is using premultipled images, the source blending
factor for the saturate operator in RENDER needs to be:

F = min (1, (1 - ALPHA_dest) / ALPHA_source)

So, OpenGL's GL_SRC_ALPHA_SATURATE blending factor can only be used with
non-premultiplied images, that's why glitz doesn't accelerate
CAIRO_OPERATOR_SATURATE right now. There's no way to accelerate RENDER's
saturate operator with OpenGL, except for when using solid colors of
course. I'll add saturate operator support for solid colors in glitz
sometime soon but that's pretty much all we can do for acceleration of
saturate operator with OpenGL.


More information about the cairo mailing list