Color::Blend

Color::Blend
static inline Color Blend(Color c1, Color c2, UByte factor);
inline Color& Blend(Color c, UByte factor);
static SF_EXPORT Color SF_STDCALL Blend(Color c1, Color c2, float factor);
Description

Blend combines two colors by taking the sum of each channel scaled by the alpha factor (c2 * (1-f) + c1 * f). Unlike the BlendDest and BlendSource methods, the Blend function takes the alpha factor as a passed parameter. For Color objects, the actual equation used for each 8 bit channel is: (((c1+1)*f)>>8)+(((c2+1)*(255-f))>>8).

Parameters
Parameters 
Description 
Color c1 
The first (the destination) of two color parameters that is combined to form a new color (return value). * 
Color c2 
The second (the source) of two color parameters that is combined to form a new color (return value). * 
UByte factor 
An alpha value that is used as the factor ("f") in the blend operation. 
Color c 
A color (the source) alpha blended into the current color (the destination). 
Return Value

The member function, taking one parameter (c), returns a Color reference to the current string, which was formed by alpha blending the passed color with the original color (c * (1-f) + this * f). 

The static function, taking two parameters (c1 and c2), returns a new color by value, which is formed by alpha blending the two colors using the factor (c2 * (1-f) + c1 * f). * 

*- pertains to static function only. 

See Also