public void stretchBilinear(ScalarImage image) /* Rescales the scalar data in 'image' to 'this' using bilinear interpolation. */ { double xscale = (image.width - 1.0) / (width - 1.0); double yscale = (image.height - 1.0) / (height - 1.0); for (int j = height - 1, k = size - 1; j >= 0; --j) for (int i = width - 1; i >= 0; --i, --k) f[k] = (float) image.getBilinear(i * xscale, j * yscale); }