2 Bitmaps, Viewports, and Windows

2.1 Understanding bitmaps, viewports, and windows

The Window Tool Kit uses bitmaps, viewports, and windows to display various kinds of output on the screen. Bitmaps are the only Window Tool Kit object that you can draw onto because bitmaps contain bits whose values can be altered. All Window Tool Kit functions draw on bitmaps by changing certain bits.

Viewports and windows are mappings between bitmaps and the screen. Thus, the pixels on the screen in a viewport or a window's screen clipping region correspond to the bits on the underlying bitmap.

Unlike a viewport, a window can have a title, borders, a bitmap output stream, and a mouse input stream. The title and borders are optional and are specifiable. The input and output streams make input to and output from the window more convenient. In most other ways windows and viewports are the same, and any Window Tool Kit function that accepts a viewport as an argument also accepts a window.

A viewport or window is always created with an associated bitmap; if you do not supply a bitmap, a new one is created automatically. All viewports and windows have associated bitmaps; however, a bitmap can be created and kept independent of a viewport or window. A bitmap can be associated with a viewport or window at any time or not at all. Since all viewports and windows have associated bitmaps, any function that accepts a bitmap as an argument also accepts a viewport or a window and uses the viewport or window's associated bitmap.

Unlike bitmaps, which have no screen location, viewports and windows can be moved, reshaped, deactivated, activated, hidden, or exposed. All viewports and windows are present in the viewport hierarchy, which describes the relationships between all viewports and windows in the Window Tool Kit. Functions are provided that allow you to change these relationships and to control how viewports or windows overlap.

Note: You cannot perform the following operations unless the Window Tool Kit has been initialized:

The Window Tool Kit - 9 SEP 1996

Generated with Harlequin WebMaker