From 16c5b2406cac683eb7009ae84f0c6a4db36cf7c7 Mon Sep 17 00:00:00 2001 From: Gonzalo Odiard Date: Thu, 28 Jun 2012 14:39:08 +0000 Subject: First stage of port of Paint to cairo Brushes and shapes are working. NOTES: * The pixmaps used as canvas has been replaced by ImageSurface and cairo context. * All the gc with tool properties were removed. * The variables needed by the freeform and rainbow were moved from Area to Desenha * The freeform code was simplified. * The heart is draw using cairo curves and is a little different than before. * I am using cairo_stroke_color and cairo_fill_color values in the tool dict to enable compatibility while the port is done, later will be unified. I am setting this color with a fixed alpha of 0.3 to display artifacts if we want enable alpha in the future. It's only for test at this stage. * The code used to display the polygons (triangle, trapezoid, arrow, paralellogram, star, polygon_regular) was simplified calling a method _draw_polygon witha array of points. PENDING: * All the clipboard operations. * All the efects. * Text * Bucket * Stamps --- (limited to 'toolbox.py') diff --git a/toolbox.py b/toolbox.py index 8d58306..b5d1e1c 100644 --- a/toolbox.py +++ b/toolbox.py @@ -336,6 +336,12 @@ class ToolsToolbarBuilder(): self._activity.area.set_stroke_color(new_color) self.properties['stroke color'] = new_color + if isinstance(new_color, unicode): + new_color = gtk.gdk.Color(new_color) + self.properties['cairo_stroke_color'] = (new_color.red_float, + new_color.green_float, + new_color.blue_float, 0.3) + def _on_signal_undo_cb(self, widget, data=None): self._verify_sensitive_buttons() @@ -378,6 +384,12 @@ class ButtonFillColor(ColorToolButton): self._activity.area.set_fill_color(new_color) self.properties['fill color'] = new_color + if isinstance(new_color, unicode): + new_color = gtk.gdk.Color(new_color) + self.properties['cairo_fill_color'] = (new_color.red_float, + new_color.green_float, + new_color.blue_float, 0.3) + def create_palette(self): self._palette = self.get_child().create_palette() color_palette_hbox = self._palette._picker_hbox -- cgit v0.9.1