[lazarus] CVS Committed

Robert Scott Horning roberth at ise-tlx.com
Fri Jan 12 16:59:57 EST 2001

Marc Weustink wrote:

> At 15:15 11-01-01 -0600, Shane Miller wrote:
> >I changed TImageList to keep images in a TList so that I could get it
> >working for now.  I'm not sure what disadvantages there are using it this
> >way.  It sure seems simpler....
> Disadvantage is that it costs a lot of resource handles (every image one).
> In the original implementation you had only one image handle
> Did you ceep in mind that you can add larger bitmaps which result in
> separate images ?
> Marc

One reason I would personally prefer an implementation like this is to allow
adding images of different sizes simultaneously.  By throwing all of the
images onto a common bitmap (how Delphi does this), you have all kinds of
problems trying to resize the base bitmap or cropping when images don't
exactly fit the dimensions you have chosen for the image list.

One other problem that I have in general with the Delphi implementation is
that on some occasions the bitmap gets corrupted, requiring me to have to load
in all of the bitmaps all over again one at a time... and remembering what
their item indexes were so I don't mess up any controls relying on the image
list, but that is beyond the scope of this thread.

In terms of resource handles, you really wouldn't (really) need to have
multiple handles, even though it would be a good idea in practice.  One
alternative idea would be to have a single resource handle for the currently
accessed bitmap, and for all of the other bitmaps you simply have a "pointer"
to a data region that gets plowed into a bitmap resource when it is needed.
This would have some overhead in terms of speed, but would free up some
resource (like the classic Windows 65,000 total system handle limit).

Robert Scott Horning
Trans-Lux West
1651 North 1000 West
Logan, Utah  84321
Phone: (435) 716-8696
FAX: (435) 752-8513
E-mail:  roberth at ise-tlx.com

More information about the Lazarus mailing list