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. Converting an icon into a bitmap

Converting an icon into a bitmap

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestionannouncement
6 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.
  • N Offline
    N Offline
    Nicolas Bonamy
    wrote on last edited by
    #1

    Hello, I need to convert icons to bitmaps. I have written something that works OK on 2000 and other systems but that fail on XP: the transparent color is replaced by black instead of being well transparent. Maybe it is related to getting a "too many color" icon were the 256 colors version is enough for what I am doing... Does anyone has something to suggest? Regards

    L I 2 Replies Last reply
    0
    • N Nicolas Bonamy

      Hello, I need to convert icons to bitmaps. I have written something that works OK on 2000 and other systems but that fail on XP: the transparent color is replaced by black instead of being well transparent. Maybe it is related to getting a "too many color" icon were the 256 colors version is enough for what I am doing... Does anyone has something to suggest? Regards

      L Offline
      L Offline
      Liorsh
      wrote on last edited by
      #2

      Can you send me the code? I worked on somthing that does this exact thing some time ago and i might be able to help you....

      N 1 Reply Last reply
      0
      • N Nicolas Bonamy

        Hello, I need to convert icons to bitmaps. I have written something that works OK on 2000 and other systems but that fail on XP: the transparent color is replaced by black instead of being well transparent. Maybe it is related to getting a "too many color" icon were the 256 colors version is enough for what I am doing... Does anyone has something to suggest? Regards

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

        If you haven't already, you need to look at GetIconInfo. This function fills in a structure with two bitmap. One is the colour info, and one is the transparency map. The transparent part *should* be black on the colur bitmap, but you can separate it using the 2nd bitmap for reference. Iain.

        N 2 Replies Last reply
        0
        • I Iain Clarke Warrior Programmer

          If you haven't already, you need to look at GetIconInfo. This function fills in a structure with two bitmap. One is the colour info, and one is the transparency map. The transparent part *should* be black on the colur bitmap, but you can separate it using the 2nd bitmap for reference. Iain.

          N Offline
          N Offline
          Nicolas Bonamy
          wrote on last edited by
          #4

          Iain, I saw this one and definitly wanted to take a look at it... Thanks for the infor. Regards

          1 Reply Last reply
          0
          • L Liorsh

            Can you send me the code? I worked on somthing that does this exact thing some time ago and i might be able to help you....

            N Offline
            N Offline
            Nicolas Bonamy
            wrote on last edited by
            #5

            Does your stuff work? My code is just around 10 lines of code where I build a DC, select an empty bitmap into, draw the icon with DrawIconEx in DI_NORMAL mode and that's it. Do you do something similar?

            1 Reply Last reply
            0
            • I Iain Clarke Warrior Programmer

              If you haven't already, you need to look at GetIconInfo. This function fills in a structure with two bitmap. One is the colour info, and one is the transparency map. The transparent part *should* be black on the colur bitmap, but you can separate it using the 2nd bitmap for reference. Iain.

              N Offline
              N Offline
              Nicolas Bonamy
              wrote on last edited by
              #6

              Okay tested it but it appears that the bitmaps returned are wrong. Basically I get my icon from the system image list in where the icons are 32 bit with alpha. When I get them I get a 256 color version but the conversion is wrong: some parts of the mask that are gray become black where as in the icon the matching pixel gets black also. So I get black. What I need now is to force the extraction in 256 colors. The problem is that I get a handle to an icon in the system image list and I do not know where this icon is located on disk so I can't really extract it from the .ico file. Anyone?

              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