[SDL] color key broken in glSDL?
David Olofson
david at olofson.net
Fri Oct 13 05:21:57 PDT 2006
On Friday 13 October 2006 13:32, James Gregory wrote:
[...]
> I ran into this problem doing this (pseudo code):
>
> surface1 = load_image();
> image_processing(surface1);
> surface2 = create_rgba_surface();
> blit(from surface1, to surface2);
> set_color_key(surface2);
> display_format(surface2);
>
> I could remove the blitting across step, but then I would need to
> reload the image each time I want to do some processing and create a
> surface from it.
I see. But, why are you creating surface2 as an RGBA surface?
The correct way of doing it would be to create the surface2 using the
pixelformat struct from surface1. Unfortunately, that doesn't quite
cover it as a general solution, as blitting from one surface to
another doesn't create a copy of the original, except in a few
special cases. You need to fiddle with the colorkey and alpha
settings of the source surface to make sure the blitter actually just
copies pixels, without keying or blending.
//David Olofson - Programmer, Composer, Open Source Advocate
.------- http://olofson.net - Games, SDL examples -------.
| http://zeespace.net - 2.5D rendering engine |
| http://audiality.org - Music/audio engine |
| http://eel.olofson.net - Real time scripting |
'-- http://www.reologica.se - Rheology instrumentation --'
More information about the SDL
mailing list