[SDL] Re: Re: 1.2 SDL_BlitSurface and colorkeying (long)

Mike Battersby mib at roadrunner.its.unimelb.edu.au
Wed Jun 6 22:00:31 PDT 2001


>Note that flags = SDL_SRCALPHA; this is because that flag is set
>automatically by CreateRGBSurface when you specify an alpha channel
>(that is, when Amask != 0)

Okay, this is the bit that doesn't make sense to me.  Why is SDL_SRCALPHA
set if Amask != 0?  In fact, why is SDL_SRCALPHA in the surface flags
at all?  It doesn't seem to be a property inherent to a surface,
but rather a behaviour for SDL_BlitSurface.  It seems like it would
make more sense for SDL_SRCALPHA to be given in a "flags" argument to
SDL_BlitSurface than being a surface property.  What am I missing?  I
guess this must be an artifact of the hardware accel somehow, right?

>>	rgba->flags =& ~SDL_SRCALPHA;
>use SDL_SetAlpha to clear the SDL_SRCALPHA instead - it takes care to
>invalidate blit mappings and other stuff so it should be safer

Is this the officially sanctioned way of removing SDL_SRCALPHA while
leaving the other flags alone?:

	SDL_SetAlpha(rgba, rgba->flags & SDL_RLEACCEL, 0);

>I'll add a note to the docs of CreateRGBSurface[from] >to clarify

Thanks.

 - Mike







More information about the SDL mailing list