- left = nrnd(sizex - 1);
- top = nrnd(sizey);
- width = nrnd(sizex - left);
- height = nrnd(sizey - top);
-
- toleft = left;
- totop = top;
-
- if (mode == IN || mode == OUT) {
- int x = left+(width/2);
- int y = top+(height/2);
- int cx = sizex/2;
- int cy = sizey/2;
- if (mode == IN) {
- if (x > cx && y > cy) bias = upleft_bias;
- else if (x < cx && y > cy) bias = upright_bias;
- else if (x < cx && y < cy) bias = downright_bias;
- else /* (x > cx && y < cy)*/ bias = downleft_bias;
- } else {
- if (x > cx && y > cy) bias = downright_bias;
- else if (x < cx && y > cy) bias = downleft_bias;
- else if (x < cx && y < cy) bias = upleft_bias;
- else /* (x > cx && y < cy)*/ bias = upright_bias;
+ if (mode == MELT || mode == STRETCH) {
+ left = nrnd(sizex/2);
+ top = nrnd(sizey);
+ width = nrnd( sizex/2 ) + sizex/2 - left;
+ height = nrnd(sizey - top);
+ toleft = left;
+ totop = top+1;
+
+ } else if (mode == FUZZ) { /* By Vince Levey <vincel@vincel.org>;
+ 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);
+ top = nrnd(sizey);
+ width = nrnd(sizex - left);
+ height = nrnd(sizey - top);
+
+ toleft = left;
+ totop = top;
+ if (mode == IN || mode == OUT) {
+ int x = left+(width/2);
+ int y = top+(height/2);
+ int cx = sizex/2;
+ int cy = sizey/2;
+ if (mode == IN) {
+ if (x > cx && y > cy) bias = upleft_bias;
+ else if (x < cx && y > cy) bias = upright_bias;
+ else if (x < cx && y < cy) bias = downright_bias;
+ else /* (x > cx && y < cy)*/ bias = downleft_bias;
+ } else {
+ if (x > cx && y > cy) bias = downright_bias;
+ else if (x < cx && y > cy) bias = downleft_bias;
+ else if (x < cx && y < cy) bias = upleft_bias;
+ else /* (x > cx && y < cy)*/ bias = upright_bias;
+ }