Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Area.py
diff options
context:
space:
mode:
Diffstat (limited to 'Area.py')
-rw-r--r--Area.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/Area.py b/Area.py
index 8d2ea96..a668837 100644
--- a/Area.py
+++ b/Area.py
@@ -292,14 +292,11 @@ class Area(gtk.DrawingArea):
if not self.drawing:
# draw stamp border in widget.window
if self.tool['name'] == 'stamp':
- size = self.tool['stamp size']
- w = self.pixbuf_stamp.get_width()
- h = self.pixbuf_stamp.get_height()
- wr, hr = size, int(size * h * 1.0 / w)
+ wr, hr = self.stamp_dimentions
widget.window.draw_rectangle(self.gc_brush, False,
self.x_cursor - wr / 2, self.y_cursor - hr / 2,
wr, hr)
-
+
# draw shape of the brush, square or circle
elif self.tool['line shape'] == 'circle':
size = self.tool['line size']
@@ -431,7 +428,7 @@ class Area(gtk.DrawingArea):
if state & gtk.gdk.BUTTON1_MASK and self.pixmap != None:
if self.tool['name'] == 'pencil':
self.d.brush(widget, coords, self.last,
- self.tool['line size'], 'circle')
+ self.tool['line size'], self.tool['line shape'])
self.last = coords
elif self.tool['name'] == 'eraser':
@@ -677,8 +674,7 @@ class Area(gtk.DrawingArea):
self.stamp_size = 0
self.pixbuf_stamp = self.pixbuf_stamp.add_alpha(True, 255, 255, 255)
- self.resizeStamp(self.tool['stamp size'])
- return self.pixbuf_stamp
+ return self.resizeStamp(self.tool['stamp size'])
def resizeStamp(self, stamp_size):
"""Change stamping pixbuffer from the given size.
@@ -691,13 +687,17 @@ class Area(gtk.DrawingArea):
logging.error('Area.resizeStamp(self) needs Area.setupStamp called first.')
return
- # Resize stamp to fit brush size as the width:
- if self.stamp_size != stamp_size:
- self.stamp_size = stamp_size
- w = self.pixbuf_stamp.get_width()
- h = self.pixbuf_stamp.get_height()
+ self.stamp_size = stamp_size
+ w = self.pixbuf_stamp.get_width()
+ h = self.pixbuf_stamp.get_height()
+ if w >= h:
wr, hr = stamp_size, int(stamp_size * h * 1.0 / w)
- self.resized_stamp = self.pixbuf_stamp.scale_simple(wr, hr, gtk.gdk.INTERP_HYPER)
+ else:
+ wr, hr = int(stamp_size * w * 1.0 / h), stamp_size
+ self.stamp_dimentions = wr, hr
+ self.resized_stamp = self.pixbuf_stamp.scale_simple(wr, hr, gtk.gdk.INTERP_HYPER)
+
+ return self.resized_stamp
def undo(self):
"""Undo the last drawing change.