Commit aeb2a6e4 authored by Michael Natterer's avatar Michael Natterer 😴

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.
parent ba1318dd
......@@ -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);
......
......@@ -291,6 +291,37 @@ image_convert_precision_cmd_callback (GtkAction *action,
gimp_image_flush (image);
}
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)
......
......@@ -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__ */
......@@ -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"
......
......@@ -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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment