[cairo] Re: problem rotating svg

Steve Chaplin stevech1097 at yahoo.com.au
Sat Apr 2 04:27:53 PST 2005


> On Fri, 2005-04-01 at 06:47 -0800, cairo-request at cairographics.org
> wrote:
> > Hi,
> > 
> > I've tried rotating some SVG images and found that parts of the image
> > aren't behaving correctly.  I'm not sure how to describe it except by
> > saying run the code and take a look.  The file home.svg comes from
> > cairo-demo/cairo_snippets/data.
> > 
> > Is it a bug or am I bone?
> > 
> > #!/usr/bin/env python
> > 
> > import gtk
> > import cairo
> > import cairo.gtk
> > import cairo.svg
> > 
> > angle = 0.0
> > 
> > ctx = cairo.svg.Context()
> > ctx.parse('./home.svg')
> > sx,sy = ctx.size
> > 
> > def expose_event(widget, event):
> >         cr = cairo.Context()
> >         cairo.gtk.set_target_drawable(cr, widget.window)
> >         cr.translate(400,400)
> >         cr.rotate(angle)
> >         cr.translate(-sx/2.0,-sy/2.0)
> >         ctx.render(cr)
> > 
> > def periodic():
> >         global angle
> >         angle = angle + 0.03
> >         da.queue_draw()
> >         return True
> > 
> > win = gtk.Window()
> > da = gtk.DrawingArea()
> > da.set_size_request(800,800)
> > win.add(da)
> > win.show_all()
> > win.connect('destroy', lambda x:gtk.main_quit())
> > da.connect('expose_event', expose_event)
> > gtk.timeout_add(100, periodic)
> > gtk.main()

I ran the script and can see the problem. I don't think its a problem
with pycairo since pycairo just consists of dumb wrapper functions
around the C API. I think the bug is in svg_cairo_render() and it looks
like its triggered by drawing rotated linear gradients.

You could log it as a bug at https://bugs.freedesktop.org/

Steve





More information about the cairo mailing list