DekGenius.com
[ Team LiB ] Previous Section Next Section

ImageAnimator

System.Drawing (system.drawing.dll)sealed class

This class provides static methods to support the animation of an Image class that contains multiple frames in the System.Drawing.Imaging.FrameDimension.Time dimension: a complex way of saying a time-based image sequence.

The Animate() method takes an image and a callback delegate, which is called whenever a new frame is needed. You can then paint the image on the appropriate Graphics surface at that time. StopAnimate() brings the animation to a halt.

There is a CanAnimate() method that tells you whether a particular Image has multiple frames in the time dimension, and an UpdateFrames() function that advances to the next frame immediately.

This may seem like a complex way of allowing you to render an animated GIF (not forgetting your UniSys licensing, of course), but it means the image framework can provide much more complex animation schemes than that—key frame-based vector graphics animation for a cartoon, say, or on-the-fly interpolation of bitmap frames. And if you do just want basic drop-in-and-go animation control, the System.Windows.Forms.PictureBox component will do the job.

public sealed class ImageAnimator {
// Public Static Methods
   public static void Animate(Image image, EventHandler onFrameChangedHandler);
   public static bool CanAnimate(Image image);
   public static void StopAnimate(Image image, EventHandler onFrameChangedHandler);
   public static void UpdateFrames();
   public static void UpdateFrames(Image image);
}
    [ Team LiB ] Previous Section Next Section