Name
WriteAnimFrame -- write single animation frame to disk (V5.0)
Synopsis
int ok = WriteAnimFrame(APTR stream, struct SaveAnimCtrl *ctrl);
Function
This function must save the frame described in the second parameter to the animation stream that is passed in the first parameter. This stream pointer is a handle that has been created by the BeginAnimStream() function. The second parameter is a pointer to a struct SaveAnimCtrl. This structure looks like this:

 
struct SaveAnimCtrl
{
    APTR Data;        // [in]
    ULONG *Palette;   // [in]
    int Modulo;       // [in]
    int Colors;       // [in]
    ULONG TransIndex; // [in]
    int Delay;        // [in]
    ULONG Flags;      // [in]
    ULONG FormatID;   // [in] -- V5.3
};

Hollywood passes the following information to your WriteAnimFrame() function:

Data:
The pixel data to save to the frame. The actual format of this data depends on the Format member.

Modulo:
Number of bytes used by a single row of pixel data. This may be more than needed to store for the width that has been passed to BeginAnimStream() since there may be some padding.

Colors:
This contains the number of colors in the color look-up table passed in the Palette member. This member is only used if HWSAVEANMFMT_CLUT has been passed to BeginAnimStream().

Palette:
Contains the look-up table that you need to convert the CLUT pixel values to RGB color values. This table consists of as many 32-bit ARGB values as has been set in the Colors member. Note that Palette is only used if HWSAVEANMFMT_CLUT has been passed to BeginAnimStream().

TransIndex:
If this animation stream has been created using HWSAVEANMFMT_CLUT this member specifies the index of the color that should appear transparent in the animation. The value specified here is only valid if the HWSAVEANMFLAGS_TRANSINDEX flag has been set (see below).

Delay:
The delay for this frame in milliseconds or 0 if there should be no delay. Not all animation formats support frame-based delaying.

Flags:
Contains a combination of flags specifying further options:

HWSAVEANMFLAGS_ALPHA:
Pixel data contains alpha channel transparency values.

HWSAVEANMFLAGS_TRANSINDEX:
The TransIndex member contains the index of a palette entry that should be made transparent in the output animation.

FormatID:
This member contains the identifier of the animation format the frame should be saved in. You only need to look at this member if your plugin supports more than one output animation format. But be careful, you are only allowed to look at this member if the user is running at least Hollywood 5.3. Otherwise, you must not access this member because older versions of Hollywood don't support it. (V5.3)

This function has to return True if the frame has been successfully saved or False in case of an error.

Inputs
stream
output anim stream handle created by BeginAnimStream()
ctrl
pointer to a struct SaveAnimCtrl containing the frame to be saved
Results
ok
True or False indicating success or failure

Show TOC