The term blit represents block image transfer. Blitting is basically copying, but it may involve some additional colour processing to achieve the desired result. For example, a rectangular image of a sprite is likely to have a uniformly coloured background which should not be copied to the screen. This background colour is known as a transparent colour. Blitting can also require that source and destination pixel colours undergo a Boolean operation such as AND or OR to determine the resultant colour.

In SDL, a block of memory representing a graphic such as an image or the screen is known as a surface. It is possible to copy a rectangular area of the source surface to the destination surface. You could load a sprite sheet image containing several sprites or a single sprite at different orientations then calculate the coordinates of the required rectangle to blit to the screen to suit the current game situation. Many such sprite sheets are available for free download, and you are advised to acknowledge the source of any that you use. The HasGraphics site provides links to some useful examples.

A surface may be stored in system memory or in the video memory. If in the video memory, it may be in the memory in use to display the screen or in a back buffer waiting for a flip to display it. You should complete at least one blit to a surface other than the current screen and then remember to update the whole screen or the part of it that you have changed.

Programming - a skill for life!

Topics you need to understand before programming with SDL