algorithm of stretching (with linear interpolation) in 2D

Hi guys,
I am looking for a stretching and linear interpolation algorithm on 2D images… because the interpolation of windows (depends on the device) and some times is very slow !!!

can anybody help me ??

linear interpolation :

for each dst_pixel {
   float src_pixel.x = dst_pixel.x / (float)ratio.x;
   int p1x = (int) src_pixel.x; // should be a floor()
   float coef = src_pixel.x - p1x;
   color dst_color = (1-coef)*getColor(p1x) + coef*getColor(p1x+1);

This is for 1d images, you should be a able to do the conversion to 2d. Not sure if it will be fast though.