Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Contrast Effect

Increases or decreases the contrast of an image.

The CLSID for this effect is CLSID_D2D1Contrast.

The contrast function modifies each color channel value using two, piecewise quadratic polynomials that meet with slope continuity at the point (0.5, 0.5).

Piecewise quadratic polynomials that meet with slope continuity at the point (0.5, 0.5)

Example Images

This example shows the output of the effect with maximum contrast applied (Contrast = 1.0).

Before

Image before effect is applied

After

Image after effect is applied

Sample Code


ComPtr<ID2D1Effect> contrastEffect;
m_d2dContext->CreateEffect(CLSID_D2D1Contrast, &contrastEffect);
 
contrastEffect->SetInput(0, bitmap);
contrastEffect->SetValue(D2D1_CONTRAST_PROP_CONTRAST, 0.5f);
contrastEffect->SetValue(D2D1_CONTRAST_PROP_CLAMP_INPUT, TRUE);
 
m_d2dContext->BeginDraw();
m_d2dContext->DrawImage(contrastEffect.Get());
m_d2dContext->EndDraw();


Effect Properties

The properties for the contrast effect are defined by the D2D1_CONTRAST_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:
© 2017 Microsoft