Previous Next

Special Effects in Display Drivers

Windows® 2000 and later operating system versions support the following special effects:

Alpha Blending

The Windows 2000 (and later) Shell uses alpha blending extensively to perform operations such as blend-in and blend-out animations and alpha cursors. Because alpha blend operations require reading from both the source and destination surfaces, it is very slow to punt to GDI when either the source or destination is in video memory. Consequently, hardware accelerations in the driver will yield visibly smoother animations and improve overall system performance.

Drivers should implement DrvAlphaBlend for bit-block transfers from compatible bitmaps using a constant alpha, and from 32 bpp BGRA system-memory surfaces with per-pixel alpha values. DrvAlphaBlend can be implemented using triangle texture fills, provided that no seam is ever visible.

The worst-case error produced by DrvAlphaBlend should not exceed one (1) per color channel. When stretching is involved, the source should be COLORONCOLOR-stretched (see the Platform SDK documentation) prior to blending; the worst-case error should not exceed one (1) per color channel combined with the worst-case stretching error.

In cases where alpha blending is combined with stretching, the Hardware Compatibility Test (HCT) tests a display driver's implementation of DrvAlphaBlend in the following way:

  1. The HCT calls the display driver's DrvAlphaBlend, producing an alpha-blended and stretched rectangle.
  2. The HCT generates a destination rectangle, using the same source rectangle as was used in the call to DrvAlphaBlend.
  3. For each pixel P in the destination rectangle of step 2, the HCT simulates a reverse stretch to determine the corresponding pixel in the source rectangle, before stretching. The HCT applies a tolerance value to the reverse stretch to accommodate the varying stretch implementations by drivers. The HCT then calculates the alpha blend that should be applied to that pixel.

    Because any of four possible pixels (the corners of the 3 X 3 pixel square centered on pixel P) in the source rectangle could be stretched to produce pixel P in the destination rectangle, the HCT must compare the color value of each corner pixel with that of the pixel at the corresponding position in the rectangle produced by DrvAlphaBlend.

The worst-case stretching error is the largest difference in color value between any pair of corresponding corner pixels, where one of them is on the DrvAlphaBlend-produced rectangle, and the other is on the HCT-produced source rectangle.

Gradient Fills

The Windows 2000 (and later) Shell uses gradient fills on all caption bars.

The results produced by DrvGradientFill depend on the number of bits per pixel, and must satisfy the following guidelines:

24-bpp or 32-bpp surfaces

15-bpp or 16-bpp surfaces

The worst-case error in any channel cannot exceed ±15.

1-bpp to 8-bpp surfaces

No error is permitted in gradient fills for any of these surfaces. For an 8-bpp surface, GDI does not call the driver's DrvGradientFill function.

Note that in all surfaces, clipping does not affect results.