[gimp] Bug 646511 - Having the possibility to remove ICC profiles



commit aeb2a6e4ffebdc47315b50628597cc566e1efd70
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jun 15 20:19:32 2015 +0200

    Bug 646511 - Having the possibility to remove ICC profiles
    
    Add Image -> Color Management -> Discard Color Profile which simply
    removes the profile without any conversion.
    
    Also added actions and callbacks for "Assign" and "Convert" but these
    are only stubs to be filled as replacement for the remaining code in
    the lcms plug-in.

 app/actions/image-actions.c  |   26 +++++++++++++
 app/actions/image-commands.c |   31 ++++++++++++++++
 app/actions/image-commands.h |   83 +++++++++++++++++++++++-------------------
 app/widgets/gimphelp-ids.h   |    3 ++
 menus/image-menu.xml.in      |    7 +++-
 5 files changed, 111 insertions(+), 39 deletions(-)
---
diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c
index 08366f3..8fd0f04 100644
--- a/app/actions/image-actions.c
+++ b/app/actions/image-actions.c
@@ -30,6 +30,7 @@
 #include "core/gimpchannel.h"
 #include "core/gimpcontext.h"
 #include "core/gimpimage.h"
+#include "core/gimpimage-profile.h"
 #include "core/gimpitemstack.h"
 
 #include "widgets/gimpactiongroup.h"
@@ -73,6 +74,24 @@ static const GimpActionEntry image_actions[] =
     G_CALLBACK (image_new_cmd_callback),
     GIMP_HELP_FILE_NEW },
 
