--- rxvt-unicode/src/rxvtutil.h 2006/01/25 00:42:21 1.20 +++ rxvt-unicode/src/rxvtutil.h 2006/01/29 20:51:28 1.21 @@ -31,6 +31,14 @@ template static inline void swap (T& a, U& b) { T t=a; a=(T)b; b=(U)t; } +// linear interpolation +template +static inline +T lerp (T a, U b, P p) +{ + return (int(a) * int(p) + int(b) * int(100 - p)) / 100; +} + // in range including end #define IN_RANGE_INC(val,beg,end) \ ((unsigned int)(val) - (unsigned int)(beg) <= (unsigned int)(end) - (unsigned int)(beg))