Good evening ppls. I've been dwelling with some problems trying to convert the system's image list into gray scale. The Conversion is actually going well. But now i don't know how to get the bitmap from the DC so i can add it to a new image list. This will be the gray scaled system imagelist. Can someone help?
you need an HBITMAP type gdi object to use ImageList_Add
there are a number of ways to get a bitmap handle, of course
but, what you probably want to do is to create a memory DC
and, create either a DDB or DIB bitmap
select the DDB or DIB into the memory DC
BitBlt the image into that DC
now, you have an HBITMAP with the image in it
if you want to alter pixels individually, you can use CreateDIBSection
otherwise, you can create a DDB (or compatible bitmap) with CreateCompatibleBitmap
the later is usually the simplest, because you don't have to fill a bitmap info structure
the DIB section may be desired, in this case, because you have more control
i don't have an ImageList example of my own, because i don't use them
but, i found a couple by Ewayne in the examples folder
C:\masm32\examples\exampl04\listview
C:\masm32\examples\exampl04\treedemo
tx dave. I'm trying to use CreateBitmap and use the altered pixels for it. i'll post as i go.
ty
...All Hail... M32!
Still dwelling in this crap. I've managed to convert the images to grayscale but the image list prints all black. I'm prolly doing one of those things... yeah you know... my consistent lack of attention... check it out and see if you can solve it.
tx.hm32
I take it the problems isn't easy to solve. Tried a lot of stuff but the images in the imagelist remain all-black. Why the bitmap shows ok on the screen? I even added some code to preserve the alpha. i noticed some of the pixels have different alpha blending. damn... the lastest thing... here it goes. Come guys... its not like fermat's enigma is it?
Ty later
using dave's advice donest seem to work either. works for the DC just not for the Imagelist.
ty
i don't have time to look at it, today
but - it may be that you are creating a compatible DC using the wrong DC as a reference
try using the display DC as a reference
then, verify that you get valid handles for all HDC's and HBITMAP's (like compatible bitmaps, etc)
latest tries... haven't debugged... not sure everything that is suppose to work actually does. ty
Solved the problem with adding the bitmap from hMemDC to ImageList with a new, fresh and short example.
Thanks