[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] strange behaviour blitting a surface w/ per pixel alpha



I have a code that that generates a visual glitch and I really can't
figure out why.

This is the code: http://pastebin.com/m13726c67
These are the two pngs used in the example:
http://blocnum.interfree.it/py/orangedot.png
http://blocnum.interfree.it/py/lsq.png

Basically I'm creating a full transparent surface, blitting two lights
over that surface and blitting the surface on the screen.

This is what actually happens:
http://blocnum.interfree.it/py/exglitch.png
On the right is how it looks like, and on the left is how it should
look like.
http://blocnum.interfree.it/py/glitch3.png

There's obviously no need to have an intermediate transparente surface
in this example, but i need that in my game to cover the dark areas
with a translucent black rectangle with "light-holes" in it:
http://blocnum.interfree.it/py/lights.png.

Any suggestions on why this is happening or how should I avoid it?

Thank you for your time and help.
Cheers.