Tom
Tom

Reputation: 3034

Changing Graphics32's TImgView32's resampler kernel on the fly

I want to change resampling kernel of Graphics32's TImgView32 on the fly. However there is no visible difference. Here's the code:

procedure TForm1.FormCreate(Sender: TObject);
begin
  ImgView321.Bitmap.LoadFromFile('1.bmp');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ImgView321.Scale := ImgView321.Scale*2;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  ImgView321.Scale := ImgView321.Scale/2;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  ImgView321.Bitmap.ResamplerClassName := 'TKernelResampler'; 
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  ImgView321.Bitmap.ResamplerClassName := 'TNearestResampler'
end;

Upvotes: 1

Views: 376

Answers (1)

CWBudde
CWBudde

Reputation: 1803

When you choose 'TKernelResampler' it is important to specify the kernel that is used. The default is TBoxKernel with a result that is nearly identical with the 'TNearestResampler'

In fact it is identical from a visual perspective, just a different computation.

Try to use the 'TCubicKernel' or 'TLanczosKernel'. For more control you can also pick the 'THermiteKernel' or 'TAlbrechtKernel', which has two control parameters (instead of just one).

Upvotes: 1

Related Questions