Share via


What Are Clippers? (Windows Embedded CE 6.0)

1/6/2010

Clippers, or DirectDrawClipper objects, allow you to blit to selected parts of a surface represented by a bounding rectangle or a list of several bounding rectangles. (See Clip Lists.)

One common use for a clipper is to define the boundaries of the screen or window. For example, imagine that you want to display a sprite as it enters the screen from an edge. You do not want to make the sprite pop suddenly onto the screen; you want it to appear as though it is smoothly moving into view.

Without a clipper object, DirectDraw does not allow you to blit the entire sprite, because part of it would fall outside the destination surface.

A straight copy of the pixel values in the sprite to the destination surface buffer would result in an incorrect display and even memory access violations.

With a clipper that has the screen rectangle as its clip list, DirectDraw knows how to trim the sprite as it performs the blit so that only the visible portion is copied.

The following illustration shows this type of clipping.

Ee490282.0ff640e1-0e2e-4ee6-948c-0faaf91acc39(en-US,WinEmbedded.60).gif

You can also use clipper objects to designate certain areas within a destination surface as writable. DirectDraw clips blit operations in these areas, protecting the pixels outside the specified clipping rectangle.

The following illustration shows this use of a clipper.

Ee490282.93994ec1-548a-429d-9f77-56e9012134e8(en-US,WinEmbedded.60).gif

Clippers have no affect on IDirectDrawSurface::Lock calls.

See Also

Concepts

Working with DirectDraw Clippers