-/* -*- Mode: C; tab-width: 4 -*-
- * ifs --- Modified iterated functions system.
- */
-#if !defined( lint ) && !defined( SABER )
-static const char sccsid[] = "@(#)ifs.c 4.02 97/04/01 xlockmore";
-#endif
-
-/* Copyright (c) 1997 by Massimino Pascal (Pascal.Massimon@ens.fr)
- *
- *
- * Permission to use, copy, modify, and distribute this software and its
- * documentation for any purpose and without fee is hereby granted,
- * provided that the above copyright notice appear in all copies and that
- * both that copyright notice and this permission notice appear in
- * supporting documentation.
- *
- * This file is provided AS IS with no warranties of any kind. The author
- * shall have no liability with respect to the infringement of copyrights,
- * trade secrets or any patents by this file or any part thereof. In no
- * event will the author be liable for any lost revenue or profits or
- * other special, indirect and consequential damages.
- *
- * Revision History:
- * 10-May-97: jwz@netscape.com: turned into a standalone program.
- * Made it render into an offscreen bitmap and then copy
- * that onto the screen, to reduce flicker.
- */
-
-#ifdef STANDALONE
-# define PROGCLASS "IFS"
-# define HACK_INIT init_ifs
-# define HACK_DRAW draw_ifs
-# define ifs_opts xlockmore_opts
-# define DEFAULTS "*delay: 20000 \n" \
- "*ncolors: 100 \n"
-# define SMOOTH_COLORS
-# include "xlockmore.h" /* from the xscreensaver distribution */
-#else /* !STANDALONE */
-# include "xlock.h" /* from the xlockmore distribution */
-#endif /* !STANDALONE */
-
-ModeSpecOpt ifs_opts = {
- 0, NULL, 0, NULL, NULL };
-
-/*****************************************************/
-/*****************************************************/
-
-typedef float DBL;
-typedef short int F_PT;
-
-/* typedef float F_PT; */
-
-/*****************************************************/
+/* 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;
+};