There seems to be a drawing issue somewhere. Below is a simple program to illustrate the problem.
This code should draw a 10x10px black square with a white outline square having a 1px border around it.
The linux qt5 and qt6 versions are fine, gtk2 has a black pixel at top left, and the windows version has top-left always off by one.
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, StdCtrls, InterfaceBase, LCLPlatformDef;
type
{ TForm1 }
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.FormCreate(Sender: TObject);
var
bmpGrid: TBitmap;
begin
bmpGrid := TBitmap.Create;
try
bmpGrid.Width := 10;
bmpGrid.Height := 10;
bmpGrid.Canvas.Brush.Color := clBlack;
bmpGrid.Canvas.Clear;
bmpGrid.Canvas.Pen.Color := clWhite;
bmpGrid.Canvas.Pen.Style := psInsideframe;
bmpGrid.Canvas.Pen.Width := 2;
bmpGrid.Canvas.Brush.Style := bsClear;
// Draw a rectangle with a 1px border all around
bmpGrid.Canvas.Rectangle(2,2,9,9);
bmpGrid.SaveToFile(LCLPlatformDirNames[GetDefaultLCLWidgetType]+'-canvas.bmp');
finally
bmpGrid.Free;
Halt;
end;
end;
end.
Please see attached bitmap images.
Running latest trunk on Debian 12 and Windows 10:
Lazarus 4.99 (rev main_4_99-920-g0d73603378) FPC 3.3.1 x86_64-linux-gtk2
Free Pascal Compiler version 3.3.1-17333-g08f44aff2c-dirty [2025/01/20] for x86_64