Bitmap Devices and Contexts

The BitGDI API provides extensions for bitmap devices of the abstract drawing device and context interfaces defined in the GDI API. The key interfaces defined by it, used for drawing on the screen, are in fact abstract. The Window Server provides concrete classes for on-screen drawing which derive from these interfaces. The concrete device and context classes that the API does provide are normally only used by applications to draw to in-memory bitmaps.

Bitmap graphics context

CBitmapContext specializes a GDI context (CGraphicsContext) for bitmap graphics. It provides extra functionality for:

  • clearing and copying rectangular areas

  • bitmap block transfer

  • setting pen color to a grey level

  • setting the shadow mode

  • resetting the GC settings to their default values

The Window Server client-side API provides one implementation, CWindowGc, used for screen drawing. Another implementation, CFbsBitGc, is used for drawing to in-memory bitmaps.

Bitmap graphics device

CBitmapDevice specializes a graphics device (CGraphicsDevice) for bitmap graphics.

The Window Server client-side API provides one implementation, CWsScreenDevice, for screen drawing. Another implementation, CFbsBitmapDevice, is used for drawing to in-memory bitmaps. A third, CFbsScreenDevice, is used (rarely) to access the screen directly, without the mediation of the window server.

Screen driver information

The screen width and height must be a multiple of four. In certain cases where the screen mode would result in a scanline (the scanline runs in the current horizontal direction of the screen) not being divisible by a whole word (32 bits) the screen width must also be a multiple of 16. This restriction will also apply to the height if there is a screen-size mode with a rotation of 90 or 270 (or both)

For example, the screen mode EGray4 is 2 bits per pixel, therefore one word would be 16 pixels, so in order for the scanline to be a whole number of words the width must be a multiple of 16.

The vertical height is unrestricted unless there is at least one screen-size mode with a rotation of 90 or 270 (or both).

Related concepts
Bitmaps
BitGDI Component