A Word About Blitting

Blitting is such a key part of Windows graphics that it’s hard to believe Visual Basic got through three major versions without offering any direct support for it. “Blit” is the common pronunciation for BitBlt, which is a contraction of the term bit block transfer. (Many books spell this term blt, but I couldn’t bring myself to write a word with no vowels.) Blitting means combining the pixels of one bitmap with the pixels of another—or, at a lower level, combining the bits of one device context with the bits of another.

You can blit the old-fashioned way, using the Windows API BitBlt function (and its cousins StretchBlt and PatBlt). Or you can blit with the newfangled Paint­Picture method. Each way has its strong points. The Bit Blast program (BIT­BLAST.VBP) shown in Figure 7-6 illustrates both approaches. The Use BitBlt

Figure 7-6. The Bit Blast program.

check box determines which version is used. Both give similar results, but the code is quite different, as you’ll see.

To use Bit Blast, select a source picture with the left mouse button and a destination with the right button. Select one of the blit modes in the list box on the right, and click the Blit button (or double-click the selection in the list box). You can get a variety of effects by combining different pictures with different modes.