Platform SDK: DirectX

Source and Destination Rectangles

[C++]

To display an overlay surface, you call the overlay surface's IDirectDrawSurface7::UpdateOverlay method, specifying the DDOVER_SHOW flag in the dwFlags parameter. The method requires you to specify a source and destination rectangle in the lpSrcRect and lpDestRect parameters. The source rectangle describes a rectangle on the overlay surface that will be visible on the primary surface. To request that the method use the entire surface, set the lpSrcRect parameter to NULL. The destination rectangle describes a portion of the primary surface on which the overlay surface will be displayed.

[Visual Basic]

To display an overlay surface, you call the overlay surface's DirectDrawSurface7.UpdateOverlay method, specifying the DDOVER_SHOW flag in the flags parameter. The method requires you to specify a source and destination rectangle in the RECT and rectD parameters. The source rectangle describes a rectangle on the overlay surface that will be visible on the primary surface. To request that the method use the entire surface, pass an empty RECT for the RECT parameter. The destination rectangle describes a portion of the primary surface on which the overlay surface will be displayed.

In addition, you can display an overlay with additional effects by calling DirectDrawSurface7.UpdateOverlayFx method. Note you must set the DDOVER_DDFX flag in the flags parameter to use overlay effects set in the ddoverfx parameter.

Source and destination rectangles do not need to be the same size. You can often specify a destination rectangle smaller or larger than the source rectangle, and the hardware will shrink or stretch the overlay appropriately when it is displayed.

To successfully display an overlay surface, you might need to adjust the size and position of both rectangles. Whether this is necessary depends on the restrictions imposed by the device driver. For more information, see Boundary and Size Alignment and Minimum and Maximum Stretch Factors.