Adjusts the saturation value of a color.
XMVECTOR XMColorAdjustSaturation(
XMVECTOR C,
float Saturation
)
C
Type: XMVECTOR
XMVECTOR describing the color. Each of the components of C should be in the range 0.0f to 1.0f.
Saturation
Type: float
Saturation value. This parameter linearly interpolates between the color converted to gray-scale and the original color, C. If Saturation is 0.0f, the function returns the gray-scale color. If Saturation is 1.0f, the function returns the original color.
Type: XMVECTOR
Returns an XMVECTOR describing the color resulting from the saturation adjustment.
The following pseudocode demonstrates the operation of the function.
XMVector colorOut;
// Approximate values for each component's contribution to luminance.
// Based upon the NTSC standard described in ITU-R Recommendation BT.709.
float Luminance = 0.2125f * C.x + 0.7154f * C.y + 0.0721f * C.z;
colorOut.x = (C.x - Luminance) * Saturation + Luminance;
colorOut.y = (C.y - Luminance) * Saturation + Luminance;
colorOut.z = (C.z - Luminance) * Saturation + Luminance;
colorOut.w = C.w;
return colorOut;
Header: Declared in directxmath.h.