Microsoft DirectX 8.0 (C++)

D3DXColorAdjustContrast

Adjusts the contrast value of a color.

D3DXCOLOR* D3DXColorAdjustContrast(
  D3DXCOLOR* pOut,
  D3DXCOLOR* pC,
  FLOAT c
); 

Parameters

pOut
[in, out] Pointer to a D3DXCOLOR structure that is the result of the operation.
pC
[in] Pointer to a source D3DXCOLOR structure.
c
[in] Contrast value. This parameter linearly interpolates between 50 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 50 percent gray. If this parameter is 1, then the returned color is the original color.

Return Values

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

Remarks

The return value for this function is the same value returned in the pOut parameter. In this way, the D3DXColorAdjustContrast 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 50 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, then the contrast is increased.

Requirements

  Header: Declared in D3dx8math.h.
  Import Library: Use D3dx8.lib.

See Also

D3DXColorAdjustSaturation