[SDL] color key broken in glSDL?

James Gregory james.jrg at gmail.com
Fri Oct 13 05:49:28 PDT 2006


On 10/13/06, David Olofson <david at olofson.net> wrote:
> 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.

The game runs in RGBA, the image I was loading just happened to not
have an alpha channel.

James




More information about the SDL mailing list