[cairo] Non-transparent composition of transparent objects

Uli Schlachter psychon at znc.in
Thu Nov 14 12:24:38 PST 2013


On 13.11.2013 09:09, LRN wrote:
> The [1] shows the output various composition operators, but the effect
> i'd like to achieve is not obvious from that documentation.
> What i want to do is to draw two transparent objects in sequence, and
> second object should be painted only in places where first object
> isn't (at all).
> Now, AFAICS, this can be achieved by just using CAIRO_OPERATOR_SOURCE
> and drawing object in reverse order: second object is drawn, then
> first object is drawn on top of it, resulting in a composition of
> both, where second object can be seen only in places where first isn't.
> Doesn't seem to be working though, because i'm drawing with surface
> patterns.

Doesn't the operator source just remove your second object again?

I think that what you are looking for is cairo_mask_surface() instead. But I am
not really sure how to do the "not at all" part of your requirements.

"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?" -- A. P. J.

More information about the cairo mailing list