PCX DisplayThe fg_showpcx() function displays an image stored in a PCX file. It can position the image using the coordinate information in the PCX header, or such that its upper left corner is at the graphics cursor position in the active virtual buffer. The first fg_showpcx() parameter is the name of the PCX file (it may include a path name). The file name must be terminated with a null character, so Delphi programmers will need to store a zero byte as the last character of the file name string. The second parameter is a series of flags that controls how the image is displayed. The following table summarizes these flags.
The fg_showpcx() function returns 0 if successful, 1 if the specified file wasn't found, 2 if the file is not a PCX file, 3 if the PCX color depth is not compatible with the active virtual buffer's color depth, and 4 if there was an error allocating memory. The incompatible color depth error occurs when you try to display a 24-bit PCX file in a 256-color virtual buffer. For example, the code shown here will display the file MOUSE.PCX with its upper left corner at the screen space position (16,16) in the active virtual buffer, using the palette values stored in the PCX file, and with automatic color reduction disabled:
C/C++:
Delphi:
Visual Basic:
In Visual Basic, prefixing the file name string with the App.Path property makes fg_showpcx() look for the file in the directory where the application's project (VBP) file resides when running the application from Visual Basic's development environment, or from the directory where the EXE file resides when running the application as an executable. If we don't do this, Visual Basic programs will look in the Visual Basic directory when running from the development environment. The PowerBASIC versions of the Fastgraph examples that require this capability include an AppPath() function that behaves the same way.
|
 
copyright 2001 Ted Gruber Software, Inc.