[SDL] optimal opening and blitting

John Philip phip at spymac.com
Tue Nov 4 22:14:00 PST 2003


I am confused about the optimal way to open an image and prepare it for 
blitting.

This is my current method:
	SDL_Surface *temp, *finished;

	temp = LoadImageFromPath(itemPath); //wraps SDL_Image's PNG loader
	SDL_SetColorKey(temp, SDL_SRCCOLORKEY | SDL_RLEACCEL,
                  temp->format->Rmask | temp->format->Gmask | 
temp->format->Bmask | SDL_ALPHA_TRANSPARENT );
	finished = SDL_DisplayFormat(temp);
	SDL_FreeSurface(temp);

Is this right? Should I call SDL_DisplayFormat() before 
SDL_SetColorKey()? What would be the best way to prepare an image to be 
blit to the screen (with minimal overhead from per-blit conversion 
etc)?

Thank you for your time.





More information about the SDL mailing list