[gimp/pippin/linear-is-the-new-black: 7/13] add radiometric(linear) invert menu item



commit 481691660d3555167daf40027410ebda761a2764
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Dec 24 03:53:19 2016 +0100

    add radiometric(linear) invert menu item

 app/actions/drawable-actions.c  |    9 ++++++++-
 app/actions/drawable-commands.c |   18 ++++++++++++++++++
 app/actions/drawable-commands.h |    2 ++
 menus/image-menu.xml.in         |    1 +
 4 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/app/actions/drawable-actions.c b/app/actions/drawable-actions.c
index f4ee705..b9a09be 100644
--- a/app/actions/drawable-actions.c
+++ b/app/actions/drawable-actions.c
@@ -49,10 +49,16 @@ static const GimpActionEntry drawable_actions[] =
 
   { "drawable-invert", GIMP_STOCK_INVERT,
     NC_("drawable-action", "In_vert"), NULL,
-    NC_("drawable-action", "Invert the colors"),
+    NC_("drawable-action", "Invert the perceived colors"),
     G_CALLBACK (drawable_invert_cmd_callback),
     GIMP_HELP_LAYER_INVERT },
 
+  { "drawable-radiometric-invert", GIMP_STOCK_INVERT,
+    NC_("drawable-action", "Radiometric Invert"), NULL,
+    NC_("drawable-action", "Invert the colors"),
+    G_CALLBACK (drawable_radiometric_invert_cmd_callback),
+    GIMP_HELP_LAYER_INVERT },
+
   { "drawable-value-invert", GIMP_STOCK_GEGL,
     NC_("drawable-action", "_Value Invert"), NULL,
     NC_("drawable-action", "Invert the brightness of each pixel"),
@@ -241,6 +247,7 @@ drawable_actions_update (GimpActionGroup *group,
 
   SET_SENSITIVE ("drawable-equalize",       writable && !children);
   SET_SENSITIVE ("drawable-invert",         writable && !children);
+  SET_SENSITIVE ("drawable-radiometric-invert", writable && !children);
   SET_SENSITIVE ("drawable-value-invert",   writable && !children);
   SET_SENSITIVE ("drawable-levels-stretch", writable && !children && is_rgb);
   SET_SENSITIVE ("drawable-dilate",         writable && !children);
diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c
index bbdfdc3..ac25fd5 100644
--- a/app/actions/drawable-commands.c
+++ b/app/actions/drawable-commands.c
@@ -88,6 +88,24 @@ drawable_invert_cmd_callback (GtkAction *action,
 }
 
 void
+drawable_radiometric_invert_cmd_callback (GtkAction *action,
+                                          gpointer   data)
+{
+  GimpImage    *image;
+  GimpDrawable *drawable;
+  GimpDisplay  *display;
+  return_if_no_drawable (image, drawable, data);
+  return_if_no_display (display, data);
+
+  /* FIXME invert masks? */
+  gimp_drawable_apply_operation_by_name (drawable, GIMP_PROGRESS (display),
+                                         _("Invert"), "gegl:invert-linear",
+                                         NULL);
+  gimp_image_flush (image);
+}
+
+
+void
 drawable_value_invert_cmd_callback (GtkAction *action,
                                     gpointer   data)
 {
diff --git a/app/actions/drawable-commands.h b/app/actions/drawable-commands.h
index 6159b10..095f2b8 100644
--- a/app/actions/drawable-commands.h
+++ b/app/actions/drawable-commands.h
@@ -23,6 +23,8 @@ void   drawable_equalize_cmd_callback       (GtkAction *action,
                                              gpointer   data);
 void   drawable_invert_cmd_callback         (GtkAction *action,
                                              gpointer   data);
+void   drawable_radiometric_invert_cmd_callback (GtkAction *action,
+                                             gpointer   data);
 void   drawable_value_invert_cmd_callback   (GtkAction *action,
                                              gpointer   data);
 void   drawable_levels_stretch_cmd_callback (GtkAction *action,
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index 64687fc..3ef8d65 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -568,6 +568,7 @@
       <separator />
       <placeholder name="Invert">
         <menuitem action="drawable-invert" />
+        <menuitem action="drawable-radiometric-invert" />
         <menuitem action="drawable-value-invert" />
       </placeholder>
       <separator />


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