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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIEImageList help

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
bmesser Posted - Oct 05 2012 : 08:48:06
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.
2   L A T E S T    R E P L I E S    (Newest First)
w2m Posted - Oct 05 2012 : 15:47:43
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
bmesser Posted - Oct 05 2012 : 10:30:44
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.