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. How to use StrecthBlt?

How to use StrecthBlt?

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

    Can anyone post a quick sample code on how to use StrecthBlt? I have a bitmap that I want to resize to its half-size. Thanks a lot in advance.

    C 1 Reply Last reply
    0
    • U User 11731824

      Can anyone post a quick sample code on how to use StrecthBlt? I have a bitmap that I want to resize to its half-size. Thanks a lot in advance.

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      assume your image is in m_bmp, and pDC is a window DC. CDC memDC = CreateCompatibleDC(pDC); CBitmap *pOldMemBmp = memDC.SelectObject(&m_bmp); pDC->StretchBlt(outX, outY, bmpWidth / 2, bmpHeight / 2, &memDC, 0, 0, bmpWidth, bmpHeight, SRCCOPY); memDC.SelectObject(pOldMemBmp); -- if you don't know bmpWidth and bmpHeight : BITMAP bm; m_bmp.GetObject(sizeof(BITMAP), &bm); bmpWidth = bm.bmWidth; bmpHeight = bm.bmHeight; -c

      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