- XClearWindow(dpy, window);
- grab_screen_image(xgwa.screen, window);
- p = XCreatePixmap(dpy, window, *widthP, *heightP, xgwa.depth);
- gcv.function = GXcopy;
- gc = XCreateGC (dpy, window, GCFunction, &gcv);
- XCopyArea (dpy, window, p, gc, 0, 0, *widthP, *heightP, 0, 0);
+ /* Center square */
+ XSetForeground (dpy, gc, 1);
+ draw_puzzle_shape (dpy, p0, gc, x, y, size, bw,
+ top_type, right_type, bottom_type, left_type,
+ True);
+
+ /* Top right square */
+ XSetForeground (dpy, gc, 0);
+ draw_puzzle_shape (dpy, p0, gc, x + size, y - size, size, bw,
+ 0, 0, -top_type, -left_type,
+ True);
+
+ /* Center right square */
+ draw_puzzle_shape (dpy, p0, gc, x + size, y, size, bw,
+ 0, 0, 0, -right_type,
+ True);
+
+ /* Bottom center square */
+ draw_puzzle_shape (dpy, p0, gc, x, y + size, size, bw,
+ -bottom_type, 0, 0, 0,
+ True);
+
+ /* And Charles Nelson Reilly in the bottom right square */
+ draw_puzzle_shape (dpy, p0, gc, x + size, y + size, size, bw,
+ -bottom_type, -right_type, 0, 0,
+ True);
+
+ /* Done with p0 (the mask).
+ To make p1 (the outline) draw an outlined piece through the mask.
+ */
+ if (bw < 0)
+ {
+ bw = size / 30;
+ if (bw < 1) bw = 1;
+ }
+
+ if (bw > 0)
+ {
+ XSetForeground (dpy, gc, 1);
+ XSetClipMask (dpy, gc, p0);
+ XSetLineAttributes (dpy, gc, bw, LineSolid, CapButt, JoinRound);
+ draw_puzzle_shape (dpy, p1, gc, x, y, size, bw,
+ top_type, right_type, bottom_type, left_type,
+ False);
+ }