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
 Best/quickest way to animate...
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

bmesser

United Kingdom
234 Posts

Posted - Jan 07 2014 :  09:04:23  Show Profile  Reply
Hi

I am using a ImageEnMView to cache images that I subsequently display and animate in a ImageEnVect component. Normally I would use an ImageEnMview to both store, display and animate the images, but in this case I need to be able to handle a couple of extra layers and also be able to draw objects, so hence the need for a separate image cache.

What I would like to know is there any quicker way of loading an image from a ImageEnMView component to the ImageEnVect component, at the moment I'm assigning the image using this:

ImageEnVect.Layers[2].Bitmap.assign(ImageEnMView.GetTIEBitmap(i));

The animation I get seem a little bit slow and I wondered if this approach was correct?

In the past I have written applications where I load multiple images as layers in an ImageEnView component, and then create an animation by hiding all but one layer and then looping round them in turn. This method did allow me to create much faster animations, the downside being that it would have to hold as many as 96 layers each of around 70 KB or more, having said that I suppose you always have to hold the images in a cache whatever method you use.

Any advice would be appreciated.

Bruce.

w2m

USA
1990 Posts

Posted - Jan 07 2014 :  09:58:32  Show Profile  Reply
I am not sure how much help this will be, but... 96 images * 70 KB is about 6.5 GB which in this day and age is not a lot. Most PC's these days will have about 8 GB ram or more plus the disk cache. My PC may be an extreme case but I have 24 GB ram. Caching will slow things down however. I suppose you could specify the required ram for your app as well.

Anyway, I do not think there is a way that is faster than Assign to get the images. Assign is pretty fast. Another idea is to use a TIEImageList to hold the images, but I do not know if that will be faster or not... plus if you are using layers it would be redundant memory usage. Another consideration is to compile as Win64 to maximize available memory so that the animated layers will have enough memory.

Finally... try doing your animation in a thread. ImageEn layers are very fast when filled this way. If you do not have my Android ImageViewer demo let me know. The demo fills layers in a thread so it may be helpful for your project. If you have trouble with the thread, email me.

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

bmesser

United Kingdom
234 Posts

Posted - Jan 07 2014 :  11:27:03  Show Profile  Reply
Bill

I'll certainly have a look at your ideas especially the idea of threading.

Hope its not too cold in your part of the world!

Thanks again

Bruce.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 07 2014 :  12:01:27  Show Profile  Reply
8 degrees F at 2:00 PM. Below 0 F at night.

William Miller
Go to Top of Page

xequte

39061 Posts

Posted - Jan 07 2014 :  13:37:39  Show Profile  Reply
@Bill: Wow, that is cold!

@Bruce: Assigning images to a TImageEnVect will necessarily be a slow way to animate. You say you are unable to use a TImageEnMView to handle the animation because of your need for extra layers, but are you sure you cannot handle this in another way, e.g. by assigning each of the different views of the image in the TImageEnVect as a new frame to the TImageEnMView?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

bmesser

United Kingdom
234 Posts

Posted - Jan 07 2014 :  13:51:00  Show Profile  Reply
Nigel

Are you saying that I should construct an image in my case by adding three layers together?

layer 1 = map base image
layer 2 = weather radar image (or satellite with transparency)
layer 3 = transparent coastal outline

Merge them together into a single image using an ImageEnView component before adding them to an ImageEnMView for animation?

Bruce.
Go to Top of Page

xequte

39061 Posts

Posted - Jan 07 2014 :  19:06:23  Show Profile  Reply
Hi Bruce

It's hard to say without seeing the project; only you will know what sort of timings would be best. I'm just putting the idea out there.

To explain in more detail, if if you need the fastest animation (e.g. for sub-second display times) you would be better off creating each animation frame (i.e. what is actually shown to the user) as a single image and adding them all to a TImageEnMView for display.

If you don't need it to be that fast (say a few seconds per frame), then a TImageEnVect is fine so long as it is not a complex object (lots of annotations).

In my slideshow application, where display times are typically 2 - 20 seconds, we only ever load from file (into a TImageEnView), but if an image has annotations then what we actually load is a "cached" version of the display (i.e. with all annotations merged into an image).

This is one of those times where a profiler can be useful for understanding where the slowness is occuring.





Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

bmesser

United Kingdom
234 Posts

Posted - Jan 08 2014 :  05:00:09  Show Profile  Reply
Hi Nigel

I've come up with an idea that I think might be the answer to my problem:

Stack a ImageEnMView on top of a TImageEnVect and then swap between the two components (using the .BringToFront to swap between which component I see), then I can have the best of both worlds - a very speedy animation routine when I need it, and a single frame viewer that I can draw on and interrogate the pixel values in the individual layers.

Bruce.
Go to Top of Page

xequte

39061 Posts

Posted - Jan 08 2014 :  14:01:41  Show Profile  Reply
That'll do it

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: