From 00884f28e2610e266dc653a34b45da1af2613e31 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 29 Nov 2022 12:28:31 +0100 Subject: Fix for issue [Cairo]: Arrows have a "gap" (#561) The problem to fix is that the arrow drawn by draw_arrow1() in src/fl_symbols.cxx displays a faint clear line between the stem and head of the arrow with the Cairo graphics driver. This occurs because draw_arrow1() draws the arrow in 2 steps (a rectangle + a triangle) and the Cairo driver is configured to use antialiasing when filling polygons. The antialiasing produces the faint line between stem and head. Why does draw_arrow1() draw a rectangle + a triangle rather than a 7-vertex polygon? That's because the X11 graphics driver fails with its polygon- drawing function when the polygon is also rotated: the polygon is drawn empty. We want to keep using antialiasing under Cairo for polygons because the result is better with non horizontal/vertical polygon edges. This implementation changes function draw_arrow1() which draws the arrow as a 7-vertex filled polygon except when the graphics driver returns false for its virtual member function can_fill_non_convex_polygon(). In that situation, draw_arrow1() draws, as before, a rectangle + a triangle. The new, virtual member function can_fill_non_convex_polygon() returns true except for the X11 graphics driver. Therefore, draw_arrow1() is effectively unchanged under the X11 driver. --- FL/Fl_Graphics_Driver.H | 2 ++ 1 file changed, 2 insertions(+) (limited to 'FL/Fl_Graphics_Driver.H') diff --git a/FL/Fl_Graphics_Driver.H b/FL/Fl_Graphics_Driver.H index 0f25756d6..e131a2961 100644 --- a/FL/Fl_Graphics_Driver.H +++ b/FL/Fl_Graphics_Driver.H @@ -316,6 +316,8 @@ public: virtual void fixloop(); virtual void end_polygon(); virtual void end_complex_polygon(); + // default implementation is most probably enough + virtual bool can_fill_non_convex_polygon() { return true; } virtual void gap(); virtual void circle(double x, double y, double r); virtual void arc(double x, double y, double r, double start, double end); -- cgit v1.2.3