TransparentBlt/AlphaBlend Error
-
Hi all, having succesfully created/loaded a 24-bit DIBSection and managed to access "the bits", I now need to display it transparently. The program loads a DIBSection from file (so say a photo), and I want to then draw another 24-bit DIBSection over it. However, using BitBlt it just copies the bitmap over it (obviously since I use the SRCCOPY flag), black background included, and you can`t see the photo anymore. Having looked at Christians article I tried using the following code to incorporate TransparentBlt :
HBITMAP hOldBitmap = (HBITMAP)dcMem.SelectObject(bm);
TransparentBlt(pDC->m_hDC,0,0,bm.bmWidth,bm.bmHeight,dcMem.m_hDC,0,0,bm.bmWidth,bm.bmHeight,0);
dcMem.SelectObject(hOldBitmap);
dcMem.DeleteDC();However, I get the following error message:
BitmapView.obj : error LNK2001 : unresolved external symbol _imp_TransparentBlt@44
Debug/Dissertation.exe: fatal error LNK1120:1 unresolved externals
Error executing Link.exe
Dissertation.exe - 2 error(s), 0 warning(s)Also, I have noticed in the MSDN that TransparentBlt should only be used with 4 or 8 bit bitmaps, and have tried using AlphaBlend, which is supposed to be for 32-bit bitmaps, but I get a similar message. Can someone please tell me where me or my computer are going wrong? Much appreciated. Alan.:confused: P.S. Any chance you know how to initialise a 24-bit DIBSection so that its background is white, not black? (Without iterating through "the bits") I`ve asked this question a couple of times, no-one seems to have a clue. AEGC
-
Hi all, having succesfully created/loaded a 24-bit DIBSection and managed to access "the bits", I now need to display it transparently. The program loads a DIBSection from file (so say a photo), and I want to then draw another 24-bit DIBSection over it. However, using BitBlt it just copies the bitmap over it (obviously since I use the SRCCOPY flag), black background included, and you can`t see the photo anymore. Having looked at Christians article I tried using the following code to incorporate TransparentBlt :
HBITMAP hOldBitmap = (HBITMAP)dcMem.SelectObject(bm);
TransparentBlt(pDC->m_hDC,0,0,bm.bmWidth,bm.bmHeight,dcMem.m_hDC,0,0,bm.bmWidth,bm.bmHeight,0);
dcMem.SelectObject(hOldBitmap);
dcMem.DeleteDC();However, I get the following error message:
BitmapView.obj : error LNK2001 : unresolved external symbol _imp_TransparentBlt@44
Debug/Dissertation.exe: fatal error LNK1120:1 unresolved externals
Error executing Link.exe
Dissertation.exe - 2 error(s), 0 warning(s)Also, I have noticed in the MSDN that TransparentBlt should only be used with 4 or 8 bit bitmaps, and have tried using AlphaBlend, which is supposed to be for 32-bit bitmaps, but I get a similar message. Can someone please tell me where me or my computer are going wrong? Much appreciated. Alan.:confused: P.S. Any chance you know how to initialise a 24-bit DIBSection so that its background is white, not black? (Without iterating through "the bits") I`ve asked this question a couple of times, no-one seems to have a clue. AEGC
TO make it white just select the DIBSection into a CDC and bltblt onto it using WHITENESS instead of SCRCCOPY. My code for TransparentBlting is called TransparentBltU, you're trying to use the standard windows function, and for some reason you're finding the header but not the library. I assume you're talking the code from WDJ. Internally that function shows how to generate a mask on the fly. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
-
TO make it white just select the DIBSection into a CDC and bltblt onto it using WHITENESS instead of SCRCCOPY. My code for TransparentBlting is called TransparentBltU, you're trying to use the standard windows function, and for some reason you're finding the header but not the library. I assume you're talking the code from WDJ. Internally that function shows how to generate a mask on the fly. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
How do i get the library? do i have to re-install it? Would you mind if I used an implementation of your code from the WDJ site? (I was talking about that - couldn`t remember site name off top of my head though). Cheers for the response, again, Christian, Alan.:-D AEGC