Example: Virtual Buffer Block Transfer

The VBdemo example shows how to copy blocks with and without transparent colors between virtual buffers. Its WM_CREATE handler creates two 640x480 virtual buffers. We'll refer to the first virtual buffer created as the background virtual buffer, and the second virtual buffer as the foreground virtual buffer (because that's the virtual buffer we initially display). WM_CREATE fills the foreground virtual buffer with white (color 25) pixels, then draws a green (color 20) rectangle, one-half the size of the virtual buffer, centered in the virtual buffer.

VBdemo has a top-level menu with just three selections: Cut, Paste, and Exit. Clicking the Cut item copies the contents of the foreground virtual buffer to the background virtual buffer, erases the foreground buffer, and then displays it. This fills the client area with black (color 0) pixels. Clicking the Paste item copies the contents of the background virtual buffer back to the foreground virtual buffer, but with color 25 defined to be transparent, and displays the new contents of the foreground virtual buffer. This displays the green rectangle but not the white border; we continue to see the color 0 pixels where the white border was originally.

C/C++ version

C++Builder version

Delphi version

Visual Basic version

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.