INFO: Blitting Between DCs for Different Devices Is Unsupported

ID: Q195830

The information in this article applies to:

SUMMARY

Using a device-dependent blitting operation, such as BitBlt() or StretchBlt(), to transfer data from a DC supported by one device to a DC supported by another device is not supported. While blitting between different devices might work with some driver pairs, you cannot rely on it to work between all driver pairs, so you should avoid it. The most common problem scenario occurs when the code for displaying a memory bitmap uses StretchBlt() to display the image to a printer DC.

To avoid this problem, convert the memory bitmap from its device-dependent form into a device-independent form by using the function GetDIBits(). You can display The device-independent image to the second device by using either SetDIBits() or StretchDIBits().

MORE INFORMATION

For more information on how to convert between device-dependent bitmaps (DDBs) and device-independent bitmaps (DIBs), see the following KB article:

   ARTICLE-ID: Q80080
   TITLE     : HOWTO: Convert Between Device-Dependent Bitmaps and DIBs

The following sample contains an extensive library of functions for manipulating, printing, and converting DIBs and DDBs:

   ARTICLE-ID: Q94326
   TITLE     : SAMPLE: SeedIB.exe Shows 16 and 32 Bits-Per-Pel Bitmap
               Formats

Additional query words:
Keywords          : kbBitmap kbGDI 
Issue type        : kbinfo

Last Reviewed: November 17, 1998