2 #include <unistd.h> // Because we can.
3 int main(int argc, char ** argv)
8 enum {OUTPUT_TO_BMP, LOOP} mode = LOOP;
12 const char * output_to_bmp = NULL;
13 const char * input_filename = NULL;
18 if (argv[i][0] != '-')
20 input_filename = argv[i];
28 Fatal("No argument following -o switch");
29 output_to_bmp = argv[i];
33 Debug("Reading paint colour");
34 for (int j = 1; j <= 4; ++j)
37 Fatal("No %d colour component following -c switch", j);
39 float * comp = (j == 1) ? (&c.r) : ((j == 2) ? (&c.g) : ((j == 3) ? (&c.b) : &(c.a)));
40 *comp = strtof(argv[i+j], &e);
42 Fatal("Colour component %d not a valid float", j);
50 if (input_filename != NULL)
52 doc.Load(input_filename);
56 doc.Add(RECT_FILLED, Rect(0.2,0.2,0.6,0.6));
60 MainLoop(doc, bounds, c);
61 else if (mode == OUTPUT_TO_BMP)
62 OverlayBMP(doc, output_to_bmp, bounds, c);