Rewrote and added interpolation modes: triangle, rectangle, cosine, gaussian