[gimp] Issue #701 - Add the ability to embed the GIMP built-in sRGB profile...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #701 - Add the ability to embed the GIMP built-in sRGB profile...
- Date: Mon, 18 Jun 2018 00:26:18 +0000 (UTC)
commit 8c9c09102135ca93a0da641f70f411149d10cedc
Author: Michael Natterer <mitch gimp org>
Date: Mon Jun 18 02:19:41 2018 +0200
Issue #701 - Add the ability to embed the GIMP built-in sRGB profile...
...upon exporting an image
Step 1: make it configurable just like "Export EXIF" etc.
app, libgimp: add "export-color-profile" config option
Add it to the preferences dialog, and pass it on to plug-ins in the
GPConfig message. Add gimp_export_color_profile() to libgimp.
Nothing uses this yet.
app/config/gimpcoreconfig.c | 14 +++++++++++++
app/config/gimpcoreconfig.h | 1 +
app/config/gimprc-blurbs.h | 3 +++
app/dialogs/preferences-dialog.c | 3 +++
app/plug-in/gimppluginmanager-call.c | 1 +
libgimp/gimp.c | 18 +++++++++++++++++
libgimp/gimp.def | 1 +
libgimp/gimp.h | 39 ++++++++++++++++++------------------
libgimpbase/gimpprotocol.c | 8 ++++++++
libgimpbase/gimpprotocol.h | 3 ++-
10 files changed, 71 insertions(+), 20 deletions(-)
---
diff --git a/app/config/gimpcoreconfig.c b/app/config/gimpcoreconfig.c
index e1613462b3..f8c621053b 100644
--- a/app/config/gimpcoreconfig.c
+++ b/app/config/gimpcoreconfig.c
@@ -110,6 +110,7 @@ enum
PROP_IMPORT_PROMOTE_DITHER,
PROP_IMPORT_ADD_ALPHA,
PROP_IMPORT_RAW_PLUG_IN,
+ PROP_EXPORT_COLOR_PROFILE,
PROP_EXPORT_METADATA_EXIF,
PROP_EXPORT_METADATA_XMP,
PROP_EXPORT_METADATA_IPTC,
@@ -641,6 +642,13 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
+ GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_EXPORT_COLOR_PROFILE,
+ "export-color-profile",
+ "Export Color Profile",
+ EXPORT_COLOR_PROFILE_BLURB,
+ TRUE,
+ GIMP_PARAM_STATIC_STRINGS);
+
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_EXPORT_METADATA_EXIF,
"export-metadata-exif",
"Export Exif metadata",
@@ -967,6 +975,9 @@ gimp_core_config_set_property (GObject *object,
g_free (core_config->import_raw_plug_in);
core_config->import_raw_plug_in = g_value_dup_string (value);
break;
+ case PROP_EXPORT_COLOR_PROFILE:
+ core_config->export_color_profile = g_value_get_boolean (value);
+ break;
case PROP_EXPORT_METADATA_EXIF:
core_config->export_metadata_exif = g_value_get_boolean (value);
break;
@@ -1166,6 +1177,9 @@ gimp_core_config_get_property (GObject *object,
case PROP_IMPORT_RAW_PLUG_IN:
g_value_set_string (value, core_config->import_raw_plug_in);
break;
+ case PROP_EXPORT_COLOR_PROFILE:
+ g_value_set_boolean (value, core_config->export_color_profile);
+ break;
case PROP_EXPORT_METADATA_EXIF:
g_value_set_boolean (value, core_config->export_metadata_exif);
break;
diff --git a/app/config/gimpcoreconfig.h b/app/config/gimpcoreconfig.h
index 9822863382..5a48f4bc90 100644
--- a/app/config/gimpcoreconfig.h
+++ b/app/config/gimpcoreconfig.h
@@ -95,6 +95,7 @@ struct _GimpCoreConfig
gboolean import_promote_dither;
gboolean import_add_alpha;
gchar *import_raw_plug_in;
+ gboolean export_color_profile;
gboolean export_metadata_exif;
gboolean export_metadata_xmp;
gboolean export_metadata_iptc;
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index 1eb9411be2..223473c853 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -204,6 +204,9 @@ _("Add an alpha channel to all layers of imported images.")
#define IMPORT_RAW_PLUG_IN_BLURB \
_("Which plug-in to use for importing raw digital camera files.")
+#define EXPORT_COLOR_PROFILE_BLURB \
+_("Export the image's color profile by default.")
+
#define EXPORT_METADATA_EXIF_BLURB \
_("Export Exif metadata by default.")
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 2670ee4da6..8f2a50afc8 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -1476,6 +1476,9 @@ prefs_dialog_new (Gimp *gimp,
vbox2 = prefs_frame_new (_("Export Policies"),
GTK_CONTAINER (vbox), FALSE);
+ button = prefs_check_button_add (object, "export-color-profile",
+ _("Export the image's color profile by default"),
+ GTK_BOX (vbox2));
button = prefs_check_button_add (object, "export-metadata-exif",
_("Export Exif metadata by default when available"),
GTK_BOX (vbox2));
diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c
index 09e92749d3..18cea699bf 100644
--- a/app/plug-in/gimppluginmanager-call.c
+++ b/app/plug-in/gimppluginmanager-call.c
@@ -207,6 +207,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager *manager,
gui_config->show_help_button);
config.use_cpu_accel = manager->gimp->use_cpu_accel;
config.use_opencl = gegl_config->use_opencl;
+ config.export_profile = core_config->export_color_profile;
config.export_exif = core_config->export_metadata_exif;
config.export_xmp = core_config->export_metadata_xmp;
config.export_iptc = core_config->export_metadata_iptc;
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index 144b46d27c..f719b79607 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -215,6 +215,7 @@ static gint _shm_ID = -1;
static guchar *_shm_addr = NULL;
static const gdouble _gamma_val = 2.2;
static gboolean _show_help_button = TRUE;
+static gboolean _export_profile = FALSE;
static gboolean _export_exif = FALSE;
static gboolean _export_xmp = FALSE;
static gboolean _export_iptc = FALSE;
@@ -1416,6 +1417,22 @@ gimp_show_help_button (void)
return _show_help_button;
}
+/**
+ * gimp_export_color_profile:
+ *
+ * Returns whether file plug-ins should default to exporting the
+ * image's color profile.
+ *
+ * Return value: TRUE if preferences are set to export the color profile.
+ *
+ * Since: 2.10.4
+ **/
+gboolean
+gimp_export_color_profile (void)
+{
+ return _export_profile;
+}
+
/**
* gimp_export_exif:
*
@@ -2155,6 +2172,7 @@ gimp_config (GPConfig *config)
_check_size = config->check_size;
_check_type = config->check_type;
_show_help_button = config->show_help_button ? TRUE : FALSE;
+ _export_profile = config->export_profile ? TRUE : FALSE;
_export_exif = config->export_exif ? TRUE : FALSE;
_export_xmp = config->export_xmp ? TRUE : FALSE;
_export_iptc = config->export_iptc ? TRUE : FALSE;
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index e0ae87943b..cf1ebdf90e 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -253,6 +253,7 @@ EXPORTS
gimp_enums_init
gimp_eraser
gimp_eraser_default
+ gimp_export_color_profile
gimp_export_exif
gimp_export_iptc
gimp_export_xmp
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index eb31ef8a5a..0f90ae502c 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -314,25 +314,26 @@ GimpPDBStatusType gimp_get_pdb_status (void);
/* Return various constants given by the GIMP core at plug-in config time.
*/
-guint gimp_tile_width (void) G_GNUC_CONST;
-guint gimp_tile_height (void) G_GNUC_CONST;
-gint gimp_shm_ID (void) G_GNUC_CONST;
-guchar * gimp_shm_addr (void) G_GNUC_CONST;
-gdouble gimp_gamma (void) G_GNUC_CONST;
-gboolean gimp_show_help_button (void) G_GNUC_CONST;
-gboolean gimp_export_exif (void) G_GNUC_CONST;
-gboolean gimp_export_xmp (void) G_GNUC_CONST;
-gboolean gimp_export_iptc (void) G_GNUC_CONST;
-GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
-GimpCheckType gimp_check_type (void) G_GNUC_CONST;
-gint32 gimp_default_display (void) G_GNUC_CONST;
-const gchar * gimp_wm_class (void) G_GNUC_CONST;
-const gchar * gimp_display_name (void) G_GNUC_CONST;
-gint gimp_monitor_number (void) G_GNUC_CONST;
-guint32 gimp_user_time (void) G_GNUC_CONST;
-const gchar * gimp_icon_theme_dir (void) G_GNUC_CONST;
-
-const gchar * gimp_get_progname (void) G_GNUC_CONST;
+guint gimp_tile_width (void) G_GNUC_CONST;
+guint gimp_tile_height (void) G_GNUC_CONST;
+gint gimp_shm_ID (void) G_GNUC_CONST;
+guchar * gimp_shm_addr (void) G_GNUC_CONST;
+gdouble gimp_gamma (void) G_GNUC_CONST;
+gboolean gimp_show_help_button (void) G_GNUC_CONST;
+gboolean gimp_export_color_profile (void) G_GNUC_CONST;
+gboolean gimp_export_exif (void) G_GNUC_CONST;
+gboolean gimp_export_xmp (void) G_GNUC_CONST;
+gboolean gimp_export_iptc (void) G_GNUC_CONST;
+GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
+GimpCheckType gimp_check_type (void) G_GNUC_CONST;
+gint32 gimp_default_display (void) G_GNUC_CONST;
+const gchar * gimp_wm_class (void) G_GNUC_CONST;
+const gchar * gimp_display_name (void) G_GNUC_CONST;
+gint gimp_monitor_number (void) G_GNUC_CONST;
+guint32 gimp_user_time (void) G_GNUC_CONST;
+const gchar * gimp_icon_theme_dir (void) G_GNUC_CONST;
+
+const gchar * gimp_get_progname (void) G_GNUC_CONST;
G_END_DECLS
diff --git a/libgimpbase/gimpprotocol.c b/libgimpbase/gimpprotocol.c
index 96b3184053..b65e798bd2 100644
--- a/libgimpbase/gimpprotocol.c
+++ b/libgimpbase/gimpprotocol.c
@@ -500,6 +500,10 @@ _gp_config_read (GIOChannel *channel,
(guint8 *) &config->use_opencl, 1,
user_data))
goto cleanup;
+ if (! _gimp_wire_read_int8 (channel,
+ (guint8 *) &config->export_profile, 1,
+ user_data))
+ goto cleanup;
if (! _gimp_wire_read_int8 (channel,
(guint8 *) &config->export_exif, 1,
user_data))
@@ -584,6 +588,10 @@ _gp_config_write (GIOChannel *channel,
(const guint8 *) &config->use_opencl, 1,
user_data))
return;
+ if (! _gimp_wire_write_int8 (channel,
+ (const guint8 *) &config->export_profile, 1,
+ user_data))
+ return;
if (! _gimp_wire_write_int8 (channel,
(const guint8 *) &config->export_exif, 1,
user_data))
diff --git a/libgimpbase/gimpprotocol.h b/libgimpbase/gimpprotocol.h
index a1667d281f..1af74eabb1 100644
--- a/libgimpbase/gimpprotocol.h
+++ b/libgimpbase/gimpprotocol.h
@@ -26,7 +26,7 @@ G_BEGIN_DECLS
/* Increment every time the protocol changes
*/
-#define GIMP_PROTOCOL_VERSION 0x0100
+#define GIMP_PROTOCOL_VERSION 0x0101
enum
@@ -69,6 +69,7 @@ struct _GPConfig
gint8 show_help_button;
gint8 use_cpu_accel;
gint8 use_opencl;
+ gint8 export_profile;
gint8 export_exif;
gint8 export_xmp;
gint8 export_iptc;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]