- for (y = 0; y < height; y += dy)
- {
- if ((y / dy) & 1)
- {
- slide_old_x = x;
- slide_new_x = x + dx;
- clear_x = x;
- }
- else
- {
- slide_old_x = dx;
- slide_new_x = 0;
- clear_x = width - x - dx;
- }
-
- XCopyArea (dpy, window, window, gc, slide_old_x, y, width - x - dx,
- dy, slide_new_x, y);
- XClearArea (dpy, window, clear_x, y, dx, dy, False);
- }
-
- XSync(dpy, False);
- usleep(delay * 3);
+ double ratio = (st->ratio - mode1) / (mode2 - mode1);
+ int max = st->height / 2;
+
+ /* fill middle */
+ XFillRectangle (st->dpy, st->window, st->fg_gc,
+ st->width/2 - radius,
+ max * ratio,
+ radius*2, st->height * (1 - ratio));
+
+ /* fill left and right */
+ XFillRectangle (st->dpy, st->window, st->bg_gc,
+ 0, 0, st->width/2 - radius, st->height);
+ XFillRectangle (st->dpy, st->window, st->bg_gc,
+ st->width/2 + radius, 0, st->width/2, st->height);
+
+ /* fill top and bottom */
+ XFillRectangle (st->dpy, st->window, st->bg_gc,
+ 0, 0, st->width, max * ratio);
+ XFillRectangle (st->dpy, st->window, st->bg_gc,
+ 0, st->height - (max * ratio),
+ st->width, max);
+
+ /* cap top */
+ XFillArc (st->dpy, st->window, st->fg_gc,
+ st->width/2 - radius,
+ max * ratio - radius,
+ radius*2, radius*2,
+ 0, 180*64);
+
+ /* cap bottom */
+ XFillArc (st->dpy, st->window, st->fg_gc,
+ st->width/2 - radius,
+ st->height - (max * ratio + radius),
+ radius*2, radius*2,
+ 180*64, 180*64);
+ }
+ else if (st->ratio < mode3) /* starburst */
+ {
+ double ratio = (st->ratio - mode2) / (mode3 - mode2);
+ double r2 = ratio * radius * 4;
+ XArc arc[9];
+ int i;
+ int angle = 360*64/countof(arc);
+
+ for (i = 0; i < countof(arc); i++)
+ {
+ double th;
+ arc[i].angle1 = angle * i;
+ arc[i].angle2 = angle;
+ arc[i].width = radius*2 * (1 + ratio);
+ arc[i].height = radius*2 * (1 + ratio);
+ arc[i].x = st->width / 2 - radius;
+ arc[i].y = st->height / 2 - radius;
+
+ th = ((arc[i].angle1 + (arc[i].angle2 / 2)) / 64.0 / 180 * M_PI);
+
+ arc[i].x += r2 * cos (th);
+ arc[i].y -= r2 * sin (th);
+ }
+
+ XFillRectangle (st->dpy, st->window, st->bg_gc,
+ 0, 0, st->width, st->height);
+ XFillArcs (st->dpy, st->window, st->fg_gc, arc, countof(arc));