[SDL] Re: Transparency not that transparent.

Mattias Engdegård f91-men at nada.kth.se
Thu Mar 15 02:32:58 PST 2001


>	orig = IMG_Load(filename);
>
>	rgba = SDL_CreateRGBSurface(SDL_SWSURFACE, orig->w, orig->h,
>				    orig->format->BitsPerPixel,
>				    orig->format->rmask, orig->format->bmask,
>				    orig->format->gmask, orig->format->amask);

you don't want to use the format of 'orig' if it's an indexed surface

>	SDL_FillRect(rgba, NULL, SDL_MapRGBA(rgba->format, 0, 0, 0, 0));

this shouldn't be necessary - SDL_CreateRGBSurface zeroes the surface
by default (too much code relies on it so we might just as well document
it)




More information about the SDL mailing list