[cairo] more svg to cairo stuff

Donn donn.ingle at gmail.com
Wed Nov 7 13:00:29 PST 2007


Okay, I have some initial code:

        #Taken from an SVG file out of inkscape and parsed:
        p=[['M', [279.75045999999998, 346.05358999999999]], ['C', 
[378.48871000000003, 389.05277999999998, 100.56077999999999, -53.799329, 
99.994930999999994, 94.069632999999996]], ['C', [99.429079999999999, 
241.93859, 181.01221000000001, 303.05439000000001, 279.75045999999998, 
346.05358999999999]], ['Z', []]]
        
        while len(p) > 0:
            step = p.pop(0  )
            if step[0] == "M": ctx.move_to(step[1][0],step[1][1])
            if step[0] == "C":
                xlist = step[1]              		
	ctx.curve_to(xlist[0],xlist[1],xlist[2],xlist[3],xlist[4],xlist[5])
                step = p.pop(0)
                ylist = step[1]
	ctx.curve_to(ylist[0],ylist[1],ylist[2],ylist[3],ylist[4],ylist[5])
                
            if step[0] == "Z": ctx.close_path()
                
            ctx.set_source_rgb(1,0,0)
            ctx.stroke()

The path does not close properly. It's smooth in inkscape, but in this test 
it's kind of dangling and open. Any clues?

\d


More information about the cairo mailing list