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. RGB (for Christian)

RGB (for Christian)

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

    Christian, does this code correct for 8 bpp Bitmap? WidthBytes=lpBitmap->biWidth/4; if (lpBitmap->biWidth%4) WidthBytes++; WidthBytes*=4; How to use color table for 8bpp bitmap (for pixels)? I think, RGBQUAD Quad = (LPRGBQUAD) Data; in this case (for 8bpp) doesn't work Am i ridht?

    C 1 Reply Last reply
    0
    • L Lost User

      Christian, does this code correct for 8 bpp Bitmap? WidthBytes=lpBitmap->biWidth/4; if (lpBitmap->biWidth%4) WidthBytes++; WidthBytes*=4; How to use color table for 8bpp bitmap (for pixels)? I think, RGBQUAD Quad = (LPRGBQUAD) Data; in this case (for 8bpp) doesn't work Am i ridht?

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

      That looks promising. You'd need to then load the palette and look up the colour values based on the indexes. You're right, RGBQUAD will not work for 8/16 bit. To be honest, if it was me, I'd do it the lazy way and convert to a 24 bit DIBSection and then just read the bits off that in memory. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

      S 1 Reply Last reply
      0
      • C Christian Graus

        That looks promising. You'd need to then load the palette and look up the colour values based on the indexes. You're right, RGBQUAD will not work for 8/16 bit. To be honest, if it was me, I'd do it the lazy way and convert to a 24 bit DIBSection and then just read the bits off that in memory. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

        S Offline
        S Offline
        Sergei
        wrote on last edited by
        #3

        What functions do i need to convert 8 or 16 bpp bitmap to a 24 bit DIBSection?

        C 1 Reply Last reply
        0
        • S Sergei

          What functions do i need to convert 8 or 16 bpp bitmap to a 24 bit DIBSection?

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

          Chris has a nice DIBSection wrapper on this site, you just create a 24 bit DIBSection and select it into a DC, then you can copy it across, and the DIBSection has a pointer to the data. LMK if you have any trouble, I'll dig it up and write some code for you. You probably don't even need the wrapper, if you go to www.wdj.com, they have an article online of mine from September, the code from which will show you how to create a DIBSection yourself and copy a bitmap onto it and access the bits directly. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

          S 1 Reply Last reply
          0
          • C Christian Graus

            Chris has a nice DIBSection wrapper on this site, you just create a 24 bit DIBSection and select it into a DC, then you can copy it across, and the DIBSection has a pointer to the data. LMK if you have any trouble, I'll dig it up and write some code for you. You probably don't even need the wrapper, if you go to www.wdj.com, they have an article online of mine from September, the code from which will show you how to create a DIBSection yourself and copy a bitmap onto it and access the bits directly. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

            S Offline
            S Offline
            Sergei
            wrote on last edited by
            #5

            Thanks

            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