Example: Bitmap Scaling and Shearing

We'll now present an example program named Scale that uses fg_scale() and fg_shear() on the 256-color bird bitmap introduced in the Bitmap program. The size of the bird bitmap is 40x20 pixels, but we'll use fg_scale() to create successively larger versions of this bitmap, in sizes 50x25, 60x30, 70x35, and 80x40. In each case, we store the scaled bitmap in the 3,200-byte ScaledBird array, which is big enough to hold the largest (80x40) bitmap. Next, we create sheared versions of the original 40x20 bitmap in each of the four fg_shear() shear types. Again, we use the ScaledBird array to hold the sheared bitmaps. We display the scaled and sheared bitmaps with fg_drwimage() in the program's WM_CREATE handler, producing the display shown here:

C/C++ version

C++Builder version

Delphi version

Visual Basic version

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.