2 #include <unistd.h> // Because we can.
3 int main(int argc, char ** argv)
5 #ifndef __STDC_IEC_559__
6 Warn("__STDC_IEC_559__ not defined. IEEE 754 floating point not fully supported.\n");
10 Debug("Compiled with REAL = %d => \"%s\" sizeof(Real) == %d bytes", REAL, g_real_name[REAL], sizeof(Real));
15 enum {OUTPUT_TO_BMP, LOOP} mode = LOOP;
19 const char * input_bmp = NULL;
20 const char * output_bmp = NULL;
21 const char * input_filename = NULL;
22 float b[4] = {0,0,1,1};
27 if (argv[i][0] != '-')
29 input_filename = argv[i];
37 Fatal("No input argument following -o switch");
40 Fatal("No output argument following -o switch");
46 Debug("Reading paint colour");
47 for (int j = 1; j <= 4; ++j)
50 Fatal("No %d colour component following -c switch", j);
52 float * comp = (j == 1) ? (&c.r) : ((j == 2) ? (&c.g) : ((j == 3) ? (&c.b) : &(c.a)));
53 *comp = strtof(argv[i+j], &e);
55 Fatal("Colour component %d not a valid float", j);
62 Debug("Reading view bounds");
63 for (int j = 1; j <= 4; ++j)
66 Fatal("No %d bounds component following -b switch", j);
68 b[j-1] = strtof(argv[i+j], &e);
70 Fatal("Bounds component %d not a valid float", j);
78 if (input_filename != NULL)
80 doc.Load(input_filename);
84 doc.AddBezierData(Bezier(0,0,0,1,1,0));
85 doc.AddBezierData(Bezier(0,0,1,0,0,1));
86 doc.AddBezierData(Bezier(0,0,1,1,1,0));
87 doc.AddBezierData(Bezier(0,1,1,0,0,1));
91 for(int x = 0; x < 8; ++x)
94 for (int y = 0; y < 8; ++y)
96 //doc.Add(static_cast<IPDF::ObjectType>((x^y)%3), Rect(0.2+x-4.0,0.2+y-4.0,0.6,0.6));
97 //doc.Add(BEZIER, Rect(0.2+x-4.0, 0.2+y-4.0, 0.6,0.6), (x^y)%3);
100 //doc.Add(RECT_OUTLINE, Rect(0.1,0.1,0.8,0.8), 0);
101 doc.Add(BEZIER, Rect(0,0,1,1), 0);
105 Rect bounds(b[0],b[1],b[2],b[3]);
108 MainLoop(doc, bounds, c);
109 else if (mode == OUTPUT_TO_BMP)
110 OverlayBMP(doc, input_bmp, output_bmp, bounds, c);