StretchDraw differences between Delphi and FPC lazarus / 39-Graphics ---------------------------------------------------------------------- lainz · 2021-03-05 16:03 Hi, we have this function to resize a QR code that the original size is 77x77 to 231x231 (3x). With LCL it works perfectly, but with Delphi the resulting image is blurred, like it uses some kind of antialiasing. Anyone that's using Delphi knows why or how to fix? Thanks. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure ResizeBitmap(Bitmap: TBitmap; Width, Height: Integer; Background: TColor);var  R: TRect;  B: TBitmap;  X, Y: Integer;begin  if assigned(Bitmap) then begin    B:= TBitmap.Create;    try      if Bitmap.Width > Bitmap.Height then begin        R.Right:= Width;      R.Bottom:= ((Width * Bitmap.Height) div Bitmap.Width);        X:= 0;      Y:= (Height div 2) - (R.Bottom div 2);      end else begin      R.Right:= ((Height * Bitmap.Width) div Bitmap.Height);        R.Bottom:= Height;        X:= (Width div 2) - (R.Right div 2);        Y:= 0;      end;      R.Left:= 0;      R.Top:= 0;      B.PixelFormat:= Bitmap.PixelFormat;      B.Width:= Width;      B.Height:= Height;    B.Canvas.Brush.Color:= Background;      B.Canvas.FillRect(B.Canvas.ClipRect);      B.Canvas.StretchDraw(R, Bitmap);      Bitmap.Width:= Width;      Bitmap.Height:= Height;      Bitmap.Canvas.Brush.Color:= Background;      Bitmap.Canvas.FillRect(Bitmap.Canvas.ClipRect);      Bitmap.Canvas.Draw(X, Y, B);    finally      B.Free;    end;  end;end; ---------------------------------------------------------------------- engkin · 2021-03-05 19:21 I don't know. Checking the source for LCL, I see it uses StretchMaskBlt. Compare: Canvas.CopyMode of both Bitmap and b, see if there is a difference between Delphi and LCL?