X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fdecayscreen.c;h=fa6561c1dae1a2e160ab87edc466193a9b972e27;hp=64a846c0f33a46876086c947b9bd177e41c0d3cb;hb=96a411663168b0ba5432b407a83be55f3df0c802;hpb=a719ec12b8b2563112366a8ac3196816fd64d2c7 diff --git a/hacks/decayscreen.c b/hacks/decayscreen.c index 64a846c0..fa6561c1 100644 --- a/hacks/decayscreen.c +++ b/hacks/decayscreen.c @@ -57,6 +57,7 @@ static int iterations=100; #define OUT 10 #define MELT 11 #define STRETCH 12 +#define FUZZ 13 static void init_decay (Display *dpy, Window window) @@ -80,10 +81,11 @@ init_decay (Display *dpy, Window window) else if (s && !strcmp(s, "out")) mode = OUT; else if (s && !strcmp(s, "melt")) mode = MELT; else if (s && !strcmp(s, "stretch")) mode = STRETCH; + else if (s && !strcmp(s, "fuzz")) mode = FUZZ; else { if (s && *s && !!strcmp(s, "random")) fprintf(stderr, "%s: unknown mode %s\n", progname, s); - mode = random() % (STRETCH+1); + mode = random() % (FUZZ+1); } delay = get_integer_resource ("delay", "Integer"); @@ -108,7 +110,7 @@ init_decay (Display *dpy, Window window) sizex = xgwa.width; sizey = xgwa.height; - grab_screen_image (xgwa.screen, window); + load_random_image (xgwa.screen, window, window, NULL); if (mode == MELT || mode == STRETCH) { /* make sure screen eventually turns background color */ @@ -159,6 +161,7 @@ decay1 (Display *dpy, Window window) case OUT: bias = no_bias; break; case MELT: bias = no_bias; break; case STRETCH: bias = no_bias; break; + case FUZZ: bias = no_bias; break; default: abort(); } @@ -172,6 +175,52 @@ decay1 (Display *dpy, Window window) toleft = left; totop = top+1; + } else if (mode == FUZZ) { /* By Vince Levey ; + inspired by the "melt" mode of the + "scrhack" IrisGL program by Paul Haeberli + circa 1991. */ + static int toggle = 0; + + left = nrnd(sizex - 1); + top = nrnd(sizey - 1); + toggle = !toggle; + if (toggle) + { + totop = top; + height = 1; + toleft = nrnd(sizex - 1); + if (toleft > left) + { + width = toleft-left; + toleft = left; + left++; + } + else + { + width = left-toleft; + left = toleft; + toleft++; + } + } + else + { + toleft = left; + width = 1; + totop = nrnd(sizey - 1); + if (totop > top) + { + height = totop-top; + totop = top; + top++; + } + else + { + height = top-totop; + top = totop; + totop++; + } + } + } else { left = nrnd(sizex - 1);