Alpha blending troubles

Using Windows 2000, SDL 1.2.0, Visual C++ 6.0

I’m using the following code to using an alpha blended image:

SDL_Surface *imageBMP, *image_dat;

imageBMP = IMG_Load(“test.png”);
SDL_SetAlpha(imageBMP, SDL_SRCALPHA, 50);
image_dat = SDL_DisplayFormatAlpha(imageBMP);
SDL_FreeSurface(imageBMP);

This should give me a nice speedy alpha blended image in image_dat. The
only thing is no alpha blending appears when I blit the image.

If I don’t use SDL_DisplayFormatAlpha the image is alpha blended (in the
original imageBMP pointer), but it’s slow of course.

Is this a possible bug or am I being waaaaay stupid?_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

imageBMP = IMG_Load(“test.png”);
SDL_SetAlpha(imageBMP, SDL_SRCALPHA, 50);
image_dat = SDL_DisplayFormatAlpha(imageBMP);
SDL_FreeSurface(imageBMP);

This should give me a nice speedy alpha blended image in image_dat. The
only thing is no alpha blending appears when I blit the image.

no it shouldn’t - you’ve only set the per-surface alpha value to 50
and added an alpha channel (which means that subsequent blits from that
surface will ignore the per-surface alpha and use the alpha channel instead)

If I don’t use SDL_DisplayFormatAlpha the image is alpha blended (in the
original imageBMP pointer), but it’s slow of course.

use SDL_DisplayFormat() instead