Platform SDK: DirectX

D3DXColorLerp

The D3DXColorLerp function uses linear interpolation to create a color value.

D3DXCOLOR* D3DXColorLerp(
  D3DXCOLOR* pOut,
  const D3DXCOLOR* pC1,
  const D3DXCOLOR* pC2,
  float s
); 

Parameters

pOut
A pointer to a D3DXCOLOR structure that is the result of the operation.
pC1
A pointer to a source D3DXCOLOR structure.
pC2
A pointer to a source D3DXCOLOR structure.
s
This parameter linearly interpolates between the two colors, pC1 and pC2, treating them both as 4-D vectors. There are no limits on the value of s.

Return Values

The function returns a pointer to a D3DXCOLOR structure that is the result of the linear interpolation.

Remarks

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

This function interpolates the red, green, blue, and alpha components of a D3DXCOLOR structure between two given colors:

    pOut->r = pC1->r + s * (pC2->r - pC1->r);

If you are linearly interpolating between the colors A and B, and s is zero, then the resulting color is A. If s is 1, then the resulting color is color B.

Requirements

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

See Also

D3DXColorModulate, D3DXColorNegative, D3DXColorScale