[cairo] push pop and stroke

Donn donn.ingle at gmail.com
Sun Dec 9 09:33:04 PST 2007


Hey,
 Okay, had a chance to go back over recent emails and do some plain tutorial 
reading and I have this little snippet to buzz the list with:
I'll interleave my questions:

        cr.push_group()
        cr.set_line_width( 20 )
        cr.save()
Aiming for a 20 'pixel' stroke around the circle.
        cr.set_source_rgb(1,1,0)
        cr.arc(100, 200, 50, 0, 2 * pi)
        cr.fill_preserve()
        cr.set_source_rgb(0,0,0)
        cr.restore()
Stroked after the restore as per tutorial suggestion.
        cr.stroke()
        pat = cr.pop_group()
        
        for x in range(0,100):
            s = (100-x)/100.0
            print s
            cr.scale( s,s ) 
It gets bigger each time
            cr.save()
            cr.translate(x*2,100)
            cr.set_source(pat) 
            cr.paint()
Draws the circles okay, but each one has a proportional stroke - how would I 
make them all draw a 20 px stroke?
            cr.restore()

\d


More information about the cairo mailing list