SDL_OPENGLBLIT + SDL_SetColorKey()

Hi everybody,

I was wondering why, if I init a screen with the SDL_OPENGLBLIT flag, the

ColorKey for my sprites do not work. Maybe OpenGL uses a different video buffer
than then one SDL uses for 2d Graphic? The question sound quite confusing, I
know (English’s not my mother language :slight_smile: ), so anyone who wants to help me
please compile the code I’ve attached to the message: the borders of the logo
are black, and I’ve set black as the colorkey for the logo, so the borders
should
end up being trasparent: this do not happen (look when the logo in on the
triangle:
it would be neat to manage to blit 2d graphic on a 3d generated background - is
this possible? What mistake am I doing?). The code should work fine on all
systems.

Thanks in advance. :slight_smile:
-------------- next part --------------
A non-text attachment was scrubbed…
Name: main.zip
Type: application/zip
Size: 1337 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20010820/e216c70c/attachment.zip

At 10:39 20.08.01 +0200, you wrote:

Hi everybody,

I was wondering why, if I init a screen with the SDL_OPENGLBLIT flag, the
ColorKey for my sprites do not work. Maybe OpenGL uses a different video
buffer
than then one SDL uses for 2d Graphic? The question sound quite confusing, I
know (English’s not my mother language :slight_smile: ), so anyone who wants to help me
please compile the code I’ve attached to the message: the borders of the logo
are black, and I’ve set black as the colorkey for the logo, so the borders
should
end up being trasparent: this do not happen (look when the logo in on the
triangle:
it would be neat to manage to blit 2d graphic on a 3d generated background

  • is

this possible? What mistake am I doing?). The code should work fine on all
systems.

Thanks in advance. :slight_smile:

Hi,

I had the same problem.

Do keep things going i us the following:

void draw_2d()
{
if(!root_2d) return;

glPushAttrib ( GL_ENABLE_BIT | GL_VIEWPORT_BIT | GL_TRANSFORM_BIT |
GL_LIGHTING_BIT ) ;

glDisable ( GL_LIGHTING ) ;
glDisable ( GL_FOG ) ;
glDisable ( GL_DEPTH_TEST ) ;
glDisable ( GL_CULL_FACE ) ;

glMatrixMode ( GL_PROJECTION ) ;
glPushMatrix () ;
glLoadIdentity () ;
gluOrtho2D ( 0, SCREEN_W, 0, SCREEN_H ) ;
glMatrixMode ( GL_MODELVIEW ) ;
glPushMatrix () ;
glLoadIdentity () ;

glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

glBindTexture(GL_TEXTURE_2D, tex_id);

glBegin( GL_QUADS );

//	glColor4f( 1.0f, .5f, 0.2f, 0.6f );

	glTexCoord2f( 0.0f, 0.0f );
	glVertex2f( rect.x + x,			 rect.y + y			 );

	glTexCoord2f( 1.0f, 0.0f );
	glVertex2f( rect.x + x + rect.w, rect.y + y			 );

	glTexCoord2f( 1.0f, 1.0f );
	glVertex2f( rect.x + x + rect.w, rect.y + y + rect.h );

	glTexCoord2f( 0.0f, 1.0f );
	glVertex2f( rect.x + x,			 rect.y + y + rect.h );

glEnd();

glDisable( GL_BLEND );

glMatrixMode ( GL_PROJECTION ) ;
glPopMatrix () ;
glMatrixMode ( GL_MODELVIEW ) ;
glPopMatrix () ;
glPopAttrib () ;
}

“Fabio ‘SnowDruid’ Franchello” wrote:

I was wondering why, if I init a screen with the
SDL_OPENGLBLIT flag, the ColorKey for my sprites do not work.

It should work - does the testgl program work with the -logo option?
And if you modify testgl to use a colour key?

At 11.53 20/08/01 +0200, you wrote:

It should work - does the testgl program work with the -logo option?
And if you modify testgl to use a colour key?

Yes, the testgl program works with the -logo option and behave exactly
like the code I attached to the previous mail if I set a colorkey for
the sprite. Also, I wish to use SDL blitting funtions for 2d graphic if
possible, and not the “make-them-textures” trick as kindly suggested by
Arne Kreutzmann.

