[cairo] Best way to intermediate compositing, recording vs grouping

Uli Schlachter psychon at znc.in
Fri Jul 30 18:08:17 UTC 2021


Am 30.07.21 um 19:25 schrieb Nikita Zlobin:
> In Fri, 30 Jul 2021 16:55:52 +0200
> Uli Schlachter <psychon at znc.in> wrote:
> 
>> Am 30.07.21 um 14:12 schrieb Nikita Zlobin:
>> [...]
>>> Even intentional "safeguard"
>>> surface creation with immediate destruction (as well as
>>> cairo_paint() with CLEAR operator... does rec surf ever interpret
>>> this?).
>>
>> Well, you have a recording surface with CAIRO_CONTENT_COLOR_ALPHA.
>> Clearing that makes it completely transparent. Drawing this to another
>> surface then does not change anything, because, well, its transparent.
>>
>> I don't know which visual you are using, but I bet that it does not
>> have an alpha channel. Thus, your group approach likely creates an
>> immediate surface with CAIRO_CONTENT_COLOR, i.e. no alpha channel.
>> Clearing that fills it completely with black.
> 
> It has alpha channel, bit depth 32.
> Test app reproduces it.
[...]

Uhm. What exactly does the test app reproduce?

- I fixed up the Makefile to actually work
- I added the XMapWindow() and sleep(1) calls that are in the source

When I run the program, it shows a black window. After a second, some
dots appear. After another second, some more dots appear. After some
time, I end up with a solid line.

Now, your program does *not* clear its background. When I replace the
"if (0)" near "Clear surface" with "if (1)" and make it draw black
instead of white (replacing cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
with cairo_set_source_rgb (cr, 0, 0, 0);), I get:

- a black window for one second, as before
- then the points appear and stay. They do not turn into a line.

So, just as I said: When drawing a background, it seems to work.

All the other code in that file confuses me...

Cheers,
Uli
-- 
- He wants the impossible...!
- That's the short definition of 'captain'.


More information about the cairo mailing list