- Debug("Parse node <%s>", root.name());
- pugi::xml_attribute attrib_w = root.attribute("width");
- pugi::xml_attribute attrib_h = root.attribute("height");
- if (!attrib_w.empty())
- width = attrib_w.as_float() * bounds.w;
- if (!attrib_h.empty())
- height = attrib_h.as_float() * bounds.h;
+ //Debug("Parsing transform %s", s.c_str());
+ string token;
+ string command;
+ unsigned i = 0;
+
+ while (i < s.size())
+ {
+ GetToken(s, command, i);
+ if (command == "," || command == "" || command == ":")
+ {
+ if (i < s.size())
+ GetToken(s, command, i);
+ else
+ return;
+ }
+ //Debug("Token is \"%s\"", command.c_str());
+
+ SVGMatrix delta = {1,0,0,0,1,0};
+
+
+ assert(GetToken(s,token, i) == "(");
+ if (command == "translate")
+ {
+ GetXYPair(s, delta.e, delta.f, i);
+ assert(GetToken(s,token, i) == ")");
+ }
+ else if (command == "matrix")
+ {
+ GetXYPair(s, delta.a, delta.b,i);
+ GetXYPair(s, delta.c, delta.d,i);
+ GetXYPair(s, delta.e, delta.f,i);
+ assert(GetToken(s,token, i) == ")");
+ }
+ else if (command == "scale")
+ {
+ delta.a = (strtod(GetToken(s,token,i).c_str(), NULL));
+ GetToken(s, token, i);
+ if (token == ",")
+ {
+ delta.d = (strtod(GetToken(s,token,i).c_str(), NULL));
+ assert(GetToken(s, token, i) == ")");
+ }
+ else
+ {
+ delta.d = delta.a;
+ assert(token == ")");
+ }