AVI Helper Functions

Fastgraph includes additional AVI support functions similar to those for BMP and PCX files. The fg_avipal() function retrieves the palette of an AVI file. Its first parameter is an AVI file name, terminated by a zero byte as with fg_showavi(). Its second parameter is the name of the array that will receive the AVI palette values. The palette values are returned as RGB color components, each between 0 and 255. The first three bytes of this array will contain the RGB values for color 0, the next three for color 1, and so forth. The array size in bytes must be at least three times the number of colors in the AVI file. If successful, the fg_avipal() return value is the number of colors in the AVI palette (usually 16 or 256), or 0 if the AVI file does not contain a palette (this will be the case for high color and true color AVI files). The possible error return values are -1 (file not found) and -2 (file is not an AVI file). You can also specify NULL for the second fg_avipal() parameter (pass nil^ for Delphi, ByVal 0 for Visual Basic, or BYVAL %NULL for PowerBASIC). In this case, the function will return the AVI color depth but no palette values.

The fg_avihead() function retrieves an AVI file header. The first fg_avihead() parameter is the name of an AVI file (terminated by a zero byte), and the second is the name of a buffer that will receive the AVI header (the buffer size must be at least 56 bytes). If successful, fg_avihead() returns zero. Otherwise, the return value is -1 if the specified file was not found, or -2 if it is not an AVI file.

The fg_avisize() function returns the width and height of an AVI image. Its first parameter is the name of a buffer containing the AVI file header returned by fg_avihead(), and its second and third parameters receive the image width and height in pixels.

<< Prev

Next >>

Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.