summaryrefslogtreecommitdiffstats
path: root/chalk/colorspaces/wetsticky/ws/main.c
blob: 8185557aa4f8ca5c65c92346a0feab6e42a75b42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
	FILE:		main.c
	PURPOSE:	The top-level program for Wet&Sticky
	AUTHOR:		Kevin Waite and David England
	VERSION:	1.00  (10-May-91)

Copyright 1991, 1992, 2002, 2003 Tunde Cockshott, Kevin Waite, David England. 

Contact David England d.england@livjm.ac.uk
School of Computing and Maths Sciences,
Liverpool John Moores University 
Liverpool L3 3AF
United Kingdom
Phone +44 151 231 2271


Wet and Sticky is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Wet and Sticky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Wet and Sticky; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 

*/

#include "constants.h"
#include "types.h"
#include "canvas.h"
#include "win_interface.h"
#include <stdio.h>
#include <string.h>
#include <math.h>

double HEIGHT_SCALE;

void main(argc, argv) 
int argc;
char *argv[];

/*
   The Wet&Sticky program can be executed with optional parameters.
   Those parameters used by the X graphics system are stripped out.
   If no parameters are given then the program runs as a purely
   interactive system.  This requires input handling which is not
   yet implemented.  If the argument is the string '-blob' then the
   program uses a square blob as the starting image.  Otherwise the
   program assumes the argument is a filename containing a previously
   stored canvas.  This is then loaded into the canvas as a starting
   point.
*/

{
   char *filename;
   extern void exit();
   int width;
   int height;
   extern int optind, opterr;
   extern char *optarg;
   int c,i;
   int blob_flag;


   fprintf(stdout, "Wet&Sticky Version %s\n", VERSION);
   fprintf(stdout, "Implemented by K.Waite and D.England, 1991\n");
   fprintf(stdout, "Based on ideas by Tunde Cockshott\n\n");


   initialise_canvas();
   if (DEBUG) fprintf (stdout, "Finished initialising the canvas\n");

   CreateWindows (&argc, argv, CANVAS_WIDTH , CANVAS_HEIGHT);

   filename = argv[1];

   blob_flag = 1;
   HEIGHT_SCALE = 20.0;

  opterr = 0;
    fprintf(stderr, "HEIGHT %g\n", HEIGHT_SCALE);

  while ((c = getopt(argc, argv, "f:s:")) != EOF)
                    switch (c) {
                case 'f':
                        filename = optarg;
			load_file(filename, &width, &height);
			blob_flag = 0;
                        break;
                case 's':
                        fprintf(stderr, "HEIGHT string %s \n",optarg);
                        HEIGHT_SCALE = atof(optarg);
                        break;
		case '?':
                        break;
                }

   if (blob_flag)
	blob (DEFAULT_BLOB_SIZE);

    fprintf(stderr, "HEIGHT %g\n", HEIGHT_SCALE);

   StartVolumeWindow (CANVAS_WIDTH, CANVAS_HEIGHT);
   StartDrynessWindow (CANVAS_WIDTH, CANVAS_HEIGHT);

   if (DEBUG) fprintf (stdout, "Finished preparing X\n");

   if (DEBUG) fprintf (stdout, "Passing control to window manager\n");
   StartWindows();
   exit(0);

}