Previous Contents Next

Basic notions

Graphics programming is tightly bound to the technological evolution of hardware, in particular to that of screens and graphics cards. In order to render images in sufficient quality, it is necessary that the drawing be refreshed (redrawn) at regular and short intervals, somewhat like in a cinema. There are basically two techniques for drawing on the screen: the first makes use of a list of visible segments where only the useful part of the drawing is drawn, the second displays all points of the screen (bitmap screen). It is the last technique which is used on ordinary computers.

Bitmap screens can be seen as rectangles of accessible, in other terms, displayable points. These points are called pixels, a word derived from picture element. They are the basic elements for constructing images. The height and width of the main bitmap is the resolution of the screen. The size of this bitmap therefore depends on the size of each pixel. In monochrome (black/white) displays, a pixel can be encoded in one bit. For screens that allow gray scales or for color displays, the size of a pixel depends on the number of different colors and shades that a pixel may take. In a bitmap of 320x640 pixels with 256 colors per pixel, it is therefore necessary to encode a pixel in 8 bits, which requires video memory of: 480 * 640 bytes = 307200 bytes ~ 300KB. This resolution is still used by certain MS-DOS programs.

The basic operations on bitmaps which one can find in the Graphics library are: All these operations take place at a reference point, the one of the bitmap. A certain number of characteristics of these graphical operations like the width of strokes, the joints of lines, the choice of the character font, the style and the motive of filling define what we call a graphical context. A graphical operation always happens in a particular graphical context, and its result depends on it. The graphical context of the Graphics library does not contain anything except for the current point, the current color, the current font and the size of the image.


Previous Contents Next