-
- delay = get_integer_resource("delay", "Delay");
- length = get_integer_resource("length", "Detail");
- mode = get_integer_resource("mode", "Mode");
-
- norotate = get_boolean_resource("norotate", "NoRotate");
- noscale = get_boolean_resource("noscale", "NoScale");
- notranslate = get_boolean_resource("notranslate", "NoTranslate");
-
- lensnum = get_integer_resource("lensnum", "Functions");
-
- lenses = malloc(sizeof(Lens)*lensnum);
-
- for(i=0;i<lensnum;i++) {
- lenses[i]=malloc(sizeof(Lens));
- }
-
- /*Thanks go to Dad for teaching me how to allocate memory for struct**s . */
-
- XGetWindowAttributes (dpy, w, &xgwa);
- width=xgwa.width;
- height=xgwa.height;
-
- /*Initialise all this X shizzle*/
- blackColor = BlackPixel(dpy, DefaultScreen(dpy));
- whiteColor = WhitePixel(dpy, DefaultScreen(dpy));
- rw = RootWindow(dpy, screen_num);
- screen_num = DefaultScreen(dpy);
- gc = XCreateGC(dpy, rw, 0, NULL);
-
- /* Do me some colourmap magic. If we're using blend mode, this is just *
- * for the nice colours - we're still using true/hicolour. Screw me if *
- * I'm going to work out how to blend with colourmaps - I'm too young to *
- * die!! On a sidenote, this is mostly stolen from halftone because I *
- * don't really know what the hell I'm doing, here. */
- ncolours = get_integer_resource("colors", "Colors");
- if(ncolours < lensnum) ncolours=lensnum; /*apparently you're allowed to do this kind of thing...*/
- colours = (XColor *)calloc(ncolours, sizeof(XColor));
- make_smooth_colormap ( dpy,
- xgwa.visual,
- xgwa.colormap,
- colours,
- &ncolours,
- True, 0, False);
- /*No, I didn't have a clue what that really did... hopefully I have some colours in an array, now.*/
- wcol = (int)myrandom(ncolours);
-
- /*Double buffering - I can't be bothered working out the XDBE thingy*/
- backbuffer = XCreatePixmap(dpy, w, width, height, XDefaultDepth(dpy, screen_num));
-
- /*Scaling factor*/
- wt=width/32;
- ht=height/24;
-
- ws=400;
- hs=400;
-
- /*Colourmapped colours for the general prettiness*/
- for(i=0;i<lensnum;i++) {
- CreateLens( myrandom(1)-0.5,
- myrandom(1),
- myrandom(4)-2,
- myrandom(4)+2,
- myrandom(ncolours),
- lenses[i]);
+
+ /* Initialise all this X shizzle */
+ st->dpy = d_arg;
+ st->window = w_arg;
+
+ st->blackColor = BlackPixel(st->dpy, DefaultScreen(st->dpy));
+ st->whiteColor = WhitePixel(st->dpy, DefaultScreen(st->dpy));
+ st->gc = XCreateGC(st->dpy, st->window, 0, NULL);
+
+ XGetWindowAttributes (st->dpy, st->window, &xgwa);
+ ifs_reshape(st->dpy, st->window, st, xgwa.width, xgwa.height);
+
+ st->ncolours = get_integer_resource(st->dpy, "colors", "Colors");
+ if (st->ncolours < st->lensnum)
+ st->ncolours = st->lensnum;
+ if (st->colours) free(st->colours);
+ st->colours = (XColor *)calloc(st->ncolours, sizeof(XColor));
+ if (!st->colours) exit(1);
+ make_smooth_colormap (st->dpy, xgwa.visual, xgwa.colormap,
+ st->colours, &st->ncolours,
+ True, 0, False);
+
+ /* Initialize IFS data */
+
+ st->delay = get_integer_resource(st->dpy, "delay", "Delay");
+ st->length = get_integer_resource(st->dpy, "length", "Detail");
+ if (st->length < 0) st->length = 0;
+ st->mode = get_integer_resource(st->dpy, "mode", "Mode");
+
+ st->rotate = get_boolean_resource(st->dpy, "rotate", "Boolean");
+ st->scale = get_boolean_resource(st->dpy, "scale", "Boolean");
+ st->translate = get_boolean_resource(st->dpy, "translate", "Boolean");
+ st->recurse = get_boolean_resource(st->dpy, "recurse", "Boolean");
+
+ st->lensnum = get_integer_resource(st->dpy, "lensnum", "Functions");
+ if (st->lenses) free (st->lenses);
+ st->lenses = (Lens *)calloc(st->lensnum, sizeof(Lens));
+ if (!st->lenses) exit(1);
+ for (i = 0; i < st->lensnum; i++) {
+ CreateLens(st,
+ myrandom(1)-0.5,
+ myrandom(1),
+ myrandom(4)-2,
+ myrandom(4)+2,
+ &st->lenses[i]);