SDL_SetColorKey problem |
SDL_SetColorKey problem |
Alex Volkov
Guest
|
Jorge Navarro wrote:
...
You are removing the the colorkey with that last call. Try something like: *pointer_fichbmp = SDL_ConvertSurface(temp, gScreen->format, temp->flags | SDL_SWSURFACE); Also, keep in mind that depending on exact surface formats involved and on which blitter is chosen to do the conversion from your loaded format to the gScreen format, the full-green pixels (00,ff,00) may get changed to non-full (for example, (00,f8,00)) and the colorkey may undergo a slightly different conversion, which will make it desynchronized with the transparent surface pixels. Since you are already hard-coding transparent green here, it may be a better choice for you to read an already converted pixel from a pre-defined location in the image (i.e. from x=0, y=0) and use that pixel as the colorkey for the converted surface. With images loaded from files, alpha channel transparency is often a better choice. Alternatively, colorkeys work very well with indexed (8bpp paletted) images, and you would not need to convert indexed images to a target format beforehand -- just blit them to the screen (?) when you need to. -Alex. |
|||||||||||||||||
|