Problem with SDL_CreateRGBSurface!

Hello Everyone !

I want to Blit a image to the screen. It is 320x200x8 big.
This image is readed out from a file which is 64800 Bytes
big. The 32 first bytes were skipped. Then comes a
3*256 Bytes big Palette and then the image data.

This is what am i doing:

char array[64000];
char pal[3*256];
char dummy[32];

read(FILEDESCRIPTOR,dummy,sizeof(dummy));
read(FILEDESCRIPT0R,pal,sizeof(pal));
read(FILEDESCRIPTOR,array,sizeof(array));

Uint8* ptr;
SDL_Surface *image;

image=SDL_CreateRGBSurface(image,320,200,8,0,0,0,0);

ptr=(Uint8*)image->pixels;

memcpy(ptr,array,64000);

SDL_Rect rect;

rect.w=320;
rec.h=200;

SDL_BlitSurface(image,NULL,screen,&rect);
SDL_UpdateScreen(screen,1,&rect);

This gives me a black window.

What am i doing wrong ???

Thanks for any help
and kind regards
Anes

This gives me a black window.

What am i doing wrong ???

Maybe you forgot set the palette of the image

“Anes Lihovac”

I want to Blit a image to the screen. It is 320x200x8 big.
This image is readed out from a file which is 64800 Bytes
big. The 32 first bytes were skipped. Then comes a
3*256 Bytes big Palette and then the image data.

<code, code, code>

This gives me a black window.

What am i doing wrong ???

did you set the display mode to 8bpp? if so i believe you’ll
need to set the palette for the screen surface also.