a715f8ee926e405d684ba6891aef9ef7c6b28475 braney Fri Feb 1 16:41:47 2019 -0800 circle primitive and a basic version of lollipops diff --git src/inc/vGfx.h src/inc/vGfx.h index d0cbb14..269fc8f 100644 --- src/inc/vGfx.h +++ src/inc/vGfx.h @@ -68,30 +68,33 @@ int xOff, int yOff, int width, int height, Color *dots, boolean zeroClear); /* Put a series of one 'pixel' width vertical lines. */ void (*fillUnder)(void *v, int x1, int y1, int x2, int y2, int bottom, Color color); /* Draw a 4 sided filled figure that has line x1/y1 to x2/y2 at * it's top, a horizontal line at bottom at it's bottom, and * vertical lines from the bottom to y1 on the left and bottom to * y2 on the right. */ void (*drawPoly)(void *v, struct gfxPoly *poly, Color color, boolean filled); /* Draw polygon, possibly filled in color. */ + void (*circle)(void *v, int xCen, int yCen, int rad, Color color, boolean filled); + /* Draw a circle. */ + void (*ellipse)(void *v, int x1, int y1, int x2, int y2, Color color, int mode, boolean isDashed); /* Draw an ellipse or half-ellipse (top or bottom), * specified by left-most and top-most points on a rectangle. * Optionally draw with dashed line. */ int (*curve)(void *v, int x1, int y1, int x2, int y2, int x3, int y3, Color color, boolean isDashed); /* Draw a segment of an anti-aliased curve within 3 points (quadratic Bezier) * Return max y value. Optionally draw curve as dashed line. */ void (*setHint)(void *v, char *hint, char *value); /* Set hint */ char *(*getHint)(void *v, char *hint); @@ -104,30 +107,33 @@ /* How wide is a string? */ }; struct vGfx *vgOpenPng(int width, int height, char *fileName, boolean useTransparency); /* Open up something that will write out a PNG file upon vgClose. * 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 vGfx *vgOpenPostScript(int width, int height, char *fileName); /* Open up something that will someday be a PostScript file. */ void vgClose(struct vGfx **pVg); /* Close down virtual graphics object, and finish writing it to file. */ +#define vgCircle(v,x,y, rad, color, filled) v->circle(v->data,x,y,rad,color,filled) +/* Draw a circle. */ + #define vgDot(v,x,y, color) v->dot(v->data,x,y,color) /* Draw a single pixel. Try to work at a higher level * when possible! */ #define vgGetDot(v,x,y) v->getDot(v->data,x,y) /* Fetch a single pixel. Please do not use this, this is special for * verticalText only */ #define vgBox(v,x,y,width,height,color) v->box(v->data,x,y,width,height,color) /* Draw a box. */ #define vgLine(v,x1,y1,x2,y2,color) v->line(v->data,x1,y1,x2,y2,color) /* Draw a line from one point to another. */ #define vgText(v,x,y,color,font,string) v->text(v->data,x,y,color,font,string)