/*
- * Geeqie
- * (C) 2006 John Ellis
- * Copyright (C) 2008 - 2009 The Geeqie Team
+ * Copyright (C) 2006 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
*
* Author: John Ellis
*
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-
#include "main.h"
#include "color-man.h"
#ifdef HAVE_LCMS
/*** color support enabled ***/
+#ifdef HAVE_LCMS2
+#include <lcms2.h>
+#else
#include <lcms.h>
+#endif
typedef struct _ColorManCache ColorManCache;
if (init_done) return;
init_done = TRUE;
+#ifndef HAVE_LCMS2
cmsErrorAction(LCMS_ERROR_IGNORE);
+#endif
}
static cmsHPROFILE color_man_create_adobe_comp(void)
(has_alpha) ? TYPE_RGBA_8 : TYPE_RGB_8,
cc->profile_out,
(has_alpha) ? TYPE_RGBA_8 : TYPE_RGB_8,
- INTENT_PERCEPTUAL, 0);
+ options->color_profile.render_intent, 0);
if (!cc->transform)
{
screen_type, screen_file, screen_data, screen_data_len);
}
+static gchar *color_man_get_profile_name(ColorManProfileType type, cmsHPROFILE profile)
+{
+ switch (type)
+ {
+ case COLOR_PROFILE_SRGB:
+ return g_strdup(_("sRGB"));
+ case COLOR_PROFILE_ADOBERGB:
+ return g_strdup(_("Adobe RGB compatible"));
+ break;
+ case COLOR_PROFILE_MEM:
+ case COLOR_PROFILE_FILE:
+ if (profile)
+ {
+#ifdef HAVE_LCMS2
+ cmsUInt32Number r;
+ char buffer[20];
+ buffer[0] = '\0';
+ r = cmsGetProfileInfoASCII(profile, cmsInfoDescription, "en", "US", buffer, 20);
+ buffer[19] = '\0'; /* Just to be sure */
+ return g_strdup(buffer);
+#else
+ return g_strdup(cmsTakeProductName(profile));
+#endif
+ }
+ return g_strdup(_("Custom profile"));
+ break;
+ case COLOR_PROFILE_NONE:
+ default:
+ return g_strdup("");
+ }
+}
+
+gboolean color_man_get_status(ColorMan *cm, gchar **image_profile, gchar **screen_profile)
+{
+ ColorManCache *cc;
+ if (!cm) return FALSE;
+
+ cc = cm->profile;
+
+ if (image_profile) *image_profile = color_man_get_profile_name(cc->profile_in_type, cc->profile_in);
+ if (screen_profile) *screen_profile = color_man_get_profile_name(cc->profile_out_type, cc->profile_out);
+ return TRUE;
+}
+
void color_man_free(ColorMan *cm)
{
if (!cm) return;
/* no op */
}
+gboolean color_man_get_status(ColorMan *cm, gchar **image_profile, gchar **screen_profile)
+{
+ return FALSE;
+}
+
#endif /* define HAVE_LCMS */
/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */