SaveBMP

Hi. I’m trying to save 8 bpp BMP files.

I have the image buffers in memory, 640x480. Pitch is 640.

This is the piece of code:

void SaveImage(char *filename, char buffer)
{
/

SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
*/
SDL_Surface *temp = SDL_CreateRGBFromSurface(buffer, 640, 480, 8, 640, 0, 0, 0, 0);

/*
int SDL_SaveBMP(SDL_Surface *surface, const char *file);
*/
SDL_SaveBMP(temp, filename);
}

The file is created, but the image is completely black.

Any help? THANKS!!!

Carlos

I have zero experience with 8 bpp surfaces, but shouldn’t you attach
some kind of palette to temp?

Gabriel Gambetta
ARTech - Development Team
ggambett at artech.com.uy

RIGHT. I forgot about that, it works now, I just added a palette to the surface.

Thanks!

Carlos----- Original Message -----
From: Gabriel Gambetta
To: A list for developers using the SDL library. (includesSDL-announce)
Sent: Tuesday, December 07, 2004 10:32 AM
Subject: RE: [SDL] SaveBMP

I have zero experience with 8 bpp surfaces, but shouldn’t you attach
some kind of palette to temp?

Gabriel Gambetta
ARTech - Development Team
ggambett at artech.com.uy


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl