Microsoft DirectX 8.0 (Visual Basic) |
Adjusts the saturation value of a color.
D3DXColorAdjustSaturation( _ COut As D3DCOLORVALUE, _ C1 As D3DCOLORVALUE, _ s As Single)
If the function fails, an error is raised and Err.Number can be set to one of the following values:
D3DERR_INVALIDCALL |
D3DERR_OUTOFVIDEOMEMORY |
For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.
This function interpolates the red, green, and blue color components of a D3DCOLORVALUE type between an unsaturated color and a color, as shown in the following example.
' Approximate values for each component's contribution to luminance. ' Based up the NTSC standard described in ITU-R Recommendation BT.709. Dim Grey As Long Grey = C1.r * 0.2125 + C1.g * 0.7154 + C1.b * 0.0721 COut.r = Grey + s * (C1.r - Grey)
If s is greater than 0 and less than 1, the saturation is decreased. If s is greater than 1, the saturation is increased.
The gray-scale color is computed as: r = g = b = 0.2125*r + 0.7154*g + 0.0721*b.