Re: ImageList_GetImageInfo - alter the bitmap(s) ?

Newyana2 <[email protected]>
Newsgroups alt.comp.os.windows-xp,alt.windows7.general,comp.os.ms-windows.programmer.win32
Organization A noiseless patient Spider
Message-ID <[email protected]>
On 10/1/2024 3:02 AM, R.Wieser wrote:
> Newyana2,
> 
>> but the docs say GetImageInfo returns an ImageInfo structure, which
>> includes an hBitmap.
> 
> Indeed it does.  Having the bitmap(s) is where my problems started. :-\
> 
>> With that you can call things like GetDIBits, SetDIBits, etc.
> 
> Yep, I found the first one too (as well as GetBitmapBits).  But I realized
> that it takes a *lot* of work to be able to create something generic from it
> (for instance, it would need handlers for all 6 BPP modi).
> 
> Also SetDIBits needs a BITMAPINFO structure filled in with stuff I /somehow/
> would need to extract/copy from the origional bitmap.
> 
> The easier way (I think) would be to use CopyBitmap, load it into a
> memoryDC* and use that to make the alterations on.
> 
> * which I would need to make sure it would have the same configuration
> (Image List Creation Flags) as the one the ImageList was created with.  In
> short: another problem.
> 
> ... but that than has a "how do I get it back into the origional
> bitmap/imagelist ?" problem.
> 
> I was hoping that the MS way would show me a simple, smart way to circumvent
> all that clumsy work.
> 
> By the way:
> for one test approach I invoked "the dark arts" and retrieved the
> memoryDC(s) the ImageList uses internally.  Drawing on them works as
> expected, very easy. Though there are a number of gotya's to recon with.  As
> well as the use of "the dark arts" ofcourse. :-)
> 

    That stuff is something I have to figure out anew every time I
work with it. I once wrote a program for my girlfriend to easily
do auto-cropping and resizing of photos in high quality. The image
ops were so complicated that I used a class to load images, convert
to DIB, then do operations on that. GDI gets very complicated.
Gdiplus is worse.

    Recently I've been working on functionality to change caret width
and color in a text window. The way to do it is to use a bitmap. So
I needed to be able to generate an endless variety of bitmaps
"on the fly". It took awhile to refresh my memory about hbitmaps and
DCs and such. But in VB6 there's the Picturebox control. Lightweight
and it wraps a lot of GDI ops. It turned out that I could paint the caret
in a hidden picturebox, then pass that picture's handle to the caret
function because a picture in a picturebox is a StdPicture. Maybe you
have something like that with Borland?

     In terms of imaglists, I have no idea. I've never had occasion to
use one. I sometimes use Image controls and sometimes use resources,
but never an imagelist.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.