Win32 DirectX Fastgraph/Light


int fg_showpcx (char *filename, int flags);

Function fg_showpcx (ByVal filename As String, ByVal flags As Long) As Long

function fg_showpcx (filename : string; flags : integer) : integer;


The fg_showpcx() function displays a PCX file.

For 256-color virtual buffers, 256-color PCX files are reduced to the 236 non-system colors if color reduction is enabled. 16-color and monochrome PCX files are always remapped to colors 10 to 25 to avoid conflicts with the system colors.


filename is the name of the PCX file. A device and path name may be included as part of the file name. The file name must be terminated by a null character (that is, a zero byte).

flags is a series of flags that controls how the image is displayed:




If specified, display the image relative to the current graphics position. If not, display the image at the position indicated in PCX header.


If specified, display the image using the current palette. If not, use the palette values stored in the PCX file. Not meaningful for 24-bit PCX files.


If specified, get the image data from the fg_imagebuf() buffer. If not, get the image data from the PCX file.


If specified, disable color reduction and remapping. If not, enable color reduction and remapping to avoid using the Windows system colors. Not meaningful for 24-bit PCX files.

Return value

0 = Success

1 = The specified file does not exist

2 = The specified file is not a PCX file

3 = The PCX file cannot be loaded into the active virtual buffer

4 = Error allocating memory


A logical palette must be defined and realized in order to use the palette values stored in the PCX file.

24-bit PCX files can only be loaded into direct color virtual buffers.

See also

fg_imagebuf(), fg_makepcx(), fg_pcxhead(), fg_pcxpal(), fg_pcxrange(), fg_pcxsize(), fg_realize()


CBdemo, Fade, Fishtank, Image, ImgProc, PCXflip, TMcube, TMcubeX

Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.