JPEG Display

Fastgraph's fg_showjpeg() function displays a color or grayscale baseline JPEG file in a direct color virtual buffer. The fg_showjpeg() function expects two parameters that are analogous to those of fg_showpcx(). That is, the first parameter is the name of the JPEG file, terminated by a null character, and the second parameter is a series of flags that controls how the image is displayed. The following table summarizes these flags.

Flag

Meaning

FG_AT_XY

If specified, display the image relative to the current graphics position. If not, display the image relative to (0,0).

FG_FROMBUFFER

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

The fg_showjpeg() function returns 0 if successful, 1 if the specified file wasn't found, 2 if the file is not a JPEG file, 3 if the file is not a baseline JPEG file or does not have a valid JPEG structure, or 4 if there was an error allocating memory.

For example, the code shown here will display the file AQUARIUM.JPG with its upper left corner at the screen space position (16,16) in the active virtual buffer:

C/C++:

fg_move(16,16);
fg_showjpeg("AQUARIUM.JPG",FG_AT_XY);

Delphi:

fg_move(16,16);
fg_showjpeg('AQUARIUM.JPG'+chr(0),FG_AT_XY);

Visual Basic:

Call fg_move(16, 16)
Call fg_showjpeg(App.Path & "\AQUARIUM.JPG", FG_AT_XY)

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.