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. Bitmap creation in internal buffer

Bitmap creation in internal buffer

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestion
4 Posts 3 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.
  • J Offline
    J Offline
    jossion
    wrote on last edited by
    #1

    I have stored monochrome pixel values of an image in a buffer of type int**. Now I would like to create a bitmap out of it to use BitBlt() function to display it. How do I create a bitmap out of raw pixel values.

    P I 2 Replies Last reply
    0
    • J jossion

      I have stored monochrome pixel values of an image in a buffer of type int**. Now I would like to create a bitmap out of it to use BitBlt() function to display it. How do I create a bitmap out of raw pixel values.

      P Offline
      P Offline
      PJ Arends
      wrote on last edited by
      #2

      CreateBitmap()


      You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!

      I 1 Reply Last reply
      0
      • J jossion

        I have stored monochrome pixel values of an image in a buffer of type int**. Now I would like to create a bitmap out of it to use BitBlt() function to display it. How do I create a bitmap out of raw pixel values.

        I Offline
        I Offline
        Iain Clarke Warrior Programmer
        wrote on last edited by
        #3

        HBITMAP CreateBitmap(
        int nWidth, // bitmap width, in pixels
        int nHeight, // bitmap height, in pixels
        UINT cPlanes, // number of color planes
        UINT cBitsPerPel, // number of bits to identify color
        CONST VOID *lpvBits // color data array
        );

        Have a look at the CreateBitmap (shocking name, I know) command - you can specify a pointer to data which will make up the bitmap. There are some issues with it - you'll need the data to match the bits per pixel, etc. Or CreateDIBitmap may be better for you. You'll have to transform you data into a format those command will be happy with though - and how hard that is depends on how "friendly" your format is. If you search codeproject by author for PJ Arends, you can use his Image Viewer article to help you. It's great if you're fiddling about with DCs, and Bitmaps - it's saved hours of development for me in the past. Iain.

        1 Reply Last reply
        0
        • P PJ Arends

          CreateBitmap()


          You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!

          I Offline
          I Offline
          Iain Clarke Warrior Programmer
          wrote on last edited by
          #4

          You beat me to it - but I plugged your image viewer helper app! Iain.

          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