[SDL] creating multiple surfaces from one

Bill Kendrick nbs at sonic.net
Sun Sep 15 13:40:01 PDT 2002


On Sun, Sep 15, 2002 at 05:19:28PM -0300, Keith Swyer wrote:
> hi, i am currently trying to make several distinct SDL_Surfaces from one
> surface. i load in a bmp and want to 'cut' it into several different
> surfaces. i know i could just use clipping rects and blit the different
> areas i want 'seperate' , but i am in the need of having the pieces distinct
> sdl_surfaces.

Use "SDL_CreateRGBSurface()" to create the new surfaces you want, and
then "SDL_BlitSurface()" to copy from your original BMP into the new ones.

Or, you can just use "SDL_BlitSurface()" to cut bits from the original
into whatever your FINAL surface is going to be.

(e.g., no middle-man '..Create...'d surfaces)


-bill!




More information about the SDL mailing list