General Block TransferWe'll start with the most general block transfer function, fg_vbcopy(). It copies a block between two virtual buffers, or to a non-overlapping position in the same virtual buffer. The fg_vbcopy() function requires eight parameters. Its first four parameters define the minimum x, maximum x, minimum y, and maximum y screen space coordinates of the region to copy from the source virtual buffer. The next two parameters define the x and y coordinates for lower left corner of the block in the destination virtual buffer. The final two parameters specify the handles for the source and destination virtual buffers. To copy a block within a virtual buffer, just specify its handle as both the source and destination virtual buffer handles. Neither virtual buffer needs to be the active virtual buffer, but both virtual buffers must have the same color depth. Suppose, for example, that we've created two 320x240 virtual buffers:
C/C++:
Delphi:
Visual Basic:
If we want to copy the entire contents of the first virtual buffer into the second, we could do so like this:
C/C++ and Delphi:
Visual Basic:
If we want to copy the top half of the first virtual buffer to the bottom half, we could do this:
C/C++ and Delphi:
Visual Basic:
|
 
copyright 2001 Ted Gruber Software, Inc.