[cairo] Applying to a surface the alpha of other

Carlos López González genetita at gmail.com
Mon Oct 15 12:36:15 PDT 2012


I'm dealing with a problem of compositing surfaces and I have a
situation that I would like to solve by using the Cairo operators but
I don't find a way to solve it.

Say I have two surfaces: A and B of the same dimensions
I would like to have a result surface (R) with the following properties:

(I'm using the nomenclature from the http://cairographics.org/operators/ page)


I've tried to achieve that operations by using the current Cairo
operators but I always get with axB for the color and not xB.

Is there any way to perform this or should I need to modify the data directly?

Alternatively to this I would be also happy if I can do the following operation:
Given a surface B I would like to obtain another surface (R) that satisfies:


So masking the resulting surface with the surface A I would obtain the
desired result.

Then basically the question is: How do I change the alpha channel of
all the pixels to be 1.0?

Thanks in advance!

More information about the cairo mailing list