Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt/tacanvas.py
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt/tacanvas.py')
-rw-r--r--TurtleArt/tacanvas.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/TurtleArt/tacanvas.py b/TurtleArt/tacanvas.py
index ac20092..8b294a9 100644
--- a/TurtleArt/tacanvas.py
+++ b/TurtleArt/tacanvas.py
@@ -700,16 +700,12 @@ class TurtleGraphics:
h = self.tw.turtle_canvas.get_height()
if x < 0 or x > (w - 1) or y < 0 or y > (h - 1):
return(-1, -1, -1, -1)
- # Map the cairo surface onto a pixmap
- pixmap = gtk.gdk.Pixmap(None, w, h, 24)
- cr = pixmap.cairo_create()
- cr.set_source_surface(self.tw.turtle_canvas, 0, 0)
- cr.paint()
+ # Map the cairo surface onto a pixbuf
+ pixbuf = Gdk.pixbuf_get_from_surface(self.tw.turtle_canvas,
+ x, y, 1, 1)
# Read the pixel
- pixel = pixmap.get_image(x, y, 1, 1).get_pixel(0, 0)
- return(int((pixel & 0xFF0000) >> 16),
- int((pixel & 0x00FF00) >> 8),
- int((pixel & 0x0000FF) >> 0), 0)
+ pixels = pixbuf.get_pixels()
+ return (ord(pixels[0]), ord(pixels[1]), ord(pixels[2]), 0)
else:
return(-1, -1, -1, -1)