Canvas.LineTo wrong, when pen.width > 1

Issue #197 new
Harry Stahl created an issue

The lineTo-Function takes not the width of the pen into account (drawing starts always on same position, but the half of pen-width has to be devided and substract from x and y in painting)

See attached a screenshot, that shows the diffrence in painting on windows and linux/mac OS.

procedure TForm7.pbPaint(Sender: TObject);
begin
with pb.Canvas do begin

Pen.Width := 1;

MoveTo(100,100);
LineTo(300, 100);

Pen.Width := 20;

MoveTo(100 + 20,100);
LineTo(300, 100);

end;
end;

By the way, thank you for the big amount of fixes in version 1.11c.

(Why the text is doubled here?)

Comments (3)

  1. Harry Stahl reporter

    The lineTo-Function takes not the width of the pen into account (drawing starts always on same position, but the half of pen-width has to be devided and substract from x and y in painting)

    See attached a screenshot, that shows the diffrence in painting on windows and linux/mac OS.

    procedure TForm7.pbPaint(Sender: TObject);
    begin
    with pb.Canvas do begin

    Pen.Width := 1;
    
    MoveTo(100,100);
    LineTo(300, 100);
    
    Pen.Width := Linewidth;
    
    MoveTo(100 + Linewidth,100);
    LineTo(300, 100);
    

    end;
    end;

    By the way, thank you for the big amount of fixes in version 1.11c.

  2. Harry Stahl reporter
    • edited description

    The lineTo-Function takes not the width of the pen into account (drawing starts always on same position, but the half of pen-width has to be devided and substract from x and y in painting)

    See attached a screenshot, that shows the diffrence in painting on windows and linux/mac OS.

    procedure TForm7.pbPaint(Sender: TObject);
    begin
    with pb.Canvas do begin

    Pen.Width := 1;
    
    MoveTo(100,100);
    LineTo(300, 100);
    
    Pen.Width := Linewidth;
    
    MoveTo(100 + Linewidth,100);
    LineTo(300, 100);
    

    end;
    end;

    By the way, thank you for the big amount of fixes in version 1.11c.

  3. Harry Stahl reporter
    • edited description

    The lineTo-Function takes not the width of the pen into account (drawing starts always on same position, but the half of pen-width has to be devided and substract from x and y in painting)

    See attached a screenshot, that shows the diffrence in painting on windows and linux/mac OS.

    procedure TForm7.pbPaint(Sender: TObject);
    begin
    with pb.Canvas do begin

    Pen.Width := 1;
    
    MoveTo(100,100);
    LineTo(300, 100);
    
    Pen.Width := 20;
    
    MoveTo(100 + 20,100);
    LineTo(300, 100);
    

    end;
    end;

    By the way, thank you for the big amount of fixes in version 1.11c.

  4. Log in to comment