A new transblending function for SDL

Hi guys,

I think SDL need a nice transblend function.
The alphablend function in SDL is nice and fast but you can’t specify an
source alpha value and an destination alpha value at the same time
like in OpenGL or Direct3D.

I have implemented this transblend fuction which can handle this but its
very slow.
I hope some one can optimize it.
Maybe this kind of function should be part of the SDL because you can make
nice effects with it.

here the code for it.
You should replease the sge stuff with the native sdl functions for it

void CVideoSystem::BltTransBelnd(SDL_Surface *src, SDL_Surface *dst,s16
x,s16 y,s16 w,s16 h,int src_alpha, int dst_alpha,bool bMask)
{
Uint32 src_color;
Uint32 dst_color;

SDL_Color src_rgb;
SDL_Color dst_rgb;
int r,g,b;

for( s16 i = 0; i < h;i++)
{
for( s16 j = 0; j < w;j++)
{

src_color = sge_GetPixel( src, j, i);
dst_color = sge_GetPixel( dst, j+x, i+y);

// if( mask_color == src_color && bMask )
// continue;

src_rgb = sge_GetRGB( src , src_color);
dst_rgb = sge_GetRGB( dst , dst_color);

r = ( ( src_rgb.r * src_alpha/256 ) ) + ( (dst_rgb.r * dst_alpha/256 ) );
g = ( ( src_rgb.g * src_alpha/256 ) ) + ( (dst_rgb.g * dst_alpha/256 ) );
b = ( ( src_rgb.b * src_alpha/256 ) ) + ( (dst_rgb.b * dst_alpha/256 ) );

//this is to keep the result values in the range of 0 … 255
r = r > 255 ? 255 : r;
g = g > 255 ? 255 : g;
b = b > 255 ? 255 : b;

sge_PutPixel( dst, x+j , y+i , r,g,b );

}
}