DXWeightedAverage function
Produces a weighted average of two samples.
Syntax
DWORD DXWeightedAverage(
_In_ DXBASESAMPLE S1,
_In_ DXBASESAMPLE S2,
_In_ unsigned long Wgt
);
Parameters
S1 [in]
A DXBASESAMPLE object that specifies the first sample to be scaled.S2 [in]
A DXBASESAMPLE object that specifies the second sample to be scaled.Wgt [in]
A value of type unsigned long that specifies a number from 0 to 255 to use as a weighting for S1.
Return value
Returns a color value that is a mixture of the two source samples.
Remarks
This function combines two samples, where S1 is weighted by Wgt, and S2 is weighted by the inverse of Wgt. The weight should be a value ranging from 0 to 255. If the Wgt is equal to the alpha value of S1, this operation is equivalent to an alpha blend of S1 over S2.
For example, assume that the RGB format color of S1 is 0xFF0000 (red) and S2 is 0x00FF00 (green). If Wgt is 192 (0xC0), the resulting color is 0xC03F00 (dark orange). Notice that the resulting sample is mostly red because the weighting is large, but that there is some green.
Requirements
Minimum supported client |
Windows XP |
Minimum supported server |
Windows 2000 Server |
Header |
Dxhelper.h |