INFO: Advantages of Device-Dependent Bitmaps

ID: Q94918

4.00 | 3.10 3.50 3.51 WINDOWS | WINDOWS NT kbgraphic
The information in this article applies to:
  • Microsoft Win32 Application Programming Interface (API), used with:
    • Microsoft Windows NT, versions 3.5, 3.51
    • Microsoft Windows 95


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.

Additional query words: 3.10 4.00

Keywords : kbNTOS310 kbNTOS350 kbNTOS351 kbSDKWin32 kbWinOS95 kbDSupport
Version : winnt:3.5,3.51
Platform : winnt
Issue type : kbinfo


Last Reviewed: July 12, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.