The question is: if I IE have a bitmap of a man which is drawn in a black
(RGB(0,0,0)) 100x50 square, and I want to blit it in a 3d generated
landscape using SDL_OPENGLBLIT, do I have to keep the black square even
if I set the RGB(0,0,0) color as the colorkey for that surface? I don’t
think so, because this is very limiting! :slight_smile: So I must be mistaking or
missing something. The code is more eloquent than the speech, anyway.
Please look at the code I posted, I wish I can eliminate the black
box around the ellipse in the logo.

I’m working on: P233-MMX, Voodoo Banshee PCI 16Megs, SDL-1.2.3 and
MSVC6/Win32 / gcc/Linux (the results are the same :slight_smile: ).

Thanks,

Yes, the testgl program works with the -logo option and behave exactly
like the code I attached to the previous mail if I set a colorkey for
the sprite.

OK, can you please dump all information about the source and destination
formats just before the call to BlitSurface? (just print out everything
in Logo->format and Screen->format, directly or using gdb)

Also try using DisplayFormat to convert the Logo to the screen format.
This should not be necessary, but may be a workaround for now

At 15.30 20/08/01 +0200, you wrote:

OK, can you please dump all information about the source and destination
formats just before the call to BlitSurface? (just print out everything
in Logo->format and Screen->format, directly or using gdb)

Also try using DisplayFormat to convert the Logo to the screen format.
This should not be necessary, but may be a workaround for now

Using SDL_DisplayFormat() does not fix the problem. Here’s the formats
WITHOUT using SDL_DisplayFormat():

Screen:
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: 0
alpha: 255

Logo:
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: -16777216
alpha: 255

And here’s the formats using SDL_DisplayFormat() (which are obviously the
same):

Screen:
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: 0
alpha: 255

Logo:
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: -16777216
alpha: 255

Thanks,__
Fabio " ‘- nowDruid " Franchello
—’---------
— snowdruid at tiscalinet.it

“Fabio ‘SnowDruid’ Franchello” wrote:

Using SDL_DisplayFormat() does not fix the problem. Here’s the formats
WITHOUT using SDL_DisplayFormat():

[snip]

something is not right – not only is the Logo format the same as the
screen, it also has an alpha channel despite being loaded from a BMP
file. What have you done with the surface more than LoadBMP() and
SetColorKey() ?

LoadBMP() never creates an alpha channel, and SetColorKey() should
not affect the image format either. Please check your code again
(and print the surface flags for each of the involved surfaces)

At 19.59 20/08/01 +0200, you wrote:

something is not right – not only is the Logo format the same as the
screen, it also has an alpha channel despite being loaded from a BMP
file. What have you done with the surface more than LoadBMP() and
SetColorKey() ?

LoadBMP() never creates an alpha channel, and SetColorKey() should
not affect the image format either. Please check your code again
(and print the surface flags for each of the involved surfaces)

I know. :slight_smile: I do ABSOLUTELY NOTHING to the surfaces other than
loading/creating and blitting. The code is the one I attached 2 mails
ago (when i started the thread). Anyway, look at this snippet:

         if(SDL_Init(SDL_INIT_VIDEO)<0)
         {
                 fprintf(stderr, "Can't init SDL: %s\n", SDL_GetError() );
                 exit(1);
         }

         atexit(SDL_Quit);

         if(!(Tmp = SDL_LoadBMP("logo.bmp")))
         {
                 fprintf( stderr, "Can't load logo: %s\n", SDL_GetError() );
                 exit(1);
         }

         SDL_SetColorKey(Tmp, SDL_SRCCOLORKEY|SDL_RLEACCEL,
                 SDL_MapRGB(Tmp->format, 0, 0, 0) );

         SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
         SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
         SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
         SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
         SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );

         if(!(Screen = SDL_SetVideoMode(640, 480, 16, 
SDL_HWSURFACE|SDL_OPENGLBLIT)))
         {
                 fprintf(stderr, "Can't open video: %s\n", SDL_GetError() );
                 exit(1);
         }

#ifdef USE_DISPLAYFORMAT
         Logo = SDL_DisplayFormat(Tmp);
         SDL_FreeSurface(Tmp);
#else
         Logo = Tmp;
#endif

I do not create any alpha channel and the logo is in .bmp format.
My drawing function:

