Recent

Author Topic: Image degradation on rotate  (Read 780 times)

liewald

  • Full Member
  • ***
  • Posts: 133
Image degradation on rotate
« on: February 04, 2019, 02:50:47 pm »
Lazarus 1.8.2 r57375 FPC 3.0.4 x86_64-linux-gtk2

I'm trying to free rotate an image on a secondary form using a Tbgraknob. the rotation is working but there is significant image degradation on the rotate:

Here's the code

Quote

procedure TForm1.r_angleValueChanged(Sender: TObject; Value: single);

var rotator,rotated: tbgrabitmap;
    xpos,ypos : integer;

begin
   xpos := form2.image1.Left;
   ypos :=- form2.image1.top;
  rotated := tbgrabitmap.Create(form2.image1.picture.Width, form2.image1.picture.Height, BGRAWhite);
  rotator := tbgrabitmap.Create(form2.image1.picture.Bitmap);
  rotated.PutImageAngle(form2.image1.picture.Width div 2,form2.image1.picture.Height div 2, rotator, r_angle.Value, rfBestQuality,form2.image1.picture.Width div 2,form2.image1.picture.Height div 2);
  form2.image1.Canvas.Draw(xpos,ypos,rotated.Bitmap);
  rotator.free;
  rotated.free;
end;

Dave


liewald

  • Full Member
  • ***
  • Posts: 133
Re: Image degradation on rotate
« Reply #1 on: February 04, 2019, 02:53:55 pm »
sorry

Quote

procedure TForm1.r_angleValueChanged(Sender: TObject; Value: single);

var rotator,rotated: tbgrabitmap;

begin
  rotated :=tbgrabitmap.Create(form2.image1.picture.Width, form2.image1.picture.Height, BGRAWhite);
  rotator :=tbgrabitmap.Create(form2.image1.picture.Bitmap);
  rotated.PutImageAngle(form2.image1.picture.Width div 2,form2.image1.picture.Height div 2, rotator, r_angle.Value, rfBestQuality,form2.image1.picture.Width div 2,form2.image1.picture.Height div 2);
  form2.image1.Canvas.Draw(0,0,rotated.Bitmap);
  rotator.free;
  rotated.free;
end;


circular

  • Hero Member
  • *****
  • Posts: 2964
    • Personal webpage
Re: Image degradation on rotate
« Reply #2 on: February 04, 2019, 04:19:38 pm »
Hmm I suppose you're talking about blur.

I suggest you try the following and see what suits your needs:
rfCosine: minimum blur
rfHalfCosine: intermediate (rfBestQuality defaults to that)
rfLinear: maximum blur

Regards
Conscience is the debugger of the mind