Changing surface formats

I need to take a SDL_Surface object and convert it to
a 32bpp formatI know I can use SDL_ConvertSurface(…) to actually
convert the surface however I need to create and SDL_PixelFormat
object and I’m not sure how to populate it.

So assuming I have the variable:
SDL_PixelFormat pixFmt;
I would guess that pixFmt.pallette could be NULL (since it’s a 32bpp
surface)
pixFmt.BitsPerPixel = 32; // let us assume the surface is RGBA format
and
pixFmt.BytesPerPixel = 4;

but what about the Rloss, Rshift, Rmask (and their G and B cousins)?

I would guess that the colorkey and alpha could be 0 since I’m not going
to be using them.

		-fjr-- 

Frank J. Ramsay
@Frank_Ramsay

Frank Ramsay wrote:

never mind…
I realized how I could do this.

	-fjr-- 

Frank J. Ramsay
@Frank_Ramsay

Frank Ramsay wrote:

never mind…
I realized how I could do this.

How? :slight_smile:
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Sam Lantinga wrote:

Frank Ramsay wrote:

never mind…
I realized how I could do this.

How? :slight_smile:
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

well like this…

SDL_Surface *theScreen = SDL_SetVideoMode(VIEW_WIDTH, VIEW_HEIGHT, 32,
SDL_DOUBLEBUF)
SDL_Surface *tmpSurface = SDL_LoadBMP(argv[1]);
SDL_Surface *panoSurfaceRaw = SDL_DisplayFormat(tmpSurface);

It’s not the best way, but it works for now.

	-fjr-- 

Frank J. Ramsay
@Frank_Ramsay