DirectX SDK

D3DXColorAdjustContrast

The D3DXColorAdjustContrast function adjusts the contrast value of a given color.

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

Parameters

pOut
A pointer to a D3DXCOLOR structure that is the result of the operation.
pC
A pointer to a source D3DXCOLOR structure.
c
The contrast value. This parameter linearly interpolates between 50% gray and the given color, pC. There are not limits on the value of c. If this parameter is zero, then the returned color is 50% gray. If this parameter is 1, then the returned color is the original color.

Return Values

The 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% gray and a specified contrast value:

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

If c is greater than zero and less than 1, then the contrast will be decreased. If c is greater than 1, then the contrast will be increased.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Windows CE: Unsupported.
  Version: Requires DirectX 7.0.
  Header: Declared in d3dxmath.h.
  Library: Use d3dx.lib.

See Also

D3DXColorAdjustSaturation