Beispiel #1
0
    def toArray(self, width=-1, height=-1, scale=1.):
        '''
        render to image buffer in RGBA format
        '''
        if CairoSVG is None:
            raise ImportError('cairo extension not available')

        svgfh = StringIO()
        self.write(svgfh)
        svgfh.seek(0)

        writer = CairoSVG(svgfh)
        return writer.toRGBA(width, height, scale)
Beispiel #2
0
 def toArray(self, width = -1, height = -1, scale = 1.):
     '''
     render to image buffer in RGBA format
     '''
     if CairoSVG is None:
         raise ImportError('cairo extension not available')
         
     svgfh = StringIO()
     self.write(svgfh)
     svgfh.seek(0)
     
     writer = CairoSVG(svgfh)
     return writer.toRGBA(width, height, scale)