[SDL] Alpha blending transparent PNGs

Ilya Olevsky info at valengames.com
Fri Oct 19 17:59:05 PDT 2007


Cracker wrote:
> Hello everybody!First, I'm sorry if this question was asked already,
 > I've searched, but looks like nobody encountered this problem.In my
 > program, I'm using SDL_DisplayFormatAlpha to convert the loaded image,
 > because I'm using transparent PNGs. I also want to fade in/out these
> images, but I can't find a way to do that. SDL_SetAlpha works only if
 > I convert the image with SDL_DisplayFormat, so ignoring the PNG's built-in
 > alpha information, but it doesn't seems to work at all if I try to set the
 > alpha value of an image which has built-in transparency. Is there a way to
 > do that? I think it can be done somehow with SDL_GetRGBA/SDL_MapRGBA, but
 > I have no idea.Best Regards,

Using the PNG alpha = per pixel alpha. Fading a surface = per surface alpha. You 
can't mix the two in SDL 1.2 (I don't know if it's possible in SDL 1.3).



More information about the SDL mailing list