Alpha blend Problem

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi ,
I am trying to alpha blend a transparent image on the screen and on a
key event i try to toggle it with a different transparent image on the
same position..

The first image is drawn fine ,but when i click the key to toggle ,the
image is distorted i.e first image is there along with second image
sharing space alotted to them i.e. the first image isn't vanished from
screen.

i use this piece of code after loading the bitmap on screen and
passing the pvbits .


VOID *pvBits;
pvbits = malloc(sizeof(hbm));
pvbits = (HBITMAP)hbm;//i am susceptible at this step
HBITMAP hBmp = CreateDIBSection(hMemDC, &bmi, DIB_RGB_COLORS, &pvBits,
NULL, 0);

SelectObject(hMemDC, hBmp);


//setting the blend function and its coordinates

BLENDFUNCTION bf;


AlphaBlend(hdc,x cord,y cord, bmi.bmiHeader.biWidth,
bmi.bmiHeader.biHeight, hMemDC, 0, 0, bmi.bmiHeader.biWidth,
bmi.bmiHeader.biHeight, bf));


.



Relevant Pages