Sign in to follow this  
TriKri

Creating a plain SDL surface?

Recommended Posts

Hello! Is there some way to create an SDL surface with a specific width and height, without loading a bitmap or setting the video mode? [Edited by - TriKri on July 29, 2008 8:29:44 AM]

Share this post


Link to post
Share on other sites


Uint32 rmask, gmask, bmask, amask;

#if SDL_BYTEORDER == SDL_BIG_ENDIAN
rmask = 0xff000000;
gmask = 0x00ff0000;
bmask = 0x0000ff00;
amask = 0x000000ff;
#else
rmask = 0x000000ff;
gmask = 0x0000ff00;
bmask = 0x00ff0000;
amask = 0xff000000;
#endif

SDL_Surface * NewSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h,32, bmask, gmask, rmask, amask);





Change the masks to fit you color and alpha needs

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this