Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. TransparentBlt/AlphaBlend Error

TransparentBlt/AlphaBlend Error

Scheduled Pinned Locked Moved C / C++ / MFC
questiongraphicsdebugginghelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Chambers
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • C Chambers

      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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      C 1 Reply Last reply
      0
      • C Christian Graus

        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

        C Offline
        C Offline
        Chambers
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups