Bad colorkeys?

Hello,
I’m trying to blit a few things onto a software surface and then blit
that surface to my “screen” surface, but it seems to be ignoring my
colorkey. When I create this software surface which I blit a few things
to:

targetting_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 145, 125,
backbuffer->format->BitsPerPixel, backbuffer->format->Rmask,
backbuffer->format->Gmask, backbuffer->format->Bmask,
backbuffer->format->Amask);
SDL_SetColorKey(targetting_surface, SDL_RLEACCEL,
(Uint32)SDL_MapRGB(targetting_surface->format, 0, 0, 0));

I create it with SDL_CreateRGBSurface() and set the colorkey with
SDL_SetColorKey(), but upon blitting this surface to my main backbuffer
surface (my second buffer) and then to the screen, the colorkey doesnt
appear to be there, and it draws black. What’s wrong?–
Chris Thielen <@Christopher_Thielen>

Tried SDL_SRCCOLORKEY | SDL_RLEACCEL instead of just SDL_RLEACCEL?–
Kylotan
http://pages.eidosnet.co.uk/kylotan

no, if i specify the SDL_SRCCOLORKEY option it completely crashes. i
dont think there is a source colorkey if you use CreateRGBSurface().On Sat, 2002-12-14 at 16:28, Kylotan wrote:

Tried SDL_SRCCOLORKEY | SDL_RLEACCEL instead of just SDL_RLEACCEL?

Chris Thielen <@Christopher_Thielen>

i’ve gotten a problem quite like that when i was making my personal font
class… never relly figured out why it was happening, just managed to make
something that worked after (quite) a few tries…

M@_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*.
http://join.msn.com/?page=features/virus

Chris Thielen wrote:

no, if i specify the SDL_SRCCOLORKEY option it completely crashes. i
dont think there is a source colorkey if you use CreateRGBSurface().

http://sdldoc.csn.ul.ie/sdlcreatergbsurface.php doesn’t agree with you
:wink:

http://sdldoc.csn.ul.ie/sdlsetcolorkey.php implies that you need
SDL_SRCCOLORKEY, or the 3rd parameter of SDL_SetColorKey is ignored.

(Aside: Personally I don’t think the SDL_RLEACCEL flag should be part of
the SDL_SetColorKey call at all. It could probably have its own function
to set it, especially since “the surface will actually be encoded for
RLE acceleration the first time SDL_BlitSurface or SDL_DisplayFormat is
called on the surface”, as the docs say.)

Sounds like a bug somewhere, and maybe in the actual SDL code if just
using an extra flag makes it crash.–
Kylotan
http://pages.eidosnet.co.uk/kylotan