Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Area.py16
-rw-r--r--Desenho.py15
2 files changed, 30 insertions, 1 deletions
diff --git a/Area.py b/Area.py
index 2e979a8..18984eb 100644
--- a/Area.py
+++ b/Area.py
@@ -286,9 +286,14 @@ class Area(gtk.DrawingArea):
Show the shape of the tool selected for pencil, brush,
rainbow and eraser
"""
- if self.tool['name'] in ['pencil', 'eraser', 'brush', 'rainbow']:
+ if self.tool['name'] in ['pencil', 'eraser', 'brush', 'rainbow', 'stamp']:
if not self.drawing:
size = self.tool['line size']
+
+ # TODO draw stamp border in widget.window
+ # if self.tool['name'] == 'stamp':
+ # pass
+
if self.tool['line shape'] == 'circle':
widget.window.draw_arc(self.gc_brush, False,
self.x_cursor - size / 2, self.y_cursor - size / 2,
@@ -355,6 +360,11 @@ class Area(gtk.DrawingArea):
self.tool['line shape'])
self.last = coords
self.drawing = True
+ elif self.tool['name'] == 'stamp':
+ self.last = []
+ self.d.stamp(widget, coords, self.last, self.tool['line size'])
+ self.last = coords
+ self.drawing = True
elif self.tool['name'] == 'rainbow':
self.last = []
self.d.rainbow(widget, coords, self.last,
@@ -425,6 +435,10 @@ class Area(gtk.DrawingArea):
self.tool['line size'], self.tool['line shape'])
self.last = coords
+ elif self.tool['name'] == 'stamp':
+ self.d.stamp(widget, coords, self.last, self.tool['line size'])
+ self.last = coords
+
elif self.tool['name'] == 'rainbow':
self.d.rainbow(widget, coords, self.last,
self.rainbow_counter, self.tool['line size'],
diff --git a/Desenho.py b/Desenho.py
index 4f8f196..cb0a11e 100644
--- a/Desenho.py
+++ b/Desenho.py
@@ -128,6 +128,21 @@ class Desenho:
widget.desenha = False
self._trace(widget, widget.gc_brush, coords, last, size, shape)
+ def stamp(self, widget, coords, last, size=5):
+ """Paint with stamp.
+
+ @param self -- Desenho.Desenho instance
+ @param last -- last of oldx
+ @param widget -- Area object (GtkDrawingArea)
+ @param coords -- Two value tuple
+ @param size -- integer (default 30)
+
+ """
+ widget.desenha = False
+ # TODO, this is a fake, not stamping at the moment:
+ size = 40
+ self._trace(widget, widget.gc_brush, coords, last, size, 'square')
+
def rainbow(self, widget, coords, last, color, size=5, shape='circle'):
"""Paint with rainbow.