[SDL] Fade in does not work when PNG file has transparent background.

Jonathan Dearborn grimfang4 at hotmail.com
Sun May 25 18:00:30 PDT 2008


Hey,



If you need to combine per-pixel alpha and per-surface alpha, you have
to do it yourself (sadly...).  You can take a look at Sprig
(http://pubpages.unh.edu/%7Ejmb97/sprig.html).  It has a blitter that
can handle that and a bunch of blending modes, but it's as slow as
software gets.

Colorkey just won't cut it if you have alpha values other than 0 and
255.  Colorkey transparency is only on/off.  I thought the colorkey was
automatically set by SDL_DisplayFormat (or Alpha)...  Well, if you
definitely know that your pngs have only full transparency and full
opacity, then I would suggest that you choose the colorkey.  Make a new
surface that is SDL_FillRect'ed with your colorkey, then blit your png
to it (with SDL_SRCALPHA).

For fading, definitely go for the overblitting approach, like Andreas said.

Jonny D

_________________________________________________________________
Make every e-mail and IM count. Join the i’m Initiative from Microsoft.
http://im.live.com/Messenger/IM/Join/Default.aspx?source=EML_WL_ MakeCount
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20080525/b4faf2c3/attachment.htm>


More information about the SDL mailing list