Site hosted by Angelfire.com: Build your free website today!

 

 

 

 

 

 

 

 

What Does Blitting to the Buffer Mean?

All this simply means is drawing your images to a bitmap that would be the size of the screen and then drawing that buffer to the screen so the images you drew appear simultaneously. Basically when you draw images to the screen the images are going to have to be drawn to the screen at separate times.

[DRAWING ROUTINE]

*Clear the screen so nothing is on the screen anymore

*Draw image 1 to screen

*Draw image 2 to screen

*Draw image 3 to screen

[/DRAWING ROUTINE]

See how the screen is cleared at a certain point then each image is being individually draw to the screen. So each time you do your drawing routine you are going to have the screen cleared so for a few milliseconds you are not going to have any images being displayed on the screen; it’s going to be a blank screen. Then after that only image 1 is only going to be on the screen, next image 2 will be put on the screen, and finally image 3 will be put on the screen. It may not seem like it will make much of a difference but when you run this drawing routine several times in a short amount of time it is very noticeable to the eye and looks very bad. To get rid of the ‘missing images’ effect you draw your images to the buffer. The buffer would be a bitmap that you would create that should be the same size as the screen (i.e. if you’re running under 640x480 screen resolution then that should be the size you create of your buffer---640x480). Here is the simple drawing routine you should take when using a buffer.

[DRAWING ROUTINE]

*Clear the buffer so nothing is on the buffer anymore

*Draw image 1 to the buffer

*Draw image 2 to the buffer

*Draw image 3 to the buffer

*Blit the buffer to the screen

[/DRAWING ROUTINE]

Let me explain how this makes such a huge difference and doesn’t give the’ missing images’ effect. First off your clearing the buffer and not the screen, so any images that are on the screen are still on the screen. Next you’re drawing each image individually to the buffer instead of the screen. The screen has still not seen a change because everything has been related to how the buffer is. Lastly you blit the buffer to the screen; all of the images that were on the buffer and how the buffer appeared now appears on the screen. Blit, for the most part, means the same thing as draw. You’re not actually seeing the buffer being displayed, though, what you’re seeing is the images that were drawn onto the buffer are now drawn onto screen.

In conclusion, it is important to now that directly displaying an individual image to the screen is inappropriate and should never be done in most circumstances. Also, when you blit the buffer to the screen, you’re not looking at the buffer directly but the images that are on the buffer through the screen.

**Blitting to the buffer refers to the technical term of double buffering**