defocus-modules/lib/color.c
Kevin Trogant ffbe68606b Initial commit
First (sort-of) working version of a pinhole camera model.

Improvement idea:
- Stretch result image to the whole size
2023-04-06 18:54:30 +02:00

15 lines
302 B
C

#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;
}