I do not know if this is wellknown bug or possible me doing something
If I load a surface and sets its colorkey like this (Error checks
ColorKey = SDL_MapRGB(Screen->format, 255, 0, 255);
SDL_Surface * tmp1 = IMG_Load(“test.png”);
SDL_SetColorKey(tmp1, SDL_SRCCOLORKEY | SDL_RLEACCEL, ColorKey);
SDL_Surface * res = SDL_DisplayFormat(tmp1);
it works, if the surface actually contains the color (255, 0, 255) and the
transparency I want, etc works.
However, if the surface does not contain the colorkey, the call to
SDL_DisplayFormat(tmp1) will segfault libsdl.
(Linux Mandrake 8.1, ia32:
Program received signal SIGSEGV, Segmentation fault.
0x40051b43 in SDL_GetRGB () from /usr/lib/libSDL-1.2.so.0)
It does not seem to have anything to do with the particular color (it also
happens for (1, 0, 0)) nor with the SDL_RLEACCEL options to SetColorKey.
If I omit the call to SDL_DisplayFormat (and use tmp1 instead of res) the
program also works, etc.
Is this due to my mistake, an unknown bug, or a known bug?
P.S. For what it is worth, I am guessing I am doing something wrong - but
I can not figure out what.–
Mads Bondo Dydensborg. @Mads_Bondo_Dydensbor
I cannot conceive of a God who rewards and punishes his creatures, or has a
will of the type of which we are conscious in ourselves. An individual who
should survive his physical death is also beyond my comprehension, nor do I
wish it otherwise; such notions are for the fears or absurd egoism of feeble
- Albert Einstein (The World as I See It, 1949)