Retina / High DPI TBitmap lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- ps · 2016-07-03 06:45 How to handle high DPI TBitmap for MacOS X? I have problem with TBitmap see attachment. Background is rendered on TBitmap with size of component. Text is painted with Canvas.TextOut(X,Y, 'Caption') and it's well rendered (except italics style). TBitmap size is same as component (TBitmap.Width := Self.Width) but in real it's half "real" width and height and result is uggly output. Target is Cocoa (under Windows target is all OK and TBitmap has real width and height 1px=1px). ---------------------------------------------------------------------- lainz · 2017-12-13 20:35 The same happens with BGRABitmap. So I see that this needs to be fixed for all kind of bitmaps. BGRABitmap uses TBitmap AFAIK. Edit: Did not find a bug report, so I did one https://bugs.freepascal.org/view.php?id=32816 ---------------------------------------------------------------------- circular · 2020-06-13 14:19 The bitmap needs to be rendered with the real resolution and drawn stretched. - You can determine the scaling factor with the function GetCanvasScaleFactor of the control on which you want to draw. - Then draw the bitmap with StretchDraw See: https://wiki.lazarus.freepascal.org/Cocoa_DPI With BGRABitmap, you can render the stretched bitmap like this: 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 uses BGRABitmap, BGRABitmapTypes; { TForm1 } procedure TForm1.FormPaint(Sender: TObject);var  bmp: TBGRABitmap;begin  bmp := TBGRABitmap.Create(    round(ClientWidth*GetCanvasScaleFactor),    round(ClientHeight*GetCanvasScaleFactor)    );  with bmp do  begin    FillRect(0,0,bmp.Width,bmp.Height,clRed);    DrawLineAntialias(0,0,bmp.Width,bmp.Height,clYellow,false);  end;  bmp.Draw(Canvas, rect(0,0,ClientWidth,ClientHeight), true);  bmp.Free;end; ---------------------------------------------------------------------- lainz · 2020-06-13 15:41 Thanks. ---------------------------------------------------------------------- circular · 2020-06-13 16:44 You're welcome. In BGRAControls, I have added Retina handling for BGRAVirtualScreen, BGRAGraphicControl and SVGViewer. Do the change make sense to you? Note it will need dev branch of BGRABitmap. ---------------------------------------------------------------------- lainz · 2020-06-13 16:50 Hi, well I don't have a mac with retina to test, so I can't say, but I trust you did the changes very well