Color::BlendRGB

Color::BlendRGB
static inline Color BlendRGB(Color c1, Color c2, UByte factor);
inline Color& BlendRGB(Color c, UByte factor);
Description

BlendRGB combines two colors by taking the alpha component of the first color and the blended RGB channels (c1.rgb * (1-f) + c2.rgb * f), using the passed alpha factor. For Color objects, the actual equation used for the 8 bit alpha channel is: (((c1.rgb+1)*f)>>8)+(((c2.rgb+1)*(255-f))>>8).

Parameters
Parameters 
Description 
Color c1 
The first (the destination) of two color parameters whose alpha component is set directly to the new color, while its RGB channels are combined with the second color's RGB values to form the new color (return value). * 
Color c2 
The second (the source) of two color parameters whose RGB channels are combined with the first color's RGB channels to form the 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) whose RGB channels are combined with the RGB of the current color (the destination). The current colors alpha component is not affected. 
Return Value

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

The static function, taking two parameters (c1 and c2), returns a new Color by value, which is formed from the first color's alpha component and the blend of the two colors RGB channels, using the passed alpha factor ((c1.rgb * (1-f) + c2.rgb*f), c1.a). * 

*- pertains to static function only. 

See Also