fg_makebmp()

Win32 DirectX Fastgraph/Light

Prototype

int fg_makebmp (int minx, int maxx, int miny, int maxy, int depth, char *filename);

Function fg_makebmp (ByVal minx As Long, ByVal maxx As Long, ByVal miny As Long, ByVal maxy As Long, ByVal depth As Long, ByVal filename As String) As Long

function fg_makebmp (minx, maxx, miny, maxy, depth : integer; filename : string) : integer;

Description

The fg_makebmp() function creates a BMP file from the specified rectangular region of the active virtual buffer. The region's extremes are expressed in screen space units.

For 16-color BMP files, fg_makebmp() assumes the color values have been mapped to the non-system colors. It thus subtracts 10 from each pixel value when creating the BMP file. For monochrome (2-color) BMP files, fg_makebmp() treats the low-order bit of each pixel as the actual color.

Parameters

minx is the x coordinate of the region's left edge.

maxx is the x coordinate of the region's right edge. It must be greater than or equal to minx.

miny is the y coordinate of the region's top edge.

maxy is the y coordinate of the region's bottom edge. It must be greater than or equal to miny.

depth is the new BMP file's color depth in bits per pixel. Valid values are 1 (monochrome), 4 (16-color), 8 (256-color), and 24 (direct color RGB).

filename is the name of the BMP file to create. 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). If an identically named file already exists, it is overwritten.

Return value

0 = Success

1 = The BMP file was not created

2 = Error allocating memory

Restrictions

Monochrome, 16-color, and 256-color BMP files can only be created with a 256-color virtual buffer is active.

24-bit BMP files can only be created when a direct color virtual buffer is active.

See also

fg_imagebuf(), fg_makepcx(), fg_showbmp()

Examples

Image, ImgProc

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.