7.1 About color

7.1.4 Color bitmaps, viewports, and windows

Bitmaps created in the color system have a default depth of 1. All host systems allow you to create bitmaps of depth 1 and of the system display depth; some host systems allow you to create bitmaps with different depths.

The depth of a bitmap determines which pixel values you can use to draw on the bitmap. The valid pixel values for a bitmap of depth depth are in the range between 0 and(1-(expt2 depth)). Any system color map entry is a valid pixel value for a bitmap of the same depth as the system display. For monochrome bitmaps, the only valid pixel values are 0 and 1. For a bitmap of depth 8, valid pixel values are between 0 and 255 inclusive. Each bitmap has default foreground and background pixel values that are used during graphic and text operations if you do not specify a color.

The function bitblt supports mapping between bitmaps of any depth. When there are an unequal number of planes in the destination bitmap and the source bitmap, you must specify how pixels in the source bitmap are translated into valid pixels for the destination bitmap.

For example, to convert a depth 8 bitmap into a depth 1 bitmap, you must specify a pixel map to translate depth 8 pixel values to depth 1 pixel values. The pixel map should be an array of 256 elements; that is, the array should contain an element for every possible pixel value in the depth 8 bitmap. The value of each element should be either 0 or 1, which are the possible pixel values for a depth 1 bitmap.

Viewports and windows can display bitmaps on the screen only when the bitmaps are the same depth as the system display or are of depth 1. On color displays, when a viewport or window has a bitmap of depth 1, it also has foreground and background colors that specify how the monochrome-to-color mapping should occur. You can change the values of these foreground and background colors.

The title of a monochrome or default color window is inverted from the default foreground and background colors of the window. The text of the title is the same color as the background, or white if a monochrome monitor is used. The bar appears in the foreground color, or in black if a monochrome monitor is used.

The Window Tool Kit - 9 SEP 1996

Generated with Harlequin WebMaker