Clip Lists
A version of this page is also available for
4/8/2010
A clip list consists of one or more RECT structures, in pixel coordinates. DirectDraw manages clip lists by using a DirectDrawClipper object, which can be attached to any surface.
The IDirectDrawSurface::Blt method copies data only to rectangles in the clip list.
For instance, if the upper right quarter of a surface is excluded by the rectangles in the clip list, and an application blitted to the entire area of the clipped surface, DirectDraw performs two blits, the first being to the upper left corner of the surface, and the second being to the bottom half of the surface, as shown in the following illustration.
You can manage a surface's clip list manually or, for a primary surface, have it done automatically by DirectDraw.
To manage the clip list yourself, create a list of rectangles in the form of a RGNDATA structure and pass this to the IDirectDrawClipper::SetClipList method.
To have DirectDraw manage the clip list for a primary surface, you attach the clipper to a window (even a full-screen window) by calling the IDirectDrawClipper::SetHWnd method, specifying the target window's handle.
This has the effect of setting the clipping region to the client area of the window and ensuring that the clip list is updated as the window is resized, covered, or uncovered.
If you set a clipper using a window handle, you cannot set additional rectangles.
Clipping for overlay surfaces is supported only if the overlay hardware can support clipping and if destination color keying is not active.