0

Background: I am displaying live images from a high speed digital camera at greater than 60Hz. Live image are displayed by updating Image control's ImageSource:

 this.Dispatcher.Invoke(DispatcherPriority.Normal,(ThreadStart)delegate() { MyImage.Source = myNewBitMapImage; });

Problem: I wanted to improve app's performance by skipping any new images if a previous image haven't been shown on screen yet. For example, when Image control (MyImage) haven't finished updating last image yet, the above dispatcher call will be skipped till MyImage become "idle" again.

I have done something similar in MFC by using GetUpdateRect() to check whether there was still an region left to be updated, and if there were, the displaying of the new image is skipped.

Question: How to achieve same goal in WPF? Such that a new image is skipped if Image control haven't finished updating last image yet.

Thanks in advace.

  • Is the image already downloaded when you set `MyImage.Source` or is it still downloading? You can check the [IsDownloading](http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapimage.isdownloading) property. How often do you update the image? – Clemens Jul 24 '12 at 07:26
  • I assume IsDownloading is TRUE when image was being created (Please correct me if I was wrong)? If that was the case, then no, the image has already been created when it was passed to MyImage.Source. – seekingalpha Jul 24 '12 at 19:13

1 Answers1

0

After some researching and testing, I realized that this can be achieved by starting a Backgroundworker through dispatcher. Basically, "MyImage.Source = myNewBitMapImage" is handled in worker's DoWork and as long as worker was busy, next image will be skipped. Hope this helps.