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. Problem with AlphaBlend.

Problem with AlphaBlend.

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 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.
  • U Offline
    U Offline
    User 12627902
    wrote on last edited by
    #1

    I display the 32 bit icon with transparency using the AlphaBlend function. If the window with the icon is moved partially outside the monitor screen, the transparent area in some places is filled. Damaged places with partial transparency.. Any idea what it might be?

    L 1 Reply Last reply
    0
    • U User 12627902

      I display the 32 bit icon with transparency using the AlphaBlend function. If the window with the icon is moved partially outside the monitor screen, the transparent area in some places is filled. Damaged places with partial transparency.. Any idea what it might be?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Member 12661464 wrote:

      Any idea what it might be?

      Maybe the Window is not getting refreshed properly. Do you have code that is controlling when the icon gets painted?

      U 1 Reply Last reply
      0
      • L Lost User

        Member 12661464 wrote:

        Any idea what it might be?

        Maybe the Window is not getting refreshed properly. Do you have code that is controlling when the icon gets painted?

        U Offline
        U Offline
        User 12627902
        wrote on last edited by
        #3

        I just put the following code in the OnPaint () handler.

        CPaintDC dc(this);
        CDC *psrcDC = m_PictureControl.GetDC();
        CDC dstDC;
        dstDC.CreateCompatibleDC(psrcDC);
        HBITMAP oldBmp = (HBITMAP)SelectObject(dstDC.m_hDC, startBitmap);
        BLENDFUNCTION blend = { AC_SRC_OVER, 0,255, AC_SRC_ALPHA };
        AlphaBlend(psrcDC->m_hDC, 0, 0, iWidth, iHeight, dstDC.m_hDC,0, 0, iWidth, iHeight, blend);
        DeleteObject(oldBmp);
        DeleteObject(startBitmap);
        ReleaseDC(psrcDC);

        L 1 Reply Last reply
        0
        • U User 12627902

          I just put the following code in the OnPaint () handler.

          CPaintDC dc(this);
          CDC *psrcDC = m_PictureControl.GetDC();
          CDC dstDC;
          dstDC.CreateCompatibleDC(psrcDC);
          HBITMAP oldBmp = (HBITMAP)SelectObject(dstDC.m_hDC, startBitmap);
          BLENDFUNCTION blend = { AC_SRC_OVER, 0,255, AC_SRC_ALPHA };
          AlphaBlend(psrcDC->m_hDC, 0, 0, iWidth, iHeight, dstDC.m_hDC,0, 0, iWidth, iHeight, blend);
          DeleteObject(oldBmp);
          DeleteObject(startBitmap);
          ReleaseDC(psrcDC);

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Sorry, I cannot see anything obvious. Also, I am afraid I don't use MFC, so cannot try a similar test.

          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