Bitmaps in Windows

Introduction:

This text gives a very brief overview about bitmaps and how windows works with them. For more detailed discussion of this topic see your API documentation or read other documents from the text files section.

The Device Independent Bitmap:

The Device Independent Bitmap (DIB) is the format which is used to store bitmaps in .bmp files. However, DIBs can also be saved in the memory. A DIB is stored in the memory, if a program (for example: an image-editing program) loaded a DIB from a file and prepares it to be displayed on the screen. If a DIB uses 256 colors, the one-byte pixel values point to entries in the logical palette which is associated with the DIB. To be displayed on the screen, a DIB has to be converted to a DDB (see Palettes in Windows).
It is important to know that the rows of a DIB are stored upside down. That means that the uppest row which appears on the screen actually is the lowest row stored in the bitmap, a short example:

pixels displayed on the screen pixels stored in a DIB

You do not need to turn around the rows manually. The API functions which also display the bitmap (convert it to a DDB) will do that for you automatically.

The Device Dependent Bitmap:

The Device Dependent Bitmap (DDB) is the format which is used to display bitmaps on the screen. When used in 256 colors display mode, the one-byte pixel values point to entries in the currently realized system palette (see Palettes in Windows).

Back to the main page



Copyright 1998 Stefan Hetzl. If you have questions or comments or have discovered an error, send mail to [email protected]. You may forward this document or publish it on your webpage as long as you don't change it and leave this notice at the end.