if(kType == 1){ //svg
kg_string_append(kResultText, "<?xml version=\"1.0\"?>\n");
kg_string_append(kResultText, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" \"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">\n");
- kg_string_append(kResultText, "<svg viewBox=\"0 0 1024 1024\">");
+ kg_string_append(kResultText, "<svg width=\"1024\" height=\"1024\" viewBox=\"0 0 1024 1024\">");
+ kg_string_append(kResultText, "<g style=\"fill: black; stroke: black\">");
}
else if(kType == 2){ //eps
kg_string_append(kResultText, "%!PS-Adobe-3.0 EPSF-3.0\n");
test2 = CalcSizes(test2, 1);
kMode = 1;
drawGlyph(test2, 0);
- kg_string_append(kResultText, "</svg>\n");
+ kg_string_append(kResultText, "</g></svg>\n");
if(type != 1) fprintf(stdout, "Content-type: image/svg-xml\n\n");
fprintf(stdout, "%s", kResultText->str);
}
#include "kagecgi.h"\r
\r
void icPolygon(kPoint *poly, int number){\r
- int i;\r
- char buf[256];\r
- \r
- if(kMode == 0){ //normal\r
- fillPolygon(poly, number, 0, kageCanvas);\r
- }\r
- else if(kMode == 1){ //output for svg\r
- sprintf(buf, "<path d=\"M ");\r
- kg_string_append(kResultText, buf);\r
- for(i = 0; i < number; i++){\r
- sprintf(buf, "%.0f,%.0f ", poly[i].X * 5, poly[i].Y * 5);\r
- kg_string_append(kResultText, buf);\r
- }\r
- sprintf(buf, "Z\"/>");\r
- kg_string_append(kResultText, buf);\r
- }\r
- else if(kMode == 2){ //output for eps\r
- sprintf(buf, "%.0f %.0f moveto\n", poly[0].X * 5, 1000 - (poly[0].Y * 5) - 200);\r
- kg_string_append(kResultText, buf);\r
- for(i = 1; i < number; i++){\r
- sprintf(buf, " %.0f %.0f lineto\n", poly[i].X * 5, 1000 - (poly[i].Y * 5) - 200);\r
- kg_string_append(kResultText, buf);\r
- }\r
- sprintf(buf, " %.0f %.0f lineto\n", poly[0].X * 5, 1000 - (poly[0].Y * 5) - 200);\r
- kg_string_append(kResultText, buf);\r
- kg_string_append(kResultText, "closepath\n");\r
- }\r
-\r
+ int i;\r
+ char buf[256];\r
+ \r
+ if(kMode == 0){ //normal\r
+ fillPolygon(poly, number, 0, kageCanvas);\r
+ }\r
+ else if(kMode == 1){ //output for svg\r
+ sprintf(buf, "<path d=\"M ");\r
+ kg_string_append(kResultText, buf);\r
+ for(i = 0; i < number; i++){\r
+ if(i == 1){\r
+ sprintf(buf, "L ");\r
+ kg_string_append(kResultText, buf);\r
+ }\r
+ sprintf(buf, "%.0f,%.0f ", poly[i].X * 5, poly[i].Y * 5);\r
+ kg_string_append(kResultText, buf);\r
+ }\r
+ sprintf(buf, "Z\"/>");\r
+ kg_string_append(kResultText, buf);\r
+ }\r
+ else if(kMode == 2){ //output for eps\r
+ sprintf(buf, "%.0f %.0f moveto\n", poly[0].X * 5, 1000 - (poly[0].Y * 5) - 200);\r
+ kg_string_append(kResultText, buf);\r
+ for(i = 1; i < number; i++){\r
+ sprintf(buf, " %.0f %.0f lineto\n", poly[i].X * 5, 1000 - (poly[i].Y * 5) - 200);\r
+ kg_string_append(kResultText, buf);\r
+ }\r
+ sprintf(buf, " %.0f %.0f lineto\n", poly[0].X * 5, 1000 - (poly[0].Y * 5) - 200);\r
+ kg_string_append(kResultText, buf);\r
+ kg_string_append(kResultText, "closepath\n");\r
+ }\r
}\r