void Draw(void)
{
         SDL_Rect src;
         static int x = 0, y = 0;
         static int Ox = 2, Oy = 2;
         static bool BlitFlag = false;

         assert(Screen);

         /* 3D drawing */

         glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
         glLoadIdentity();
         glTranslatef(0.0f, 0.38f, -6.0f);

         glBegin(GL_TRIANGLES);
                 glColor3f (1.f, 1.f, 0.f);
                         glVertex3f( 0.0f, 2.0f, 0.0f);
                 glColor3f (0.f, 1.f, 1.f);
                         glVertex3f(-2.0f,-2.0f, 2.0f);
                 glColor3f (1.f, 0.f, 1.f);
                         glVertex3f( 2.0f,-2.0f, 2.0f);
         glEnd();

         glFlush();

         /* 2d drawing */

         src.x = x+=Ox;
         src.y = y+=Oy;
         src.w = Logo->w;
         src.h = Logo->h;

         if(!BlitFlag)
         {
                 fprintf( Log, "Screen[%ld]:\n", Screen );
                 PrintFormat(Screen->format);

                 fprintf( Log, "Logo[%ld]:\n", Logo );
                 PrintFormat(Logo->format);

                 BlitFlag = true;
         }

         SDL_BlitSurface(Logo, NULL, Screen, &src);
         SDL_UpdateRects(Screen, 1, &src);

         if(x<0 || x>640-Logo->w)
         {
                 Ox = -Ox;
         }

         if(y<0 || y>480-Logo->h)
         {
                 Oy = -Oy;
         }

         return;
}

I do nothing more than this.

Thanks,__
Fabio " ‘- nowDruid " Franchello
—’---------
— snowdruid at tiscalinet.it

    SDL_SetColorKey(Tmp, SDL_SRCCOLORKEY|SDL_RLEACCEL,
            SDL_MapRGB(Tmp->format, 0, 0, 0) );

this may (or may not be) part of the problem. but it is no
use using RLEACCEL if you only plan on blitting it to opengl.
in fact, i imagine it would even make the opengl blits run
slower. but i don’t think RLEACCEL changes the format of the
surface at all, so i’m guessing there is something else going on.

“Fabio ‘SnowDruid’ Franchello” wrote:

I know. :slight_smile: I do ABSOLUTELY NOTHING to the surfaces other than
loading/creating and blitting.

please narrow it down. Dump the “Logo” format params including the
surface flags after LoadBMP and after each manipulation, to see where
they are changed. I can’t remote-debug for you

At 23.59 20/08/01 +0200, you wrote:

please narrow it down. Dump the “Logo” format params including the
surface flags after LoadBMP and after each manipulation, to see where
they are changed. I can’t remote-debug for you

Ok:

Logo: after SDL_LoadBMP:
Video Flags:NO FLAGS

Surface = 8199856 [0]
palette: NULL
BitsPerPixel: 24
BytesPerPixel: 3
Rmask: 16711680
Gmask: 65280
Bmask: 255
Amask: 0
Rshift: 16
Gshift: 8
Bshift: 0
Ashift: 0
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 8
colorkey: 0
alpha: 255

Logo: after SDL_SetColorKey:
Video Flags: SDL_SRCCOLORKEY|SDL_RLEACCELOK

Surface = 8199856 [0]
palette: NULL
BitsPerPixel: 24
BytesPerPixel: 3
Rmask: 16711680
Gmask: 65280
Bmask: 255
Amask: 0
Rshift: 16
Gshift: 8
Bshift: 0
Ashift: 0
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 8
colorkey: 0
alpha: 255

Screen: After SetVideoMode(640,480,16,SDL_HWSURFACE|SDL_OPENGLBLIT)
Video Flags: SDL_OPENGL|SDL_OPENGLBLIT
Surface = 8199984 [0]
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: 0
alpha: 255

Logo:
Video Flags: SDL_SRCCOLORKEY|SDL_RLEACCELOK
Surface = 8199856 [0]
palette: NULL
BitsPerPixel: 24
BytesPerPixel: 3
Rmask: 16711680
Gmask: 65280
Bmask: 255
Amask: 0
Rshift: 16
Gshift: 8
Bshift: 0
Ashift: 0
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 8
colorkey: 0
alpha: 255

Screen: After SDL_DisplayFormat(Logo)
Video Flags: SDL_OPENGL|SDL_OPENGLBLIT
Surface = 8199984 [0]
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: 0
alpha: 255

