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

Re: [pygame] fade out surfaces



Luke Miller wrote:

Hello!

Is there an easy way to fade out a surface that uses per pixel alpha?

Luke




If you're rendering with OpenGL this is simply a matter of changing the color you're drawing your textures with. Without OpenGL you'll have to modify the pixel colors directly which is pretty slow, or use surfarrays which are faster, especially via pixels_alpha():
http://www.pygame.org/docs/ref/pygame_surfarray.html


You might be able to do some tricks with color indexing too, but it depends what exactly you're trying to do.

-Jasper