INFO: Advantages of Device-Dependent Bitmaps (94918)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • Microsoft Windows NT Server 3.5
    • Microsoft Windows NT Server 3.51
    • Microsoft Windows NT Workstation 3.5
    • Microsoft Windows NT Workstation 3.51
    • Microsoft Windows 95

This article was previously published under Q94918
4.00 | 3.10 3.50 3.51 WINDOWS | WINDOWS NT kbgraphic

SUMMARY

A Device-Dependent Bitmap (DDB) is much faster than a Device Independent-Bitmap (DIB) to BitBlt(). For this reason, it is often a good strategy under Win32 (as well as under Windows 3.1) to create a DDB from a DIB when caching or calling *Blt() functions.

The slight drawback of memory overhead for the DDB is handled well by Win32. With Windows 3.1, the DDB memory could be marked as discardable. Under Win32, the memory will be paged out if system resources become tight (at least until the next repaint); if the memory is marked as PAGE_READONLY, it can be efficiently reused, [see VirtualProtect() in the Win32 Application Programming Interface (API) Help file].

However, saving the DDB to disk as a mechanism for transfer to other applications or for later display (another invocation) is not recommended. This is because DDBs are driver and driver version dependent. DDBs do not have header information, which is needed for proper translation if passed to another driver or, potentially, to a later version of the driver for the same card.

MORE INFORMATION

Windows 95 and Windows NT 3.5 and later support DIBSections. DIBSections are the fastest and easiest to manipulate, giving the speed of DDBs with direct access to the DIB bits.

NOTE: Win32s does not support DIBSections.

Modification Type:MinorLast Reviewed:2/11/2005
Keywords:kbinfo KB94918