VolumetricHandler AnimSaverHandler Classes Table of Contents

AnimLoaderHandler
AnimLoaderInterface

At each time step, an animation loader gives Layout a frame from an animation file.

Background

Animation loaders must be prepared to provide random access to the frames contained in an animation file. They are also responsible for deciding whether a given file is in a format they understand. Animation loaders are called in sequence until one of them claims to recognize the file.

Handler Activation Function

   XCALL_( int ) MyAnimLoader( long version, GlobalFunc *global,
      LWAnimLoaderHandler *local, void *serverData );

The local argument to an anim loader's activation function is an LWAnimLoaderHandler.

   typedef struct st_LWAnimLoaderHandler {
      LWInstanceFuncs  *inst;
      int              result;
      const char       *filename;
      int             (*frameCount) (LWInstance);
      double          (*frameRate)  (LWInstance);
      void            (*evaluate)   (LWInstance, double,
                         LWAnimFrameAccess *);
   } LWAnimLoaderHandler;

The first member of this structure points to the standard instance handler functions. An anim loader is also given the name of the file to load and provides functions that return frames and other information from the file.

result
This is set to a code that indicates what happened when the activation function tried to open and read the file.

IPSTAT_BADFILE
The file couldn't be opened.
IPSTAT_NOREC
The format of the file wasn't recognized (the file isn't the type this loader handles).
IPSTAT_OK
The file was opened and recognized.

filename
The name of the file to open.
frameCount( instance )
Returns the number of frames in the file.
frameRate( instance )
Returns the animation's playback speed, in frames per second.
evaluate( instance, time, access )
The evaluation function is called to load an image at the specified running time from the file. At the loader's discretion, the image can be the frame nearest to the time or an interpolation of two or more frames. The access structure, described below, provides the functions the loader uses to pass image data to Layout.

Interface Activation Function

   XCALL_( int ) MyInterface( long version, GlobalFunc *global,
      ??? *???, void *serverData );

TBD.

Anim Loader Access

The access structure passed to the loader's evaluation function uses the same mechanism as image loaders to pass image data to Layout.

   typedef struct st_LWAnimFrameAccess {
      void               *priv_data;
      LWImageProtocolID (*begin) (void *, int type);
      void              (*done)  (void *, LWImageProtocolID);
   } LWAnimFrameAccess;
priv_data
An opaque pointer to data used by Layout. Pass this to begin and done.

begin( priv_data, type )
Call this to tell Layout that you're about to send it image data. The type argument describes the kind of pixel data you'll send.

LWIMTYP_RGB24
LWIMTYP_GREY8
LWIMTYP_INDEX8
LWIMTYP_GREYFP
LWIMTYP_RGBFP
LWIMTYP_RGBA32
LWIMTYP_RGBAFP

Layout returns an LWImageProtocolID containing the functions used to pass the data.

done( priv_data, protocol )
Call this to tell Layout that you've finished sending the image.