fg_bmppal()

Win32 DirectX Fastgraph/Light

Prototype

int fg_bmppal (char *filename, void *palette);

Function fg_bmppal (ByVal filename As String, palette() As Any) As Long

function fg_bmppal (filename : string; var palette) : integer;

Description

The fg_bmppal() function retrieves the palette of an image stored in a BMP file. The palette values are returned as RGB color components, each between 0 and 255.

Parameters

filename is name of the BMP file. The file name must be terminated by a zero byte.

palette is the name of the array that will receive the BMP palette values. The palette values are returned as RGB color components, each between 0 and 255. The first three bytes of palette will contain the RGB values for color 0, the next three for color 1, and so forth. The size of the palette array must be at least three times the number of colors in the BMP palette. You can also specify NULL for the palette parameter (nil^ for Delphi, ByVal 0 for Visual Basic, or BYVAL %NULL for PowerBASIC). In this case fg_bmppal() will return the image's color depth but no palette values.

Return value

>0 = The number of colors in the BMP palette

0 = The BMP file does not have a palette (probably a 24-bit BMP file)

-1 = The specified file does not exist

-2 = The specified file is not a BMP file

Restrictions

none

See also

fg_bmphead(), fg_setdacs(), fg_showbmp()

Examples

Image, ImgProc

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.