[chronojump] UtilGtk.DrawHorizontalLine() with optional empty arrows



commit 8c5da9ab248f72a5c8b28ea450e46863fabe4794
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Feb 16 00:09:06 2020 +0100

    UtilGtk.DrawHorizontalLine() with optional empty arrows

 src/utilGtk.cs | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
---
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 5d406496..eb3b99d7 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -802,6 +802,35 @@ public class UtilGtk
                return pixbuf;
        }
 
+       //spacing allows the line to breath
+       public static void DrawHorizontalLine(Pixmap pixmap, Gdk.GC pen, int xleft, int xright, int y,
+                       int spacing, bool arrowleft, bool arrowright, int arrowlength)
+       {
+               pixmap.DrawLine(pen, xleft + spacing, y, xright - spacing, y);
+
+               //empty arrows
+               if(arrowleft)
+               {
+                       pixmap.DrawLine(pen,
+                                       xleft + spacing, y,
+                                       xleft + spacing + arrowlength, y - arrowlength);
+                       pixmap.DrawLine(pen,
+                                       xleft + spacing, y,
+                                       xleft + spacing + arrowlength, y + arrowlength);
+               }
+               if(arrowright)
+               {
+                       pixmap.DrawLine(pen,
+                                       xright - spacing, y,
+                                       xright - spacing - arrowlength, y - arrowlength);
+                       pixmap.DrawLine(pen,
+                                       xright - spacing, y,
+                                       xright - spacing - arrowlength, y + arrowlength);
+               }
+       }
+
+
+
        // adapted from: https://stackoverflow.com/a/9295210/12366369
        // thanks to renosis and Komplot
        public static void DrawArrow (Pixmap pixmap, Gdk.GC pen, int tipX, int tailX, int tipY, int tailY, 
int arrowLength)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]