+/* Copyright © Chris Le Sueur and Robby Griffin, 2005-2006
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Ultimate thanks go to Massimino Pascal, who created the original
+xscreensaver hack, and inspired me with it's swirly goodness. This
+version adds things like variable quality, number of functions and also
+a groovier colouring mode.
+
+This version by Chris Le Sueur <thefishface@gmail.com>, Feb 2005
+Many improvements by Robby Griffin <rmg@terc.edu>, Mar 2006
+Multi-coloured mode added by Jack Grahl <j.grahl@ucl.ac.uk>, Jan 2007
+*/
+
+#include <assert.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include "screenhack.h"
+
+#undef countof
+#define countof(x) (sizeof((x)) / sizeof(*(x)))
+
+typedef struct {
+ float r, s, tx, ty; /* Rotation, Scale, Translation X & Y */
+ float ro, rt, rc; /* Old Rotation, Rotation Target, Rotation Counter */
+ float so, st, sc; /* Old Scale, Scale Target, Scale Counter */
+ float sa, txa, tya; /* Scale change, Translation change */
+
+ int ua, ub, utx; /* Precomputed combined r,s,t values */
+ int uc, ud, uty; /* Precomputed combined r,s,t values */
+
+} Lens;
+
+struct state {
+ Display *dpy;
+ Window window;
+ GC gc;
+ Drawable backbuffer;
+ XColor *colours;
+ int ncolours;
+ int ccolour;
+ int blackColor, whiteColor;
+
+ int width, widthb, height;
+ int width8, height8;
+ unsigned int *board;
+ XPoint pointbuf[1000];
+ int npoints;
+ int xmin, xmax, ymin, ymax;
+ int x, y;
+
+ int delay;
+
+ int lensnum;
+ Lens *lenses;
+ int length;
+ int mode;
+ Bool recurse;
+ Bool multi;
+ Bool translate, scale, rotate;
+};