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. Any Suggestin about shrink/ stretch a BMP?

Any Suggestin about shrink/ stretch a BMP?

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
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.
  • Y Offline
    Y Offline
    ytod
    wrote on last edited by
    #1

    Can someone suggest a simple way to shrink/ stretch a BMP? Better not involving MFC. Thanks.

    N 1 Reply Last reply
    0
    • Y ytod

      Can someone suggest a simple way to shrink/ stretch a BMP? Better not involving MFC. Thanks.

      N Offline
      N Offline
      namaskaaram
      wrote on last edited by
      #2

      try that function.....CDC::StretchBlt :-D

      Y 1 Reply Last reply
      0
      • N namaskaaram

        try that function.....CDC::StretchBlt :-D

        Y Offline
        Y Offline
        ytod
        wrote on last edited by
        #3

        I knew that...;P Maybe need to talk in more detail... Some function would provide the BITMAPINFOHEADER and Bitmap buffer data. I wanna change the size of the resulting BMP. The step I thought was that: 1. call CreateCompatibleDC( ) to create a memory DC. 2. call CreateCompatibleBitmap( ), get the handle of a bitmap and use last-created memory DC to select it. 3. call memcpy( ) to copy the data to the last-created compatible bitmap. 4. call StretchBlt( ) from the memory DC to the dialog DC( or memory DC number 2 ). For I need to save time, the data of the BMP after stretch need to be saved. So...the following work may required to be done only once. 5. call GetCurrentBitmap for the dialog DC( or memory DC number 2 ). 6. call CBitmap::GetBitmapBits( ), get the data( upset-down, need to flip. ) 7. CreateDIBSection( ) for the new data in new size. 8. OK, next time when repaint is required, simply use a memory DC to select these bitmap handles and call BitBlt from a memory DC to dialog DC. ( The steps concerning with the deleting of some temp GDI objects are omitted. ) OMG! Too many steps... Is there a simpler way than that? Thanks!

        N 1 Reply Last reply
        0
        • Y ytod

          I knew that...;P Maybe need to talk in more detail... Some function would provide the BITMAPINFOHEADER and Bitmap buffer data. I wanna change the size of the resulting BMP. The step I thought was that: 1. call CreateCompatibleDC( ) to create a memory DC. 2. call CreateCompatibleBitmap( ), get the handle of a bitmap and use last-created memory DC to select it. 3. call memcpy( ) to copy the data to the last-created compatible bitmap. 4. call StretchBlt( ) from the memory DC to the dialog DC( or memory DC number 2 ). For I need to save time, the data of the BMP after stretch need to be saved. So...the following work may required to be done only once. 5. call GetCurrentBitmap for the dialog DC( or memory DC number 2 ). 6. call CBitmap::GetBitmapBits( ), get the data( upset-down, need to flip. ) 7. CreateDIBSection( ) for the new data in new size. 8. OK, next time when repaint is required, simply use a memory DC to select these bitmap handles and call BitBlt from a memory DC to dialog DC. ( The steps concerning with the deleting of some temp GDI objects are omitted. ) OMG! Too many steps... Is there a simpler way than that? Thanks!

          N Offline
          N Offline
          namaskaaram
          wrote on last edited by
          #4

          ;)wow.....try using directx9 functionz.....that may help..... check thiz out..... http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/htm/resizeflags.asp[^] dunno if that helpz u out..... anyway..... Happy Programmin..... Cheerz..... :-D

          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