Using 256-Color High-Resolution Display Drivers

The Multimedia high-resolution 256-color display drivers MMV7VGA.DRV and MMWD480.DRV are enhanced versions of the Windows 3.0 display drivers. These display drivers have the following enhancements:

BitBlt and StretchBlt can ignore a background color while moving a bitmap

StretchBlt and StretchDIBits operations are handled by the display driver when they expand an 8-bit bitmap or DIB by integer factors

SetDIBitsToDevice is optimized for 8-bit DIBs

SetDIBitsToScreen, StretchBlt, StretchDIBits, and the new transparent background mode of BitBlt and StretchBlt use 80386-specific code when they detect 80386 processors

Bitmap Blits with Transparent Backgrounds

The Multimedia display drivers add a transparent mode to the BitBlt and StretchBlt functions. These functions check the background mode (BkMode) of the destination display context. When they find the background mode set to NEWTRANSPARENT, they don't copy the pixels in the source bitmap matching the current device-context background. As a result, they treat the matching pixels as transparent. Your applications can use this mode to remove the background color from an image and add the image onto another background. The statements in the following example move a bitmap with red designated as the background transparent color:

SetBkColor(hdc, RGB (255, 0, 0));
SetBkMode (hdc, NEWTRANSPARENT);
BitBlt (hdc, 0, 0, 100, 100, hdcBits, 0, 0, SRCCOPY);

The following fragment uses the new constants CAPS1 and C1_TRANSPARENT defined in MMSYSTEM.H to determine if a display driver supports the transparent mode:

        if (GetDeviceCaps(hDC, CAPS1) & C1_TRANSPARENT)))
                return TRUE;

Using StretchBlt and StretchDIBits

The display driver optimizations for StretchBlt and StretchDIBits are transparent to your application. The Multimedia display drivers automatically use the optimized versions of these functions under the following conditions:

Your application is using an 8-bit bitmap or DIB

Your application expands the image by integer factors

Your application does not mirror the image

Your application does not use a clipped destination wider than 1024

Your application can improve the speed of StretchBlt and StretchDIBits by using a one-to-one mapping between the image palette and the system palette. When these functions detect the one-to-one mapping, they avoid translating the image color palette to the system palette. Refer to the Data Preparation Tools User's Guide for information on using PalEdit to create an identity palette which will map directly to the system palette.

The StretchBlt and StretchDIBits also use 80386-specific code when they detect an 80386 processor. Thus, these functions operate faster on an 80386 processor than on an 80286 processor.

Using SetDIBitsToDevice with 8-bit DIBs

The display driver optimizations for SetDIBsToDevice are also transparent to your application. The code for your application will operate with both the multimedia display drivers and the standard display drivers.

Although operation of this function is transparent, your application can do the following to get the best speed improvements from SetDIBsToDevice when working with 8-bit DIBs:

Use the DIB_PAL_COLORS option to prevent color matching by GDI.

Use a one-to-one mapping for the palette. This function detects the one-to-one mapping and avoids translating the image color palette to the system palette.

While your application cannot select the processor, your application can anticipate a performance improvement from SetDIBitsToDevice when used with an 80386 processor. The performance of SetDIBitsToDevice approaches BitBlt when used with an 8-bit DIB and used with an 80386 processor.