plug-ins: Use CMYK profile stored in GimpImage

CMYK profile is now stored in GimpImage on load 
(rather than being discarded) and it's used for export rather than
the default simulation profile stored in Preferences
This commit is contained in:
Alx Sa 2022-07-19 10:56:32 +00:00 committed by Jehan
parent f152e825bf
commit 0f323d0279
4 changed files with 16 additions and 11 deletions

View File

@ -346,11 +346,16 @@ load_image (GFile *file,
{ {
encoding = "cmyk u8"; encoding = "cmyk u8";
if (cmyk_profile) if (cmyk_profile)
space = gimp_color_profile_get_space (cmyk_profile, {
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC, space = gimp_color_profile_get_space (cmyk_profile,
error); GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
error);
gimp_image_set_simulation_profile (image, cmyk_profile);
}
else else
space = NULL; {
space = NULL;
}
} }
else else
{ {

View File

@ -213,7 +213,6 @@ save_image (GFile *file,
FILE * volatile outfile; FILE * volatile outfile;
guchar *data; guchar *data;
guchar *src; guchar *src;
GimpColorConfig *color_config = gimp_get_color_configuration ();
GimpColorProfile *profile = NULL; GimpColorProfile *profile = NULL;
GimpColorProfile *cmyk_profile = NULL; GimpColorProfile *cmyk_profile = NULL;
@ -436,7 +435,7 @@ save_image (GFile *file,
{ {
GError *err = NULL; GError *err = NULL;
cmyk_profile = gimp_color_config_get_simulation_color_profile (color_config, &err); cmyk_profile = gimp_image_get_simulation_profile (image);
if (! cmyk_profile && err) if (! cmyk_profile && err)
g_printerr ("%s: no soft-proof profile: %s\n", G_STRFUNC, err->message); g_printerr ("%s: no soft-proof profile: %s\n", G_STRFUNC, err->message);
@ -838,13 +837,13 @@ destroy_preview (void)
gboolean gboolean
save_dialog (GimpProcedure *procedure, save_dialog (GimpProcedure *procedure,
GimpProcedureConfig *config, GimpProcedureConfig *config,
GimpDrawable *drawable) GimpDrawable *drawable,
GimpImage *image)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *widget; GtkWidget *widget;
GtkWidget *profile_label; GtkWidget *profile_label;
GtkListStore *store; GtkListStore *store;
GimpColorConfig *color_config = gimp_get_color_configuration ();
GimpColorProfile *cmyk_profile = NULL; GimpColorProfile *cmyk_profile = NULL;
gint orig_quality; gint orig_quality;
gint restart; gint restart;
@ -900,7 +899,7 @@ save_dialog (GimpProcedure *procedure,
gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog), gimp_procedure_dialog_fill_frame (GIMP_PROCEDURE_DIALOG (dialog),
"cmyk-frame", "cmyk", FALSE, "cmyk-frame", "cmyk", FALSE,
"profile-label"); "profile-label");
cmyk_profile = gimp_color_config_get_simulation_color_profile (color_config, NULL); cmyk_profile = gimp_image_get_simulation_profile (image);
if (cmyk_profile) if (cmyk_profile)
{ {
if (gimp_color_profile_is_cmyk (cmyk_profile)) if (gimp_color_profile_is_cmyk (cmyk_profile))

View File

@ -32,6 +32,7 @@ gboolean save_image (GFile *file,
GError **error); GError **error);
gboolean save_dialog (GimpProcedure *procedure, gboolean save_dialog (GimpProcedure *procedure,
GimpProcedureConfig *config, GimpProcedureConfig *config,
GimpDrawable *drawable); GimpDrawable *drawable,
GimpImage *image);
#endif /* __JPEG_SAVE_H__ */ #endif /* __JPEG_SAVE_H__ */

View File

@ -590,7 +590,7 @@ jpeg_save (GimpProcedure *procedure,
drawable_global = drawables[0]; drawable_global = drawables[0];
/* First acquire information with a dialog */ /* First acquire information with a dialog */
if (! save_dialog (procedure, config, drawables[0])) if (! save_dialog (procedure, config, drawables[0], orig_image))
{ {
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }