XMAS 1994
XMAS 1994


In native Windows programming the way to draw a part of an image onto another image was to call BitBlt:

BitBlt( hDC,screenX,screenY,width,height,hImageDC, imageX, imageY,SRCCOPY );

BitBlt was a very useful function. It would take the handles of two Drawing Contexts (DC). A drawing context could be the main screen, a printer, or a memory location. What I would do is draw the animation cells onto a bitmap, with MS Paint, and embed the bmps into the application, which would compile all of the bitmaps into the .exe file, so everything is packaged together. Then I would get the handle to the drawing contexts of all the bitmaps. I would also get the handles to the screen, and a chunk of memory the size of the screen, which contained a copy of the screen.

The first five parameters of BitBlt are for the destination drawing. They are the handle, the location, and the size. The next three would be the source handle, and the source location, the size was assumed to be the same. The last parameter was the most important, it would tell how to copy the image.

To copy the part of the image as is, use SRCCOPY. This is used when the background of the cell was in the image, and all that needed to do was copy it over the last image.

Since drawing images in 1993 was very slow, drawing transparent bitmaps, took a lot more work. For this webpage, the background is drawn every frame, and no one really notices. Back then, however, this would produce a flicker. So, transparencies would take two steps to start and then three steps for each frame after that. The first two steps would ne to draw a mask on the screen, and then another mask on top of that. The first mask was a black and white image, where the white part defined the transparent part, and the black would end up being white on the screen. This BitBlt would use SRCAND, which would and the screen image and the mask.

The second mask is a color image, where black is the transparent and the color will be displayed. When done correctly the color part will be over the white part from the first step. The BitBlt would use SRCPAINT.

When the next frame is drawn, the first step is to overlay the chunk of screen from a memory screen copy, this will set the screen back to how it was before the last frame, then the SCRAND and SCRPAINT would be applied again. For the stars on the tree the next frame would not be moved, but for the flakes, the location would be moved before drawing the two last steps.

Copyright 2018 by James Wright. All Rights Reserved.