Recent

Author Topic: Lazreport: Antialiasing mode  (Read 249 times)

luca

  • Jr. Member
  • **
  • Posts: 86
Lazreport: Antialiasing mode
« on: October 16, 2024, 02:04:10 pm »
Hi,
I've a report that include a JPEG image from a file.
Because the image is not always the same (in this case you can adapt original image), I must adapt it the TPicture component by stretching it.
Depending by the size of the original JPEG the image appears not very good.

By adding the command to set Antialiasing mode in the TfrPictureView.Draw procedure of the LR_Class Unit, the result is excellent.
Below the code (line 19.):

Code: Pascal  [Select][+][-]
  1. unit LR_Class;
  2. ...
  3. procedure TfrPictureView.Draw(aCanvas: TCanvas);
  4. var
  5.   r: TRect;
  6.   kx, ky: Double;
  7.   w, h, w1, h1, PictureHeight, PictureWidth: Integer;
  8.   {$IFDEF LCLNOGUI}
  9.   bmp: TLazreportBitmap;
  10.   {$ELSE}
  11.   ClipRgn, PreviousClipRgn: HRGN;
  12.   ClipNeeded: Boolean;
  13.   {$ENDIF}
  14.  
  15. begin
  16.   {$IFDEF DebugLR}
  17.   DebugLnEnter('TfrPictureView.Draw INI');
  18.   {$ENDIF}
  19.   aCanvas.AntialiasingMode:=amON;
  20. ...
  21.  

I don't know another way to obtain same result, so I share this solution with you.

I'm using Lazarus 2.2.0 on Windows 10.
Luca
« Last Edit: October 16, 2024, 02:07:16 pm by luca »

 

TinyPortal © 2005-2018