Zooming into a photo spreads its pixels apart, and every new pixel between them needs a brightness. Write between(square, fx, fy): given the 4 old pixels around a new one (square, 2 × 2) and how far the new pixel sits across (fx, 0 at the left pixels, 1 at the right ones) and down (fy, 0 at the top, 1 at the bottom), return its brightness.
A handwritten 7, 8 × 8 pixels, zoomed in 4×. Copying the nearest pixel only makes the same blocks bigger. The goal is a zoom where the brightness slides smoothly from pixel to pixel, like the one it ends on. Your between() gets the 4 old pixels around a new one and where it sits between them.
between(square, fx, fy)| square | the 4 old pixels around the new one (a 2x2 numpy array): square[0] the top two, square[1] the bottom two | e.g. [[0, 0], [0, 16]] |
| fx | how far across the new pixel sits, 0 at the left pixels to 1 at the right ones | e.g. 0 |
| fy | how far down it sits, 0 at the top pixels to 1 at the bottom ones | e.g. 0 |
| returns | the new pixel's brightness | |