e3ab5bcc4bf9024a1c21c8ad5f7ef21ffc9a67cc
kate
  Wed Jan 3 15:21:09 2018 -0800
Add curve drawing (ellipse and bezier).  Code by Zingl Alois, 2016, posted to github and  http://members.chello.at/~easyfilter/bresenham.html. refs #17512

diff --git src/hg/inc/hvGfx.h src/hg/inc/hvGfx.h
index 90f502b..1d0a2ce 100644
--- src/hg/inc/hvGfx.h
+++ src/hg/inc/hvGfx.h
@@ -10,30 +10,34 @@
 
 struct hvGfx
 /* browser graphics interface */
 {
     struct hvGfx *next;	     /* Next in list. */
     struct vGfx *vg;         /* virtual graphics object */
     boolean rc;              /* reverse-complement display (negative strand) */
     boolean pixelBased;      /* Real pixels, not PostScript or something. */
     int width, height;       /* Virtual pixel dimensions. */
     int clipMinX;            /* X clipping region, before reverse */
     int clipMaxX;
     int clipMinY;
     int clipMaxY;
 };
 
+#define ELLIPSE_FULL    0
+#define ELLIPSE_TOP     1
+#define ELLIPSE_BOTTOM  2
+
 struct hvGfx *hvGfxOpenPng(int width, int height, char *fileName, boolean useTransparency);
 /* Open up something that we'll write out as a PNG someday.
  * If useTransparency, then the first color in memgfx's colormap/palette is
  * assumed to be the image background color, and pixels of that color
  * are made transparent. */
 
 struct hvGfx *hvGfxOpenPostScript(int width, int height, char *fileName);
 /* Open up something that will someday be a PostScript file. */
 
 void hvGfxClose(struct hvGfx **pHvg);
 /* Close down virtual graphics object, and finish writing it to file. */
 
 INLINE int hvGfxAdjX(struct hvGfx *hvg, int x)
 /* Return an X position, updating if reverse-complement mode */
 {
@@ -295,16 +299,46 @@
 /* Draw a ruler inside the indicated part of mg with numbers that start at
  * startNum and span range.  Bump text positions slightly. */
 
 void hvGfxDrawRuler(struct hvGfx *hvg, int xOff, int yOff, int height, int width,
         Color color, MgFont *font,
         int startNum, int range);
 /* Draw a ruler inside the indicated part of mg with numbers that start at
  * startNum and span range.  */
 
 void hvGfxNextItemButton(struct hvGfx *hvg, int x, int y, int w, int h, 
 		      Color color, Color hvgColor, boolean nextItem);
 /* Draw a button that looks like a fast-forward or rewind button on */
 /* a remote control. If nextItem is TRUE, it points right, otherwise */
 /* left. color is the outline color, and hvgColor is the fill color. */
 
+void hvGfxEllipseDraw(struct hvGfx *hvg, int x0, int y0, int x1, int y1, Color color,  int mode);
+/* Draw an ellipse or half (top or bottom) using Bresenham algorithm.
+ * Point 1 is left, point 2 is top
+ * Adapted trivially from code posted at http://members.chello.at/~easyfilter/bresenham.html
+ */
+
+void hvGfxEllipse(struct hvGfx *hvg, int x0, int y0, int x1, int y1, Color color);
+/* Draw an ellipse using Bresenham algorithm.
+ * Point 1 is left, point 2 is top
+ * Adapted trivially from code posted at http://members.chello.at/~easyfilter/bresenham.html
+ */
+
+void hvGfxEllipseAA(struct hvGfx *hvg, int x0, int y0, int x1, int y1, Color color);
+/* Draw an anti-aliased ellipse specified by rectangle, using Bresenham algorithm.
+ * Point 0 is left, point 1 is top of rectangle
+ * Adapted trivially from code posted at http://members.chello.at/~easyfilter/bresenham.html
+ */
+
+void hvGfxCurveAA(struct hvGfx *hvg, int x0, int y0, int x1, int y1, int x2, int y2, Color color);
+/* Draw a an anti-aliased curve within 3 points (quadratic Bezier)
+ * Adapted trivially from code posted at http://members.chello.at/~easyfilter/bresenham.html */
+ /* Thanks to author  * @author Zingl Alois
+ * @date 22.08.2016 */
+
+void hvGfxCurve(struct hvGfx *hvg, int x0, int y0, int x1, int y1, int x2, int y2, Color color);
+/* Draw curve within 3 points (quadratic Bezier)
+ * Adapted trivially from code posted on github and at http://members.chello.at/~easyfilter/bresenham.html */
+ /* Thanks to author  * @author Zingl Alois
+ * @date 22.08.2016 */
+
 #endif