[cairo] Best way to intermediate compositing, recording vs grouping
Nikita Zlobin
nick87720z at gmail.com
Fri Jul 30 23:02:32 UTC 2021
В Fri, 30 Jul 2021 20:08:17 +0200
Uli Schlachter <psychon at znc.in> пишет:
> 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
draw() consists of blocks in conditins like if(1) or if(0).
At the moment of publish it had enabled block to draw dots line.
You could leave it, but it's irrelevant.
You need blocks: 0 (to fill background) and two, related to additive
stiching (uncomment only one of them).
More information about the cairo
mailing list