[Sugar-devel] [PATCH Paint activity v2] Implemented Mirroring Effect in Paint Activity (SL#2463)

Ayush Goyal ayush at seeta.in
Wed Oct 20 10:30:16 EDT 2010


Two mirror effects 'Mirror Horizontal' and 'Mirror Vertical' have been added.
Mirror horizontal tool flips the entire image or selected area horizontally.
Mirror vertical tool does the same vertically.

Signed-off-by: Ayush Goyal <ayush at seeta.in>
---
 Area.py                     |   47 ++++++++
 icons/mirror-horizontal.svg |  272 +++++++++++++++++++++++++++++++++++++++++++
 icons/mirror-vertical.svg   |  272 +++++++++++++++++++++++++++++++++++++++++++
 toolbox.py                  |   18 +++
 4 files changed, 609 insertions(+), 0 deletions(-)
 create mode 100644 icons/mirror-horizontal.svg
 create mode 100644 icons/mirror-vertical.svg
 v1->v2:Standardized to pep8 and optimized the code

diff --git a/Area.py b/Area.py
index 35d38b3..ba022f5 100644
--- a/Area.py
+++ b/Area.py
@@ -966,6 +966,53 @@ class Area(gtk.DrawingArea):
         if not self.selmove:
             self.enableUndo(widget)
 
+    def mirror(self, widget, horizontal=True):
+        """Apply mirror horizontal/vertical effect.
+
+            @param  self -- the Area object (GtkDrawingArea)
+            @param  widget -- the Area object (GtkDrawingArea)
+            @param  horizontal -- If true sets flip as horizontal else vertical
+
+        """
+
+        width, height = self.window.get_size()
+
+        if self.selmove:
+            size = self.pixmap_sel.get_size()
+            pix = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8,
+                size[0], size[1])
+            pix.get_from_drawable(self.pixmap_sel,
+                gtk.gdk.colormap_get_system(), 0, 0, 0, 0, size[0], size[1])
+        else:
+            pix = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8,
+                width, height)
+            pix.get_from_drawable(self.pixmap, gtk.gdk.colormap_get_system(),
+                0, 0, 0, 0, width, height)
+
+            pix = pix.flip(horizontal)
+
+        if self.selmove:
+            self.pixmap_sel.draw_pixbuf(self.gc, pix, 0, 0, 0, 0,
+                size[0], size[1], dither=gtk.gdk.RGB_DITHER_NORMAL,
+                x_dither=0, y_dither=0)
+
+            self.pixmap_temp.draw_drawable(self.gc, self.pixmap, 0, 0, 0, 0,
+                width, height)
+            self.pixmap_temp.draw_drawable(self.gc, self.pixmap_sel,
+                0, 0, self.orig_x, self.orig_y, size[0], size[1])
+            self.pixmap_temp.draw_rectangle(self.gc_selection, False,
+                self.orig_x, self.orig_y, size[0], size[1])
+            self.pixmap_temp.draw_rectangle(self.gc_selection1, False,
+                self.orig_x - 1, self.orig_y - 1, size[0] + 2, size[1] + 2)
+
+        else:
+            self.pixmap.draw_pixbuf(self.gc, pix, 0, 0, 0, 0, width, height,
+                dither=gtk.gdk.RGB_DITHER_NORMAL, x_dither=0, y_dither=0)
+
+        self.queue_draw()
+        if not self.selmove:
+            self.enableUndo(widget)
+
     def _pixbuf2Image(self, pb):
         """change a pixbuf to RGB image
 
diff --git a/icons/mirror-horizontal.svg b/icons/mirror-horizontal.svg
new file mode 100644
index 0000000..2554356
--- /dev/null
+++ b/icons/mirror-horizontal.svg
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   enable-background="new 0 0 55 55"
+   height="55px"
+   version="1.1"
+   viewBox="0 0 55 55"
+   width="55px"
+   x="0px"
+   xml:space="preserve"
+   y="0px"
+   id="svg2"
+   inkscape:version="0.48.0 r9654"
+   sodipodi:docname="mirror-horizontal.svg"><metadata
+     id="metadata50"><rdf:RDF><cc:Work
+         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+     id="defs48"><inkscape:path-effect
+       effect="skeletal"
+       id="path-effect5822"
+       is_visible="true"
+       pattern="M 0,0 0,10 10,5 z"
+       copytype="single_stretched"
+       prop_scale="1"
+       scale_y_rel="false"
+       spacing="0"
+       normal_offset="0"
+       tang_offset="0"
+       prop_units="false"
+       vertical_pattern="false"
+       fuse_tolerance="0" /><inkscape:path-effect
+       effect="skeletal"
+       id="path-effect5818"
+       is_visible="true"
+       pattern="M 0,0 0,10 10,5 z"
+       copytype="single_stretched"
+       prop_scale="1"
+       scale_y_rel="false"
+       spacing="0"
+       normal_offset="0"
+       tang_offset="0"
+       prop_units="false"
+       vertical_pattern="false"
+       fuse_tolerance="0" /><linearGradient
+       id="linearGradient5788"
+       osb:paint="solid"><stop
+         style="stop-color:#000000;stop-opacity:1;"
+         offset="0"
+         id="stop5790" /></linearGradient><linearGradient
+       gradientTransform="matrix(-4.371139e-8,1,-1,-4.371139e-8,55,-4.882812e-4)"
+       gradientUnits="userSpaceOnUse"
+       id="SVGID_1_-0"
+       x1="8.4995003"
+       x2="46.5"
+       y1="27.5"
+       y2="27.5"><stop
+         offset="0"
+         style="stop-color:#FF0000"
+         id="stop6-4" /><stop
+         offset="0.0044"
+         style="stop-color:#FF0500"
+         id="stop8-8" /><stop
+         offset="0.0489"
+         style="stop-color:#FF3000"
+         id="stop10-7" /><stop
+         offset="0.092"
+         style="stop-color:#FF5200"
+         id="stop12-1" /><stop
+         offset="0.1326"
+         style="stop-color:#FF6B00"
+         id="stop14-7" /><stop
+         offset="0.1699"
+         style="stop-color:#FF7A00"
+         id="stop16-2" /><stop
+         offset="0.2006"
+         style="stop-color:#FF7F00"
+         id="stop18-7" /><stop
+         offset="0.2506"
+         style="stop-color:#FF9200"
+         id="stop20-2" /><stop
+         offset="0.3497"
+         style="stop-color:#FFB300"
+         id="stop22-2" /><stop
+         offset="0.4042"
+         style="stop-color:#FFBF00"
+         id="stop24-6" /><stop
+         offset="0.4385"
+         style="stop-color:#E3CA03"
+         id="stop26-1" /><stop
+         offset="0.5423"
+         style="stop-color:#93EB0C"
+         id="stop28-0" /><stop
+         offset="0.5898"
+         style="stop-color:#73F80F"
+         id="stop30-6" /><stop
+         offset="0.6159"
+         style="stop-color:#6AF11D"
+         id="stop32-1" /><stop
+         offset="0.6649"
+         style="stop-color:#54E041"
+         id="stop34-5" /><stop
+         offset="0.7315"
+         style="stop-color:#2FC47B"
+         id="stop36-9" /><stop
+         offset="0.8084"
+         style="stop-color:#00A0C6"
+         id="stop38-4" /><stop
+         offset="0.8916"
+         style="stop-color:#1C64CB"
+         id="stop40-9" /><stop
+         offset="1"
+         style="stop-color:#4210D2"
+         id="stop42-0" /></linearGradient><linearGradient
+       gradientTransform="matrix(-4.371139e-8,1,-1,-4.371139e-8,55,-4.882812e-4)"
+       gradientUnits="userSpaceOnUse"
+       id="SVGID_1_-0-1"
+       x1="8.4995003"
+       x2="46.5"
+       y1="27.5"
+       y2="27.5"><stop
+         offset="0"
+         style="stop-color:#FF0000"
+         id="stop6-4-7" /><stop
+         offset="0.0044"
+         style="stop-color:#FF0500"
+         id="stop8-8-5" /><stop
+         offset="0.0489"
+         style="stop-color:#FF3000"
+         id="stop10-7-9" /><stop
+         offset="0.092"
+         style="stop-color:#FF5200"
+         id="stop12-1-6" /><stop
+         offset="0.1326"
+         style="stop-color:#FF6B00"
+         id="stop14-7-2" /><stop
+         offset="0.1699"
+         style="stop-color:#FF7A00"
+         id="stop16-2-1" /><stop
+         offset="0.2006"
+         style="stop-color:#FF7F00"
+         id="stop18-7-7" /><stop
+         offset="0.2506"
+         style="stop-color:#FF9200"
+         id="stop20-2-8" /><stop
+         offset="0.3497"
+         style="stop-color:#FFB300"
+         id="stop22-2-5" /><stop
+         offset="0.4042"
+         style="stop-color:#FFBF00"
+         id="stop24-6-7" /><stop
+         offset="0.4385"
+         style="stop-color:#E3CA03"
+         id="stop26-1-4" /><stop
+         offset="0.5423"
+         style="stop-color:#93EB0C"
+         id="stop28-0-1" /><stop
+         offset="0.5898"
+         style="stop-color:#73F80F"
+         id="stop30-6-8" /><stop
+         offset="0.6159"
+         style="stop-color:#6AF11D"
+         id="stop32-1-5" /><stop
+         offset="0.6649"
+         style="stop-color:#54E041"
+         id="stop34-5-9" /><stop
+         offset="0.7315"
+         style="stop-color:#2FC47B"
+         id="stop36-9-7" /><stop
+         offset="0.8084"
+         style="stop-color:#00A0C6"
+         id="stop38-4-5" /><stop
+         offset="0.8916"
+         style="stop-color:#1C64CB"
+         id="stop40-9-3" /><stop
+         offset="1"
+         style="stop-color:#4210D2"
+         id="stop42-0-8" /></linearGradient><linearGradient
+       y2="27.5"
+       x2="46.5"
+       y1="27.5"
+       x1="8.4995003"
+       gradientTransform="matrix(-4.371139e-8,1,-1,-4.371139e-8,55,-4.882812e-4)"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3454"
+       xlink:href="#SVGID_1_-0-1"
+       inkscape:collect="always" /><filter
+       id="filter3547"
+       inkscape:label="Invert"
+       x="0"
+       y="0"
+       width="1"
+       height="1"
+       inkscape:menu="Color"
+       inkscape:menu-tooltip="Invert colors"
+       color-interpolation-filters="sRGB"><feColorMatrix
+         id="feColorMatrix3549"
+         type="saturate"
+         values="1"
+         result="fbSourceGraphic" /><feColorMatrix
+         id="feColorMatrix3551"
+         in="fbSourceGraphic"
+         values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0 " /></filter></defs><sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1280"
+     inkscape:window-height="751"
+     id="namedview46"
+     showgrid="false"
+     inkscape:zoom="9.7454545"
+     inkscape:cx="27.721451"
+     inkscape:cy="49.087021"
+     inkscape:window-x="0"
+     inkscape:window-y="24"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg2"
+     inkscape:snap-global="false" /><rect
+     style="fill:#ffffff;fill-opacity:1;stroke:none"
+     id="rect3800"
+     width="56.231339"
+     height="55.718288"
+     x="-0.82089543"
+     y="-3.6838074e-07" /><path
+     sodipodi:type="star"
+     style="fill:#ffffff;stroke:#000000;stroke-width:1.11099993999999991;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;fill-opacity:1"
+     id="path3928"
+     sodipodi:sides="3"
+     sodipodi:cx="19.393658"
+     sodipodi:cy="8.2089548"
+     sodipodi:r1="10.515096"
+     sodipodi:r2="5.2575479"
+     sodipodi:arg1="0.52359878"
+     sodipodi:arg2="1.5707963"
+     inkscape:flatsided="true"
+     inkscape:rounded="0"
+     inkscape:randomized="0"
+     d="m 28.499998,13.466503 -18.21268,0 9.10634,-15.7726439 z"
+     transform="matrix(0,1,-1,0,50.792911,6.156715)"
+     inkscape:transform-center-x="-2.6287735" /><path
+     sodipodi:type="star"
+     style="fill:#ffffff;stroke:#000000;stroke-width:1.11099993999999991;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;fill-opacity:1"
+     id="path3928-8"
+     sodipodi:sides="3"
+     sodipodi:cx="19.393658"
+     sodipodi:cy="8.2089548"
+     sodipodi:r1="10.515096"
+     sodipodi:r2="5.2575479"
+     sodipodi:arg1="0.52359878"
+     sodipodi:arg2="1.5707963"
+     inkscape:flatsided="true"
+     inkscape:rounded="0"
+     inkscape:randomized="0"
+     d="m 28.499998,13.466503 -18.21268,0 9.10634,-15.7726439 z"
+     transform="matrix(0,-1,1,0,5.0523239,45.188391)"
+     inkscape:transform-center-x="2.6287735" /><path
+     style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:1, 1;stroke-dashoffset:0"
+     d="M 27.397388,0.20522335 27.602612,54.999999 27.5,54.692163 l 0,0.205224"
+     id="path3948"
+     inkscape:connector-curvature="0" /></svg>
\ No newline at end of file
diff --git a/icons/mirror-vertical.svg b/icons/mirror-vertical.svg
new file mode 100644
index 0000000..0bfd72b
--- /dev/null
+++ b/icons/mirror-vertical.svg
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   enable-background="new 0 0 55 55"
+   height="55px"
+   version="1.1"
+   viewBox="0 0 55 55"
+   width="55px"
+   x="0px"
+   xml:space="preserve"
+   y="0px"
+   id="svg2"
+   inkscape:version="0.48.0 r9654"
+   sodipodi:docname="mirror-vertical.svg"><metadata
+     id="metadata50"><rdf:RDF><cc:Work
+         rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+     id="defs48"><inkscape:path-effect
+       effect="skeletal"
+       id="path-effect5822"
+       is_visible="true"
+       pattern="M 0,0 0,10 10,5 z"
+       copytype="single_stretched"
+       prop_scale="1"
+       scale_y_rel="false"
+       spacing="0"
+       normal_offset="0"
+       tang_offset="0"
+       prop_units="false"
+       vertical_pattern="false"
+       fuse_tolerance="0" /><inkscape:path-effect
+       effect="skeletal"
+       id="path-effect5818"
+       is_visible="true"
+       pattern="M 0,0 0,10 10,5 z"
+       copytype="single_stretched"
+       prop_scale="1"
+       scale_y_rel="false"
+       spacing="0"
+       normal_offset="0"
+       tang_offset="0"
+       prop_units="false"
+       vertical_pattern="false"
+       fuse_tolerance="0" /><linearGradient
+       id="linearGradient5788"
+       osb:paint="solid"><stop
+         style="stop-color:#000000;stop-opacity:1;"
+         offset="0"
+         id="stop5790" /></linearGradient><linearGradient
+       gradientTransform="matrix(-4.371139e-8,1,-1,-4.371139e-8,55,-4.882812e-4)"
+       gradientUnits="userSpaceOnUse"
+       id="SVGID_1_-0"
+       x1="8.4995003"
+       x2="46.5"
+       y1="27.5"
+       y2="27.5"><stop
+         offset="0"
+         style="stop-color:#FF0000"
+         id="stop6-4" /><stop
+         offset="0.0044"
+         style="stop-color:#FF0500"
+         id="stop8-8" /><stop
+         offset="0.0489"
+         style="stop-color:#FF3000"
+         id="stop10-7" /><stop
+         offset="0.092"
+         style="stop-color:#FF5200"
+         id="stop12-1" /><stop
+         offset="0.1326"
+         style="stop-color:#FF6B00"
+         id="stop14-7" /><stop
+         offset="0.1699"
+         style="stop-color:#FF7A00"
+         id="stop16-2" /><stop
+         offset="0.2006"
+         style="stop-color:#FF7F00"
+         id="stop18-7" /><stop
+         offset="0.2506"
+         style="stop-color:#FF9200"
+         id="stop20-2" /><stop
+         offset="0.3497"
+         style="stop-color:#FFB300"
+         id="stop22-2" /><stop
+         offset="0.4042"
+         style="stop-color:#FFBF00"
+         id="stop24-6" /><stop
+         offset="0.4385"
+         style="stop-color:#E3CA03"
+         id="stop26-1" /><stop
+         offset="0.5423"
+         style="stop-color:#93EB0C"
+         id="stop28-0" /><stop
+         offset="0.5898"
+         style="stop-color:#73F80F"
+         id="stop30-6" /><stop
+         offset="0.6159"
+         style="stop-color:#6AF11D"
+         id="stop32-1" /><stop
+         offset="0.6649"
+         style="stop-color:#54E041"
+         id="stop34-5" /><stop
+         offset="0.7315"
+         style="stop-color:#2FC47B"
+         id="stop36-9" /><stop
+         offset="0.8084"
+         style="stop-color:#00A0C6"
+         id="stop38-4" /><stop
+         offset="0.8916"
+         style="stop-color:#1C64CB"
+         id="stop40-9" /><stop
+         offset="1"
+         style="stop-color:#4210D2"
+         id="stop42-0" /></linearGradient><linearGradient
+       gradientTransform="matrix(-4.371139e-8,1,-1,-4.371139e-8,55,-4.882812e-4)"
+       gradientUnits="userSpaceOnUse"
+       id="SVGID_1_-0-1"
+       x1="8.4995003"
+       x2="46.5"
+       y1="27.5"
+       y2="27.5"><stop
+         offset="0"
+         style="stop-color:#FF0000"
+         id="stop6-4-7" /><stop
+         offset="0.0044"
+         style="stop-color:#FF0500"
+         id="stop8-8-5" /><stop
+         offset="0.0489"
+         style="stop-color:#FF3000"
+         id="stop10-7-9" /><stop
+         offset="0.092"
+         style="stop-color:#FF5200"
+         id="stop12-1-6" /><stop
+         offset="0.1326"
+         style="stop-color:#FF6B00"
+         id="stop14-7-2" /><stop
+         offset="0.1699"
+         style="stop-color:#FF7A00"
+         id="stop16-2-1" /><stop
+         offset="0.2006"
+         style="stop-color:#FF7F00"
+         id="stop18-7-7" /><stop
+         offset="0.2506"
+         style="stop-color:#FF9200"
+         id="stop20-2-8" /><stop
+         offset="0.3497"
+         style="stop-color:#FFB300"
+         id="stop22-2-5" /><stop
+         offset="0.4042"
+         style="stop-color:#FFBF00"
+         id="stop24-6-7" /><stop
+         offset="0.4385"
+         style="stop-color:#E3CA03"
+         id="stop26-1-4" /><stop
+         offset="0.5423"
+         style="stop-color:#93EB0C"
+         id="stop28-0-1" /><stop
+         offset="0.5898"
+         style="stop-color:#73F80F"
+         id="stop30-6-8" /><stop
+         offset="0.6159"
+         style="stop-color:#6AF11D"
+         id="stop32-1-5" /><stop
+         offset="0.6649"
+         style="stop-color:#54E041"
+         id="stop34-5-9" /><stop
+         offset="0.7315"
+         style="stop-color:#2FC47B"
+         id="stop36-9-7" /><stop
+         offset="0.8084"
+         style="stop-color:#00A0C6"
+         id="stop38-4-5" /><stop
+         offset="0.8916"
+         style="stop-color:#1C64CB"
+         id="stop40-9-3" /><stop
+         offset="1"
+         style="stop-color:#4210D2"
+         id="stop42-0-8" /></linearGradient><linearGradient
+       y2="27.5"
+       x2="46.5"
+       y1="27.5"
+       x1="8.4995003"
+       gradientTransform="matrix(-4.371139e-8,1,-1,-4.371139e-8,55,-4.882812e-4)"
+       gradientUnits="userSpaceOnUse"
+       id="linearGradient3454"
+       xlink:href="#SVGID_1_-0-1"
+       inkscape:collect="always" /><filter
+       id="filter3547"
+       inkscape:label="Invert"
+       x="0"
+       y="0"
+       width="1"
+       height="1"
+       inkscape:menu="Color"
+       inkscape:menu-tooltip="Invert colors"
+       color-interpolation-filters="sRGB"><feColorMatrix
+         id="feColorMatrix3549"
+         type="saturate"
+         values="1"
+         result="fbSourceGraphic" /><feColorMatrix
+         id="feColorMatrix3551"
+         in="fbSourceGraphic"
+         values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0 " /></filter></defs><sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1280"
+     inkscape:window-height="751"
+     id="namedview46"
+     showgrid="false"
+     inkscape:zoom="9.7454545"
+     inkscape:cx="9.0773758"
+     inkscape:cy="15.370883"
+     inkscape:window-x="0"
+     inkscape:window-y="24"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="svg2"
+     inkscape:snap-global="false" /><rect
+     style="fill:#ffffff;fill-opacity:1;stroke:none"
+     id="rect3800"
+     width="56.949623"
+     height="55.8209"
+     x="-1.1287289"
+     y="-0.051307671" /><path
+     sodipodi:type="star"
+     style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.11099994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+     id="path3928"
+     sodipodi:sides="3"
+     sodipodi:cx="19.393658"
+     sodipodi:cy="8.2089548"
+     sodipodi:r1="10.515096"
+     sodipodi:r2="5.2575479"
+     sodipodi:arg1="0.52359878"
+     sodipodi:arg2="1.5707963"
+     inkscape:flatsided="true"
+     inkscape:rounded="0"
+     inkscape:randomized="0"
+     d="m 28.499998,13.466503 -18.21268,0 9.10634,-15.7726439 z"
+     inkscape:transform-center-y="-2.6287739"
+     transform="translate(7.0802239,4.8246269)" /><path
+     sodipodi:type="star"
+     style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.11099994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+     id="path3928-8"
+     sodipodi:sides="3"
+     sodipodi:cx="19.393658"
+     sodipodi:cy="8.2089548"
+     sodipodi:r1="10.515096"
+     sodipodi:r2="5.2575479"
+     sodipodi:arg1="0.52359878"
+     sodipodi:arg2="1.5707963"
+     inkscape:flatsided="true"
+     inkscape:rounded="0"
+     inkscape:randomized="0"
+     d="m 28.499998,13.466503 -18.21268,0 9.10634,-15.7726439 z"
+     inkscape:transform-center-y="2.6287735"
+     transform="matrix(1,0,0,-1,7.4906711,48.214509)" /><path
+     style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:1,1;stroke-dashoffset:0"
+     d="M 0.20522388,26.679104 55,26.47388 l -0.307836,0.102612 0.205224,0"
+     id="path3948"
+     inkscape:connector-curvature="0" /></svg>
\ No newline at end of file
diff --git a/toolbox.py b/toolbox.py
index 1ff4e6f..d8b75ee 100644
--- a/toolbox.py
+++ b/toolbox.py
@@ -1276,6 +1276,16 @@ class EffectsToolbar(gtk.Toolbar):
         separator = gtk.SeparatorToolItem()
         self.insert(separator, -1)
 
+        self._mirror_horizontal = ToolButton('mirror-horizontal')
+        self.insert(self._mirror_horizontal, -1)
+        self._mirror_horizontal.show()
+        self._mirror_horizontal.set_tooltip(_('Mirror Horizontal'))
+
+        self._mirror_vertical = ToolButton('mirror-vertical')
+        self.insert(self._mirror_vertical, -1)
+        self._mirror_vertical.show()
+        self._mirror_vertical.set_tooltip(_('Mirror Vertical'))
+
         """
         #FIXME: Must be implemented
         self._black_and_white = ToolButton('black_and_white')
@@ -1290,6 +1300,8 @@ class EffectsToolbar(gtk.Toolbar):
         self._effect_grayscale.connect('clicked', self.grayscale)
         self._effect_rainbow.connect('clicked', self.rainbow)
         self._invert_colors.connect('clicked', self.invert_colors)
+        self._mirror_vertical.connect('clicked', self.mirror_vertical)
+        self._mirror_horizontal.connect('clicked', self.mirror_horizontal)
 
     ##Make the colors be in grayscale
     def grayscale(self, widget):
@@ -1302,6 +1314,12 @@ class EffectsToolbar(gtk.Toolbar):
     def invert_colors(self, widget):
         self._activity.area.invert_colors(widget)
 
+    def mirror_horizontal(self, widget):
+        self._activity.area.mirror(widget)
+
+    def mirror_vertical(self, widget):
+        self._activity.area.mirror(widget, horizontal=False)
+
         # setting cursor: moved to Area
 
     def _configure_palette(self, button, tool=None):
-- 
1.7.1



More information about the Sugar-devel mailing list