Example: Retrieving Bitmaps

The PCXflip example demonstrates the fg_getimage() function. Its WM_CREATE handler displays a 320x200 PCX image from the file Mouse.pcx using fg_showpcx(). It calls fg_getimage() to retrieve the image as a 256-color bitmap, and then calls fg_revimage() to display the image mirrored about the y axis.

PCXflip computes the size of the bitmap array with fg_imagesiz(). This function returns the number of bytes required to store a bitmapped image of specified dimensions. Its two integer parameters specify the bitmap width and height in pixels. The return value is the bitmap size in bytes. The specific bitmap type depends on the active virtual buffer's color depth:

  • For 256-color virtual buffers, fg_imagesiz() returns the size of a 256-color bitmap (one byte per pixel).

  • For high color virtual buffers, fg_imagesiz() returns the size of a direct color bitmap in the high color format (two bytes per pixel).

  • For true color virtual buffers, fg_imagesiz() returns the size of a direct color bitmap in the true color format (three bytes per pixel).

In PCXFLIP, we use a 320x200 bitmap and a 256-color virtual buffer, so fg_imagesiz() returns a bitmap size of 64,000 bytes.

C/C++ version

C++Builder version

Delphi version

Visual Basic version

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.