Esempio n. 1
0
    def effect(self):
        # Prepare the document for exporting
        SynfigPrep.effect(self)

        svg = self.document.getroot()
        width = get_dimension(svg.get("width", 1024))
        height = get_dimension(svg.get("height", 768))

        title = svg.xpath("svg:title", namespaces=NSS)
        if len(title) == 1:
            name = title[0].text
        else:
            name = svg.get(addNS("docname", "sodipodi"), "Synfig Animation 1")

        d = SynfigDocument(width, height, name)

        layers = []
        for node in svg.iterchildren():
            layers += self.convert_node(node, d)

        root_canvas = d.get_root_canvas()
        for layer in layers:
            root_canvas.append(layer)

        d.get_root_tree().write(sys.stdout)
Esempio n. 2
0
def extract_width(style, width_attrib, mtx):
    if width_attrib in style.keys():
        width = get_dimension(style[width_attrib])
    else:
        width = 1

    area_scale_factor = mtx[0][0] * mtx[1][1] - mtx[0][1] * mtx[1][0]
    linear_scale_factor = math.sqrt(abs(area_scale_factor))

    return width * linear_scale_factor / sif.kux
Esempio n. 3
0
def extract_width(style, width_attrib, mtx):
    if width_attrib in style.keys():
        width = get_dimension(style[width_attrib])
    else:
        width = 1

    area_scale_factor = mtx[0][0] * mtx[1][1] - mtx[0][1] * mtx[1][0]
    linear_scale_factor = math.sqrt(abs(area_scale_factor))

    return width * linear_scale_factor / sif.kux
Esempio n. 4
0
    def effect(self):
        # Prepare the document for exporting
        SynfigPrep.effect(self)
        svg = self.document.getroot()
        width = get_dimension(svg.get("width", 1024))
        height = get_dimension(svg.get("height", 768))

        title = svg.getElement('svg:title')
        if title:
            name = title.text
        else:
            name = svg.get('sodipodi:docname', "Synfig Animation 1")

        doc = SynfigDocument(width, height, name)

        layers = []
        for node in svg.iterchildren():
            layers += self.convert_node(node, doc)

        root_canvas = doc.get_root_canvas()
        for layer in layers:
            root_canvas.append(layer)

        self.synfig_document = doc.get_root_tree()