SDL_CreateRGBSurfaceFrom pixels parameter question


I need to solve the following situation for a BMP animation:

First Frame: BMP file loaded from a file as a pattern image(SDL_LoadBMP works OK here)
Second Frame: Image created by joining(blitting?) the pattern image with pixel information stored in a file with a custom format indicating only which pixels are different from the first frame.
Next Frames: Created like the Second Frame but by taking the previous frame as the new pattern image.

The problem is that I’m not sure how to solve the loading of the frames after the first one. I think I have two possibilities where performance has to be as good as possible:

  • Clone the pattern image in memory, modify the cloned image pixel by pixel by locking and unlocking it, and then filp the shown image with the modified one. For what I see the lock\unlock method is not the most recommended and performant way of loading many pixels together to the screen, right?
    *So I decided to draw attention to the SDL_CreateRGBSurfaceFrom, but couldn’t find any example in the documentation (official doc, articles, tutorials, this list, etc). My main doubt is which sould be the format of the void *pixels parameter. I think this should be an array, but what is the structure of the elements contained here? will this structure be different if I change from a 256 colors palette to a 16 bits color depth? Any example would be appreciated.

Thanks in advanced,

Martin Gorostegui---------------------------------
Pregunt?. Respond?. Descubr?.
Todo lo que quer?as saber, y lo que ni imaginabas,
est? en Yahoo! Respuestas (Beta).
Probalo ya!