Author: post
Date: 2011-03-13 22:43:08 +0100 (Sun, 13 Mar 2011)
New Revision: 3877
Modified:
trunk/src/application.h
trunk/src/rs-cache.c
trunk/src/rs-photo.c
trunk/src/rs-toolbox.c
Log:
Save ICC profile selected for each image, and properly apply it when opening
picture.
Modified: trunk/src/application.h
===================================================================
--- trunk/src/application.h 2011-03-13 21:41:36 UTC (rev 3876)
+++ trunk/src/application.h 2011-03-13 21:43:08 UTC (rev 3877)
@@ -48,6 +48,7 @@
RS_RECT *crop;
gdouble angle;
gboolean exported;
+ RSColorSpace *embedded_profile;
RSDcpFile *dcp;
RSIccProfile *icc;
gboolean dispose_has_run;
Modified: trunk/src/rs-cache.c
===================================================================
--- trunk/src/rs-cache.c 2011-03-13 21:41:36 UTC (rev 3876)
+++ trunk/src/rs-cache.c 2011-03-13 21:43:08 UTC (rev 3877)
@@ -83,6 +83,20 @@
dcp_id);
}
+ RSIccProfile *icc = rs_photo_get_icc_profile(photo);
+ if (RS_IS_ICC_PROFILE(icc))
+ {
+ const gchar *icc_filename;
+ g_object_get(icc, "filename", &icc_filename, NULL);
+ if (icc_filename)
+ {
+ gchar *basename = g_path_get_basename(icc_filename);
+ xmlTextWriterWriteFormatElement(writer, BAD_CAST
"icc-profile", "%s",
+ basename);
+ g_free(basename);
+ }
+ }
+
if (photo->crop)
{
xmlTextWriterWriteFormatElement(writer, BAD_CAST "crop", "%d %d
%d %d",
@@ -426,6 +440,18 @@
xmlFree(val);
}
}
+ else if ((!xmlStrcmp(cur->name, BAD_CAST "icc-profile")))
+ {
+ val = xmlNodeListGetString(doc, cur->xmlChildrenNode,
1);
+ if (val)
+ {
+ RSProfileFactory *factory =
rs_profile_factory_new_default();
+ RSIccProfile *icc =
rs_profile_factory_find_icc_from_filename(factory, (gchar *) val);
+ if (icc)
+ rs_photo_set_icc_profile(photo, icc);
+ xmlFree(val);
+ }
+ }
else if ((!xmlStrcmp(cur->name, BAD_CAST "crop")))
{
RS_RECT *crop = g_new0(RS_RECT, 1);
Modified: trunk/src/rs-photo.c
===================================================================
--- trunk/src/rs-photo.c 2011-03-13 21:41:36 UTC (rev 3876)
+++ trunk/src/rs-photo.c 2011-03-13 21:43:08 UTC (rev 3877)
@@ -152,6 +152,7 @@
photo->angle = 0.0;
photo->exported = FALSE;
photo->auto_wb_mul = NULL;
+ photo->embedded_profile = NULL;
}
static void
@@ -805,13 +806,22 @@
if (photo && photo->input_response)
{
- photo->icc =
rs_filter_param_get_object_with_type(RS_FILTER_PARAM(photo->input_response),
"embedded-colorspace", RS_TYPE_COLOR_SPACE);
+ photo->embedded_profile =
rs_filter_param_get_object_with_type(RS_FILTER_PARAM(photo->input_response),
"embedded-colorspace", RS_TYPE_COLOR_SPACE);
+ if (photo->embedded_profile)
+ {
+ photo->icc = NULL;
+ photo->dcp = NULL;
+ }
if (photo->icc)
+ {
+ RSColorSpace *cs =
rs_color_space_icc_new_from_icc(photo->icc);
+ g_object_set(photo->input_response,
"colorspace", cs, NULL);
photo->dcp = NULL;
+ }
}
/* Load default DCP */
- if (!photo->dcp && !photo->icc && photo->metadata &&
photo->metadata->model_ascii)
+ if (!photo->dcp && !photo->icc && !photo->embedded_profile &&
photo->metadata && photo->metadata->model_ascii)
{
RSProfileFactory *factory =
rs_profile_factory_new_default();
const gchar* unique_id = NULL;
Modified: trunk/src/rs-toolbox.c
===================================================================
--- trunk/src/rs-toolbox.c 2011-03-13 21:41:36 UTC (rev 3876)
+++ trunk/src/rs-toolbox.c 2011-03-13 21:43:08 UTC (rev 3877)
@@ -1115,7 +1115,7 @@
photo_finalized(toolbox, NULL);
/* Enable Embedded Profile, if present */
- gboolean embedded_present = photo && (!!photo->icc);
+ gboolean embedded_present = photo && (!!photo->embedded_profile);
if (embedded_present && photo->input_response)
{
RSProfileFactory *factory = rs_profile_factory_new_default();
@@ -1165,11 +1165,14 @@
if (photo)
{
RSDcpFile *dcp_profile = rs_photo_get_dcp_profile(photo);
+ RSIccProfile *icc_profile = rs_photo_get_icc_profile(photo);
if (embedded_present)
gtk_combo_box_set_active(GTK_COMBO_BOX(toolbox->selector), 0);
else if (dcp_profile)
rs_profile_selector_select_profile(toolbox->selector,
dcp_profile);
+ else if (icc_profile)
+ rs_profile_selector_select_profile(toolbox->selector,
icc_profile);
}
toolbox->mute_from_sliders = FALSE;
gtk_widget_set_sensitive(toolbox->transforms, !!(toolbox->photo));
_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit