Edge Detection Effect

Filters out the content of an image leaving lines at the edges of contrasting sections of the image.

The CLSID for this effect is CLSID_D2D1EdgeDetection.

Example Image

Example of effect output

Sample Code


ComPtr<ID2D1Effect> edgeDetectionEffect;
m_d2dContext->CreateEffect(CLSID_D2D1EdgeDetection, &edgeDetectionEffect);
 
edgeDetectionEffect->SetInput(0, bitmap);
edgeDetectionEffect->SetValue(D2D1_EDGEDETECTION_PROP_STRENGTH, 0.5f);
edgeDetectionEffect->SetValue(D2D1_EDGEDETECTION_PROP_BLUR_RADIUS, 0.0f);
edgeDetectionEffect->SetValue(D2D1_EDGEDETECTION_PROP_MODE, D2D1_EDGEDETECTION_MODE_SOBEL);
edgeDetectionEffect->SetValue(D2D1_EDGEDETECTION_PROP_OVERLAY_EDGES, false);
edgeDetectionEffect->SetValue(D2D1_EDGEDETECTION_PROP_ALPHA_MODE, D2D1_ALPHA_MODE_PREMULTIPLIED);
 
m_d2dContext->BeginDraw();
m_d2dContext->DrawImage(edgeDetectionEffect.Get());
m_d2dContext->EndDraw();




Effect Properties

The properties for the edge detection effect are defined by the D2D1_EDGEDETECTION_PROP enumeration.

Requirements

Minimum supported clientWindows 10 [desktop apps | Windows Store apps]
Minimum supported serverWindows 10 [desktop apps | Windows Store apps]
Headerd2d1effects_2.h
Libraryd2d1.lib, dxguid.lib

 

Related topics

ID2D1Effect

 

 

Show: