diff options
author | Manuel QuiƱones <manuel.por.aca@gmail.com> | 2011-04-18 14:18:04 (GMT) |
---|---|---|
committer | Manuel QuiƱones <manuel.por.aca@gmail.com> | 2011-04-18 14:18:04 (GMT) |
commit | 22919d56574b22a71bf02e96f35068829c5964e0 (patch) | |
tree | 0b04bb5386de35027c2a6df4a873bd1e7853831c | |
parent | 4961e69146dfef880167905c928ec661ae0a4aea (diff) |
Stamp tracing code, still not stamping
-rw-r--r-- | Area.py | 16 | ||||
-rw-r--r-- | Desenho.py | 15 |
2 files changed, 30 insertions, 1 deletions
@@ -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'], @@ -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. |