+  { "image-color-profile-assign", NULL,
+    NC_("image-action", "_Assign Color Profile..."), NULL,
+    NC_("image-action", "Set a color profile on the image"),
+    G_CALLBACK (image_color_profile_assign_cmd_callback),
+    GIMP_HELP_IMAGE_COLOR_PROFILE_ASSIGN },
+
+  { "image-color-profile-convert", NULL,
+    NC_("image-action", "_Convert to Color Profile..."), NULL,
+    NC_("image-action", "Apply a color profile to the image"),
+    G_CALLBACK (image_color_profile_convert_cmd_callback),
+    GIMP_HELP_IMAGE_COLOR_PROFILE_CONVERT },
+
+  { "image-color-profile-discard", NULL,
+    NC_("image-action", "_Discard Color Profile"), NULL,
+    NC_("image-action", "Remove the image's color profile"),
+    G_CALLBACK (image_color_profile_discard_cmd_callback),
+    GIMP_HELP_IMAGE_COLOR_PROFILE_DISCARD },
+
   { "image-resize", GIMP_STOCK_RESIZE,
     NC_("image-action", "Can_vas Size..."), NULL,
     NC_("image-action", "Adjust the image dimensions"),
@@ -326,6 +345,7 @@ image_actions_update (GimpActionGroup *group,
   gboolean   lp          = FALSE;
   gboolean   sel         = FALSE;
   gboolean   groups      = FALSE;
+  gboolean   profile     = FALSE;
 
   if (image)
     {
@@ -393,6 +413,8 @@ image_actions_update (GimpActionGroup *group,
       layers = gimp_image_get_layers (image);
 
       groups = ! gimp_item_stack_is_flat (GIMP_ITEM_STACK (layers));
+
+      profile = (gimp_image_get_icc_profile (image) != NULL);
     }
 
 #define SET_SENSITIVE(action,condition) \
@@ -415,6 +437,10 @@ image_actions_update (GimpActionGroup *group,
   SET_SENSITIVE ("image-convert-double-gamma",  image && !is_indexed);
   SET_SENSITIVE ("image-convert-double-linear", image && !is_indexed);
 
+  SET_SENSITIVE ("image-color-profile-assign",  image);
+  SET_SENSITIVE ("image-color-profile-convert", image);
+  SET_SENSITIVE ("image-color-profile-discard", image && profile);
+
   SET_SENSITIVE ("image-flip-horizontal", image);
   SET_SENSITIVE ("image-flip-vertical",   image);
   SET_SENSITIVE ("image-rotate-90",       image);
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 8677c30..46cdf2d 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -292,6 +292,37 @@ image_convert_precision_cmd_callback (GtkAction *action,
 }
 
 void
+image_color_profile_assign_cmd_callback (GtkAction *action,
+                                         gpointer   data)
+{
+  GimpImage *image;
+  return_if_no_image (image, data);
+
+  g_message ("FIXME: implement image_color_profile_assign_cmd_callback()");
+}
+
+void
+image_color_profile_convert_cmd_callback (GtkAction *action,
+                                          gpointer   data)
+{
+  GimpImage *image;
+  return_if_no_image (image, data);
+
+  g_message ("FIXME: implement image_color_profile_convert_cmd_callback()");
+}
+
+void
+image_color_profile_discard_cmd_callback (GtkAction *action,
+                                          gpointer   data)
+{
+  GimpImage *image;
+  return_if_no_image (image, data);
+
+  gimp_image_set_color_profile (image, NULL, NULL);
+  gimp_image_flush (image);
+}
+
+void
 image_resize_cmd_callback (GtkAction *action,
                            gpointer   data)
 {
diff --git a/app/actions/image-commands.h b/app/actions/image-commands.h
index a74ae07..b98bfc1 100644
--- a/app/actions/image-commands.h
+++ b/app/actions/image-commands.h
@@ -19,49 +19,56 @@
 #define __IMAGE_COMMANDS_H__
 
 
-void   image_new_cmd_callback                 (GtkAction *action,
-                                               gpointer   data);
+void   image_new_cmd_callback                   (GtkAction *action,
+                                                 gpointer   data);
 
-void   image_convert_base_type_cmd_callback   (GtkAction *action,
-                                               GtkAction *current,
-                                               gpointer   data);
-void   image_convert_precision_cmd_callback   (GtkAction *action,
-                                               GtkAction *current,
-                                               gpointer   data);
+void   image_convert_base_type_cmd_callback     (GtkAction *action,
+                                                 GtkAction *current,
+                                                 gpointer   data);
+void   image_convert_precision_cmd_callback     (GtkAction *action,
+                                                 GtkAction *current,
+                                                 gpointer   data);
 
-void   image_resize_cmd_callback              (GtkAction *action,
-                                               gpointer   data);
-void   image_resize_to_layers_cmd_callback    (GtkAction *action,
-                                               gpointer   data);
-void   image_resize_to_selection_cmd_callback (GtkAction *action,
-                                               gpointer   data);
-void   image_print_size_cmd_callback          (GtkAction *action,
-                                               gpointer   data);
-void   image_scale_cmd_callback               (GtkAction *action,
-                                               gpointer   data);
-void   image_flip_cmd_callback                (GtkAction *action,
-                                               gint       value,
-                                               gpointer   data);
-void   image_rotate_cmd_callback              (GtkAction *action,
-                                               gint       value,
-                                               gpointer   data);
-void   image_crop_to_selection_cmd_callback   (GtkAction *action,
-                                               gpointer   data);
-void   image_crop_to_content_cmd_callback     (GtkAction *action,
-                                               gpointer   data);
+void   image_color_profile_assign_cmd_callback  (GtkAction *action,
+                                                 gpointer   data);
+void   image_color_profile_convert_cmd_callback (GtkAction *action,
+                                                 gpointer   data);
+void   image_color_profile_discard_cmd_callback (GtkAction *action,
+                                                 gpointer   data);
 
-void   image_duplicate_cmd_callback           (GtkAction *action,
-                                               gpointer   data);
+void   image_resize_cmd_callback                (GtkAction *action,
+                                                 gpointer   data);
+void   image_resize_to_layers_cmd_callback      (GtkAction *action,
+                                                 gpointer   data);
+void   image_resize_to_selection_cmd_callback   (GtkAction *action,
+                                                 gpointer   data);
+void   image_print_size_cmd_callback            (GtkAction *action,
+                                                 gpointer   data);
+void   image_scale_cmd_callback                 (GtkAction *action,
+                                                 gpointer   data);
+void   image_flip_cmd_callback                  (GtkAction *action,
+                                                 gint       value,
+                                                 gpointer   data);
+void   image_rotate_cmd_callback                (GtkAction *action,
+                                                 gint       value,
+                                                 gpointer   data);
+void   image_crop_to_selection_cmd_callback     (GtkAction *action,
+                                                 gpointer   data);
+void   image_crop_to_content_cmd_callback       (GtkAction *action,
+                                                 gpointer   data);
 
-void   image_merge_layers_cmd_callback        (GtkAction *action,
-                                               gpointer   data);
-void   image_flatten_image_cmd_callback       (GtkAction *action,
-                                               gpointer   data);
+void   image_duplicate_cmd_callback             (GtkAction *action,
+                                                 gpointer   data);
 
-void   image_configure_grid_cmd_callback      (GtkAction *action,
-                                               gpointer   data);
-void   image_properties_cmd_callback          (GtkAction *action,
-                                               gpointer   data);
+void   image_merge_layers_cmd_callback          (GtkAction *action,
+                                                 gpointer   data);
+void   image_flatten_image_cmd_callback         (GtkAction *action,
+                                                 gpointer   data);
+
+void   image_configure_grid_cmd_callback        (GtkAction *action,
+                                                 gpointer   data);
+void   image_properties_cmd_callback            (GtkAction *action,
+                                                 gpointer   data);
 
 
 #endif /* __IMAGE_COMMANDS_H__ */
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index 7628e3c..cec8900 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -147,6 +147,9 @@
 #define GIMP_HELP_IMAGE_DUPLICATE                 "gimp-image-duplicate"
 #define GIMP_HELP_IMAGE_MERGE_LAYERS              "gimp-image-merge-layers"
 #define GIMP_HELP_IMAGE_FLATTEN                   "gimp-image-flatten"
+#define GIMP_HELP_IMAGE_COLOR_PROFILE_ASSIGN      "gimp-image-color-profile-assign"
+#define GIMP_HELP_IMAGE_COLOR_PROFILE_CONVERT     "gimp-image-color-profile-convert"
+#define GIMP_HELP_IMAGE_COLOR_PROFILE_DISCARD     "gimp-image-color-profile-discard"
 #define GIMP_HELP_IMAGE_GRID                      "gimp-image-grid"
 #define GIMP_HELP_IMAGE_PROPERTIES                "gimp-image-properties"
 
diff --git a/menus/image-menu.xml.in b/menus/image-menu.xml.in
index b9f2470..c81396d 100644
--- a/menus/image-menu.xml.in
+++ b/menus/image-menu.xml.in
@@ -348,7 +348,12 @@
         <separator />
       </menu>
       <menu action="image-color-management-menu" name="Color Management">
-      </menu>
+       <!-- disabled until the actions are implemented
+         <menuitem action="image-color-profile-assign" />
+         <menuitem action="image-color-profile-convert" />
+       -->
+         <menuitem action="image-color-profile-discard" />
+     </menu>
       <separator />
       <menu action="image-transform-menu" name="Transform">
         <placeholder name="Flip">


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