Logo:
Video Flags: SDL_SRCCOLORKEY|SDL_RLEACCELOK|SDL_SRCALPHA
***(The alpha channel is added by SDL_DisplayFormat(), because Screen has
an alpha
***channel, even if I don’t set it (SDL_SetVideoMode() result)
Surface = 8192608 [0]
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: -16777216
alpha: 255

Screen: After OpenGL Init and before entering main loop
Video Flags: SDL_OPENGL|SDL_OPENGLBLIT
Surface = 8199984 [0]
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: 0
alpha: 255

Logo:
Video Flags: SDL_SRCCOLORKEY|SDL_RLEACCELOK|SDL_SRCALPHA

Surface = 8192608 [0]
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: -16777216
alpha: 255

Screen[8199728] right befiore blit:
Video Flags: SDL_OPENGL|SDL_OPENGLBLIT
Surface = 8199984 [0]
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: 0
alpha: 255

Logo[8192656] right before blit:
Video Flags: SDL_SRCCOLORKEY|SDL_RLEACCELOK|SDL_SRCALPHA
Surface = 8192608 [0]
palette: NULL
BitsPerPixel: 32
BytesPerPixel: 4
Rmask: 255
Gmask: 65280
Bmask: 16711680
Amask: -16777216
Rshift: 0
Gshift: 8
Bshift: 16
Ashift: 24
Rloss: 0
Gloss: 0
Bloss: 0
Aloss: 0
colorkey: -16777216
alpha: 255

Thanks,__
Fabio " ‘- nowDruid " Franchello
—’---------
— snowdruid at tiscalinet.it

Hi everybody,

I was wondering why, if I init a screen with the SDL_OPENGLBLIT flag, the

ColorKey for my sprites do not work. Maybe OpenGL uses a different video buffer
than then one SDL uses for 2d Graphic? The question sound quite confusing, I
know (English’s not my mother language :slight_smile: ), so anyone who wants to help me
please compile the code I’ve attached to the message: the borders of the logo
are black, and I’ve set black as the colorkey for the logo, so the borders
should
end up being trasparent: this do not happen (look when the logo in on the
triangle:
it would be neat to manage to blit 2d graphic on a 3d generated background - is
this possible? What mistake am I doing?). The code should work fine on all
systems.

Thanks in advance. :slight_smile:
-------------- next part --------------
A non-text attachment was scrubbed…
Name: main.zip
Type: application/zip
Size: 1337 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20010820/766d2178/attachment.zip

Pete Shinners wrote:

this may (or may not be) part of the problem. but it is no
use using RLEACCEL if you only plan on blitting it to opengl.
in fact, i imagine it would even make the opengl blits run
slower.

that is irrelevant. RLEACCEL should speed up SDL 2d blits to OPENGLBLIT
screens nicely

The cases when RLEACCEL is a bad idea are
a) when you are modifying the source surface frequently (causing many
de- and re-encoding runs)
b) when you have hardware that supports the blits you are interested in

Otherwise it should run as fast as or faster than without RLEACCEL

“Fabio ‘SnowDruid’ Franchello” wrote:

Logo: after SDL_SetColorKey:
Video Flags: SDL_SRCCOLORKEY|SDL_RLEACCELOK

Surface = 8199856 [0]
palette: NULL
BitsPerPixel: 24
BytesPerPixel: 3
Rmask: 16711680
Gmask: 65280
Bmask: 255
Amask: 0

Now this makes more sense, but it is completely different from what
you said last time — you claimed that the logo had an alpha channel
even when you didn’t use DisplayFormat(), which is clearly not true.
Please be more careful when reporting bugs, or it is impossible to
help you

As you can see, DisplayFormat gives an alpha channel to the logo; for
some reason it also sets SRCALPHA while retaining SRCCOLORKEY.
Try removing SRCALPHA by calling

SDL_SetAlpha(Logo, SDL_RLEACCEL, 255);

Alternatively, try converting the colourkey to an alpha channel by
calling SDL_DisplayFormatAlpha (instead of DisplayFormat) after having set
the colourkey

HI,
I would like to ask if there is any way to lock the mouse pointer to a
specific position inside the SDL window.

One solution would be to Wrap the mouse to the position each frame, but if
the frame rate is low (e.g. with OpenGL) then the mouse cursor moves
during the subsequent calls of the wrap function.

