RGB-to-hue effect

Converts an RGB image to either the HSL (Hue, Saturation, Lightness) or HSV (Hue, Saturation, Value) color spaces.

HSL and HSV are two different models for representing an RGB color in a cylindrical color space. They are useful because they allow you to reason about a color using more intuitive concepts like hue and intensity versus combining red, green and blue values.

This effect normalizes the output data (hue, saturation value for HSV or hue, saturation, lightness for HSL) to the range [0, 1].

The CLSID for this effect is CLSID_D2D1RgbToHue.

To reverse the behavior of this effect, use the Hue to RGB effect.

Sample code

ComPtr<ID2D1Effect> rgbToHueEffect;
m_d2dContext->CreateEffect(CLSID_D2D1RgbToHue, &rgbToHueEffect);
 
rgbToHueEffect->SetInput(0, bitmap);
rgbToHueEffect->SetValue(D2D1_RGBTOHUE_PROP_OUTPUT_COLOR_SPACE, D2D1_RGBTOHUE_OUTPUT_COLOR_SPACE_HUE_SATURATION_VALUE);
 
m_d2dContext->BeginDraw();
m_d2dContext->DrawImage(rgbToHueEffect.Get());
m_d2dContext->EndDraw();

Effect properties

The properties for the contrast effect are defined by the D2D1_RGBTOHUE_PROP enumeration.

Requirements

Requirement Value
Minimum supported client Windows 10 [desktop apps | Windows Store apps]
Minimum supported server Windows 10 [desktop apps | Windows Store apps]
Header d2d1effects_2.h
Library d2d1.lib, dxguid.lib