From 60239ed7cd42d294f71d824d6c4d39acebd16a8e Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Sat, 05 Nov 2011 19:55:39 +0000 Subject: centered rotation on image --- (limited to 'TurtleArt') diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py index 72814a9..8474c87 100644 --- a/TurtleArt/tacanvas.py +++ b/TurtleArt/tacanvas.py @@ -532,9 +532,10 @@ class TurtleGraphics: # the set_source_pixbuf attribute. cr = gtk.gdk.CairoContext(self.canvas) cr.save() - cr.translate(x, y) # center the rotation on x, y + # center the rotation on the center of the image + cr.translate(x + w / 2., y + h / 2.) cr.rotate(self.heading * DEGTOR) - cr.translate(-x, -y) # reset the position + cr.translate(-x - w / 2., -y - h / 2.) cr.set_source_pixbuf(pixbuf, x, y) cr.rectangle(x, y, w, h) cr.fill() -- cgit v0.9.1