[cairo] Unbounded operators question

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Wed Jun 23 10:48:06 PDT 2010

On Wed, 23 Jun 2010, Andrei Bucur wrote:

> I need to use the CAIRO_OPERATOR_DEST_IN operator but in a bounded form
> (restricted to an image mask). Is there a specific reason why they were
> implemented like this in the first place?

Mostly due to an accident of definitions inherited from XRender I 

> Also is there a way to achieve the same effect without using it?

Yes. Implement src DEST_IN(mask) dst as follows:

tmp := src DEST_IN dst
dst := (tmp IN mask) ADD (dst OUT mask)

The above implements interpolation between the unmasked result (tmp) 
with the destination by using the mask as the interpolation parameter.  
If your mask can be represented by a path, then you could let cairo do 
this for you by setting your path as the clip path and then doing an 
unmasked src DEST_IN dst.


More information about the cairo mailing list