Yeah, but as I mentioned, his problem was his ‘destination’ surface was
never created. He just had some random pointer pointing off into
who-knows-where. ;^)
When I got to exactly duplicate a particular surface into a new surface
(like when I go to change the tint or color of a rubber stamp in Tux Paint),
I do this:
/* ‘amask’ is of type “Uint32” */
amask = ~(src->format->Rmask |
src->format->Gmask |
src->format->Bmask);
/* ‘newsurf’ is, of course, an “SDL_Surface *” /
/ And, obviously, so is the source surface, ‘src’! :^) */
newsurf = SDL_CreateRGBSurface(SDL_SWSURFACE,
src->w,
src->h,
src->format->BitsPerPixel,
src->format->Rmask,
src->format->Gmask,
src->format->Bmask,
amask);
And then, obviously, test ‘newsurf’ to see if it’s NULL.
If so, the ‘Create’ function failed for some reason.
(You can print the string returned by “SDL_GetError()” to stderr/stdout,
to show why, for example.)
-bill!On Sun, Mar 23, 2003 at 09:06:09PM -0000, Tane Piper wrote:
Use this very handy function which was posted on this list before:
–
bill at newbreedsoftware.com Hire me!
http://newbreedsoftware.com/bill/ http://newbreedsoftware.com/bill/resume/