2.11.2 Device-Independent Bitmap Functions

Microsoft Windows version 3.0 provides a set of functions that define and manipulate color bitmaps which can be appropriately displayed on any device with a given resolution, regardless of the method by which the display represents color in memory. These functions translate a device-independent bitmap specification into the device-specific format used by the current display. The following is a list of these functions:

Function Description  
CreateDIBitmap Creates a device-specific memory bitmap from a device-independent bitmap (DIB) specification and optionally initializes bits in the bitmap. This function is similar to CreateBitmap.  
GetDIBits Retrieves the bits in memory for a specific bitmap
in device-independent form. This function is similar to GetBitmapBits.
 
SetDIBits Sets a memory bitmap's bits from a DIB. This function is similar to SetBitmapBits.  
SetDIBitsToDevice Sets bits on a device surface directly from a DIB.  
StretchDIBits Moves a device-independent bitmap (DIB) from
a source rectangle into a destination rectangle, stretching or compressing the bitmap as required.
 

A device-independent bitmap specification consists of two parts:

1.A BITMAPINFO data structure that defines the format of the bitmap and optionally supplies a table of colors used by the bitmap

2.An array of bytes that contain the bitmap bit values

Depending on the values contained in the bitmap information data structure, the bitmap bit values can specify explicit color (RGB) values or indexes into the color table. In addition, the color table can consist of indexes into the currently realized logical palette instead of explicit RGB color values. It is important to note that the coordinate-system origin for DIBs is the lower-left corner, not the Windows default upper-left corner.