2 #include <unistd.h> // Because we can.
4 int main(int argc, char ** argv)
6 #ifndef __STDC_IEC_559__
7 Warn("__STDC_IEC_559__ not defined. IEEE 754 floating point not fully supported.\n");
11 Debug("Compiled with REAL = %d => \"%s\" sizeof(Real) == %d bytes", REAL, g_real_name[REAL], sizeof(Real));
16 enum {OUTPUT_TO_BMP, LOOP} mode = LOOP;
20 const char * input_bmp = NULL;
21 const char * output_bmp = NULL;
22 const char * input_filename = NULL;
23 float b[4] = {0,0,1,1};
28 if (argv[i][0] != '-')
30 input_filename = argv[i];
38 Fatal("No input argument following -o switch");
41 Fatal("No output argument following -o switch");
47 Debug("Reading paint colour");
48 for (int j = 1; j <= 4; ++j)
51 Fatal("No %d colour component following -c switch", j);
53 float * comp = (j == 1) ? (&c.r) : ((j == 2) ? (&c.g) : ((j == 3) ? (&c.b) : &(c.a)));
54 *comp = strtof(argv[i+j], &e);
56 Fatal("Colour component %d not a valid float", j);
63 Debug("Reading view bounds");
64 for (int j = 1; j <= 4; ++j)
67 Fatal("No %d bounds component following -b switch", j);
69 b[j-1] = strtof(argv[i+j], &e);
71 Fatal("Bounds component %d not a valid float", j);
79 if (input_filename != NULL)
81 doc.LoadSVG(input_filename, Rect(0,0,Real(1)/Real(800),Real(1)/Real(600)));
85 /* doc.AddBezierData(Bezier(0,0,0,1,1,0));
86 doc.AddBezierData(Bezier(0,0,1,0,0,1));
87 doc.AddBezierData(Bezier(0,0,1,1,1,0));
88 doc.AddBezierData(Bezier(0,1,1,0,0,1));*/
92 doc.AddText("abcde", 0.5, Real(0), Real(1));
94 for(int x = 0; x < 8; ++x)
97 for (int y = 0; y < 8; ++y)
99 //doc.Add(static_cast<IPDF::ObjectType>((x^y)%3), Rect(0.2+x-4.0,0.2+y-4.0,0.6,0.6));
100 //doc.Add(BEZIER, Rect(0.2+x-4.0, 0.2+y-4.0, 0.6,0.6), (x^y)%3);
103 /* doc.Add(BEZIER, Rect(0.1,0.1,0.8,0.8), 0);
104 doc.Add(BEZIER, Rect(0.1,0.1,0.8,0.8), 1);
105 doc.Add(BEZIER, Rect(0.1,0.1,0.8,0.8), 2);
106 doc.Add(BEZIER, Rect(0.1,0.1,0.8,0.8), 3);*/
107 //doc.Add(CIRCLE_FILLED, Rect(0.1,0.1,0.8,0.8), 0);
110 Rect bounds(b[0],b[1],b[2],b[3]);
113 MainLoop(doc, bounds, c);
114 else if (mode == OUTPUT_TO_BMP)
115 OverlayBMP(doc, input_bmp, output_bmp, bounds, c);