Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Area.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@gmail.com>2012-07-24 18:21:43 (GMT)
committer Gonzalo Odiard <godiard@gmail.com>2012-08-10 13:49:30 (GMT)
commit1a0de2965f7a9c3b147b6b08054f648cd4bc3614 (patch)
treebbd5084777c7c45e38d96dbbe3165210a80fdbe3 /Area.py
parentca94b8e6eaf957b439486e4ab93725586e530e57 (diff)
Implement stamp tool with cairo
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'Area.py')
-rw-r--r--Area.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Area.py b/Area.py
index 9c2acbb..7eabb33 100644
--- a/Area.py
+++ b/Area.py
@@ -732,11 +732,12 @@ class Area(gtk.DrawingArea):
"""
if self.is_selected():
# Change stamp, get it from selection:
- _x, _y, width, height = self.get_selection_bounds()
- self.pixbuf_stamp = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False,
- 8, width, height)
- self.pixbuf_stamp.get_from_drawable(self.pixmap_sel,
- gtk.gdk.colormap_get_system(), 0, 0, 0, 0, width, height)
+ pixbuf_data = StringIO.StringIO()
+ self.get_selection().write_to_png(pixbuf_data)
+ pxb_loader = gtk.gdk.PixbufLoader(image_type='png')
+ pxb_loader.write(pixbuf_data.getvalue())
+
+ self.pixbuf_stamp = pxb_loader.get_pixbuf()
self.stamp_size = 0
# Set white color as transparent:
stamp_alpha = self.pixbuf_stamp.add_alpha(True, 255, 255, 255)