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

[pygame] Question about .bmp files and transparency



Hi

Just started trying out Pygame and my first project is coming along
nicely: A Tank Wars game. (Got to start somewhere ;)

To be able to create some nice explosions I thought I would use some
images and 'throw' them around. For the images I already have some .bmp
files which I took from another game. 
Here is the problem though. These .bmp files are all with a black
background, and all have their edges etc. antialiased against black. The
game where the images are used the images black background turns fully
transparent, then less dark pixels get some transparency and only bright
pixels are none transparent.
How this is done has me a bit puzzled. The .bmp images are 24 bit no
alpha channel.

Could I just add together the RGB layers and create an alpha channel
from those? Is that viable solution? Or how would -you- do it? :)
I could always just use some transparent .gifs but the effects wouldn't
be so nice then, with transparency only being limited to one color.

I'm also a bit unsure about how to use images with alpha channel or how
to add an alpha channel to a image.

From searching the in Internet I guess the term for this is 'alpha
blending'? :)


Anyway, I really like pygame. I've been using BlitzBasic earlier, but
with pygame you much of the same functionality but with a much better
programming language.

Also, I see now need for future support for older versions of python.



-
Erlend Stromsvik