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. DrawIconEx & ILD_BLEND50

DrawIconEx & ILD_BLEND50

Scheduled Pinned Locked Moved C / C++ / MFC
c++databasedotnetgraphicsjson
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.
  • C Offline
    C Offline
    ClickHeRe
    wrote on last edited by
    #1

    Hello, I'm building owner drawn menus and when using this ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 ); The icon color is only dimed, but not blended with the specified RGB color and yes my icon has a mask as I can draw it with ILD_MASK and I see a black icon painted which is the mask. Piece of MSDN help --------------------- rgbFg Foreground color of the image. This parameter can be an application-defined RGB value or one of the following values: CLR_NONE - No blend color. The image is blended with the color of the destination device context. CLR_DEFAULT - Default foreground color. The image is drawn using the system highlight color as the foreground color. fStyle Drawing style and, optionally, the overlay image. For information about specifying an overlay image index, see the comments section at the end of this topic. This parameter can be a combination of an overlay image index and one or more of the following values: ILD_BLEND25, ILD_FOCUS Draws the image, blending 25 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask. ILD_BLEND50, ILD_SELECTED, ILD_BLEND Draws the image, blending 50 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask. ------------------- Note: Using Win32 API, no MFC Thanks David -- modified at 17:25 Sunday 16th October, 2005

    S 1 Reply Last reply
    0
    • C ClickHeRe

      Hello, I'm building owner drawn menus and when using this ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 ); The icon color is only dimed, but not blended with the specified RGB color and yes my icon has a mask as I can draw it with ILD_MASK and I see a black icon painted which is the mask. Piece of MSDN help --------------------- rgbFg Foreground color of the image. This parameter can be an application-defined RGB value or one of the following values: CLR_NONE - No blend color. The image is blended with the color of the destination device context. CLR_DEFAULT - Default foreground color. The image is drawn using the system highlight color as the foreground color. fStyle Drawing style and, optionally, the overlay image. For information about specifying an overlay image index, see the comments section at the end of this topic. This parameter can be a combination of an overlay image index and one or more of the following values: ILD_BLEND25, ILD_FOCUS Draws the image, blending 25 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask. ILD_BLEND50, ILD_SELECTED, ILD_BLEND Draws the image, blending 50 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask. ------------------- Note: Using Win32 API, no MFC Thanks David -- modified at 17:25 Sunday 16th October, 2005

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      ClickHeRe wrote:

      ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 ); The icon color is only dimed, but not blended with the specified RGB color

      You realize that you're blending with medium gray, right? This is usually going to cause some dimming...

      Post faster, post more, post now

      C 1 Reply Last reply
      0
      • S Shog9 0

        ClickHeRe wrote:

        ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 ); The icon color is only dimed, but not blended with the specified RGB color

        You realize that you're blending with medium gray, right? This is usually going to cause some dimming...

        Post faster, post more, post now

        C Offline
        C Offline
        ClickHeRe
        wrote on last edited by
        #3

        I tried with plain RGB(255,0,0) and the icon only dimmed, never turned redish

        S 1 Reply Last reply
        0
        • C ClickHeRe

          I tried with plain RGB(255,0,0) and the icon only dimmed, never turned redish

          S Offline
          S Offline
          Shog9 0
          wrote on last edited by
          #4

          I looked into this a bit, and have discovered that if you are using a manfiest (so that your program uses the v6 common controls on XP), ImageList_DrawEx() is broken, just as you found. Without the manifest (or on Windows versions prior to XP), the function works as documented, dithering the foreground color over the image. Interestingly, ImageList_Draw() works fine, blending the system highlight color with the icon.

          Post faster, post more, post now

          C 1 Reply Last reply
          0
          • S Shog9 0

            I looked into this a bit, and have discovered that if you are using a manfiest (so that your program uses the v6 common controls on XP), ImageList_DrawEx() is broken, just as you found. Without the manifest (or on Windows versions prior to XP), the function works as documented, dithering the foreground color over the image. Interestingly, ImageList_Draw() works fine, blending the system highlight color with the icon.

            Post faster, post more, post now

            C Offline
            C Offline
            ClickHeRe
            wrote on last edited by
            #5

            Any thoughts on a function or way to achieve the same sort of end result and that would work on any machine. I want to grey the disabled icon and possibly apply this technique on other cases on the menus like normal unselected icons making the selected one the only true color icon. Thanks David

            S 1 Reply Last reply
            0
            • C ClickHeRe

              Any thoughts on a function or way to achieve the same sort of end result and that would work on any machine. I want to grey the disabled icon and possibly apply this technique on other cases on the menus like normal unselected icons making the selected one the only true color icon. Thanks David

              S Offline
              S Offline
              Shog9 0
              wrote on last edited by
              #6

              There is an article here you should read then: CreateGrayScaleIcon A nice little function that creates a sharp-looking grayscale version of whatever is passed in. Also, it's pretty easy to modify the function to do other image manipulation on icons.

              Post faster, post more, post now

              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