I am looking at Graphics32 code which seems faster, and provides also other filters. It's in the unit GR32_Resamplers.pas. It is possible to inspire from it.
Thinking about the fact that when i need to enlarge the image over it's original size TImage's stretch resample do practically identical result (tested with imgviewer example) as TBGRABitmap's, i putted this small fix
procedure TForm1.FormCreate(Sender: TObject);
begin
image := TBGRABitmap.Create('/Users/asd/Documents/itsanimage.jpg');
Img_View.Stretch := true;
end;
procedure TForm1.FormPaint(Sender: TObject);
var
stretched: TBGRABitmap;
begin
if (Img_View.Width < trunc(image.Width/3*2)) or (Img_View.Height < trunc(image.Height/3*2)) then
begin
stretched := image.Resample(Img_View.Width, Img_View.Height) as TBGRABitmap;
Img_View.Picture.Bitmap.Assign(stretched.Bitmap);
stretched.Free;
end;
end;
But with big images (e.g. 1280x1024) when you mess around 800x600 size of form it's slow, so i putted /3*2 because TImage still make good result.