Microsoft KB Archive/94918

{|
 * width="100%"|

INFO: Advantages of Device-Dependent Bitmaps

 * }

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 Server versions 3.5, 3.51
 * Microsoft Windows NT Workstation 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 : kbOSWinNT310 kbOSWinNT350 kbOSWinNT351 kbSDKWin32 kbOSWin95 kbDSupport

Issue type : kbinfo

Technology : kbAudDeveloper kbWin32sSearch kbWin32API