+/*
+ * Creates and returns a drawing mask for the scope:
+ * mask out anything outside of the disc.
+ */
+static Pixmap
+scope_mask (Display *dpy, Window win, sonar_info *si)
+{
+ XGCValues gcv;
+ Pixmap mask = XCreatePixmap(dpy, win, si->width, si->height, 1);
+ GC gc = XCreateGC (dpy, mask, 0, &gcv);
+ XSetFunction (dpy, gc, GXclear);
+ XFillRectangle (dpy, mask, gc, 0, 0, si->width, si->height);
+ XSetFunction (dpy, gc, GXset);
+ XFillArc(dpy, mask, gc, si->minx, si->miny,
+ si->maxx - si->minx, si->maxy - si->miny,
+ 0, 360 * 64);
+ return mask;
+}
+
+