Posted on 2004-10-06
I want to blit a transparent button (a round button) using a monochrome mask. This code works:
SelectObject(hDCSrc, hBMP); //copy HBITMAP's DC
SelectObject(hDCMsk, hMask); //copy monochrome bitmap's DC
BitBlt(hDCDst, 0, 0, uBMPWid, uBMPHgt, hDC, 0, 0, SRCAND); //blit mask with &
BitBlt(hDCDst, 0, 0, uBMPWid, uBMPHgt, hDC, 0, 0, SRCPAINT); //paint to set bits
but it flickers. I have spent the last few hours googling for solutions to no avail.
I have tried rendering to a HBITMAP in memory but it seems to ignore alpha. I tried MaskBlt but the only MAKEROP4 combos that would work were SRCCOPY, SRCCOPY, not terribly useful for transparent blitting.
I am using standard Win32 not MFC.
Any suggestions will be greatly appreciated.