BMP Creation

The fg_makebmp() function creates a BMP file from the specified rectangular region of the active virtual buffer. Its first four parameters define the minimum x, maximum x, minimum y, and maximum y screen space coordinates of the region. Its fifth parameter defines the color depth in bits per pixel of the BMP file; valid values are 1 (monochrome), 4 (16-color), 8 (256-color) and 24 (direct color RGB). However, monochrome, 16-color, and 256-color BMP files cannot be created when a direct color virtual buffer is active. Similarly, 24-bit BMP files can only be created when a direct color virtual buffer is active. The last fg_makebmp() parameter is the name of the BMP file to create (it may include a path name). As with fg_showbmp(), the file name must be terminated with a null character. If an identically named file exists, it is overwritten. For example, the statement

C/C++:

fg_makebmp(0,fg_getmaxx(),0,fg_getmaxy(),8,"NEW.BMP");

Delphi:

fg_makebmp(0,fg_getmaxx,0,fg_getmaxy,8,"NEW.BMP"+chr(0));

Visual Basic:

Call fg_makebmp(0, fg_getmaxx(), 0, fg_getmaxy(), 8,
   App.Path & "\NEW.BMP")

would create a 256-color (8 bits per pixel) BMP file named NEW.BMP from the active virtual buffer. The fg_makebmp() function returns 0 if successful, 1 if the BMP file was not created, or 2 if there was an error allocating memory.

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.