X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/puzzles/blobdiff_plain/5c9f61fd500f6fd53a9f33721a1e66b9d5e1d9cc..28b5987d5dbdcb396c07b937a638590e5361361e:/gtk.c diff --git a/gtk.c b/gtk.c index ef795a4..1a79f0e 100644 --- a/gtk.c +++ b/gtk.c @@ -348,7 +348,7 @@ void draw_line(frontend *fe, int x1, int y1, int x2, int y2, int colour) } void draw_polygon(frontend *fe, int *coords, int npoints, - int fill, int colour) + int fillcolour, int outlinecolour) { GdkPoint *points = snewn(npoints, GdkPoint); int i; @@ -358,19 +358,32 @@ void draw_polygon(frontend *fe, int *coords, int npoints, points[i].y = coords[i*2+1]; } - gdk_gc_set_foreground(fe->gc, &fe->colours[colour]); - gdk_draw_polygon(fe->pixmap, fe->gc, fill, points, npoints); + if (fillcolour >= 0) { + gdk_gc_set_foreground(fe->gc, &fe->colours[fillcolour]); + gdk_draw_polygon(fe->pixmap, fe->gc, TRUE, points, npoints); + } + assert(outlinecolour >= 0); + gdk_gc_set_foreground(fe->gc, &fe->colours[outlinecolour]); + gdk_draw_polygon(fe->pixmap, fe->gc, FALSE, points, npoints); sfree(points); } void draw_circle(frontend *fe, int cx, int cy, int radius, - int fill, int colour) + int fillcolour, int outlinecolour) { - gdk_gc_set_foreground(fe->gc, &fe->colours[colour]); - gdk_draw_arc(fe->pixmap, fe->gc, fill, - cx - radius, cy - radius, - 2 * radius, 2 * radius, 0, 360 * 64); + if (fillcolour >= 0) { + gdk_gc_set_foreground(fe->gc, &fe->colours[fillcolour]); + gdk_draw_arc(fe->pixmap, fe->gc, TRUE, + cx - radius, cy - radius, + 2 * radius, 2 * radius, 0, 360 * 64); + } + + assert(outlinecolour >= 0); + gdk_gc_set_foreground(fe->gc, &fe->colours[outlinecolour]); + gdk_draw_arc(fe->pixmap, fe->gc, FALSE, + cx - radius, cy - radius, + 2 * radius, 2 * radius, 0, 360 * 64); } struct blitter {