|
||
An animation DLL performs drawing from within the window server thread. This makes continuous updating of graphics possible, since the window server thread has high priority and is unlikely to be pre-empted by other threads. This means that animation effects which rely on continual and fast graphic updates are possible. This could be used for example to make a clock second hand sweep smoothly, and might even be exploited for video-style animations although its intended use is for drawn rather than bitmap graphics.
A distinction between animated graphics and animated bitmaps is worth making. The animation classes are intended primarily for line drawing based animation. Bitmaps can be animated using either the animation classes or sprites, but sprites will usually be preferred. Sprites animate arbitrary bitmaps. Typical uses are for cursors, PacMan style games, and so on. Because the window server handles much of the complexity sprites can be thought of as bulletproof. The animation classes on the other hand provide server side speed and great flexibility, but are probably a little more complex to use.
It is possible to create animation effects using ordinary window server clients, for example using active objects on the client side to schedule graphics updates, but these would suffer from the (relatively) lower priority of the client thread, and from the fact that active objects are non-pre-emptively scheduled, so that the window update might be delayed by another already-running client-side active object.
An animation DLL also provides accurate clock ticks. If you worked on the client side and just required a one second timer to move the second hand on on a clock, then drift occurs with the clock loosing very gradually. The animation DLL provides access to timers that do not suffer from this problem.
The Animation classes form two pairs across the client/server boundary, one pair providing functions at DLL level and the other at the level of individual animation classes. To create an animation requires a DLL class, and a class for each animated object. More accurately, a pair of classes is required in each case, with each pair comprising one server side class and one client side class.
This general mechanism allows client/server separation while also allowing client side classes to benefit from server side privilege — in this case fast graphical updates made possible by the high priority of the server thread.
For efficiency reasons, it makes sense to collect multiple animation classes into a single DLL, even if they are otherwise logically quite separate classes.