Color::BlendCh

Color::BlendCh
static inline UByte BlendCh(unsigned c1, unsigned c2, UByte factor);
Description

BlendCh combines two channels by taking the sum of the two scaled channels, using the alpha value as the scale factor (c2 * (1-f) + c1 * f). The second channel is scaled by one minus the alpha value (1-f). For 8 bit channels, the actual equation used is: (((c1+1)*f)>>8)+(((c2+1)*(255-f))>>8).

Parameters
Parameters 
Description 
unsigned c1 
The first (the destination) of two channels that are combined to form the new value (return value). 
unsigned c2 
The second (the source) of two channels that are combined to form the new value (return value). 
UByte factor 
An alpha value that is used as the factor ("f") in the blend operation. 
Return Value

An UByte value formed by alpha blending the two channels using the factor (c2 * (1-f) + c1 * f).

See Also