fgi_pcxpal() (Fastgraph/Image)

Win32 DirectX Fastgraph/Light

Prototype

int fgi_pcxpal (char *filename, void *palette, int handle);

Function fgi_pcxpal (ByVal filename As String, palette() As Any, ByVal handle As Long) As Long

function fgi_pcxpal (filename : string; var palette; handle : integer) : integer;

Description

The fgi_pcxpal() function retrieves the palette of a PCX file stored in an FGI library. The palette values are returned as RGB color components, each between 0 and 255.

If the PCX file includes an extended (256-color) palette, fgi_pcxpal() will return the values in the extended palette. Otherwise, fgi_pcxpal() will return the values from the 16-color palette in the PCX header.

Parameters

filename is the name of the PCX file. It may only include a file name and extension (such as PICTURE.PCX) and must be terminated by a null character (that is, a zero byte).

palette is the name of the array that will receive the PCX 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 PCX 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 fgi_pcxpal() will return the image's color depth but no palette values.

handle is the file handle for the FGI library containing filename.

Return value

>0 = The number of colors in the PCX palette (16 or 256)

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

-1 = Error reading the FGI library

-2 = The requested file is not in the FGI library

-3 = The requested file is not a PCX file

Restrictions

none

See also

fgi_pcxhead(), fg_setdacs(), fgi_showpcx()

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.