XmHTML and Animations

If you are viewing this document with example_2, you should see an animation here -->

The animation displayed in this document is not a gif animation but rather a sequence of xpm images. It has been specified as follows:

<img src="eye.xpm,eye1.xpm,eye2.xpm,eye3.xpm,eye4.xpm,eye5.xpm,eye6.xpm,
	eye7.xpm,eye8.xpm,eye9.xpm,eye10.xpm,eye11.xpm,eye12.xpm,eye13.xpm,eye14.xpm,
	eye15.xpm,eye16.xpm,eye17.xpm,eye18.xpm,eye19.xpm,eye20.xpm,eye21.xpm,
	eye22.xpm,eye23.xpm,eye24.xpm">

Obviously, example_2 knows how to deal with such an image specification; look at the source to see how it is done.

If you run this example with the -d6 option (enable debug output from the image routines), you will notice that XmHTML will say something like the following a number of times:

images.c: lookForImage, checking private cache for ....
(where ... is replaced by the series of images making up the animation). At some stage it will say:
images.c: lookForImage, ... not yet loaded
or
images.c: lookForImage, ... found!
The first will be followed by a lot more messages telling you that the images are being created while the latter will be followed by a single message:
images.c: _XmHTMLNewImage, image ... copied, dimension 32x32
which, shortly said, means that XmHTML has copied the essential members of the image and linked the internal pixmaps of the previously loaded animation to the new animation. This greatly reduces the amount of memory used and causes a considerable speedup: XmHTML does not have to recreate all images in the animation but simply reuses the ones from the previous one.

This image-reusing is also retained when animations are replaced or updated using the XmHTMLReplaceImage or XmHTMLUpdateImage convenience function.