To understand how to use the objects you've been reading about, you need to look at the techniques used in DirectX to create animations. The techniques include blitting, page flipping, back buffering, and palette cycling.
Blitting is the process of taking rectangles from offscreen drawing surfaces and copying them onto primary or secondary drawing surfaces. Blitting is much like taking pieces of a jigsaw puzzle and assembling the finished product on a table.
Page Flipping and Back Buffering
Page flipping is the process of cycling through the drawing surfaces, or pages. In back buffering, you populate these surfaces with new frames of information. With these two techniques, you can create true animation by creating a frame, displaying the frame, creating the secondary surface, and then displaying it. Figure 3.9 shows how page flipping occurs.
Figure 3.9 Page flipping.
Before the flip occurs, users see a single vehicle going east. What they are seeing at that point is the primary surface. While this is going on, the secondary surface is being redrawn with an additional vehicle, a little bit larger, going west. When the flip occurs, the users' view is changed to the secondary surface. In essence, the secondary surface in the previous frame is now the primary surface, and vice versa. Users now see both vehicles. Because the car going east will have traveled off the screen in the next frame, you remove it from the secondary surface. The secondary surface is now redrawn to get ready for the next flip.
Palette cycling can best be visualized by imagining a painter's palette. Painters use a palette of colors to create their paintings. Just imagine what would happen if they changed a few of the colors on their palettes to new colors, and that change resulted in the colors in their painting automatically changing, too. You would have the same painting, but with a few colors changed. If you continued to do that, some of the images in the painting would look animated, simply because you had changed their colors over and over. This effect is called palette animation, and this technique can be used to create psychedelic effects such as those popular in the `70s. You can also use it to create fading effects on objects and text to give the impression that they are appearing or disappearing.