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. Stretching Bitmap Problem

Stretching Bitmap Problem

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsperformancehelp
2 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.
  • M Offline
    M Offline
    mirsad
    wrote on last edited by
    #1

    Hello, I'm trying to stretch a bitmap that is in memory using StretchBlt();. Here is what I'm doing and it isn't working: HBITMAP hBmp = dibSect.GetSafeHandle(); CDC MemDC, srcMemDC; CBitmap Bitmap; if(!srcMemDC.CreateCompatibleDC(NULL)) return -1; if(!MemDC.CreateCompatibleDC(NULL)) return -1; if(hBmp != NULL) Bitmap.Attach(hBmp); else return -1; MemDC.SelectObject(hBmp); MemDC.SetStretchBltMode(COLORONCOLOR); if(MemDC.StretchBlt(0, 0, 32, 32, &srcMemDC, 0, 0, bmiHeader.biWidth, bmiHeader.biHeight, SRCCOPY) == 0) return -1; Pos = m_ImageList->Add(MemDC.GetCurrentBitmap(), RGB(0,0,0) ); MemDC.DeleteDC(); srcMemDC.DeleteDC();

    F 1 Reply Last reply
    0
    • M mirsad

      Hello, I'm trying to stretch a bitmap that is in memory using StretchBlt();. Here is what I'm doing and it isn't working: HBITMAP hBmp = dibSect.GetSafeHandle(); CDC MemDC, srcMemDC; CBitmap Bitmap; if(!srcMemDC.CreateCompatibleDC(NULL)) return -1; if(!MemDC.CreateCompatibleDC(NULL)) return -1; if(hBmp != NULL) Bitmap.Attach(hBmp); else return -1; MemDC.SelectObject(hBmp); MemDC.SetStretchBltMode(COLORONCOLOR); if(MemDC.StretchBlt(0, 0, 32, 32, &srcMemDC, 0, 0, bmiHeader.biWidth, bmiHeader.biHeight, SRCCOPY) == 0) return -1; Pos = m_ImageList->Add(MemDC.GetCurrentBitmap(), RGB(0,0,0) ); MemDC.DeleteDC(); srcMemDC.DeleteDC();

      F Offline
      F Offline
      Feng Yuan
      wrote on last edited by
      #2

      hBmp should be selected into srcMemDC. Destination bitmap missing.

      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