2
# -*- coding: utf-8 -*-
6
__authors__ = ["Jan Jokela <janjokela@gmail.com>"]
7
__licenses__ = ["LICENSE.LGPL"]
8
__description__ = "A CairoTexture from a SVG"
13
from clutter.cluttercairo import CairoTexture
15
class SVGTexture(CairoTexture):
16
""" Creates a CairoTexture based on a given SVG """
18
def __init__(self, uri, width, height):
20
CairoTexture.__init__(self, width, height)
26
#self.svg_context = cairo.svg.Context()
27
self.context = self.cairo_create()
31
self.svg = rsvg.Handle(self.uri)
33
self.matrix = cairo.Matrix((self.width * 1.0 / self.svg.props.width),0,0,(self.height * 1.0 / self.svg.props.height),0,0)
34
#print self.svg.props.width, self.svg.props.height, self.svg.props.em, self.svg.props.ex
35
self.context.transform(self.matrix)
36
self.svg.render_cairo(self.context)
38
self.context.close_path()
44
def resize(self, width, height):