You might know the classic GetPixel() function, now I want to make a function that retrieves the intermediate color from a floating-point coordinate. This is what I'm doing:

Code:
function im_cImage.GetInterPixel(
  X, Y: Single
  ): cr_rARGB;

  var
    X0, Y0, X1, Y1: Integer;
    FX, FY: Single;
    C10, C01, C11: cr_rARGB;

begin
  X0 := Trunc(X);
  Y0 := Trunc(Y);
  FX := X-X0;
  FY := Y-Y0;

  if FX < 0.5 then
  begin
    X1 &#58;= X0;
    X0 &#58;= X1-1;
    FX &#58;= FX+0.5;
  end else
  begin
    X1 &#58;= X0+1;
    FX &#58;= FX-0.5;
  end;

  if FY < 0.5 then
  begin
    Y1 &#58;= Y0;
    Y0 &#58;= Y1-1;
    FY &#58;= FY+0.5;
  end else
  begin
    Y1 &#58;= Y0+1;
    FY &#58;= FY-0.5;
  end;

  C10 &#58;= cr_Interpolate&#40;GetPixel&#40;X0, Y0&#41;, GetPixel&#40;X1, Y0&#41;, FX&#41;;
  C01 &#58;= cr_Interpolate&#40;GetPixel&#40;X0, Y0&#41;, GetPixel&#40;X0, Y1&#41;, FY&#41;;
  C11 &#58;= cr_Interpolate&#40;GetPixel&#40;X0, Y0&#41;, GetPixel&#40;X1, Y1&#41;,
    cm_Distance&#40;0, 0, FX, FY&#41;&#41;;

  // ... what should I do next? ...
end;
When I first started had the idea of blending those 3 colors (C10, C01 and C11), but now I'm not sure if those should be interpolated (and how), to get the right color. Any ideas? :?