[cairo] surface SVG to current context

Donn donn.ingle at gmail.com
Thu Dec 13 23:18:18 PST 2007


In Python, using cairo 1.4.0

 I am testing this notion of:
Surface -> Pattern -> Source -> Mask -> Surface
with the final surface being GTk.DrawingArea and the input Surface being an 
SVG file.

       #Open the file: no errs.
        svgS = cairo.SVGSurface("thingum.repo/cube.svg",400,400)

        #Make a pattern out of the surf: no errors
        svgP = cairo.SurfacePattern(svgS)
        
        #Try to paint it.
        cr.set_source(svgP)
        cr.paint() # nothing happens

        # Try to paint directly from surf
        cr.set_source_surface(svgS)
        cr.paint() # also nothing

        #Another stab:
        cr.rectangle(0,0,width,height)
        cr.set_source(svgP)
        cr.fill() # no go


I wanted an SVG input surface to go through to the screen. I'm not sure where 
librsvg comes in *if* this should work, but so far it's not.

Any ideas?
\d


More information about the cairo mailing list