The following code seems to create a gray bar at the top of a loaded bitmap image. The newsurf seems to have some pixel corruption the first few lines…
I got this code from some overlaytest.c file.
Am I doing something wrong?
SDL_Surface *pic;
bmpfile=("sample.bmp");
pic = SDL_LoadBMP(bmpfile);
SDL_Surface *newsurf;
SDL_PixelFormat format;
format.palette=NULL;
format.BitsPerPixel=32;
format.BytesPerPixel=4;
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
format.Rshift=0;
format.Gshift=8;
format.Bshift=16;
#else
format.Rshift=24;
format.Gshift=16;
format.Bshift=8;
#endif
format.Ashift=0;
format.Rmask=0xff<<format.Rshift;
format.Gmask=0xff<<format.Gshift;
format.Bmask=0xff<<format.Bshift;
format.Amask=0;
format.Rloss=0;
format.Gloss=0;
format.Bloss=0;
format.Aloss=8;
format.colorkey=0;
format.alpha=0;
newsurf=SDL_ConvertSurface(pic, &format, SDL_SWSURFACE);
Shane