ID2D1BitmapBrush::SetExtendModeX method (d2d1.h)

Specifies how the brush horizontally tiles those areas that extend past its bitmap.

Syntax

void SetExtendModeX(
  D2D1_EXTEND_MODE extendModeX
);

Parameters

extendModeX

Type: D2D1_EXTEND_MODE

A value that specifies how the brush horizontally tiles those areas that extend past its bitmap.

Return value

None

Remarks

Sometimes, the bitmap for a bitmap brush doesn't completely fill the area being painted. When this happens, Direct2D uses the brush's horizontal (SetExtendModeX) and vertical (SetExtendModeY) extend mode settings to determine how to fill the remaining area.

The following illustration shows the results from every possible combination of the extend modes for an ID2D1BitmapBrush: D2D1_EXTEND_MODE_CLAMP (CLAMP), D2D1_EXTEND_MODE_WRAP (WRAP), and D2D1_EXTEND_MIRROR (MIRROR).

Illustration of a bitmap and the resulting images from various extend modes

Examples

The following example shows how to set the bitmap brush's x- and y-extend modes to D2D1_EXTEND_MIRROR. It then paints the rectangle with the ID2D1BitmapBrush.

It produces the following output.

Illustration an original image and the resulting image from setting both x- and y- extend modes to mirror
m_pBitmapBrush->SetExtendModeX(D2D1_EXTEND_MODE_MIRROR);
m_pBitmapBrush->SetExtendModeY(D2D1_EXTEND_MODE_MIRROR);

m_pRenderTarget->FillRectangle(exampleRectangle, m_pBitmapBrush);

Requirements

   
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header d2d1.h
Library D2d1.lib
DLL D2d1.dll

See also

ID2D1BitmapBrush

ID2D1BitmapBrush::GetExtendModeX