Example: 256-Color Bitmaps

The Bitmap program defines a 40x20 256-color bitmapped image of a bird in flight; it stores this bitmap in the Bird array. Bitmap has a top-level menu with selections for each Fastgraph 256-color bitmap display function. For example, clicking on "Drwimage" displays the bird with fg_drwimage() in the middle of the client area, as shown here:

The processing for each menu item is very similar: fill the virtual buffer with green pixels (which erases any previously drawn bitmap), move to the desired position, display the bitmap, and copy the virtual buffer contents to the window's client area. The Drwimage, Revimage, and Putimage handlers each display the bird bitmap in the middle of the virtual buffer. To demonstrate clipping, the Clpimage handler displays the bird entering the left edge of the window, and the Flpimage handler does so from the right edge. Note that all the bitmap display functions except fg_putimage() treat color 0 pixels as transparent. The fg_putimage() function displays them as black pixels, producing a black rectangle around the bird.

C/C++ version

C++Builder version

Delphi version

Visual Basic version

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.