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 * input_bmp = NULL;
13 const char * output_bmp = NULL;
14 const char * input_filename = NULL;
19 if (argv[i][0] != '-')
21 input_filename = argv[i];
29 Fatal("No input argument following -o switch");
32 Fatal("No output argument following -o switch");
38 Debug("Reading paint colour");
39 for (int j = 1; j <= 4; ++j)
42 Fatal("No %d colour component following -c switch", j);
44 float * comp = (j == 1) ? (&c.r) : ((j == 2) ? (&c.g) : ((j == 3) ? (&c.b) : &(c.a)));
45 *comp = strtof(argv[i+j], &e);
47 Fatal("Colour component %d not a valid float", j);
55 if (input_filename != NULL)
57 doc.Load(input_filename);
61 doc.Add(RECT_FILLED, Rect(0.2,0.2,0.6,0.6));
65 MainLoop(doc, bounds, c);
66 else if (mode == OUTPUT_TO_BMP)
67 OverlayBMP(doc, input_bmp, output_bmp, bounds, c);