COLORREF Mix(COLORREF top, COLORREF bottom)
{
COLORREF ret = 0;
float a1 = 0.5, a2 = 1, a3;
int r1, g1, b1, r2, g2, b2;
int r3, g3, b3;
r1 = top & 0xff;
g1 = (top & 0xff00) >> 8 ;
b1 = (top & 0xff0000) >> 16;
//a1 = (top & 0xff000000) >> 24;
r2 = bottom & 0xff;
g2 = (bottom & 0xff00) >> 8;
b2 = (bottom & 0xff0000) >> 16;
//a2 = (bottom & 0xff000000) >> 24;
r3 = r1 * a1 + r2 * a2 * (1-a1);
g3 = g1 * a1 + g2 * a2 * (1-a1);
b3 = b1 * a1 + b2 * a2 * (1-a1);
a3 = 1 - (1 - a1) * ( 1 - a2 );
ret = r3 + (g3<<8) + (b3<<16) + (int(a3*256)<<24);
return ret;
}