[SDL] Alpha transparency on created surface?

L-28C kixdemp at gmail.com
Wed Aug 8 11:52:14 PDT 2007


I found the right word to say what I want to do!

Per-pixel alpha. ;-)

How do you do that? I thought of loading a 1x1 PNG and filling my 
surface with that single pixel, but that wouldn't be very efficient...

Thanks!

L-28C wrote:
> Hmm... The docs on SDL_CreateRGBSurface(...) say that if you specify an 
> alpha mask > 0, then SDL_SRCALPHA will be automatically set...
> 
> Well, I set a mask of 255, but the surface is still black instead of 
> transparent. :-/
> 
> I called SDL_SetAlpha(...) with the parameters you specified, but the 
> same thing is displayed.
> 
> I basically just want the surface to be filled with (0,0,0,0) (nothing) 
> instead of (0,0,0) (black).
> 
> Thanks you three! ;-)
> 
> (P.S; talking about SDL_CreateRGBSurface, what's the advantage on using 
> hardware surfaces over software ones?)




More information about the SDL mailing list