[gimp] Bug 679195 - Foreground Select Tool Mask Inverted



commit 5b39be560576d1d121e8eb8c74da55b6bca49835
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jul 15 01:57:00 2013 +0200

    Bug 679195 - Foreground Select Tool Mask Inverted
    
    gimp_display_shell_render(): invert the mask so it masks what is *not*
    the foreground object.

 app/display/gimpdisplayshell-render.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c
index 4ed04ff..9c3f6c1 100644
--- a/app/display/gimpdisplayshell-render.c
+++ b/app/display/gimpdisplayshell-render.c
@@ -134,6 +134,8 @@ gimp_display_shell_render (GimpDisplayShell *shell,
 
   if (shell->mask)
     {
+      gint mask_height;
+
       if (! shell->mask_surface)
         {
           shell->mask_surface =
@@ -159,6 +161,23 @@ gimp_display_shell_render (GimpDisplayShell *shell,
                        babl_format ("Y u8"),
                        data, stride,
                        GEGL_ABYSS_NONE);
+
+      /* invert the mask so what is *not* the foreground object is masked */
+      mask_height = h * window_scale;
+      while (mask_height--)
+        {
+          gint    mask_width = w * window_scale;
+          guchar *d          = data;
+
+          while (mask_width--)
+            {
+              guchar inv = 255 - *d;
+
+              *d++ = inv;
+            }
+
+          data += stride;
+        }
     }
 
   /*  put it to the screen  */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]