Share via


Boundary and Size Alignment (Windows Embedded CE 6.0)

1/6/2010

Due to various hardware limitations, some device drivers impose restrictions on the position and size of the source and destination rectangles used to display overlay surfaces. To find out which restrictions apply for a device, call the IDirectDraw::GetCaps method and then examine the overlay-related flags in the dwCaps member of the DDCAPS structure. The following table shows the members and flags specific to boundary and size alignment restrictions.

Category Flag Member

Boundary (position) restrictions

DDCAPS_ALIGNBOUNDARYSRC

dwAlignBoundarySrc

 

DDCAPS_ALIGNBOUNDARYDEST

dwAlignBoundaryDest

Size restrictions

DDCAPS_ALIGNSIZESRC

dwAlignSizeSrc

 

DDCAPS_ALIGNSIZEDEST

dwAlignSizeDest

There are two types of restrictions, boundary restrictions and size restrictions. Both types of restrictions are expressed in terms of pixels (not bytes) and can apply to the source and destination rectangles. Also, these restrictions can vary depending on the pixel formats of the overlay and primary surface.

Boundary restrictions affect where you can position a source or destination rectangle. The values in the dwAlignBoundarySrc and dwAlignBoundaryDest members tell you how to align the top left corner of the corresponding rectangle. The x-coordinate of the top left corner of the rectangle (the left member of the RECT structure), must be a multiple of the reported value.

Size restrictions affect the valid widths for source and destination rectangles. The values in the dwAlignSizeSrc and dwAlignSizeDest members tell you how to align the width, in pixels, of the corresponding rectangle.

Your rectangles must have a pixel width that is a multiple of the reported value. If you stretch the rectangle to comply with a minimum required stretch factor, be sure that the stretched rectangle is still size aligned.

After stretching the rectangle, align its width by rounding up, not down, so you preserve the minimum stretch factor.

For more information, see Minimum and Maximum Stretch Factors.

See Also

Concepts

Overlay Surfaces