[SDL] Transparent Surfaces

Sam Lantinga slouken at devolution.com
Tue Aug 24 15:48:40 PDT 1999

> You have to put the color you are using but converted to the pixel format
> you are working.
> I use bright pink (R255,G0,B255) for tranparent pixels so I have to put
> this in SDL_SetColorKey function:

> SDL_SetColorKey(surface, SDL_SRCCOLORKEY, 0xF81F);

A portable way of doing this is:
  SDL_SetColorkey(surface, SDL_SRCCOLORKEY, SDL_MapRGB(surface->format, 255,0,255));

	-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software
"Any sufficiently advanced bug is indistinguishable from a feature"
						 -- Rich Kulawiec 

More information about the SDL mailing list