Thanks in advance

One solution would be to Wrap the mouse to the position each frame, but if
the frame rate is low (e.g. with OpenGL) then the mouse cursor moves
during the subsequent calls of the wrap function.

SDL_ShowCursor(SDL_DISABLE), then draw your own mouse cursor. This gives
you complete control of the rendering, it looks the same on every
platform, etc.

Warping the mouse every frame is inefficient, and causes an unwanted
mousemotion event to boot.

Also, you might want to consider if the user will like the control of
their mouse pointer being restricted arbitrarily. Unless you’ve got a good
reason, it’ll probably be somewhat annoying from a usability standpoint,
but then again, I don’t know what exactly you have in mind, so I shouldn’t
speak.

–ryan.

At 11.17 21/08/01 +0200, you wrote:

“Fabio ‘SnowDruid’ Franchello” <@Fabio_Franchello> wrote:

Logo: after SDL_SetColorKey:
Video Flags: SDL_SRCCOLORKEY|SDL_RLEACCELOK

Surface = 8199856 [0]
palette: NULL
BitsPerPixel: 24
BytesPerPixel: 3
Rmask: 16711680
Gmask: 65280
Bmask: 255
Amask: 0

Now this makes more sense, but it is completely different from what
you said last time — you claimed that the logo had an alpha channel
even when you didn’t use DisplayFormat(), which is clearly not true.
Please be more careful when reporting bugs, or it is impossible to
help you

Sorry. :slight_smile:

As you can see, DisplayFormat gives an alpha channel to the logo; for
some reason it also sets SRCALPHA while retaining SRCCOLORKEY.
Try removing SRCALPHA by calling

SDL_SetAlpha(Logo, SDL_RLEACCEL, 255);

Alternatively, try converting the colourkey to an alpha channel by
calling SDL_DisplayFormatAlpha (instead of DisplayFormat) after having set
the colourkey

It’s no use. Nothing changes. Like the first version of the code I sent, the
colorkey become trasparent, but, in seems, on another video buffer then
the one OpenGL’s using: hence, I don’t see the polygons in the colorkey
space of the logo but plain white.

Can you please send me a working example of SDL_OPENGLBLIT to test on
my system? (Remember that testgl -logo has the same behaviour of my code).

Thanks,__
Fabio " ‘- nowDruid " Franchello
—’---------
— snowdruid at tiscalinet.it

“Fabio ‘SnowDruid’ Franchello” wrote:

It’s no use. Nothing changes. Like the first version of the code I sent, the
colorkey become trasparent, but, in seems, on another video buffer then
the one OpenGL’s using: hence, I don’t see the polygons in the colorkey
space of the logo but plain white.

You have the SDL source, and I think it’s a lot more productive if you
start debugging yourself instead of having me guessing what is happening
inside your computer

Can you please send me a working example of SDL_OPENGLBLIT to test on
my system? (Remember that testgl -logo has the same behaviour of my code).

sorry, I don’t have access to any OpenGL-capable machine to test on

At 17.26 21/08/01 +0200, you wrote:

You have the SDL source, and I think it’s a lot more productive if you
start debugging yourself instead of having me guessing what is happening
inside your computer

Please don’t get upset, I don’t expect you to solve all my problems. This
is an open list, lots of people are reading this. Maybe someone knows more
than me and you and can help, isn’t this list supposed to be for help
also? I’m a newbie in SDL, and I thought I was the one mistaking. That’s it.
This is getting off-topic, so please let’s stop the discussion here.

I’m asking all the people in the list who’re reading this. Can someone
successully used SDL_OPENGLBLIT in a project?

Thanks,__
Fabio " ‘- nowDruid " Franchello
—’---------
— snowdruid at tiscalinet.it

“Fabio ‘SnowDruid’ Franchello” wrote:

Please don’t get upset, I don’t expect you to solve all my problems.

no worry, I’m not - I just don’t think it’s a good way to solve it

RLE-encoding with SRCCOLORKEY requires that the source and destination
formats are the same (hence DisplayFormat), but that SRCALPHA is not set
(can’t combine per-pixel alpha blending with colour key)

You can also use RLE-encoded source surfaces with alpha channel, but
you then have to remove SRCCOLORKEY for it to work