View Issue Details

IDProjectCategoryView StatusLast Update
0037520LazarusLCLpublic2020-08-09 15:24
Reporterwp Assigned ToDmitry Boyarintsev  
Status resolvedResolutionfixed 
Summary0037520: Cocoa: Pen properties are ignored when Canvas.Clipping is active
DescriptionBased on forum discussion,50890 about line series in TAChart sometimes ignoriung their color in macOS/cocoa I found the issue that cocoa seem to ignore Pen properties such as Color, Width, PenStyle when clipping of the canvas is active.
Steps To ReproduceRun attached demo project. It paints a horizontal red dashed thick line onto a Paintbox canvas. Clipping can be activated by checking the "Clipping" checkbox. When this checkbox is OFF the line runs with its set attributes across the Paintbox, as expected. But when the checkbox is ON the clipped line becomes black, thin and solid. This does not happen on Windows.

This is the relevant painting code used in the demo project:

procedure TForm1.PaintBox1Paint(Sender: TObject);
  with Paintbox1 do
    Canvas.Brush.Color := clWhite;
    Canvas.FillRect(0, 0, Width, Height);

    if Checkbox1.Checked then begin
      Canvas.ClipRect := Rect(50, 50, Width-50, Height-50);
      Canvas.Clipping := true;

    Canvas.Pen.Color := clRed;
    Canvas.Pen.Width := 3;
    Canvas.Pen.Style := psDash;
    Canvas.Line(0, 100, Width, 100);

    if Checkbox1.Checked then
      Canvas.Clipping := false;
TagsNo tags attached.
Fixed in Revision63702
Attached Files



2020-08-08 11:06

developer (2,034 bytes)

Dmitry Boyarintsev

2020-08-09 06:04

developer   ~0124682

please test and close if ok


2020-08-09 15:24

developer   ~0124694

Thanks Dmitry. This seems to fix the issue, and I could remove the related workarounds from TAChart. Just wainting for feedback from the posters in the forum. Afterwards, I'll close the report.

Issue History

Date Modified Username Field Change
2020-08-08 11:06 wp New Issue
2020-08-08 11:06 wp File Added:
2020-08-09 06:04 Dmitry Boyarintsev Assigned To => Dmitry Boyarintsev
2020-08-09 06:04 Dmitry Boyarintsev Status new => resolved
2020-08-09 06:04 Dmitry Boyarintsev Resolution open => fixed
2020-08-09 06:04 Dmitry Boyarintsev Fixed in Revision => 63702
2020-08-09 06:04 Dmitry Boyarintsev LazTarget => -
2020-08-09 06:04 Dmitry Boyarintsev Widgetset Cocoa => Cocoa
2020-08-09 06:04 Dmitry Boyarintsev Note Added: 0124682
2020-08-09 15:24 wp Note Added: 0124694