X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fdecayscreen.c;h=d4b95f1c1b1d300625bcf9fb1a1d99f9a2f73ca2;hb=2d04c4f22466851aedb6ed0f2919d148f726b889;hp=64a846c0f33a46876086c947b9bd177e41c0d3cb;hpb=a719ec12b8b2563112366a8ac3196816fd64d2c7;p=xscreensaver diff --git a/hacks/decayscreen.c b/hacks/decayscreen.c index 64a846c0..d4b95f1c 100644 --- a/hacks/decayscreen.c +++ b/hacks/decayscreen.c @@ -1,4 +1,4 @@ -/* xscreensaver, Copyright (c) 1992, 1993, 1994, 1996, 1997 +/* xscreensaver, Copyright (c) 1992, 1993, 1994, 1996, 1997, 2005 * Jamie Zawinski * * Permission to use, copy, modify, distribute, and sell this software and its @@ -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, 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);