From c6a03c79cfda4cb543334e951e58da3eb04f4a0a Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Thu, 16 May 2013 21:24:19 +0000 Subject: Solve the draw of shapes with alpha with big line width - SL #3789 Signed-off-by: Gonzalo Odiard --- (limited to 'Desenho.py') diff --git a/Desenho.py b/Desenho.py index 0420f51..392f042 100644 --- a/Desenho.py +++ b/Desenho.py @@ -343,16 +343,20 @@ class Desenho: else: ctx.set_line_cap(cairo.LINE_CAP_SQUARE) ctx.set_line_join(cairo.LINE_JOIN_MITER) + ctx.set_line_width(widget.tool['line size']) if fill: + ctx.save() ctx.set_source_rgba(*widget.tool['cairo_fill_color']) - ctx.set_line_width(0) ctx.fill_preserve() + ctx.set_operator(cairo.OPERATOR_SOURCE) + ctx.set_source_rgba(1.0, 1.0, 1.0, 1) + ctx.stroke_preserve() + ctx.restore() if widget.tool['name'] == 'eraser': ctx.set_source_rgba(1.0, 1.0, 1.0, 1.0) else: ctx.set_source_rgba(*widget.tool['cairo_stroke_color']) - ctx.set_line_width(widget.tool['line size']) ctx.stroke() ctx.restore() if fill or closed: @@ -525,8 +529,14 @@ class Desenho: ctx.set_line_width(line_width / w) if fill: + ctx.save() ctx.set_source_rgba(*widget.tool['cairo_fill_color']) ctx.fill_preserve() + ctx.set_operator(cairo.OPERATOR_SOURCE) + ctx.set_source_rgba(1.0, 1.0, 1.0, 1) + ctx.stroke_preserve() + ctx.restore() + ctx.set_source_rgba(*widget.tool['cairo_stroke_color']) ctx.stroke() ctx.restore() @@ -560,8 +570,14 @@ class Desenho: ctx.arc(0., 0., 1., 0., 2 * math.pi) ctx.set_line_width(line_width / float(min(dx, dy))) if fill: + ctx.save() ctx.set_source_rgba(*widget.tool['cairo_fill_color']) ctx.fill_preserve() + ctx.set_operator(cairo.OPERATOR_SOURCE) + ctx.set_source_rgba(1.0, 1.0, 1.0, 1) + ctx.stroke_preserve() + ctx.restore() + ctx.set_source_rgba(*widget.tool['cairo_stroke_color']) ctx.stroke() ctx.restore() -- cgit v0.9.1