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. initialize bmiColors in BITMAPINFO

initialize bmiColors in BITMAPINFO

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
3 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.
  • M Offline
    M Offline
    Maverick
    wrote on last edited by
    #1

    Hello! Im trying to convert an HBITMAP from a third party image class.. so that i can draw the image in a CView.. I have initialized all properties already except the bmiColors of the BITMAPINFO*. How do you initialize this, lets say for example i have 256 colors and 16 bits in the image? do i use RGB values or realized palettes? having a hard time with this one? tnx in advance. maverick

    C 1 Reply Last reply
    0
    • M Maverick

      Hello! Im trying to convert an HBITMAP from a third party image class.. so that i can draw the image in a CView.. I have initialized all properties already except the bmiColors of the BITMAPINFO*. How do you initialize this, lets say for example i have 256 colors and 16 bits in the image? do i use RGB values or realized palettes? having a hard time with this one? tnx in advance. maverick

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

      16-bit image = no palette 256 colors implies an 8-bit image the palette lives between the end of the BITMAPINFOHEADER and the start of the pixel data. you can find its size by calculating (1 << bmih.biBitDepth) * sizeof(RGBQUAD) . a little pointer arithmetic will get you to the start of the palette: (address of the BITMAPINFOHEADER + sizeof(BITMAPINFOHEADER)) Cleek | Image Toolkits | Thumbnail maker

      M 1 Reply Last reply
      0
      • C Chris Losinger

        16-bit image = no palette 256 colors implies an 8-bit image the palette lives between the end of the BITMAPINFOHEADER and the start of the pixel data. you can find its size by calculating (1 << bmih.biBitDepth) * sizeof(RGBQUAD) . a little pointer arithmetic will get you to the start of the palette: (address of the BITMAPINFOHEADER + sizeof(BITMAPINFOHEADER)) Cleek | Image Toolkits | Thumbnail maker

        M Offline
        M Offline
        Maverick
        wrote on last edited by
        #3

        i got the position/address of the palette.. what do i do next? what values do i initialize i wih ?

        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