[AGGPas] Difference between fpGUI and LCL (arc method of agg_2D unit) lazarus / 39-Graphics ---------------------------------------------------------------------- Roland57 · 2026-02-16 10:58 The attached example (an arc filled with gradient) doesn't produce the same output, depending on whether we link to fpGUI or to LCL units. You can use the included Makefile as follows: Code: Bash  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i make arcmake arc LCL=1 (You need to edit paths according to your installation.) ---------------------------------------------------------------------- wp · 2026-02-16 13:15 In the LCL-AggPas, the arc is painted with the "strokeOnly" parameter, while in Graeme's it has "FillAndStroke". - I think I can change this in the LCL. But on the other hand, Delphi's and Lazarus' and fcl- Image's Arc draw the outline only, there's a dedication method for the filled arc ("Chord"). Maybe the most flexible option would be to provide an optional additional DrawPathFlag parameter (FillOnly, StrokeOnly, FillAndStroke, FillWithLineColor) The other difference is that the LCL version seems to draw the arc in clockwise direction although the missing ccw parameter has the value true, i.e. counter-clockwise. The problem is that aggpas, in acc2d.arc, suddenly sets the ccw parameter to false (clockwise). Not sure if this is intentional (if yes, why didn't they default ccw to false in the first place?). Graeme seems to have decided to define this as a bug because his code exchanges the "start" and "sweep" angle parameters and thus makes the clockwise to a counter-clickwise. I personally think this way of dealing with the issue is confusing, and I tend to remove the ccw="false" argument from Agg2D.arg so that the default value of "true" will be used again. ---------------------------------------------------------------------- Roland57 · 2026-02-17 09:18 Thank you Werner for your investigation. Probably I will create an issue in fpGUI repository, to be sure that Graeme see this discussion. Meanwhile I made a more complete test program. ---------------------------------------------------------------------- Graeme · 2026-02-17 10:04 Quote from: wp on February 16, 2026, 02:15:23 pmintentional (if yes, why didn't they default ccw to false in the first place?). Graeme seems to have decided to define this as a bug because his code exchanges the "start" and "sweep" angle parameters and thus makes the clockwise to a counter-clickwise. I'll have to check the git history for clues - it's been years. I do recall that because fpGUI used GDI and X11 api's years before AggCanvas was added, I adapted some agg2d code to match the behavior of GDI and X11 to some degree. That might have been one such case. In hindsight - if that was so - there definitely are better ways to handle that. If I get a moment, I'll have a look. G ---------------------------------------------------------------------- cdbc · 2026-02-17 16:02 Hi Roland Sorry for the break in Sorry mate, my github broke over the last couple of days So, here it is, can you please fork it as you see fit =^ Have fun... Note: this package should compile with FPC 3.2.2 out of the box No external dependencies, like before  Regards Benny ---------------------------------------------------------------------- Graeme · 2026-02-19 22:36 Quote from: wp on February 16, 2026, 02:15:23 pmIn the LCL-AggPas, the arc is painted with the "strokeOnly" parameter, while in Graeme's it has "FillAndStroke". I had a quick look. Regardless if there is FillAndStroke in the Arc() method. If you call agg.noFill before calling Arc(), it will not fill the arc. Using FillAndStroke in all the shape APIs just means I don't need to add additional parameters to all the methods, and you can still control if Arc() will render with stroke-only, fill-only or both. ---------------------------------------------------------------------- Roland57 · 2026-02-19 23:16 Thank you for the investigation Graeme. Quote from: Graeme on February 19, 2026, 11:36:17 pmI had a quick look. Regardless if there is FillAndStroke in the Arc() method. If you call agg.noFill before calling Arc(), it will not fill the arc. Using FillAndStroke in all the shape APIs just means I don't need to add additional parameters to all the methods, and you can still control if Arc() will render with stroke-only, fill-only or both. I would agree on that point. On the second point I would agree with @wp. If it were my code, I would remove the default parameter value in the low level function: 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 // agg_arc.pasconstructor arc.Construct(x ,y ,rx ,ry ,a1 ,a2 : double; ccw : boolean = true ); And I would put parameters in correct order here: 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 // agg_2D.pasprocedure Agg2D.arc(cx ,cy ,rx ,ry ,start ,sweep : double );var ar : {bezier_}agg_arc.arc; begin  // ... ar.Construct(cx ,cy ,rx ,ry ,sweep, start,false ); // <--- And change the boolean value (?). While I was working on my clock example, I noticed that agg_2D and Agg2D use different convention: trigonometric for the one, antitrigonometric for the other. If it is a clear decision, why not. Anyway please find an agreement with @wp, so that we can go forward. ---------------------------------------------------------------------- Graeme · 2026-02-19 23:38 Yeah, I didn't mention in my earlier message. I do agree about the inconsistent default, the unused `ccw` parameter (it never set the field variable), and swapped angle arguments do seem wrong. It will all be fixed very shortly. :-) ---------------------------------------------------------------------- wp · 2026-02-19 23:55 Modified the arc procedure in the LCL's aggpas to use the FillAndStroke parameter as suggested by Graeme. Modified the Construct method such that the ccw argument can be true, also in TAggFPCanvas.Arc. Renamed some misleading parameters (endangle instead of sweep) and corrected some comments (counter-clockwise vs clockwise). Added an incompatibility note to the Laz 5.0 release notes about the FillAndStroke parameter (https://wiki.freepascal.org/Lazarus _5.0_release_notes#aggpas_incompatibility). ---------------------------------------------------------------------- Roland57 · 2026-02-20 08:26 @wp Tested your changes successfully. Thanks! ---------------------------------------------------------------------- Graeme · 2026-02-22 11:55 For fpGUI's FillArc() which is totally the wrong name - so we learn.  Anyway, I noticed when AggCanvas was enabled, it didn't render a "filled pie" like GDI and X11 did. I created a new agg_2D.pas implementation which now matches the other platforms. I'll start the deprecation of Canvas.FillArc() to become Pie() or something, so it more accurately reflects the implementation intent. ---------------------------------------------------------------------- Roland57 · 2026-03-14 15:36 Hello AGG friends. The problem is still not (totally) solved. ---------------------------------------------------------------------- Graeme · 2026-03-17 01:29 I've given a full explanation here, based on the example app you attached in the bug report: https://github.com/graemeg/fpGUI/issues/163#issuecomment-4071720074