Hi all,<br><br>I was playing with cairo to flatten several layers with transparency.<br>Some of my surfaces are data surface filled by an external lib.<br>Pixels on these surfaces have distributed alpha values (not only fully  transparent or opaque).<br>
<br>When I dump any surface independently, the transparency seems to be fine.<br><br>But as soon as I want to compose them, the transparent values of the top layer behaves oddly.<br>I did a lot of tests but the best I could do to explain is the dummy cpp file attached.<br>
<br>Basically I draw a gradient manually (let's say it is what the external lib do). So alpha layer is in [0,1]. I want a red square to be behind this gradient. So I expect the result square not to change on parts where transparency is near 0.<br>
<br>When line 52 : buf[y*rowLen+x*4+1] = 50;<br>I see the square but is already altered because it is not its actual color.<br><br>When line 52 : buf[y*rowLen+x*4+1] = 255;<br>I see everything in green and I just can't explain why for now.<br>
<br>I keep on reading the doc to get it, but if someone could explain what happens and how I could merge/flatten/composite several layers, it would be nice, because it is a little unclear to me for now.<br>Thanks,<br><br>
Steve<br><br>PS:<br><br>A copy/paste way to compile and run the example :<br>$ g++ -g -I/usr/include/cairo -o test Dummy.cpp -lpng -lcairo && ./test<br><br>A way to see the result :<br>$ eog test.png<br><br>