[cairo] [RFC] Cairo operators expressed in shader syntax

Daniel Amelang daniel.amelang at gmail.com
Sat May 12 15:05:37 PDT 2007


On 5/12/07, Jeff Muizelaar <jeff at infidigm.net> wrote:
> On Fri, May 11, 2007 at 04:22:11PM -0700, Daniel Amelang wrote:
> > ; SOURCE
> > result = src
> > ; src IN mask SOURCE dst
> > result = src * mask.a
> > ; src COMPONENT_IN mask SOURCE dst
> > result = src * mask
>
> Just as a note, although pixman's SOURCE operator behaves this way,
> Cairo's does not. It looks more like:
> result = src * mask.a + (1.0 - mask.a) * dst

Wait a sec...then why does the xlib backend seem to just pass along
CAIRO_OPERATOR_SOURCE to XRenderComposite as PictOpSrc? This from
cairo-xlib-surface.c:

static int
_render_operator (cairo_operator_t op)
{
    ...
    case CAIRO_OPERATOR_SOURCE:
	return PictOpSrc;
   ...
}

which is then used like this (from _cairo_xlib_surface_composite):

XRenderComposite (dst->dpy,
			      _render_operator (op),
			      src->src_picture,
			      mask->src_picture,
			      dst->dst_picture,
			      src_x + src_attr.x_offset,
			      src_y + src_attr.y_offset,
			      mask_x + mask_attr.x_offset,
			      mask_y + mask_attr.y_offset,
			      dst_x, dst_y,
			      width, height);

So where does cairo actually implement this strange version of SOURCE
you speak of?

Dan Amelang


More information about the cairo mailing list