D3DXColorAdjustContrast function (D3dx9math.h)

Note

The D3DX utility library is deprecated. We recommend that you use DirectXMath instead.

Adjusts the contrast value of a color.

Syntax

D3DXCOLOR* D3DXColorAdjustContrast(
  _Inout_       D3DXCOLOR *pOut,
  _In_    const D3DXCOLOR *pC,
  _In_          FLOAT     c
);

Parameters

pOut [in, out]

Type: D3DXCOLOR*

Pointer to a D3DXCOLOR structure that is the result of the operation.

pC [in]

Type: const D3DXCOLOR*

Pointer to a source D3DXCOLOR structure.

c [in]

Type: FLOAT

Contrast value. This parameter linearly interpolates between fifty percent gray and the color, pC. There are not limits on the value of c. If this parameter is zero, then the returned color is fifty percent gray. If this parameter is 1, then the returned color is the original color.

Return value

Type: D3DXCOLOR*

This function returns a pointer to a D3DXCOLOR structure that is the result of the contrast adjustment.

Remarks

The input alpha channel is copied, unmodified, to the output alpha channel.

The return value for this function is the same value returned in the pOut parameter. In this way, this function can be used as a parameter for another function.

This function interpolates the red, green, and blue color components of a D3DXCOLOR structure between fifty percent gray and a specified contrast value, as shown in the following example.

pOut->r = 0.5f + c * (pC->r - 0.5f);

If c is greater than 0 and less than 1, the contrast is decreased. If c is greater than 1, the contrast is increased.

Requirements

Requirement Value
Header
D3dx9math.h
Library
D3dx9.lib

See also

Math Functions

D3DXColorAdjustSaturation