defocus-modules/lib/color.c

15 lines
302 B
C
Raw Normal View History

#include <defocus/base.h>
#include <math.h>
df_color df_lerp_color(df_color a, df_color b, double t)
{
df_color r;
for (int i = 0; i < 4; ++i) {
double af = (double)a.e[i];
double bf = (double)b.e[i];
r.e[i] = (uint8_t)floor(af + (bf - af) * t);
}
return r;
}