AVI High-Level Functions

The fg_showavi() function plays the entire contents of an AVI file any number of times. It can position the image such that its upper left corner is at the screen space origin or at the graphics cursor position in the active virtual buffer. As fg_showavi() processes each AVI frame, it automatically scales the frame from the virtual buffer to the client area, which causes the AVI animation to appear in the client area as it plays.

The fg_showavi() function expects three parameters. The first is the AVI file name, which may include a path name, but must be null-terminated. The second specifies the number of times to play the AVI file. If the play count is zero, fg_showavi() will play it continuously until the Escape key is pressed. Note that this is the only way to stop playing the AVI file if the play count is zero (continuous play). The third fg_showavi() parameter is a series of flags that controls how the AVI is played. The following table summarizes these flags.

Flag

Meaning

FG_AT_XY

If specified, play the AVI file relative to the current graphics position. If not, play it relative to (0,0).

FG_IGNOREAVIPALETTE

If specified, play the AVI file using the current palette. If not, use the palette values stored in the AVI file. Not meaningful for high color or true color AVI files.

FG_NODELAY

If specified, play the AVI file with no delay between frames. If not, delay between frames as specified in the AVI header.

If successful, fg_showavi() returns zero. The possible error return values are -1 (file not found), -2 (file is not an AVI file), -3 (error initializing the AVI video stream), -4 (error allocating memory), or -5 (codec not available).

For example, the code shown here will play the file SEARCH.AVI with its upper left corner at the screen space position (16,16) in the active virtual buffer and no delay between frames:

C/C++:

fg_move(16,16);
fg_showavi("SEARCH.AVI",FG_AT_XY | FG_NODELAY);

Delphi:

fg_move(16,16);
fg_showavi('SEARCH.AVI'+chr(0), FG_AT_XY or FG_NODELAY);

Visual Basic:

Call fg_move(16, 16)
Call fg_showavi(App.Path & "\SEARCH.AVI", FG_AT_XY + FG_NODELAY)

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.