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. Help about GetBitmapBits!!!

Help about GetBitmapBits!!!

Scheduled Pinned Locked Moved C / C++ / MFC
graphicshelp
6 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.
  • T Offline
    T Offline
    twing
    wrote on last edited by
    #1

    unsigned char *px = new unsigned char[bm.bmHeight*bm.bmWidthBytes]; bitmap->GetBitmapBits(bm.bmHeight*bm.bmWidthBytes,px); Please, tell me the color format of the px above. Thank you,anyway! Hello World!

    C 1 Reply Last reply
    0
    • T twing

      unsigned char *px = new unsigned char[bm.bmHeight*bm.bmWidthBytes]; bitmap->GetBitmapBits(bm.bmHeight*bm.bmWidthBytes,px); Please, tell me the color format of the px above. Thank you,anyway! Hello World!

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Won't work. For starters, some formats have extra bytes of padding on the end of each scanline, so your size could be wrong. However, if bmWidthBytes is accurate, then it's easy. bmWidthByte value color format 1 paletised, could be 1, 4 or 8 bit 2 16 bit 3 24 bit 4 32 bit ( but the last 8 are ignored. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

      T 1 Reply Last reply
      0
      • C Christian Graus

        Won't work. For starters, some formats have extra bytes of padding on the end of each scanline, so your size could be wrong. However, if bmWidthBytes is accurate, then it's easy. bmWidthByte value color format 1 paletised, could be 1, 4 or 8 bit 2 16 bit 3 24 bit 4 32 bit ( but the last 8 are ignored. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

        T Offline
        T Offline
        twing
        wrote on last edited by
        #3

        unsigned char *px = new unsigned char[bm.bmHeight*bm.bmWidthBytes]; bitmap->GetBitmapBits(bm.bmHeight*bm.bmWidthBytes,px); i found px[2] is a red color BYTE. whereas px[0] and px[1] is what color BYTE. Thank you! Hello World!

        C 1 Reply Last reply
        0
        • T twing

          unsigned char *px = new unsigned char[bm.bmHeight*bm.bmWidthBytes]; bitmap->GetBitmapBits(bm.bmHeight*bm.bmWidthBytes,px); i found px[2] is a red color BYTE. whereas px[0] and px[1] is what color BYTE. Thank you! Hello World!

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Windows generally stores 24 and 32 bit images as BGR, rather than RGB. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

          T 1 Reply Last reply
          0
          • C Christian Graus

            Windows generally stores 24 and 32 bit images as BGR, rather than RGB. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

            T Offline
            T Offline
            twing
            wrote on last edited by
            #5

            unsigned char *px = new unsigned char[bm.bmHeight*bm.bmWidthBytes]; bitmap->GetBitmapBits(bm.bmHeight*bm.bmWidthBytes,px); if my image is 24 bit, the px array is stored as neither BGR nor RGB. why so? Thank you! Hello World!

            C 1 Reply Last reply
            0
            • T twing

              unsigned char *px = new unsigned char[bm.bmHeight*bm.bmWidthBytes]; bitmap->GetBitmapBits(bm.bmHeight*bm.bmWidthBytes,px); if my image is 24 bit, the px array is stored as neither BGR nor RGB. why so? Thank you! Hello World!

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              The only possible reaon I can think of is my first hunch - GetBitmapBits does not work. Actually, I think it does, only if your bitmap is a DIBSection. Christian I have drunk the cool-aid and found it wan and bitter. - Chris Maunder

              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