[cairo] clear operator
ranma42 at gmail.com
Wed Jun 1 02:42:22 PDT 2011
On Wed, Jun 1, 2011 at 10:06 AM, control H <control.h at gmail.com> wrote:
>> surf1 is now completely transparent
> I don't understand. I expect surf1 to be the circle, except for the
> parts where is any pixel in surf2. That is what I want at least, but
> also how I interpret the operators at
> http://cairographics.org/operators/. I do understand the result if I
> change the operator into any other, like DEST_OUT. So could you please
> explain why in this case surf1 becomes _completely_ transparent?
Using http://cairographics.org/operators/ as reference:
- paint implies a mask which covers the whole surface (1 everywhere)
- CLEAR ignores the context source
- you have not clipped to anything
The expected result can be computed based on the "Bounded" formula:
(src CLEAR dst) LERP_(clip IN mask) dst =
(0) LERP_(1 IN 1) dst =
0 LERP_1 dst = dst
>> This is actually a no-op.
>>> cairo_destroy (cr);
>>> return TRUE;
>>> The result is just a white screen. However, if I change
>> This is expected. When you paint() cr1 with a CLEAR
>> operator, you make it completely transparent.
>> Painting surf1 OVER cr has thus no effect at all
>> and correctly leaves surface white.
> Sure, when surf1 is already transparent that makes sense :)
More information about the cairo