1 #!/usr/bin/env python 2 3 import libxml2dom.svg 4 5 # NOTE: Need to incorporate unit conversion. 6 7 xscale, yscale = 3.75, 3.75 8 9 d = libxml2dom.svg.parse("tests/test_svg.xml") 10 svg = d.documentElement 11 path = svg.xpath(".//svg:path")[0] 12 m = svg.createSVGMatrixComponents(1, 0, 0, 1, 0, 0) 13 m.mTranslate(-20 * xscale, -30 * yscale) 14 m.mRotate(60) 15 m.mTranslate(20 * xscale, 30 * yscale) 16 path.setMatrixTrait("transform", m) 17 d.toFile(open("tmp_test.svg", "wb")) 18 19 # vim: tabstop=4 expandtab shiftwidth=4