+ //Debug("Path data attribute is \"%s\"", d.c_str());
+ bool closed = false;
+ pair<unsigned, unsigned> range = ParseSVGPathData(d, transform, closed);
+ if (closed)
+ {
+ Colour c(0,0,0,0);
+ string colour_str("");
+ map<string, string> style;
+ if (child.attribute("style"))
+ {
+ ParseSVGStyleData(child.attribute("style").as_string(), style);
+ }
+
+ // Determine shading colour
+ if (child.attribute("fill"))
+ {
+ colour_str = child.attribute("fill").as_string();
+ }
+ else if (style.find("fill") != style.end())
+ {
+ colour_str = style["fill"];
+ }
+ if (colour_str == "red")
+ c = {1,0,0,1};
+ else if (colour_str == "blue")
+ c = {0,0,1,1};
+ else if (colour_str == "green")
+ c = {0,1,0,1};
+ else if (colour_str == "black")
+ c = {0,0,0,1};
+ else if (colour_str == "white")
+ c = {1,1,1,1};
+ else if (colour_str.size() == 7 && colour_str[0] == '#')
+ {
+ Debug("Parse colour string: \"%s\"", colour_str.c_str());
+ char comp[2] = {colour_str[1], colour_str[2]};
+ c.r = Real(strtoul(comp, NULL, 16))/Real(255);
+ comp[0] = colour_str[3]; comp[1] = colour_str[4];
+ c.g = Real(strtoul(comp, NULL, 16))/Real(255);
+ comp[0] = colour_str[5]; comp[1] = colour_str[6];
+ c.b = Real(strtoul(comp, NULL, 16))/Real(255);
+ c.a = 1;
+ Debug("Colour is: %f, %f, %f, %f", Float(c.r), Float(c.g), Float(c.b), Float(c.a));
+ }
+
+ // Determin shading alpha
+ if (child.attribute("fill-opacity"))
+ {
+ c.a = child.attribute("fill-opacity").as_float();
+ }
+ else if (style.find("fill-opacity") != style.end())
+ {
+ c.a = strtod(style["fill-opacity"].c_str(), NULL);
+ }
+
+ Debug("fill-opacity is %f", Float(c.a));
+ AddPath(range.first, range.second, c);
+ }