Border effect

Use the border effect to extend an image from the edges. You can use this effect to repeat the pixels from the edges of the image, wrap the pixels from the opposite end of the image, or mirror the pixels across the bitmap border to extend the bitmap region.

The CLSID for this effect is CLSID_D2D1Border.

Example images

The examples here show the output of the border effect using each mode. The output size is infinite, but these example images are cropped to twice the size.

Mirror

Before
The image before the effect.
After
The image after the transform.

 

Clamp

Before
The image before the effect.
After
The image after the transform.

 

Wrap

Before
The image before the effect.
After
The image after the transform.

 


ComPtr<ID2D1Effect> borderEffect;
m_d2dContext->CreateEffect(CLSID_D2D1Border, &borderEffect);

borderEffect->SetInput(0, bitmap);
borderEffect->SetValue(D2D1_BORDER_PROP_EDGE_MODE_X, D2D1_BORDER_EDGE_MODE_MIRROR);
borderEffect->SetValue(D2D1_BORDER_PROP_EDGE_MODE_Y, D2D1_BORDER_EDGE_MODE_MIRROR);

m_d2dContext->BeginDraw();
m_d2dContext->DrawImage(borderEffect.Get());
m_d2dContext->EndDraw(); 

Effect properties

Display name and index enumerationType and default valueDescription

Edge Mode X

D2D1_BORDER_PROP_EDGE_MODE_X

D2D1_BORDER_EDGE_MODE

D2D1_BORDER_EDGE_MODE_CLAMP

The edge mode in the X direction for the effect. You can set this to clamp, wrap, or mirror. See Edge modes for more info.

Edge Mode Y

D2D1_BORDER_PROP_EDGE_MODE_Y

D2D1_BORDER_EDGE_MODE

D2D1_BORDER_EDGE_MODE_CLAMP

The edge mode in the Y direction for the effect. You can set this to clamp, wrap, or mirror. See Edge modes for more info.

 

Edge modes

Display name and index enumerationDescription

Clamp

D2D1_BORDER_EDGE_MODE_CLAMP

Repeats the pixels from the edges of the image.

Wrap

D2D1_BORDER_EDGE_MODE_WRAP

Uses pixels from the opposite end edge of the image.

Mirror

D2D1_BORDER_EDGE_MODE_MIRROR

Reflects pixels about the edge of the image.

 

Output bitmap

The output bitmap size is infinite for all inputs, except a 0 sized input image. If the height or the width of an input image is 0, the output size is 0.

Requirements

Minimum supported clientWindows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]
Minimum supported serverWindows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]
Headerd2d1effects.h
Libraryd2d1.lib, dxguid.lib

 

Related topics

ID2D1Effect

 

 

Community Additions

ADD
Show:
© 2014 Microsoft