Blocks with Transparent ColorsThe fg_vbtcopy(), fg_vbtzcopy(), and fg_vbtccopy() functions copy a rectangular region between virtual buffers just as fg_vbcopy() does, but they support transparent colors. By transparent, we mean any pixels whose color is defined to be transparent are not copied from the source region, but all other pixels are. The fg_vbtcopy() function lets you define a single transparent color, while fg_vbtzcopy() always treats zero-valued pixels as transparent. For fg_vbtcopy(), the transparent color is a logical palette index for 256-color virtual buffers, or an fg_maprgb() encoded color value for direct color virtual buffers. For example, the following fg_vbtcopy() and fg_vbtzcopy() calls will each copy the specified region between two virtual buffers, with zero-valued pixels considered transparent:
C/C++ and Delphi:
Visual Basic:
The fg_vbtccopy() function lets you define up to 256 transparent colors. It has the same eight parameters as fg_vbcopy(). In fact, if we haven't defined any transparent colors, fg_vbtccopy() is functionally equivalent to fg_vbcopy(). The fg_vbtcopy() and fg_vbtzcopy() functions are always faster than fg_vbtccopy(), especially when used with direct color virtual buffers. We use fg_tcdefine() to define which colors are considered transparent in subsequent calls to fg_vbtccopy(). The fg_tcdefine() function expects two integer parameters: one defining the color number (between 0 and 255) and another defining the transparency state associated with that color. If the state is zero, the specified color will be opaque (non-transparent). If it is any other value, the color will be transparent. For example, we can make colors 11 and 15 transparent with these two calls:
C/C++ and Delphi:
Visual Basic:
|
 
copyright 2001 Ted Gruber Software, Inc.