public SVGParser(SVGPath path) { m_SVGPath = path; m_SVGPathTokenizer = new SVGPathTokenizer(); m_TitleFlag = false; m_PathFlag = false; }
public void parse_path(SVGPathTokenizer tok) { while (tok.next()) { double[] arg = new double[10]; int cmd = tok.last_command(); int i; switch (cmd) { case 'M': case 'm': arg[0] = tok.last_number(); arg[1] = tok.next(cmd); MoveTo(arg[0], arg[1], cmd == 'm'); break; case 'L': case 'l': arg[0] = tok.last_number(); arg[1] = tok.next(cmd); LineTo(arg[0], arg[1], cmd == 'l'); break; case 'V': case 'v': vline_to(tok.last_number(), cmd == 'v'); break; case 'H': case 'h': hline_to(tok.last_number(), cmd == 'h'); break; case 'Q': case 'q': arg[0] = tok.last_number(); for (i = 1; i < 4; i++) { arg[i] = tok.next(cmd); } Curve3(arg[0], arg[1], arg[2], arg[3], cmd == 'q'); break; case 'T': case 't': arg[0] = tok.last_number(); arg[1] = tok.next(cmd); Curve3(arg[0], arg[1], cmd == 't'); break; case 'C': case 'c': arg[0] = tok.last_number(); for (i = 1; i < 6; i++) { arg[i] = tok.next(cmd); } Curve4(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], cmd == 'c'); break; case 'S': case 's': arg[0] = tok.last_number(); for (i = 1; i < 4; i++) { arg[i] = tok.next(cmd); } Curve4(arg[0], arg[1], arg[2], arg[3], cmd == 's'); break; case 'A': case 'a': throw new SVGException("parse_path: Command A: NOT IMPLEMENTED YET"); case 'Z': case 'z': CloseSubPath(); break; default: { throw new SVGException("parse_path: Invalid Command %c", cmd); } } } }