ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIEImageList help
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

bmesser

United Kingdom
224 Posts

Posted - Oct 05 2012 :  08:48:06  Show Profile  Reply
Hi

In a recent forum question someone mentioned the TIEImageList as a speedy way of storing and displaying cached bitmaps. So I thought I'd take a look and this is what I do:

(1) I create an image cache with an ImageList
(2) I then load an image into a TImageEnView component with a with a call to ImageEnView.IO.LoadFromFile(path).
(3) I then add that image to the ImageList by ImageList.AppendImageRef(ImageEnView.IEBitmap,path)
(4) I repeat that for a number of images
(5) I then iterate through the images in the ImageList and assign them to the TImageEnView component by callingImageEnView.IEBitmap.Assign(ImageList.Image[i]) and calling ImageEnView.Repaint.

I end up with blank images - the image list does report that there are images in it through the Imagecount - but nothing gets displayed.

The other odd thing that happens is that I get an exception when I close the MDI child that holds both the imagelist and the TImageEnView component when I call ImageList.Clear and then ImageList.Free.

The help on TIEImageList is as you would expect very simple because it is after all a very simple non-visual component. It does mention a demo in Display\ManualFlow which I can't find, and a search throught the entire samples folder returns nothing for TIEImageList.

Any help about how you add and retrieve images from an TIEImageList with it would be very helpful - because I think I've gone down a cul-de-sac in trying to use it.

Bruce.

bmesser

United Kingdom
224 Posts

Posted - Oct 05 2012 :  10:30:44  Show Profile  Reply
Hi

Just an update...

I can now see that the TIEImageList doesn't seem to store the actual bitmap (forgot to read the documentation) and I'm not particularly sure what it's for. I've now put together my own simple cache class with a dynamic array at the heart of it which seems to be behaving itself.

Bruce.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Oct 05 2012 :  15:47:43  Show Profile  Reply
Hi Bruce,

You must have done something wrong. I built a very simple demo with Delphi 2010 on Windows 7 that loads images into TIEImageList and adds a description of the file to a TListView. When a ListView item is selected, the image is loaded from the in-memory TIEImageList and is displayed nicely in ImageEnView.

I do not get any exceptions when the TIEImageList is freed.

I built a couple of example applications that store screen captures, and files opened from disk for my EBook as well. These do not have any of the problems you reported.

The problem may be this:
ImageList.AppendImageRef(TIEBitmap.Create(ImageEnView1.IO.IEBitmap), iFileName);

where TIEBitmap.Create(ImageEnView1.IO.IEBitmap) creates the imagelist bitmap.

Change AppendImageRef method from
ImageList.AppendImageRef(ImageEnView1.IEBitmap, Path);

to
ImageList.AppendImageRef(TIEBitmap.Create(ImageEnView1.IO.IEBitmap), Path);

and I suspect your app will work as expected and the exceptions will probably not occur as well. The bitmaps will be stored in memory.

TIEImageList is very nice because if memory is exceeded by the images the bitmaps are cached to disk sutomatically.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: