mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
libgimpcolor, *: change GimpColorProfile to be a GObject
it used to be a typedef to gpointer and actually was a cmsHPROFILE. Change its API to be more "standard", remove the public close() function. The object caches both the cmsHPROFILE and the data/length ICC blob, so conversions between the two become obsolete (simply call get_lcms_profile() or get_icc_profile()). Adapt everything to the new API, but port it in a naive way for now, the code doesn't take advantage of the new possibilities yet (like refcounting).
This commit is contained in:
parent
763e459a92
commit
c102dde92b
33 changed files with 730 additions and 512 deletions
|
@ -52,14 +52,14 @@
|
||||||
/* local function prototypes */
|
/* local function prototypes */
|
||||||
|
|
||||||
static void gimp_image_convert_profile_rgb (GimpImage *image,
|
static void gimp_image_convert_profile_rgb (GimpImage *image,
|
||||||
GimpColorProfile src_profile,
|
GimpColorProfile *src_profile,
|
||||||
GimpColorProfile dest_profile,
|
GimpColorProfile *dest_profile,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc,
|
gboolean bpc,
|
||||||
GimpProgress *progress);
|
GimpProgress *progress);
|
||||||
static void gimp_image_convert_profile_indexed (GimpImage *image,
|
static void gimp_image_convert_profile_indexed (GimpImage *image,
|
||||||
GimpColorProfile src_profile,
|
GimpColorProfile *src_profile,
|
||||||
GimpColorProfile dest_profile,
|
GimpColorProfile *dest_profile,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc,
|
gboolean bpc,
|
||||||
GimpProgress *progress);
|
GimpProgress *progress);
|
||||||
|
@ -133,14 +133,14 @@ gimp_image_validate_icc_profile (GimpImage *image,
|
||||||
gsize length,
|
gsize length,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||||
g_return_val_if_fail (data != NULL, FALSE);
|
g_return_val_if_fail (data != NULL, FALSE);
|
||||||
g_return_val_if_fail (length != 0, FALSE);
|
g_return_val_if_fail (length != 0, FALSE);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_data (data, length, error);
|
profile = gimp_color_profile_new_from_icc_profile (data, length, error);
|
||||||
|
|
||||||
if (! profile)
|
if (! profile)
|
||||||
{
|
{
|
||||||
|
@ -150,11 +150,11 @@ gimp_image_validate_icc_profile (GimpImage *image,
|
||||||
|
|
||||||
if (! gimp_image_validate_color_profile (image, profile, error))
|
if (! gimp_image_validate_color_profile (image, profile, error))
|
||||||
{
|
{
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -219,11 +219,11 @@ gimp_image_set_icc_profile (GimpImage *image,
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_image_validate_color_profile (GimpImage *image,
|
gimp_image_validate_color_profile (GimpImage *image,
|
||||||
GimpColorProfile profile,
|
GimpColorProfile *profile,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||||
g_return_val_if_fail (profile != NULL, FALSE);
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), FALSE);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||||
|
|
||||||
if (gimp_image_get_base_type (image) == GIMP_GRAY)
|
if (gimp_image_get_base_type (image) == GIMP_GRAY)
|
||||||
|
@ -245,7 +245,7 @@ gimp_image_validate_color_profile (GimpImage *image,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_image_get_color_profile (GimpImage *image)
|
gimp_image_get_color_profile (GimpImage *image)
|
||||||
{
|
{
|
||||||
const GimpParasite *parasite;
|
const GimpParasite *parasite;
|
||||||
|
@ -255,53 +255,42 @@ gimp_image_get_color_profile (GimpImage *image)
|
||||||
parasite = gimp_image_get_icc_parasite (image);
|
parasite = gimp_image_get_icc_parasite (image);
|
||||||
|
|
||||||
if (parasite)
|
if (parasite)
|
||||||
return gimp_color_profile_open_from_data (gimp_parasite_data (parasite),
|
return gimp_color_profile_new_from_icc_profile (gimp_parasite_data (parasite),
|
||||||
gimp_parasite_data_size (parasite),
|
gimp_parasite_data_size (parasite),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_image_set_color_profile (GimpImage *image,
|
gimp_image_set_color_profile (GimpImage *image,
|
||||||
GimpColorProfile profile,
|
GimpColorProfile *profile,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
guint8 *data = NULL;
|
const guint8 *data = NULL;
|
||||||
gsize length = 0;
|
gsize length = 0;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||||
|
g_return_val_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile),
|
||||||
|
FALSE);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
data = gimp_color_profile_get_icc_profile (profile, &length);
|
||||||
data = gimp_color_profile_save_to_data (profile, &length, error);
|
|
||||||
if (! data)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! gimp_image_set_icc_profile (image, data, length, error))
|
return gimp_image_set_icc_profile (image, data, length, error);
|
||||||
{
|
|
||||||
g_free (data);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (data);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gimp_image_convert_color_profile (GimpImage *image,
|
gimp_image_convert_color_profile (GimpImage *image,
|
||||||
GimpColorProfile dest_profile,
|
GimpColorProfile *dest_profile,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc,
|
gboolean bpc,
|
||||||
GimpProgress *progress,
|
GimpProgress *progress,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpColorProfile src_profile;
|
GimpColorProfile *src_profile;
|
||||||
GimpColorProfile builtin_profile;
|
GimpColorProfile *builtin_profile;
|
||||||
const Babl *layer_format;
|
const Babl *layer_format;
|
||||||
gchar *src_label;
|
gchar *src_label;
|
||||||
gchar *dest_label;
|
gchar *dest_label;
|
||||||
|
@ -318,7 +307,7 @@ gimp_image_convert_color_profile (GimpImage *image,
|
||||||
|
|
||||||
if (gimp_color_profile_is_equal (src_profile, dest_profile))
|
if (gimp_color_profile_is_equal (src_profile, dest_profile))
|
||||||
{
|
{
|
||||||
gimp_color_profile_close (src_profile);
|
g_object_unref (src_profile);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +342,7 @@ gimp_image_convert_color_profile (GimpImage *image,
|
||||||
gimp_image_set_color_profile (image, dest_profile, NULL);
|
gimp_image_set_color_profile (image, dest_profile, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_profile_close (builtin_profile);
|
g_object_unref (builtin_profile);
|
||||||
|
|
||||||
/* omg... */
|
/* omg... */
|
||||||
gimp_image_parasite_detach (image, "icc-profile-name");
|
gimp_image_parasite_detach (image, "icc-profile-name");
|
||||||
|
@ -383,7 +372,7 @@ gimp_image_convert_color_profile (GimpImage *image,
|
||||||
if (progress)
|
if (progress)
|
||||||
gimp_progress_end (progress);
|
gimp_progress_end (progress);
|
||||||
|
|
||||||
gimp_color_profile_close (src_profile);
|
g_object_unref (src_profile);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -393,8 +382,8 @@ gimp_image_convert_color_profile (GimpImage *image,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_image_convert_profile_rgb (GimpImage *image,
|
gimp_image_convert_profile_rgb (GimpImage *image,
|
||||||
GimpColorProfile src_profile,
|
GimpColorProfile *src_profile,
|
||||||
GimpColorProfile dest_profile,
|
GimpColorProfile *dest_profile,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc,
|
gboolean bpc,
|
||||||
GimpProgress *progress)
|
GimpProgress *progress)
|
||||||
|
@ -413,6 +402,8 @@ gimp_image_convert_profile_rgb (GimpImage *image,
|
||||||
list = g_list_next (list), nth_drawable++)
|
list = g_list_next (list), nth_drawable++)
|
||||||
{
|
{
|
||||||
GimpDrawable *drawable = list->data;
|
GimpDrawable *drawable = list->data;
|
||||||
|
cmsHPROFILE src_lcms;
|
||||||
|
cmsHPROFILE dest_lcms;
|
||||||
const Babl *iter_format;
|
const Babl *iter_format;
|
||||||
cmsUInt32Number lcms_format;
|
cmsUInt32Number lcms_format;
|
||||||
cmsUInt32Number flags;
|
cmsUInt32Number flags;
|
||||||
|
@ -421,6 +412,9 @@ gimp_image_convert_profile_rgb (GimpImage *image,
|
||||||
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
src_lcms = gimp_color_profile_get_lcms_profile (src_profile);
|
||||||
|
dest_lcms = gimp_color_profile_get_lcms_profile (dest_profile);
|
||||||
|
|
||||||
iter_format =
|
iter_format =
|
||||||
gimp_color_profile_get_format (gimp_drawable_get_format (drawable),
|
gimp_color_profile_get_format (gimp_drawable_get_format (drawable),
|
||||||
&lcms_format);
|
&lcms_format);
|
||||||
|
@ -430,8 +424,8 @@ gimp_image_convert_profile_rgb (GimpImage *image,
|
||||||
if (bpc)
|
if (bpc)
|
||||||
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
||||||
|
|
||||||
transform = cmsCreateTransform (src_profile, lcms_format,
|
transform = cmsCreateTransform (src_lcms, lcms_format,
|
||||||
dest_profile, lcms_format,
|
dest_lcms, lcms_format,
|
||||||
intent, flags);
|
intent, flags);
|
||||||
|
|
||||||
if (transform)
|
if (transform)
|
||||||
|
@ -474,21 +468,26 @@ gimp_image_convert_profile_rgb (GimpImage *image,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_image_convert_profile_indexed (GimpImage *image,
|
gimp_image_convert_profile_indexed (GimpImage *image,
|
||||||
GimpColorProfile src_profile,
|
GimpColorProfile *src_profile,
|
||||||
GimpColorProfile dest_profile,
|
GimpColorProfile *dest_profile,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc,
|
gboolean bpc,
|
||||||
GimpProgress *progress)
|
GimpProgress *progress)
|
||||||
{
|
{
|
||||||
GimpColorTransform transform;
|
cmsHPROFILE src_lcms;
|
||||||
|
cmsHPROFILE dest_lcms;
|
||||||
guchar *cmap;
|
guchar *cmap;
|
||||||
gint n_colors;
|
gint n_colors;
|
||||||
|
GimpColorTransform transform;
|
||||||
|
|
||||||
|
src_lcms = gimp_color_profile_get_lcms_profile (src_profile);
|
||||||
|
dest_lcms = gimp_color_profile_get_lcms_profile (dest_profile);
|
||||||
|
|
||||||
n_colors = gimp_image_get_colormap_size (image);
|
n_colors = gimp_image_get_colormap_size (image);
|
||||||
cmap = g_memdup (gimp_image_get_colormap (image), n_colors * 3);
|
cmap = g_memdup (gimp_image_get_colormap (image), n_colors * 3);
|
||||||
|
|
||||||
transform = cmsCreateTransform (src_profile, TYPE_RGB_8,
|
transform = cmsCreateTransform (src_lcms, TYPE_RGB_8,
|
||||||
dest_profile, TYPE_RGB_8,
|
dest_lcms, TYPE_RGB_8,
|
||||||
intent,
|
intent,
|
||||||
cmsFLAGS_NOOPTIMIZE |
|
cmsFLAGS_NOOPTIMIZE |
|
||||||
(bpc ? cmsFLAGS_BLACKPOINTCOMPENSATION : 0));
|
(bpc ? cmsFLAGS_BLACKPOINTCOMPENSATION : 0));
|
||||||
|
|
|
@ -44,15 +44,15 @@ gboolean gimp_image_set_icc_profile (GimpImage *ima
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean gimp_image_validate_color_profile (GimpImage *image,
|
gboolean gimp_image_validate_color_profile (GimpImage *image,
|
||||||
GimpColorProfile profile,
|
GimpColorProfile *profile,
|
||||||
GError **error);
|
GError **error);
|
||||||
GimpColorProfile gimp_image_get_color_profile (GimpImage *image);
|
GimpColorProfile * gimp_image_get_color_profile (GimpImage *image);
|
||||||
gboolean gimp_image_set_color_profile (GimpImage *image,
|
gboolean gimp_image_set_color_profile (GimpImage *image,
|
||||||
GimpColorProfile profile,
|
GimpColorProfile *profile,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
gboolean gimp_image_convert_color_profile (GimpImage *image,
|
gboolean gimp_image_convert_color_profile (GimpImage *image,
|
||||||
GimpColorProfile dest_profile,
|
GimpColorProfile *dest_profile,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc,
|
gboolean bpc,
|
||||||
GimpProgress *progress,
|
GimpProgress *progress,
|
||||||
|
|
|
@ -180,7 +180,7 @@ static void gimp_image_real_colormap_changed (GimpImage *image,
|
||||||
static const guint8 *
|
static const guint8 *
|
||||||
gimp_image_color_managed_get_icc_profile (GimpColorManaged *managed,
|
gimp_image_color_managed_get_icc_profile (GimpColorManaged *managed,
|
||||||
gsize *len);
|
gsize *len);
|
||||||
static GimpColorProfile
|
static GimpColorProfile *
|
||||||
gimp_image_color_managed_get_color_profile (GimpColorManaged *managed);
|
gimp_image_color_managed_get_color_profile (GimpColorManaged *managed);
|
||||||
|
|
||||||
static void gimp_image_projectable_flush (GimpProjectable *projectable,
|
static void gimp_image_projectable_flush (GimpProjectable *projectable,
|
||||||
|
@ -1369,11 +1369,11 @@ gimp_image_color_managed_get_icc_profile (GimpColorManaged *managed,
|
||||||
return gimp_image_get_icc_profile (GIMP_IMAGE (managed), len);
|
return gimp_image_get_icc_profile (GIMP_IMAGE (managed), len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpColorProfile
|
static GimpColorProfile *
|
||||||
gimp_image_color_managed_get_color_profile (GimpColorManaged *managed)
|
gimp_image_color_managed_get_color_profile (GimpColorManaged *managed)
|
||||||
{
|
{
|
||||||
GimpImage *image = GIMP_IMAGE (managed);
|
GimpImage *image = GIMP_IMAGE (managed);
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_image_get_color_profile (image);
|
profile = gimp_image_get_color_profile (image);
|
||||||
|
|
||||||
|
|
|
@ -461,7 +461,7 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
|
||||||
i += print (title, title_len, i, "%s",
|
i += print (title, title_len, i, "%s",
|
||||||
gimp_color_profile_get_label (profile));
|
gimp_color_profile_get_label (profile));
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ static void gimp_display_shell_real_rotated (GimpDisplayShell *shell);
|
||||||
static const guint8 *
|
static const guint8 *
|
||||||
gimp_display_shell_get_icc_profile(GimpColorManaged *managed,
|
gimp_display_shell_get_icc_profile(GimpColorManaged *managed,
|
||||||
gsize *len);
|
gsize *len);
|
||||||
static GimpColorProfile
|
static GimpColorProfile *
|
||||||
gimp_display_shell_get_color_profile(GimpColorManaged *managed);
|
gimp_display_shell_get_color_profile(GimpColorManaged *managed);
|
||||||
static void gimp_display_shell_profile_changed(GimpColorManaged *managed);
|
static void gimp_display_shell_profile_changed(GimpColorManaged *managed);
|
||||||
|
|
||||||
|
@ -1138,7 +1138,7 @@ gimp_display_shell_get_icc_profile (GimpColorManaged *managed,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpColorProfile
|
static GimpColorProfile *
|
||||||
gimp_display_shell_get_color_profile (GimpColorManaged *managed)
|
gimp_display_shell_get_color_profile (GimpColorManaged *managed)
|
||||||
{
|
{
|
||||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (managed);
|
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (managed);
|
||||||
|
|
|
@ -60,18 +60,21 @@ image_get_color_profile_invoker (GimpProcedure *procedure,
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_image_get_color_profile (image);
|
profile = gimp_image_get_color_profile (image);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
gsize length;
|
const guint8 *data;
|
||||||
|
gsize length;
|
||||||
|
|
||||||
profile_data = gimp_color_profile_save_to_data (profile, &length, NULL);
|
data = gimp_color_profile_get_icc_profile (profile, &length);
|
||||||
|
|
||||||
|
profile_data = g_memdup (data, length);
|
||||||
num_bytes = length;
|
num_bytes = length;
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,15 +111,16 @@ image_set_color_profile_invoker (GimpProcedure *procedure,
|
||||||
{
|
{
|
||||||
if (color_profile)
|
if (color_profile)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_data (color_profile, num_bytes,
|
profile = gimp_color_profile_new_from_icc_profile (color_profile,
|
||||||
error);
|
num_bytes,
|
||||||
|
error);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
success = gimp_image_set_color_profile (image, profile, error);
|
success = gimp_image_set_color_profile (image, profile, error);
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
|
@ -149,15 +153,18 @@ image_get_effective_color_profile_invoker (GimpProcedure *procedure,
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
gsize length;
|
const guint8 *data;
|
||||||
|
gsize length;
|
||||||
|
|
||||||
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
||||||
|
|
||||||
profile_data = gimp_color_profile_save_to_data (profile, &length, NULL);
|
data = gimp_color_profile_get_icc_profile (profile, &length);
|
||||||
|
|
||||||
|
profile_data = g_memdup (data, length);
|
||||||
num_bytes = length;
|
num_bytes = length;
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return_vals = gimp_procedure_get_return_values (procedure, success,
|
return_vals = gimp_procedure_get_return_values (procedure, success,
|
||||||
|
@ -197,16 +204,18 @@ image_convert_color_profile_invoker (GimpProcedure *procedure,
|
||||||
{
|
{
|
||||||
if (color_profile)
|
if (color_profile)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_data (color_profile, num_bytes,
|
profile = gimp_color_profile_new_from_icc_profile (color_profile,
|
||||||
error);
|
num_bytes,
|
||||||
|
error);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
success = gimp_image_convert_color_profile (image, profile,
|
success = gimp_image_convert_color_profile (image, profile,
|
||||||
intent, bpc,
|
intent, bpc,
|
||||||
progress, error);
|
progress, error);
|
||||||
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
|
|
|
@ -1880,7 +1880,7 @@ plug_in_icc_profile_info_invoker (GimpProcedure *procedure,
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
||||||
|
|
||||||
|
@ -1888,7 +1888,7 @@ plug_in_icc_profile_info_invoker (GimpProcedure *procedure,
|
||||||
profile_desc = gimp_color_profile_get_description (profile);
|
profile_desc = gimp_color_profile_get_description (profile);
|
||||||
profile_info = gimp_color_profile_get_summary (profile);
|
profile_info = gimp_color_profile_get_summary (profile);
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1928,9 +1928,9 @@ plug_in_icc_profile_file_info_invoker (GimpProcedure *procedure,
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
GimpColorProfile p;
|
GimpColorProfile *p;
|
||||||
|
|
||||||
p = gimp_color_profile_open_from_file (file, error);
|
p = gimp_color_profile_new_from_file (file, error);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
|
@ -1939,7 +1939,7 @@ plug_in_icc_profile_file_info_invoker (GimpProcedure *procedure,
|
||||||
profile_desc = gimp_color_profile_get_description (p);
|
profile_desc = gimp_color_profile_get_description (p);
|
||||||
profile_info = gimp_color_profile_get_summary (p);
|
profile_info = gimp_color_profile_get_summary (p);
|
||||||
|
|
||||||
gimp_color_profile_close (p);
|
g_object_unref (p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
|
|
|
@ -103,7 +103,7 @@ gimp_image_profile_view_update (GimpImageParasiteView *view)
|
||||||
GimpImageProfileView *profile_view = GIMP_IMAGE_PROFILE_VIEW (view);
|
GimpImageProfileView *profile_view = GIMP_IMAGE_PROFILE_VIEW (view);
|
||||||
GimpImage *image;
|
GimpImage *image;
|
||||||
GimpColorManaged *managed;
|
GimpColorManaged *managed;
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
image = gimp_image_parasite_view_get_image (view);
|
image = gimp_image_parasite_view_get_image (view);
|
||||||
managed = GIMP_COLOR_MANAGED (image);
|
managed = GIMP_COLOR_MANAGED (image);
|
||||||
|
@ -112,5 +112,5 @@ gimp_image_profile_view_update (GimpImageParasiteView *view)
|
||||||
|
|
||||||
gimp_color_profile_view_set_profile (profile_view->profile_view, profile);
|
gimp_color_profile_view_set_profile (profile_view->profile_view, profile);
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,11 @@
|
||||||
* image has no color profile assigned.
|
* image has no color profile assigned.
|
||||||
*
|
*
|
||||||
* Returns: The image's color profile. The returned value
|
* Returns: The image's color profile. The returned value
|
||||||
* must be freed with gimp_color_profile_close().
|
* must be freed with g_object_unref().
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_image_get_color_profile (gint32 image_ID)
|
gimp_image_get_color_profile (gint32 image_ID)
|
||||||
{
|
{
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
@ -47,9 +47,9 @@ gimp_image_get_color_profile (gint32 image_ID)
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_data (data, length, NULL);
|
profile = gimp_color_profile_new_from_icc_profile (data, length, NULL);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
|
@ -72,28 +72,24 @@ gimp_image_get_color_profile (gint32 image_ID)
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gimp_image_set_color_profile (gint32 image_ID,
|
gimp_image_set_color_profile (gint32 image_ID,
|
||||||
GimpColorProfile profile)
|
GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
guint8 *data = NULL;
|
const guint8 *data = NULL;
|
||||||
gint length = 0;
|
gint length = 0;
|
||||||
gboolean success;
|
|
||||||
|
g_return_val_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile),
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
gsize l;
|
gsize l;
|
||||||
|
|
||||||
data = gimp_color_profile_save_to_data (profile, &l, NULL);
|
data = gimp_color_profile_get_icc_profile (profile, &l);
|
||||||
length = l;
|
length = l;
|
||||||
|
|
||||||
if (! data)
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
success = _gimp_image_set_color_profile (image_ID, length, data);
|
return _gimp_image_set_color_profile (image_ID, length, data);
|
||||||
g_free (data);
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,11 +106,11 @@ gimp_image_set_color_profile (gint32 image_ID,
|
||||||
* in preferences either, a generated default RGB profile is returned.
|
* in preferences either, a generated default RGB profile is returned.
|
||||||
*
|
*
|
||||||
* Returns: The color profile. The returned value
|
* Returns: The color profile. The returned value
|
||||||
* must be freed with gimp_color_profile_close().
|
* must be freed with g_object_unref().
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_image_get_effective_color_profile (gint32 image_ID)
|
gimp_image_get_effective_color_profile (gint32 image_ID)
|
||||||
{
|
{
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
@ -124,9 +120,9 @@ gimp_image_get_effective_color_profile (gint32 image_ID)
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_data (data, length, NULL);
|
profile = gimp_color_profile_new_from_icc_profile (data, length, NULL);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
|
@ -138,9 +134,9 @@ gimp_image_get_effective_color_profile (gint32 image_ID)
|
||||||
/**
|
/**
|
||||||
* gimp_image_convert_color_profile:
|
* gimp_image_convert_color_profile:
|
||||||
* @image_ID: The image.
|
* @image_ID: The image.
|
||||||
* @profile: The color profile to convert to.
|
* @profile: The color profile to convert to.
|
||||||
* @intent: Rendering intent.
|
* @intent: Rendering intent.
|
||||||
* @bpc: Black point compensation.
|
* @bpc: Black point compensation.
|
||||||
*
|
*
|
||||||
* Convert the image's layers to a color profile
|
* Convert the image's layers to a color profile
|
||||||
*
|
*
|
||||||
|
@ -153,29 +149,25 @@ gimp_image_get_effective_color_profile (gint32 image_ID)
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gimp_image_convert_color_profile (gint32 image_ID,
|
gimp_image_convert_color_profile (gint32 image_ID,
|
||||||
GimpColorProfile profile,
|
GimpColorProfile *profile,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc)
|
gboolean bpc)
|
||||||
{
|
{
|
||||||
guint8 *data = NULL;
|
const guint8 *data = NULL;
|
||||||
gint length = 0;
|
gint length = 0;
|
||||||
gboolean success;
|
|
||||||
|
g_return_val_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile),
|
||||||
|
NULL);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
gsize l;
|
gsize l;
|
||||||
|
|
||||||
data = gimp_color_profile_save_to_data (profile, &l, NULL);
|
data = gimp_color_profile_get_icc_profile (profile, &l);
|
||||||
length = l;
|
length = l;
|
||||||
|
|
||||||
if (! data)
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
success = _gimp_image_convert_color_profile (image_ID, length, data,
|
return _gimp_image_convert_color_profile (image_ID, length, data,
|
||||||
intent, bpc);
|
intent, bpc);
|
||||||
g_free (data);
|
|
||||||
|
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,16 +30,17 @@ G_BEGIN_DECLS
|
||||||
/* For information look into the C source or the html documentation */
|
/* For information look into the C source or the html documentation */
|
||||||
|
|
||||||
|
|
||||||
GimpColorProfile gimp_image_get_color_profile (gint32 image_ID);
|
GimpColorProfile * gimp_image_get_color_profile (gint32 image_ID);
|
||||||
gboolean gimp_image_set_color_profile (gint32 image_ID,
|
gboolean gimp_image_set_color_profile (gint32 image_ID,
|
||||||
GimpColorProfile profile);
|
GimpColorProfile *profile);
|
||||||
|
|
||||||
GimpColorProfile gimp_image_get_effective_color_profile (gint32 image_ID);
|
GimpColorProfile * gimp_image_get_effective_color_profile (gint32 image_ID);
|
||||||
|
|
||||||
|
gboolean gimp_image_convert_color_profile (gint32 image_ID,
|
||||||
|
GimpColorProfile *profile,
|
||||||
|
GimpColorRenderingIntent intent,
|
||||||
|
gboolean bpc);
|
||||||
|
|
||||||
gboolean gimp_image_convert_color_profile (gint32 image_ID,
|
|
||||||
GimpColorProfile profile,
|
|
||||||
GimpColorRenderingIntent intent,
|
|
||||||
gboolean bpc);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -25,22 +25,23 @@ EXPORTS
|
||||||
gimp_color_managed_get_icc_profile
|
gimp_color_managed_get_icc_profile
|
||||||
gimp_color_managed_interface_get_type
|
gimp_color_managed_interface_get_type
|
||||||
gimp_color_managed_profile_changed
|
gimp_color_managed_profile_changed
|
||||||
gimp_color_profile_close
|
|
||||||
gimp_color_profile_get_copyright
|
gimp_color_profile_get_copyright
|
||||||
gimp_color_profile_get_description
|
gimp_color_profile_get_description
|
||||||
gimp_color_profile_get_format
|
gimp_color_profile_get_format
|
||||||
|
gimp_color_profile_get_icc_profile
|
||||||
gimp_color_profile_get_label
|
gimp_color_profile_get_label
|
||||||
|
gimp_color_profile_get_lcms_profile
|
||||||
gimp_color_profile_get_manufacturer
|
gimp_color_profile_get_manufacturer
|
||||||
gimp_color_profile_get_model
|
gimp_color_profile_get_model
|
||||||
gimp_color_profile_get_summary
|
gimp_color_profile_get_summary
|
||||||
gimp_color_profile_is_cmyk
|
gimp_color_profile_is_cmyk
|
||||||
gimp_color_profile_is_equal
|
gimp_color_profile_is_equal
|
||||||
gimp_color_profile_is_rgb
|
gimp_color_profile_is_rgb
|
||||||
|
gimp_color_profile_new_from_file
|
||||||
|
gimp_color_profile_new_from_icc_profile
|
||||||
|
gimp_color_profile_new_from_lcms_profile
|
||||||
gimp_color_profile_new_linear_rgb
|
gimp_color_profile_new_linear_rgb
|
||||||
gimp_color_profile_new_srgb
|
gimp_color_profile_new_srgb
|
||||||
gimp_color_profile_open_from_data
|
|
||||||
gimp_color_profile_open_from_file
|
|
||||||
gimp_color_profile_save_to_data
|
|
||||||
gimp_hsl_get_type
|
gimp_hsl_get_type
|
||||||
gimp_hsl_set
|
gimp_hsl_set
|
||||||
gimp_hsl_set_alpha
|
gimp_hsl_set_alpha
|
||||||
|
|
|
@ -141,7 +141,7 @@ gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_color_managed_get_color_profile (GimpColorManaged *managed)
|
gimp_color_managed_get_color_profile (GimpColorManaged *managed)
|
||||||
{
|
{
|
||||||
GimpColorManagedInterface *iface;
|
GimpColorManagedInterface *iface;
|
||||||
|
|
|
@ -51,17 +51,17 @@ struct _GimpColorManagedInterface
|
||||||
void (* profile_changed) (GimpColorManaged *managed);
|
void (* profile_changed) (GimpColorManaged *managed);
|
||||||
|
|
||||||
/* virtual functions */
|
/* virtual functions */
|
||||||
GimpColorProfile (* get_color_profile) (GimpColorManaged *managed);
|
GimpColorProfile * (* get_color_profile) (GimpColorManaged *managed);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_color_managed_interface_get_type (void) G_GNUC_CONST;
|
GType gimp_color_managed_interface_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
const guint8 * gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
|
const guint8 * gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
|
||||||
gsize *len);
|
gsize *len);
|
||||||
GimpColorProfile gimp_color_managed_get_color_profile (GimpColorManaged *managed);
|
GimpColorProfile * gimp_color_managed_get_color_profile (GimpColorManaged *managed);
|
||||||
|
|
||||||
void gimp_color_managed_profile_changed (GimpColorManaged *managed);
|
void gimp_color_managed_profile_changed (GimpColorManaged *managed);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -58,6 +58,23 @@
|
||||||
#define GIMP_LCMS_MD5_DIGEST_LENGTH 16
|
#define GIMP_LCMS_MD5_DIGEST_LENGTH 16
|
||||||
|
|
||||||
|
|
||||||
|
struct _GimpColorProfilePrivate
|
||||||
|
{
|
||||||
|
cmsHPROFILE lcms_profile;
|
||||||
|
guint8 *data;
|
||||||
|
gsize length;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
static void gimp_color_profile_finalize (GObject *object);
|
||||||
|
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (GimpColorProfile, gimp_color_profile,
|
||||||
|
G_TYPE_OBJECT);
|
||||||
|
|
||||||
|
#define parent_class gimp_color_profile_parent_class
|
||||||
|
|
||||||
|
|
||||||
static GQuark
|
static GQuark
|
||||||
gimp_color_profile_error_quark (void)
|
gimp_color_profile_error_quark (void)
|
||||||
{
|
{
|
||||||
|
@ -69,8 +86,48 @@ gimp_color_profile_error_quark (void)
|
||||||
return quark;
|
return quark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_profile_class_init (GimpColorProfileClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->finalize = gimp_color_profile_finalize;
|
||||||
|
|
||||||
|
g_type_class_add_private (klass, sizeof (GimpColorProfilePrivate));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_profile_init (GimpColorProfile *profile)
|
||||||
|
{
|
||||||
|
profile->priv = G_TYPE_INSTANCE_GET_PRIVATE (profile,
|
||||||
|
GIMP_TYPE_COLOR_PROFILE,
|
||||||
|
GimpColorProfilePrivate);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_profile_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
GimpColorProfile *profile = GIMP_COLOR_PROFILE (object);
|
||||||
|
|
||||||
|
if (profile->priv->lcms_profile)
|
||||||
|
{
|
||||||
|
cmsCloseProfile (profile->priv->lcms_profile);
|
||||||
|
profile->priv->lcms_profile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profile->priv->data)
|
||||||
|
{
|
||||||
|
g_free (profile->priv->data);
|
||||||
|
profile->priv->data = NULL;
|
||||||
|
profile->priv->length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_color_profile_open_from_file:
|
* gimp_color_profile_new_from_file:
|
||||||
* @file: a #GFile
|
* @file: a #GFile
|
||||||
* @error: return location for #GError
|
* @error: return location for #GError
|
||||||
*
|
*
|
||||||
|
@ -81,11 +138,14 @@ gimp_color_profile_error_quark (void)
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_color_profile_open_from_file (GFile *file,
|
gimp_color_profile_new_from_file (GFile *file,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
|
cmsHPROFILE lcms_profile = NULL;
|
||||||
|
guint8 *data = NULL;
|
||||||
|
gsize length = 0;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
g_return_val_if_fail (G_IS_FILE (file), NULL);
|
||||||
|
@ -96,18 +156,16 @@ gimp_color_profile_open_from_file (GFile *file,
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
GMappedFile *mapped;
|
GMappedFile *mapped;
|
||||||
const guint8 *data;
|
|
||||||
gsize length;
|
|
||||||
|
|
||||||
mapped = g_mapped_file_new (path, FALSE, error);
|
mapped = g_mapped_file_new (path, FALSE, error);
|
||||||
|
|
||||||
if (! mapped)
|
if (! mapped)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
data = (const guint8 *) g_mapped_file_get_contents (mapped);
|
|
||||||
length = g_mapped_file_get_length (mapped);
|
length = g_mapped_file_get_length (mapped);
|
||||||
|
data = g_memdup (g_mapped_file_get_contents (mapped), length);
|
||||||
|
|
||||||
profile = cmsOpenProfileFromMem (data, length);
|
lcms_profile = cmsOpenProfileFromMem (data, length);
|
||||||
|
|
||||||
g_mapped_file_unref (mapped);
|
g_mapped_file_unref (mapped);
|
||||||
}
|
}
|
||||||
|
@ -122,8 +180,9 @@ gimp_color_profile_open_from_file (GFile *file,
|
||||||
if (info)
|
if (info)
|
||||||
{
|
{
|
||||||
GInputStream *input;
|
GInputStream *input;
|
||||||
goffset length = g_file_info_get_size (info);
|
|
||||||
guint8 *data = g_malloc (length);
|
length = g_file_info_get_size (info);
|
||||||
|
data = g_malloc (length);
|
||||||
|
|
||||||
g_object_unref (info);
|
g_object_unref (info);
|
||||||
|
|
||||||
|
@ -137,26 +196,40 @@ gimp_color_profile_open_from_file (GFile *file,
|
||||||
&bytes_read, NULL, error) &&
|
&bytes_read, NULL, error) &&
|
||||||
bytes_read == length)
|
bytes_read == length)
|
||||||
{
|
{
|
||||||
profile = cmsOpenProfileFromMem (data, length);
|
lcms_profile = cmsOpenProfileFromMem (data, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (input);
|
g_object_unref (input);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! profile && error && *error == NULL)
|
if (lcms_profile)
|
||||||
g_set_error (error, gimp_color_profile_error_quark (), 0,
|
{
|
||||||
_("'%s' does not appear to be an ICC color profile"),
|
profile = g_object_new (GIMP_TYPE_COLOR_PROFILE, NULL);
|
||||||
gimp_file_get_utf8_name (file));
|
|
||||||
|
profile->priv->lcms_profile = lcms_profile;
|
||||||
|
profile->priv->data = data;
|
||||||
|
profile->priv->length = length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (data)
|
||||||
|
g_free (data);
|
||||||
|
|
||||||
|
if (error && *error == NULL)
|
||||||
|
{
|
||||||
|
g_set_error (error, gimp_color_profile_error_quark (), 0,
|
||||||
|
_("'%s' does not appear to be an ICC color profile"),
|
||||||
|
gimp_file_get_utf8_name (file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_color_profile_open_from_data:
|
* gimp_color_profile_new_from_icc_profile:
|
||||||
* @data: pointer to memory containing an ICC profile
|
* @data: pointer to memory containing an ICC profile
|
||||||
* @length: lenght of the profile in memory, in bytes
|
* @length: lenght of the profile in memory, in bytes
|
||||||
* @error: return location for #GError
|
* @error: return location for #GError
|
||||||
|
@ -168,60 +241,82 @@ gimp_color_profile_open_from_file (GFile *file,
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_color_profile_open_from_data (const guint8 *data,
|
gimp_color_profile_new_from_icc_profile (const guint8 *data,
|
||||||
gsize length,
|
gsize length,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
cmsHPROFILE lcms_profile;
|
||||||
|
GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, NULL);
|
g_return_val_if_fail (data != NULL, NULL);
|
||||||
g_return_val_if_fail (length > 0, NULL);
|
g_return_val_if_fail (length > 0, NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
profile = cmsOpenProfileFromMem (data, length);
|
lcms_profile = cmsOpenProfileFromMem (data, length);
|
||||||
|
|
||||||
if (! profile)
|
if (lcms_profile)
|
||||||
g_set_error_literal (error, gimp_color_profile_error_quark (), 0,
|
{
|
||||||
_("Data does not appear to be an ICC color profile"));
|
profile = g_object_new (GIMP_TYPE_COLOR_PROFILE, NULL);
|
||||||
|
|
||||||
|
profile->priv->lcms_profile = lcms_profile;
|
||||||
|
profile->priv->data = g_memdup (data, length);
|
||||||
|
profile->priv->length = length;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_set_error_literal (error, gimp_color_profile_error_quark (), 0,
|
||||||
|
_("Data does not appear to be an ICC color profile"));
|
||||||
|
}
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_color_profile_dave_to_data:
|
* gimp_color_profile_new_from_lcms_profile:
|
||||||
* @profile: a #GimpColorProfile
|
* @lcms_profile: an LCMS cmsHPROFILE pointer
|
||||||
* @length: return location for the number of bytes written
|
* @error: return location for #GError
|
||||||
* @error: return location for #GError
|
|
||||||
*
|
*
|
||||||
* This function saves @profile to an ICC color profile in newly
|
* This function creates a GimpColorProfile from a cmsHPROFILE. On
|
||||||
* allocated memory. On error, %NULL is returned and @error is set.
|
* error, %NULL is returned and @error is set. The passed
|
||||||
|
* @lcms_profile pointer is not retained by the created
|
||||||
|
* #GimpColorProfile.
|
||||||
*
|
*
|
||||||
* Return value: a pointer to the written IIC profile in memory, or
|
* Return value: the #GimpColorProfile, or %NULL.
|
||||||
* %NULL. Free with g_free().
|
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
guint8 *
|
GimpColorProfile *
|
||||||
gimp_color_profile_save_to_data (GimpColorProfile profile,
|
gimp_color_profile_new_from_lcms_profile (gpointer lcms_profile,
|
||||||
gsize *length,
|
GError **error)
|
||||||
GError **error)
|
|
||||||
{
|
{
|
||||||
cmsUInt32Number size;
|
cmsUInt32Number size;
|
||||||
|
|
||||||
g_return_val_if_fail (profile != NULL, NULL);
|
g_return_val_if_fail (lcms_profile != NULL, NULL);
|
||||||
g_return_val_if_fail (length != NULL, NULL);
|
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
|
||||||
if (cmsSaveProfileToMem (profile, NULL, &size))
|
if (cmsSaveProfileToMem (lcms_profile, NULL, &size))
|
||||||
{
|
{
|
||||||
guint8 *data = g_malloc (size);
|
guint8 *data = g_malloc (size);
|
||||||
|
|
||||||
if (cmsSaveProfileToMem (profile, data, &size))
|
if (cmsSaveProfileToMem (lcms_profile, data, &size))
|
||||||
{
|
{
|
||||||
*length = size;
|
gsize length = size;
|
||||||
|
|
||||||
return data;
|
lcms_profile = cmsOpenProfileFromMem (data, length);
|
||||||
|
|
||||||
|
if (lcms_profile)
|
||||||
|
{
|
||||||
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
|
profile = g_object_new (GIMP_TYPE_COLOR_PROFILE, NULL);
|
||||||
|
|
||||||
|
profile->priv->lcms_profile = lcms_profile;
|
||||||
|
profile->priv->data = data;
|
||||||
|
profile->priv->length = length;
|
||||||
|
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (data);
|
g_free (data);
|
||||||
|
@ -234,37 +329,65 @@ gimp_color_profile_save_to_data (GimpColorProfile profile,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_color_profile_close:
|
* gimp_color_profile_get_icc_profile:
|
||||||
* @profile: a #GimpColorProfile
|
* @profile: a #GimpColorProfile
|
||||||
|
* @length: return location for the number of bytes
|
||||||
|
* @error: return location for #GError
|
||||||
*
|
*
|
||||||
* This function closes a #GimpColorProfile and frees its memory.
|
* This function returns @profile as ICC profile data. The returned
|
||||||
|
* memory belongs to @profile and must not be modified or freed.
|
||||||
|
*
|
||||||
|
* Return value: a pointer to the IIC profile data.
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
void
|
const guint8 *
|
||||||
gimp_color_profile_close (GimpColorProfile profile)
|
gimp_color_profile_get_icc_profile (GimpColorProfile *profile,
|
||||||
|
gsize *length)
|
||||||
{
|
{
|
||||||
g_return_if_fail (profile != NULL);
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL);
|
||||||
|
g_return_val_if_fail (length != NULL, NULL);
|
||||||
|
|
||||||
cmsCloseProfile (profile);
|
*length = profile->priv->length;
|
||||||
|
|
||||||
|
return profile->priv->data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gimp_color_profile_get_lcms_profile:
|
||||||
|
* @profile: a #GimpColorProfile
|
||||||
|
*
|
||||||
|
* This function returns @profile's cmsHPROFILE. The returned
|
||||||
|
* value belongs to @profile and must not be modified or freed.
|
||||||
|
*
|
||||||
|
* Return value: a pointer to the cmsHPROFILE.
|
||||||
|
*
|
||||||
|
* Since: 2.10
|
||||||
|
**/
|
||||||
|
gpointer
|
||||||
|
gimp_color_profile_get_lcms_profile (GimpColorProfile *profile)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL);
|
||||||
|
|
||||||
|
return profile->priv->lcms_profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
gimp_color_profile_get_info (GimpColorProfile profile,
|
gimp_color_profile_get_info (GimpColorProfile *profile,
|
||||||
cmsInfoType info)
|
cmsInfoType info)
|
||||||
{
|
{
|
||||||
cmsUInt32Number size;
|
cmsUInt32Number size;
|
||||||
gchar *text = NULL;
|
gchar *text = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (profile != NULL, NULL);
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL);
|
||||||
|
|
||||||
size = cmsGetProfileInfoASCII (profile, info,
|
size = cmsGetProfileInfoASCII (profile->priv->lcms_profile, info,
|
||||||
"en", "US", NULL, 0);
|
"en", "US", NULL, 0);
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
gchar *data = g_new (gchar, size + 1);
|
gchar *data = g_new (gchar, size + 1);
|
||||||
|
|
||||||
size = cmsGetProfileInfoASCII (profile, info,
|
size = cmsGetProfileInfoASCII (profile->priv->lcms_profile, info,
|
||||||
"en", "US", data, size);
|
"en", "US", data, size);
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
text = gimp_any_to_utf8 (data, -1, NULL);
|
text = gimp_any_to_utf8 (data, -1, NULL);
|
||||||
|
@ -285,7 +408,7 @@ gimp_color_profile_get_info (GimpColorProfile profile,
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gchar *
|
gchar *
|
||||||
gimp_color_profile_get_description (GimpColorProfile profile)
|
gimp_color_profile_get_description (GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
return gimp_color_profile_get_info (profile, cmsInfoDescription);
|
return gimp_color_profile_get_info (profile, cmsInfoDescription);
|
||||||
}
|
}
|
||||||
|
@ -300,7 +423,7 @@ gimp_color_profile_get_description (GimpColorProfile profile)
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gchar *
|
gchar *
|
||||||
gimp_color_profile_get_manufacturer (GimpColorProfile profile)
|
gimp_color_profile_get_manufacturer (GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
return gimp_color_profile_get_info (profile, cmsInfoManufacturer);
|
return gimp_color_profile_get_info (profile, cmsInfoManufacturer);
|
||||||
}
|
}
|
||||||
|
@ -315,7 +438,7 @@ gimp_color_profile_get_manufacturer (GimpColorProfile profile)
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gchar *
|
gchar *
|
||||||
gimp_color_profile_get_model (GimpColorProfile profile)
|
gimp_color_profile_get_model (GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
return gimp_color_profile_get_info (profile, cmsInfoModel);
|
return gimp_color_profile_get_info (profile, cmsInfoModel);
|
||||||
}
|
}
|
||||||
|
@ -330,7 +453,7 @@ gimp_color_profile_get_model (GimpColorProfile profile)
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gchar *
|
gchar *
|
||||||
gimp_color_profile_get_copyright (GimpColorProfile profile)
|
gimp_color_profile_get_copyright (GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
return gimp_color_profile_get_info (profile, cmsInfoCopyright);
|
return gimp_color_profile_get_info (profile, cmsInfoCopyright);
|
||||||
}
|
}
|
||||||
|
@ -348,11 +471,11 @@ gimp_color_profile_get_copyright (GimpColorProfile profile)
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gchar *
|
gchar *
|
||||||
gimp_color_profile_get_label (GimpColorProfile profile)
|
gimp_color_profile_get_label (GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
gchar *label;
|
gchar *label;
|
||||||
|
|
||||||
g_return_val_if_fail (profile != NULL, NULL);
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL);
|
||||||
|
|
||||||
label = gimp_color_profile_get_description (profile);
|
label = gimp_color_profile_get_description (profile);
|
||||||
|
|
||||||
|
@ -391,12 +514,12 @@ gimp_color_profile_get_label (GimpColorProfile profile)
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gchar *
|
gchar *
|
||||||
gimp_color_profile_get_summary (GimpColorProfile profile)
|
gimp_color_profile_get_summary (GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
GString *string;
|
GString *string;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
|
||||||
g_return_val_if_fail (profile != NULL, NULL);
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), NULL);
|
||||||
|
|
||||||
string = g_string_new (NULL);
|
string = g_string_new (NULL);
|
||||||
|
|
||||||
|
@ -414,6 +537,7 @@ gimp_color_profile_get_summary (GimpColorProfile profile)
|
||||||
g_string_append (string, "\n");
|
g_string_append (string, "\n");
|
||||||
|
|
||||||
g_string_append (string, text);
|
g_string_append (string, text);
|
||||||
|
g_free (text);
|
||||||
}
|
}
|
||||||
|
|
||||||
text = gimp_color_profile_get_manufacturer (profile);
|
text = gimp_color_profile_get_manufacturer (profile);
|
||||||
|
@ -423,6 +547,7 @@ gimp_color_profile_get_summary (GimpColorProfile profile)
|
||||||
g_string_append (string, "\n");
|
g_string_append (string, "\n");
|
||||||
|
|
||||||
g_string_append (string, text);
|
g_string_append (string, text);
|
||||||
|
g_free (text);
|
||||||
}
|
}
|
||||||
|
|
||||||
text = gimp_color_profile_get_copyright (profile);
|
text = gimp_color_profile_get_copyright (profile);
|
||||||
|
@ -432,6 +557,7 @@ gimp_color_profile_get_summary (GimpColorProfile profile)
|
||||||
g_string_append (string, "\n");
|
g_string_append (string, "\n");
|
||||||
|
|
||||||
g_string_append (string, text);
|
g_string_append (string, text);
|
||||||
|
g_free (text);
|
||||||
}
|
}
|
||||||
|
|
||||||
return g_string_free (string, FALSE);
|
return g_string_free (string, FALSE);
|
||||||
|
@ -449,23 +575,23 @@ gimp_color_profile_get_summary (GimpColorProfile profile)
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gimp_color_profile_is_equal (GimpColorProfile profile1,
|
gimp_color_profile_is_equal (GimpColorProfile *profile1,
|
||||||
GimpColorProfile profile2)
|
GimpColorProfile *profile2)
|
||||||
{
|
{
|
||||||
cmsUInt8Number digest1[GIMP_LCMS_MD5_DIGEST_LENGTH];
|
cmsUInt8Number digest1[GIMP_LCMS_MD5_DIGEST_LENGTH];
|
||||||
cmsUInt8Number digest2[GIMP_LCMS_MD5_DIGEST_LENGTH];
|
cmsUInt8Number digest2[GIMP_LCMS_MD5_DIGEST_LENGTH];
|
||||||
|
|
||||||
g_return_val_if_fail (profile1 != NULL, FALSE);
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile1), FALSE);
|
||||||
g_return_val_if_fail (profile2 != NULL, FALSE);
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile1), FALSE);
|
||||||
|
|
||||||
if (! cmsMD5computeID (profile1) ||
|
if (! cmsMD5computeID (profile1->priv->lcms_profile) ||
|
||||||
! cmsMD5computeID (profile2))
|
! cmsMD5computeID (profile2->priv->lcms_profile))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmsGetHeaderProfileID (profile1, digest1);
|
cmsGetHeaderProfileID (profile1->priv->lcms_profile, digest1);
|
||||||
cmsGetHeaderProfileID (profile2, digest2);
|
cmsGetHeaderProfileID (profile2->priv->lcms_profile, digest2);
|
||||||
|
|
||||||
return (memcmp (digest1, digest2, GIMP_LCMS_MD5_DIGEST_LENGTH) == 0);
|
return (memcmp (digest1, digest2, GIMP_LCMS_MD5_DIGEST_LENGTH) == 0);
|
||||||
}
|
}
|
||||||
|
@ -480,11 +606,11 @@ gimp_color_profile_is_equal (GimpColorProfile profile1,
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gimp_color_profile_is_rgb (GimpColorProfile profile)
|
gimp_color_profile_is_rgb (GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (profile != NULL, FALSE);
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), FALSE);
|
||||||
|
|
||||||
return (cmsGetColorSpace (profile) == cmsSigRgbData);
|
return (cmsGetColorSpace (profile->priv->lcms_profile) == cmsSigRgbData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -497,11 +623,11 @@ gimp_color_profile_is_rgb (GimpColorProfile profile)
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
gboolean
|
gboolean
|
||||||
gimp_color_profile_is_cmyk (GimpColorProfile profile)
|
gimp_color_profile_is_cmyk (GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (profile != NULL, FALSE);
|
g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), FALSE);
|
||||||
|
|
||||||
return (cmsGetColorSpace (profile) == cmsSigCmykData);
|
return (cmsGetColorSpace (profile->priv->lcms_profile) == cmsSigCmykData);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -517,10 +643,10 @@ gimp_color_profile_set_tag (cmsHPROFILE profile,
|
||||||
cmsMLUfree (mlu);
|
cmsMLUfree (mlu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpColorProfile
|
static cmsHPROFILE *
|
||||||
gimp_color_profile_new_srgb_internal (void)
|
gimp_color_profile_new_srgb_internal (void)
|
||||||
{
|
{
|
||||||
cmsHPROFILE srgb_profile;
|
cmsHPROFILE profile;
|
||||||
cmsCIExyY d65_srgb_specs = { 0.3127, 0.3290, 1.0 };
|
cmsCIExyY d65_srgb_specs = { 0.3127, 0.3290, 1.0 };
|
||||||
|
|
||||||
cmsCIExyYTRIPLE srgb_primaries_pre_quantized =
|
cmsCIExyYTRIPLE srgb_primaries_pre_quantized =
|
||||||
|
@ -540,19 +666,19 @@ gimp_color_profile_new_srgb_internal (void)
|
||||||
|
|
||||||
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric_curve;
|
tone_curve[0] = tone_curve[1] = tone_curve[2] = srgb_parametric_curve;
|
||||||
|
|
||||||
srgb_profile = cmsCreateRGBProfile (&d65_srgb_specs,
|
profile = cmsCreateRGBProfile (&d65_srgb_specs,
|
||||||
&srgb_primaries_pre_quantized,
|
&srgb_primaries_pre_quantized,
|
||||||
tone_curve);
|
tone_curve);
|
||||||
|
|
||||||
cmsFreeToneCurve (srgb_parametric_curve);
|
cmsFreeToneCurve (srgb_parametric_curve);
|
||||||
|
|
||||||
gimp_color_profile_set_tag (srgb_profile, cmsSigProfileDescriptionTag,
|
gimp_color_profile_set_tag (profile, cmsSigProfileDescriptionTag,
|
||||||
"GIMP built-in sRGB");
|
"GIMP built-in sRGB");
|
||||||
gimp_color_profile_set_tag (srgb_profile, cmsSigDeviceMfgDescTag,
|
gimp_color_profile_set_tag (profile, cmsSigDeviceMfgDescTag,
|
||||||
"GIMP");
|
"GIMP");
|
||||||
gimp_color_profile_set_tag (srgb_profile, cmsSigDeviceModelDescTag,
|
gimp_color_profile_set_tag (profile, cmsSigDeviceModelDescTag,
|
||||||
"sRGB");
|
"sRGB");
|
||||||
gimp_color_profile_set_tag (srgb_profile, cmsSigCopyrightTag,
|
gimp_color_profile_set_tag (profile, cmsSigCopyrightTag,
|
||||||
"Public Domain");
|
"Public Domain");
|
||||||
|
|
||||||
/* The following line produces a V2 profile with a point curve TRC.
|
/* The following line produces a V2 profile with a point curve TRC.
|
||||||
|
@ -565,7 +691,7 @@ gimp_color_profile_new_srgb_internal (void)
|
||||||
* cmsSetProfileVersion (srgb_profile, 2.1);
|
* cmsSetProfileVersion (srgb_profile, 2.1);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return srgb_profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -595,32 +721,33 @@ gimp_color_profile_new_srgb_internal (void)
|
||||||
* ArgyllCMS sRGB.icm profile. The resulting sRGB profile's colorants
|
* ArgyllCMS sRGB.icm profile. The resulting sRGB profile's colorants
|
||||||
* exactly matches the ArgyllCMS sRGB.icm profile colorants.
|
* exactly matches the ArgyllCMS sRGB.icm profile colorants.
|
||||||
*
|
*
|
||||||
* Return value: the sRGB cmsHPROFILE.
|
* Return value: the sRGB #GimpColorProfile.
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_color_profile_new_srgb (void)
|
gimp_color_profile_new_srgb (void)
|
||||||
{
|
{
|
||||||
static guint8 *profile_data = NULL;
|
static GimpColorProfile *profile = NULL;
|
||||||
static gsize profile_length = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (profile_data == NULL))
|
const guint8 *data;
|
||||||
|
gsize length;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (profile == NULL))
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
cmsHPROFILE lcms_profile = gimp_color_profile_new_srgb_internal ();
|
||||||
|
|
||||||
profile = gimp_color_profile_new_srgb_internal ();
|
profile = gimp_color_profile_new_from_lcms_profile (lcms_profile, NULL);
|
||||||
|
|
||||||
profile_data = gimp_color_profile_save_to_data (profile, &profile_length,
|
cmsCloseProfile (lcms_profile);
|
||||||
NULL);
|
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gimp_color_profile_open_from_data (profile_data, profile_length, NULL);
|
data = gimp_color_profile_get_icc_profile (profile, &length);
|
||||||
|
|
||||||
|
return gimp_color_profile_new_from_icc_profile (data, length, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpColorProfile
|
static cmsHPROFILE
|
||||||
gimp_color_profile_new_linear_rgb_internal (void)
|
gimp_color_profile_new_linear_rgb_internal (void)
|
||||||
{
|
{
|
||||||
cmsHPROFILE profile;
|
cmsHPROFILE profile;
|
||||||
|
@ -669,29 +796,30 @@ gimp_color_profile_new_linear_rgb_internal (void)
|
||||||
* This function creates a profile for babl_model("RGB"). Please
|
* This function creates a profile for babl_model("RGB"). Please
|
||||||
* somebody write someting smarter here.
|
* somebody write someting smarter here.
|
||||||
*
|
*
|
||||||
* Return value: the linear RGB cmsHPROFILE.
|
* Return value: the linear RGB #GimpColorProfile.
|
||||||
*
|
*
|
||||||
* Since: 2.10
|
* Since: 2.10
|
||||||
**/
|
**/
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_color_profile_new_linear_rgb (void)
|
gimp_color_profile_new_linear_rgb (void)
|
||||||
{
|
{
|
||||||
static guint8 *profile_data = NULL;
|
static GimpColorProfile *profile = NULL;
|
||||||
static gsize profile_length = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (profile_data == NULL))
|
const guint8 *data;
|
||||||
|
gsize length;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (profile == NULL))
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
cmsHPROFILE lcms_profile = gimp_color_profile_new_linear_rgb_internal ();
|
||||||
|
|
||||||
profile = gimp_color_profile_new_linear_rgb_internal ();
|
profile = gimp_color_profile_new_from_lcms_profile (lcms_profile, NULL);
|
||||||
|
|
||||||
profile_data = gimp_color_profile_save_to_data (profile, &profile_length,
|
cmsCloseProfile (lcms_profile);
|
||||||
NULL);
|
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gimp_color_profile_open_from_data (profile_data, profile_length, NULL);
|
data = gimp_color_profile_get_icc_profile (profile, &length);
|
||||||
|
|
||||||
|
return gimp_color_profile_new_from_icc_profile (data, length, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,35 +32,70 @@ G_BEGIN_DECLS
|
||||||
/* For information look into the C source or the html documentation */
|
/* For information look into the C source or the html documentation */
|
||||||
|
|
||||||
|
|
||||||
GimpColorProfile gimp_color_profile_open_from_file (GFile *file,
|
#define GIMP_TYPE_COLOR_PROFILE (gimp_color_profile_get_type ())
|
||||||
GError **error);
|
#define GIMP_COLOR_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_COLOR_PROFILE, GimpColorProfile))
|
||||||
GimpColorProfile gimp_color_profile_open_from_data (const guint8 *data,
|
#define GIMP_COLOR_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_COLOR_PROFILE, GimpColorProfileClass))
|
||||||
gsize length,
|
#define GIMP_IS_COLOR_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_COLOR_PROFILE))
|
||||||
GError **error);
|
#define GIMP_IS_COLOR_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_COLOR_PROFILE))
|
||||||
guint8 * gimp_color_profile_save_to_data (GimpColorProfile profile,
|
#define GIMP_COLOR_PROFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_COLOR_PROFILE, GimpColorProfileClass))
|
||||||
gsize *length,
|
|
||||||
GError **error);
|
|
||||||
void gimp_color_profile_close (GimpColorProfile profile);
|
|
||||||
|
|
||||||
gchar * gimp_color_profile_get_description (GimpColorProfile profile);
|
|
||||||
gchar * gimp_color_profile_get_manufacturer (GimpColorProfile profile);
|
|
||||||
gchar * gimp_color_profile_get_model (GimpColorProfile profile);
|
|
||||||
gchar * gimp_color_profile_get_copyright (GimpColorProfile profile);
|
|
||||||
|
|
||||||
gchar * gimp_color_profile_get_label (GimpColorProfile profile);
|
typedef struct _GimpColorProfileClass GimpColorProfileClass;
|
||||||
gchar * gimp_color_profile_get_summary (GimpColorProfile profile);
|
typedef struct _GimpColorProfilePrivate GimpColorProfilePrivate;
|
||||||
|
|
||||||
gboolean gimp_color_profile_is_equal (GimpColorProfile profile1,
|
struct _GimpColorProfile
|
||||||
GimpColorProfile profile2);
|
{
|
||||||
|
GObject parent_instance;
|
||||||
|
|
||||||
gboolean gimp_color_profile_is_rgb (GimpColorProfile profile);
|
GimpColorProfilePrivate *priv;
|
||||||
gboolean gimp_color_profile_is_cmyk (GimpColorProfile profile);
|
};
|
||||||
|
|
||||||
GimpColorProfile gimp_color_profile_new_srgb (void);
|
struct _GimpColorProfileClass
|
||||||
GimpColorProfile gimp_color_profile_new_linear_rgb (void);
|
{
|
||||||
|
GObjectClass parent_class;
|
||||||
|
|
||||||
const Babl * gimp_color_profile_get_format (const Babl *format,
|
/* Padding for future expansion */
|
||||||
guint32 *lcms_format);
|
void (* _gimp_reserved1) (void);
|
||||||
|
void (* _gimp_reserved2) (void);
|
||||||
|
void (* _gimp_reserved3) (void);
|
||||||
|
void (* _gimp_reserved4) (void);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
GType gimp_color_profile_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
GimpColorProfile * gimp_color_profile_new_srgb (void);
|
||||||
|
GimpColorProfile * gimp_color_profile_new_linear_rgb (void);
|
||||||
|
|
||||||
|
GimpColorProfile * gimp_color_profile_new_from_file (GFile *file,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
GimpColorProfile * gimp_color_profile_new_from_icc_profile (const guint8 *data,
|
||||||
|
gsize length,
|
||||||
|
GError **error);
|
||||||
|
GimpColorProfile * gimp_color_profile_new_from_lcms_profile (gpointer lcms_profile,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
|
const guint8 * gimp_color_profile_get_icc_profile (GimpColorProfile *profile,
|
||||||
|
gsize *length);
|
||||||
|
gpointer gimp_color_profile_get_lcms_profile (GimpColorProfile *profile);
|
||||||
|
|
||||||
|
gchar * gimp_color_profile_get_description (GimpColorProfile *profile);
|
||||||
|
gchar * gimp_color_profile_get_manufacturer (GimpColorProfile *profile);
|
||||||
|
gchar * gimp_color_profile_get_model (GimpColorProfile *profile);
|
||||||
|
gchar * gimp_color_profile_get_copyright (GimpColorProfile *profile);
|
||||||
|
|
||||||
|
gchar * gimp_color_profile_get_label (GimpColorProfile *profile);
|
||||||
|
gchar * gimp_color_profile_get_summary (GimpColorProfile *profile);
|
||||||
|
|
||||||
|
gboolean gimp_color_profile_is_equal (GimpColorProfile *profile1,
|
||||||
|
GimpColorProfile *profile2);
|
||||||
|
|
||||||
|
gboolean gimp_color_profile_is_rgb (GimpColorProfile *profile);
|
||||||
|
gboolean gimp_color_profile_is_cmyk (GimpColorProfile *profile);
|
||||||
|
|
||||||
|
const Babl * gimp_color_profile_get_format (const Babl *format,
|
||||||
|
guint32 *lcms_format);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -29,8 +29,8 @@ G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
||||||
typedef struct _GimpColorManaged GimpColorManaged; /* dummy typedef */
|
typedef struct _GimpColorManaged GimpColorManaged; /* dummy typedef */
|
||||||
|
typedef struct _GimpColorProfile GimpColorProfile;
|
||||||
|
|
||||||
typedef gpointer GimpColorProfile;
|
|
||||||
typedef gpointer GimpColorTransform;
|
typedef gpointer GimpColorTransform;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -370,11 +370,11 @@ gimp_color_config_get_property (GObject *object,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,
|
gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
|
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
@ -383,11 +383,11 @@ gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,
|
||||||
{
|
{
|
||||||
GFile *file = g_file_new_for_path (config->rgb_profile);
|
GFile *file = g_file_new_for_path (config->rgb_profile);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, error);
|
profile = gimp_color_profile_new_from_file (file, error);
|
||||||
|
|
||||||
if (profile && ! gimp_color_profile_is_rgb (profile))
|
if (profile && ! gimp_color_profile_is_rgb (profile))
|
||||||
{
|
{
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
profile = NULL;
|
profile = NULL;
|
||||||
|
|
||||||
g_set_error (error, GIMP_CONFIG_ERROR, 0,
|
g_set_error (error, GIMP_CONFIG_ERROR, 0,
|
||||||
|
@ -401,11 +401,11 @@ gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_color_config_get_cmyk_color_profile (GimpColorConfig *config,
|
gimp_color_config_get_cmyk_color_profile (GimpColorConfig *config,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
|
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
@ -414,11 +414,11 @@ gimp_color_config_get_cmyk_color_profile (GimpColorConfig *config,
|
||||||
{
|
{
|
||||||
GFile *file = g_file_new_for_path (config->cmyk_profile);
|
GFile *file = g_file_new_for_path (config->cmyk_profile);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, error);
|
profile = gimp_color_profile_new_from_file (file, error);
|
||||||
|
|
||||||
if (profile && ! gimp_color_profile_is_cmyk (profile))
|
if (profile && ! gimp_color_profile_is_cmyk (profile))
|
||||||
{
|
{
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
profile = NULL;
|
profile = NULL;
|
||||||
|
|
||||||
g_set_error (error, GIMP_CONFIG_ERROR, 0,
|
g_set_error (error, GIMP_CONFIG_ERROR, 0,
|
||||||
|
@ -432,11 +432,11 @@ gimp_color_config_get_cmyk_color_profile (GimpColorConfig *config,
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_color_config_get_display_color_profile (GimpColorConfig *config,
|
gimp_color_config_get_display_color_profile (GimpColorConfig *config,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
|
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
@ -445,18 +445,18 @@ gimp_color_config_get_display_color_profile (GimpColorConfig *config,
|
||||||
{
|
{
|
||||||
GFile *file = g_file_new_for_path (config->display_profile);
|
GFile *file = g_file_new_for_path (config->display_profile);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, error);
|
profile = gimp_color_profile_new_from_file (file, error);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_color_config_get_printer_color_profile (GimpColorConfig *config,
|
gimp_color_config_get_printer_color_profile (GimpColorConfig *config,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
|
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
|
||||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||||
|
@ -465,7 +465,7 @@ gimp_color_config_get_printer_color_profile (GimpColorConfig *config,
|
||||||
{
|
{
|
||||||
GFile *file = g_file_new_for_path (config->printer_profile);
|
GFile *file = g_file_new_for_path (config->printer_profile);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, error);
|
profile = gimp_color_profile_new_from_file (file, error);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,10 +484,10 @@ gimp_color_config_set_rgb_profile (GimpColorConfig *config,
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
GFile *file = g_file_new_for_path (filename);
|
GFile *file = g_file_new_for_path (filename);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, error);
|
profile = gimp_color_profile_new_from_file (file, error);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
|
@ -499,7 +499,7 @@ gimp_color_config_set_rgb_profile (GimpColorConfig *config,
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -525,10 +525,10 @@ gimp_color_config_set_cmyk_profile (GimpColorConfig *config,
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
GFile *file = g_file_new_for_path (filename);
|
GFile *file = g_file_new_for_path (filename);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, error);
|
profile = gimp_color_profile_new_from_file (file, error);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
|
@ -540,7 +540,7 @@ gimp_color_config_set_cmyk_profile (GimpColorConfig *config,
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -566,14 +566,14 @@ gimp_color_config_set_display_profile (GimpColorConfig *config,
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
GFile *file = g_file_new_for_path (filename);
|
GFile *file = g_file_new_for_path (filename);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, error);
|
profile = gimp_color_profile_new_from_file (file, error);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -599,14 +599,14 @@ gimp_color_config_set_printer_profile (GimpColorConfig *config,
|
||||||
|
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
GFile *file = g_file_new_for_path (filename);
|
GFile *file = g_file_new_for_path (filename);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, error);
|
profile = gimp_color_profile_new_from_file (file, error);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,16 +77,16 @@ struct _GimpColorConfigClass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType gimp_color_config_get_type (void) G_GNUC_CONST;
|
GType gimp_color_config_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GimpColorProfile gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,
|
GimpColorProfile * gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,
|
||||||
GError **error);
|
GError **error);
|
||||||
GimpColorProfile gimp_color_config_get_cmyk_color_profile (GimpColorConfig *config,
|
GimpColorProfile * gimp_color_config_get_cmyk_color_profile (GimpColorConfig *config,
|
||||||
GError **error);
|
GError **error);
|
||||||
GimpColorProfile gimp_color_config_get_display_color_profile (GimpColorConfig *config,
|
GimpColorProfile * gimp_color_config_get_display_color_profile (GimpColorConfig *config,
|
||||||
GError **error);
|
GError **error);
|
||||||
GimpColorProfile gimp_color_config_get_printer_color_profile (GimpColorConfig *config,
|
GimpColorProfile * gimp_color_config_get_printer_color_profile (GimpColorConfig *config,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
|
||||||
#endif /* GIMP_COLOR_CONFIG_H__ */
|
#endif /* GIMP_COLOR_CONFIG_H__ */
|
||||||
|
|
|
@ -183,7 +183,7 @@ gimp_color_profile_chooser_dialog_add_shortcut (GimpColorProfileChooserDialog *d
|
||||||
static void
|
static void
|
||||||
gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog *dialog)
|
gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog *dialog)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
GFile *file;
|
GFile *file;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog
|
||||||
switch (g_file_query_file_type (file, G_FILE_QUERY_INFO_NONE, NULL))
|
switch (g_file_query_file_type (file, G_FILE_QUERY_INFO_NONE, NULL))
|
||||||
{
|
{
|
||||||
case G_FILE_TYPE_REGULAR:
|
case G_FILE_TYPE_REGULAR:
|
||||||
profile = gimp_color_profile_open_from_file (file, &error);
|
profile = gimp_color_profile_new_from_file (file, &error);
|
||||||
|
|
||||||
if (! profile)
|
if (! profile)
|
||||||
{
|
{
|
||||||
|
@ -210,7 +210,7 @@ gimp_color_profile_chooser_dialog_update_preview (GimpColorProfileChooserDialog
|
||||||
{
|
{
|
||||||
gimp_color_profile_view_set_profile (dialog->priv->profile_view,
|
gimp_color_profile_view_set_profile (dialog->priv->profile_view,
|
||||||
profile);
|
profile);
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -424,11 +424,11 @@ gimp_color_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
||||||
if (filename && ! (label && *label))
|
if (filename && ! (label && *label))
|
||||||
{
|
{
|
||||||
GFile *file;
|
GFile *file;
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
file = g_file_new_for_path (filename);
|
file = g_file_new_for_path (filename);
|
||||||
profile = gimp_color_profile_open_from_file (file, &error);
|
profile = gimp_color_profile_new_from_file (file, &error);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
|
|
||||||
if (! profile)
|
if (! profile)
|
||||||
|
@ -439,7 +439,7 @@ gimp_color_profile_combo_box_set_active (GimpColorProfileComboBox *combo,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
l = gimp_color_profile_get_label (profile);
|
l = gimp_color_profile_get_label (profile);
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -34,11 +34,12 @@
|
||||||
|
|
||||||
struct _GimpColorProfileViewPrivate
|
struct _GimpColorProfileViewPrivate
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static void gimp_color_profile_view_constructed (GObject *object);
|
static void gimp_color_profile_view_constructed (GObject *object);
|
||||||
|
static void gimp_color_profile_view_finalize (GObject *object);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (GimpColorProfileView, gimp_color_profile_view,
|
G_DEFINE_TYPE (GimpColorProfileView, gimp_color_profile_view,
|
||||||
|
@ -53,6 +54,7 @@ gimp_color_profile_view_class_init (GimpColorProfileViewClass *klass)
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
object_class->constructed = gimp_color_profile_view_constructed;
|
object_class->constructed = gimp_color_profile_view_constructed;
|
||||||
|
object_class->finalize = gimp_color_profile_view_finalize;
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (GimpColorProfileViewPrivate));
|
g_type_class_add_private (klass, sizeof (GimpColorProfileViewPrivate));
|
||||||
}
|
}
|
||||||
|
@ -90,6 +92,20 @@ gimp_color_profile_view_constructed (GObject *object)
|
||||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (object), 6);
|
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (object), 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_color_profile_view_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
GimpColorProfileView *view = GIMP_COLOR_PROFILE_VIEW (object);
|
||||||
|
|
||||||
|
if (view->priv->profile)
|
||||||
|
{
|
||||||
|
g_object_unref (view->priv->profile);
|
||||||
|
view->priv->profile = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gimp_color_profile_view_new (void)
|
gimp_color_profile_view_new (void)
|
||||||
{
|
{
|
||||||
|
@ -98,42 +114,52 @@ gimp_color_profile_view_new (void)
|
||||||
|
|
||||||
void
|
void
|
||||||
gimp_color_profile_view_set_profile (GimpColorProfileView *view,
|
gimp_color_profile_view_set_profile (GimpColorProfileView *view,
|
||||||
GimpColorProfile profile)
|
GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
GtkTextBuffer *buffer;
|
GtkTextBuffer *buffer;
|
||||||
GtkTextIter iter;
|
|
||||||
gchar *label;
|
|
||||||
gchar *summary;
|
|
||||||
|
|
||||||
g_return_if_fail (GIMP_IS_COLOR_PROFILE_VIEW (view));
|
g_return_if_fail (GIMP_IS_COLOR_PROFILE_VIEW (view));
|
||||||
|
g_return_if_fail (profile == NULL || GIMP_IS_COLOR_PROFILE (profile));
|
||||||
|
|
||||||
|
if (profile == view->priv->profile)
|
||||||
|
return;
|
||||||
|
|
||||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||||
|
|
||||||
gtk_text_buffer_set_text (buffer, "", 0);
|
gtk_text_buffer_set_text (buffer, "", 0);
|
||||||
|
|
||||||
|
if (view->priv->profile)
|
||||||
|
g_object_unref (view->priv->profile);
|
||||||
|
|
||||||
view->priv->profile = profile;
|
view->priv->profile = profile;
|
||||||
|
|
||||||
if (! profile)
|
if (view->priv->profile)
|
||||||
return;
|
|
||||||
|
|
||||||
gtk_text_buffer_get_start_iter (buffer, &iter);
|
|
||||||
|
|
||||||
label = gimp_color_profile_get_label (profile);
|
|
||||||
summary = gimp_color_profile_get_summary (profile);
|
|
||||||
|
|
||||||
if (label && strlen (label))
|
|
||||||
{
|
{
|
||||||
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
GtkTextIter iter;
|
||||||
label, -1,
|
gchar *label;
|
||||||
"strong", NULL);
|
gchar *summary;
|
||||||
gtk_text_buffer_insert (buffer, &iter, "\n", 1);
|
|
||||||
|
g_object_ref (view->priv->profile);
|
||||||
|
|
||||||
|
gtk_text_buffer_get_start_iter (buffer, &iter);
|
||||||
|
|
||||||
|
label = gimp_color_profile_get_label (profile);
|
||||||
|
summary = gimp_color_profile_get_summary (profile);
|
||||||
|
|
||||||
|
if (label && strlen (label))
|
||||||
|
{
|
||||||
|
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
|
||||||
|
label, -1,
|
||||||
|
"strong", NULL);
|
||||||
|
gtk_text_buffer_insert (buffer, &iter, "\n", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (summary)
|
||||||
|
gtk_text_buffer_insert (buffer, &iter, summary, -1);
|
||||||
|
|
||||||
|
g_free (label);
|
||||||
|
g_free (summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (summary)
|
|
||||||
gtk_text_buffer_insert (buffer, &iter, summary, -1);
|
|
||||||
|
|
||||||
g_free (label);
|
|
||||||
g_free (summary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -59,7 +59,7 @@ GType gimp_color_profile_view_get_type (void) G_GNUC_CONST;
|
||||||
GtkWidget * gimp_color_profile_view_new (void);
|
GtkWidget * gimp_color_profile_view_new (void);
|
||||||
|
|
||||||
void gimp_color_profile_view_set_profile (GimpColorProfileView *view,
|
void gimp_color_profile_view_set_profile (GimpColorProfileView *view,
|
||||||
GimpColorProfile profile);
|
GimpColorProfile *profile);
|
||||||
void gimp_color_profile_view_set_error (GimpColorProfileView *view,
|
void gimp_color_profile_view_set_error (GimpColorProfileView *view,
|
||||||
const gchar *message);
|
const gchar *message);
|
||||||
|
|
||||||
|
|
|
@ -352,10 +352,10 @@ gimp_get_monitor_at_pointer (GdkScreen **screen)
|
||||||
return gdk_screen_get_monitor_at_point (*screen, x, y);
|
return gdk_screen_get_monitor_at_point (*screen, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
GimpColorProfile
|
GimpColorProfile *
|
||||||
gimp_widget_get_color_profile (GtkWidget *widget)
|
gimp_widget_get_color_profile (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
gint monitor;
|
gint monitor;
|
||||||
|
|
||||||
|
@ -391,7 +391,8 @@ gimp_widget_get_color_profile (GtkWidget *widget)
|
||||||
0, 64 * 1024 * 1024, FALSE,
|
0, 64 * 1024 * 1024, FALSE,
|
||||||
&type, &format, &nitems, &data) && nitems > 0)
|
&type, &format, &nitems, &data) && nitems > 0)
|
||||||
{
|
{
|
||||||
profile = gimp_color_profile_open_from_data (data, nitems, NULL);
|
profile = gimp_color_profile_new_from_icc_profile (data, nitems,
|
||||||
|
NULL);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -421,9 +422,9 @@ gimp_widget_get_color_profile (GtkWidget *widget)
|
||||||
CFDataGetBytes (data, CFRangeMake (0, CFDataGetLength (data)),
|
CFDataGetBytes (data, CFRangeMake (0, CFDataGetLength (data)),
|
||||||
buffer);
|
buffer);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_data (data,
|
profile = gimp_color_profile_new_from_icc_profile (data,
|
||||||
CFDataGetLength (data),
|
CFDataGetLength (data),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
CFRelease (data);
|
CFRelease (data);
|
||||||
|
@ -446,7 +447,7 @@ gimp_widget_get_color_profile (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GFile *file = g_file_new_for_path (path);
|
GFile *file = g_file_new_for_path (path);
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, NULL);
|
profile = gimp_color_profile_new_from_file (file, NULL);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,11 +460,11 @@ gimp_widget_get_color_profile (GtkWidget *widget)
|
||||||
return profile;
|
return profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpColorProfile
|
static GimpColorProfile *
|
||||||
get_display_profile (GtkWidget *widget,
|
get_display_profile (GtkWidget *widget,
|
||||||
GimpColorConfig *config)
|
GimpColorConfig *config)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
if (config->display_profile_from_gdk)
|
if (config->display_profile_from_gdk)
|
||||||
profile = gimp_widget_get_color_profile (widget);
|
profile = gimp_widget_get_color_profile (widget);
|
||||||
|
@ -484,13 +485,15 @@ gimp_widget_get_color_transform (GtkWidget *widget,
|
||||||
const Babl **src_format,
|
const Babl **src_format,
|
||||||
const Babl **dest_format)
|
const Babl **dest_format)
|
||||||
{
|
{
|
||||||
GimpColorTransform transform = NULL;
|
GimpColorTransform transform = NULL;
|
||||||
GimpColorProfile src_profile = NULL;
|
GimpColorProfile *src_profile = NULL;
|
||||||
GimpColorProfile dest_profile = NULL;
|
GimpColorProfile *dest_profile = NULL;
|
||||||
GimpColorProfile proof_profile = NULL;
|
GimpColorProfile *proof_profile = NULL;
|
||||||
cmsUInt32Number lcms_src_format;
|
cmsHPROFILE src_lcms;
|
||||||
cmsUInt32Number lcms_dest_format;
|
cmsHPROFILE dest_lcms;
|
||||||
cmsUInt16Number alarmCodes[cmsMAXCHANNELS] = { 0, };
|
cmsUInt32Number lcms_src_format;
|
||||||
|
cmsUInt32Number lcms_dest_format;
|
||||||
|
cmsUInt16Number alarmCodes[cmsMAXCHANNELS] = { 0, };
|
||||||
|
|
||||||
g_return_val_if_fail (widget == NULL || GTK_IS_WIDGET (widget), NULL);
|
g_return_val_if_fail (widget == NULL || GTK_IS_WIDGET (widget), NULL);
|
||||||
g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), NULL);
|
g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), NULL);
|
||||||
|
@ -513,13 +516,19 @@ gimp_widget_get_color_transform (GtkWidget *widget,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
src_lcms = gimp_color_profile_get_lcms_profile (src_profile);
|
||||||
|
dest_lcms = gimp_color_profile_get_lcms_profile (dest_profile);
|
||||||
|
|
||||||
*src_format = gimp_color_profile_get_format (*src_format, &lcms_src_format);
|
*src_format = gimp_color_profile_get_format (*src_format, &lcms_src_format);
|
||||||
*dest_format = gimp_color_profile_get_format (*dest_format, &lcms_dest_format);
|
*dest_format = gimp_color_profile_get_format (*dest_format, &lcms_dest_format);
|
||||||
|
|
||||||
if (proof_profile)
|
if (proof_profile)
|
||||||
{
|
{
|
||||||
|
cmsHPROFILE proof_lcms;
|
||||||
cmsUInt32Number softproof_flags = cmsFLAGS_SOFTPROOFING;
|
cmsUInt32Number softproof_flags = cmsFLAGS_SOFTPROOFING;
|
||||||
|
|
||||||
|
proof_lcms = gimp_color_profile_get_lcms_profile (proof_profile);
|
||||||
|
|
||||||
if (config->simulation_use_black_point_compensation)
|
if (config->simulation_use_black_point_compensation)
|
||||||
{
|
{
|
||||||
softproof_flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
softproof_flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
||||||
|
@ -540,14 +549,14 @@ gimp_widget_get_color_transform (GtkWidget *widget,
|
||||||
cmsSetAlarmCodes (alarmCodes);
|
cmsSetAlarmCodes (alarmCodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
transform = cmsCreateProofingTransform (src_profile, lcms_src_format,
|
transform = cmsCreateProofingTransform (src_lcms, lcms_src_format,
|
||||||
dest_profile, lcms_dest_format,
|
dest_lcms, lcms_dest_format,
|
||||||
proof_profile,
|
proof_lcms,
|
||||||
config->simulation_intent,
|
config->simulation_intent,
|
||||||
config->display_intent,
|
config->display_intent,
|
||||||
softproof_flags);
|
softproof_flags);
|
||||||
|
|
||||||
gimp_color_profile_close (proof_profile);
|
g_object_unref (proof_profile);
|
||||||
}
|
}
|
||||||
else if (! gimp_color_profile_is_equal (src_profile, dest_profile))
|
else if (! gimp_color_profile_is_equal (src_profile, dest_profile))
|
||||||
{
|
{
|
||||||
|
@ -558,14 +567,14 @@ gimp_widget_get_color_transform (GtkWidget *widget,
|
||||||
display_flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
display_flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
transform = cmsCreateTransform (src_profile, lcms_src_format,
|
transform = cmsCreateTransform (src_lcms, lcms_src_format,
|
||||||
dest_profile, lcms_dest_format,
|
dest_lcms, lcms_dest_format,
|
||||||
config->display_intent,
|
config->display_intent,
|
||||||
display_flags);
|
display_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_profile_close (src_profile);
|
g_object_unref (src_profile);
|
||||||
gimp_color_profile_close (dest_profile);
|
g_object_unref (dest_profile);
|
||||||
|
|
||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,29 +30,29 @@ G_BEGIN_DECLS
|
||||||
/* For information look into the C source or the html documentation */
|
/* For information look into the C source or the html documentation */
|
||||||
|
|
||||||
|
|
||||||
GtkWidget * gimp_table_attach_aligned (GtkTable *table,
|
GtkWidget * gimp_table_attach_aligned (GtkTable *table,
|
||||||
gint column,
|
gint column,
|
||||||
gint row,
|
gint row,
|
||||||
const gchar *label_text,
|
const gchar *label_text,
|
||||||
gfloat xalign,
|
gfloat xalign,
|
||||||
gfloat yalign,
|
gfloat yalign,
|
||||||
GtkWidget *widget,
|
GtkWidget *widget,
|
||||||
gint colspan,
|
gint colspan,
|
||||||
gboolean left_align);
|
gboolean left_align);
|
||||||
|
|
||||||
void gimp_label_set_attributes (GtkLabel *label,
|
void gimp_label_set_attributes (GtkLabel *label,
|
||||||
...);
|
...);
|
||||||
|
|
||||||
gint gimp_widget_get_monitor (GtkWidget *widget);
|
gint gimp_widget_get_monitor (GtkWidget *widget);
|
||||||
gint gimp_get_monitor_at_pointer (GdkScreen **screen);
|
gint gimp_get_monitor_at_pointer (GdkScreen **screen);
|
||||||
|
|
||||||
GimpColorProfile gimp_widget_get_color_profile (GtkWidget *widget);
|
GimpColorProfile * gimp_widget_get_color_profile (GtkWidget *widget);
|
||||||
|
|
||||||
GimpColorTransform gimp_widget_get_color_transform (GtkWidget *widget,
|
GimpColorTransform gimp_widget_get_color_transform (GtkWidget *widget,
|
||||||
GimpColorManaged *managed,
|
GimpColorManaged *managed,
|
||||||
GimpColorConfig *config,
|
GimpColorConfig *config,
|
||||||
const Babl **src_format,
|
const Babl **src_format,
|
||||||
const Babl **dest_format);
|
const Babl **dest_format);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -353,8 +353,10 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
|
||||||
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module);
|
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (module);
|
||||||
GimpColorConfig *config = module->config;
|
GimpColorConfig *config = module->config;
|
||||||
cmsUInt32Number flags = 0;
|
cmsUInt32Number flags = 0;
|
||||||
GimpColorProfile rgb_profile = NULL;
|
GimpColorProfile *rgb_profile = NULL;
|
||||||
GimpColorProfile cmyk_profile = NULL;
|
GimpColorProfile *cmyk_profile = NULL;
|
||||||
|
cmsHPROFILE rgb_lcms;
|
||||||
|
cmsHPROFILE cmyk_lcms;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
gchar *summary;
|
gchar *summary;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
|
@ -397,28 +399,31 @@ colorsel_cmyk_config_changed (ColorselCmyk *module)
|
||||||
g_free (label);
|
g_free (label);
|
||||||
g_free (summary);
|
g_free (summary);
|
||||||
|
|
||||||
|
rgb_lcms = gimp_color_profile_get_lcms_profile (rgb_profile);
|
||||||
|
cmyk_lcms = gimp_color_profile_get_lcms_profile (cmyk_profile);
|
||||||
|
|
||||||
if (config->display_intent ==
|
if (config->display_intent ==
|
||||||
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC)
|
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC)
|
||||||
{
|
{
|
||||||
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
module->rgb2cmyk = cmsCreateTransform (rgb_profile, TYPE_RGB_DBL,
|
module->rgb2cmyk = cmsCreateTransform (rgb_lcms, TYPE_RGB_DBL,
|
||||||
cmyk_profile, TYPE_CMYK_DBL,
|
cmyk_lcms, TYPE_CMYK_DBL,
|
||||||
config->display_intent,
|
config->display_intent,
|
||||||
flags);
|
flags);
|
||||||
module->cmyk2rgb = cmsCreateTransform (cmyk_profile, TYPE_CMYK_DBL,
|
module->cmyk2rgb = cmsCreateTransform (cmyk_lcms, TYPE_CMYK_DBL,
|
||||||
rgb_profile, TYPE_RGB_DBL,
|
rgb_lcms, TYPE_RGB_DBL,
|
||||||
config->display_intent,
|
config->display_intent,
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
||||||
if (rgb_profile)
|
if (rgb_profile)
|
||||||
gimp_color_profile_close (rgb_profile);
|
g_object_unref (rgb_profile);
|
||||||
|
|
||||||
if (cmyk_profile)
|
if (cmyk_profile)
|
||||||
gimp_color_profile_close (cmyk_profile);
|
g_object_unref (cmyk_profile);
|
||||||
|
|
||||||
if (! module->in_destruction)
|
if (! module->in_destruction)
|
||||||
colorsel_cmyk_set_color (selector, &selector->rgb, &selector->hsv);
|
colorsel_cmyk_set_color (selector, &selector->rgb, &selector->hsv);
|
||||||
|
|
|
@ -73,27 +73,27 @@ struct _CdisplayLcmsClass
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
GType cdisplay_lcms_get_type (void);
|
GType cdisplay_lcms_get_type (void);
|
||||||
|
|
||||||
static void cdisplay_lcms_finalize (GObject *object);
|
static void cdisplay_lcms_finalize (GObject *object);
|
||||||
|
|
||||||
static GtkWidget * cdisplay_lcms_configure (GimpColorDisplay *display);
|
static GtkWidget * cdisplay_lcms_configure (GimpColorDisplay *display);
|
||||||
static void cdisplay_lcms_convert_buffer (GimpColorDisplay *display,
|
static void cdisplay_lcms_convert_buffer (GimpColorDisplay *display,
|
||||||
GeglBuffer *buffer,
|
GeglBuffer *buffer,
|
||||||
GeglRectangle *area);
|
GeglRectangle *area);
|
||||||
static void cdisplay_lcms_changed (GimpColorDisplay *display);
|
static void cdisplay_lcms_changed (GimpColorDisplay *display);
|
||||||
|
|
||||||
static GimpColorProfile cdisplay_lcms_get_display_profile (CdisplayLcms *lcms);
|
static GimpColorProfile * cdisplay_lcms_get_display_profile (CdisplayLcms *lcms);
|
||||||
|
|
||||||
static void cdisplay_lcms_attach_labelled (GtkTable *table,
|
static void cdisplay_lcms_attach_labelled (GtkTable *table,
|
||||||
gint row,
|
gint row,
|
||||||
const gchar *text,
|
const gchar *text,
|
||||||
GtkWidget *widget);
|
GtkWidget *widget);
|
||||||
static void cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
|
static void cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
static void cdisplay_lcms_notify_profile (GObject *config,
|
static void cdisplay_lcms_notify_profile (GObject *config,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
CdisplayLcms *lcms);
|
CdisplayLcms *lcms);
|
||||||
|
|
||||||
|
|
||||||
static const GimpModuleInfo cdisplay_lcms_info =
|
static const GimpModuleInfo cdisplay_lcms_info =
|
||||||
|
@ -284,13 +284,13 @@ cdisplay_lcms_changed (GimpColorDisplay *display)
|
||||||
&lcms->dest_format);
|
&lcms->dest_format);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GimpColorProfile
|
static GimpColorProfile *
|
||||||
cdisplay_lcms_get_display_profile (CdisplayLcms *lcms)
|
cdisplay_lcms_get_display_profile (CdisplayLcms *lcms)
|
||||||
{
|
{
|
||||||
GimpColorConfig *config;
|
GimpColorConfig *config;
|
||||||
GimpColorManaged *managed;
|
GimpColorManaged *managed;
|
||||||
GtkWidget *widget = NULL;
|
GtkWidget *widget = NULL;
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
config = gimp_color_display_get_config (GIMP_COLOR_DISPLAY (lcms));
|
config = gimp_color_display_get_config (GIMP_COLOR_DISPLAY (lcms));
|
||||||
managed = gimp_color_display_get_managed (GIMP_COLOR_DISPLAY (lcms));
|
managed = gimp_color_display_get_managed (GIMP_COLOR_DISPLAY (lcms));
|
||||||
|
@ -342,7 +342,7 @@ cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
|
||||||
GimpColorConfig *config;
|
GimpColorConfig *config;
|
||||||
GimpColorManaged *managed;
|
GimpColorManaged *managed;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
gchar *text;
|
gchar *text;
|
||||||
gchar *tooltip;
|
gchar *tooltip;
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@ cdisplay_lcms_update_profile_label (CdisplayLcms *lcms,
|
||||||
g_free (tooltip);
|
g_free (tooltip);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -323,8 +323,8 @@ static void
|
||||||
cdisplay_proof_changed (GimpColorDisplay *display)
|
cdisplay_proof_changed (GimpColorDisplay *display)
|
||||||
{
|
{
|
||||||
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
CdisplayProof *proof = CDISPLAY_PROOF (display);
|
||||||
GimpColorProfile rgb_profile;
|
GimpColorProfile *rgb_profile;
|
||||||
GimpColorProfile proof_profile;
|
GimpColorProfile *proof_profile;
|
||||||
GFile *file;
|
GFile *file;
|
||||||
|
|
||||||
if (proof->transform)
|
if (proof->transform)
|
||||||
|
@ -339,25 +339,30 @@ cdisplay_proof_changed (GimpColorDisplay *display)
|
||||||
rgb_profile = gimp_color_profile_new_srgb ();
|
rgb_profile = gimp_color_profile_new_srgb ();
|
||||||
|
|
||||||
file = g_file_new_for_path (proof->profile);
|
file = g_file_new_for_path (proof->profile);
|
||||||
proof_profile = gimp_color_profile_open_from_file (file, NULL);
|
proof_profile = gimp_color_profile_new_from_file (file, NULL);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
|
|
||||||
if (proof_profile)
|
if (proof_profile)
|
||||||
{
|
{
|
||||||
|
cmsHPROFILE rgb_lcms;
|
||||||
|
cmsHPROFILE proof_lcms;
|
||||||
cmsUInt32Number flags = cmsFLAGS_SOFTPROOFING;
|
cmsUInt32Number flags = cmsFLAGS_SOFTPROOFING;
|
||||||
|
|
||||||
|
rgb_lcms = gimp_color_profile_get_lcms_profile (rgb_profile);
|
||||||
|
proof_lcms = gimp_color_profile_get_lcms_profile (proof_profile);
|
||||||
|
|
||||||
if (proof->bpc)
|
if (proof->bpc)
|
||||||
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
||||||
|
|
||||||
proof->transform = cmsCreateProofingTransform (rgb_profile, TYPE_RGBA_FLT,
|
proof->transform = cmsCreateProofingTransform (rgb_lcms, TYPE_RGBA_FLT,
|
||||||
rgb_profile, TYPE_RGBA_FLT,
|
rgb_lcms, TYPE_RGBA_FLT,
|
||||||
proof_profile,
|
proof_lcms,
|
||||||
proof->intent,
|
proof->intent,
|
||||||
proof->intent,
|
proof->intent,
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
gimp_color_profile_close (proof_profile);
|
g_object_unref (proof_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_profile_close (rgb_profile);
|
g_object_unref (rgb_profile);
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,6 @@ libexec_PROGRAMS = \
|
||||||
web-browser \
|
web-browser \
|
||||||
$(WEB_PAGE)
|
$(WEB_PAGE)
|
||||||
|
|
||||||
|
|
||||||
EXTRA_PROGRAMS = \
|
EXTRA_PROGRAMS = \
|
||||||
file-aa \
|
file-aa \
|
||||||
file-jp2-load \
|
file-jp2-load \
|
||||||
|
@ -1432,8 +1431,6 @@ jigsaw_LDADD = \
|
||||||
$(INTLLIBS) \
|
$(INTLLIBS) \
|
||||||
$(jigsaw_RC)
|
$(jigsaw_RC)
|
||||||
|
|
||||||
lcms_CFLAGS = $(LCMS_CFLAGS)
|
|
||||||
|
|
||||||
lcms_SOURCES = \
|
lcms_SOURCES = \
|
||||||
lcms.c
|
lcms.c
|
||||||
|
|
||||||
|
@ -1448,7 +1445,6 @@ lcms_LDADD = \
|
||||||
$(libgimpbase) \
|
$(libgimpbase) \
|
||||||
$(GTK_LIBS) \
|
$(GTK_LIBS) \
|
||||||
$(GEGL_LIBS) \
|
$(GEGL_LIBS) \
|
||||||
$(LCMS_LIBS) \
|
|
||||||
$(RT_LIBS) \
|
$(RT_LIBS) \
|
||||||
$(INTLLIBS) \
|
$(INTLLIBS) \
|
||||||
$(lcms_RC)
|
$(lcms_RC)
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <lcms2.h>
|
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
@ -69,29 +67,29 @@ static void run (const gchar *name,
|
||||||
gint *nreturn_vals,
|
gint *nreturn_vals,
|
||||||
GimpParam **return_vals);
|
GimpParam **return_vals);
|
||||||
|
|
||||||
static GimpPDBStatusType lcms_icc_set (GimpColorConfig *config,
|
static GimpPDBStatusType lcms_icc_set (GimpColorConfig *config,
|
||||||
gint32 image,
|
gint32 image,
|
||||||
GFile *file);
|
GFile *file);
|
||||||
static GimpPDBStatusType lcms_icc_apply (GimpColorConfig *config,
|
static GimpPDBStatusType lcms_icc_apply (GimpColorConfig *config,
|
||||||
GimpRunMode run_mode,
|
GimpRunMode run_mode,
|
||||||
gint32 image,
|
gint32 image,
|
||||||
GFile *file,
|
GFile *file,
|
||||||
GimpColorRenderingIntent intent,
|
GimpColorRenderingIntent intent,
|
||||||
gboolean bpc,
|
gboolean bpc,
|
||||||
|
gboolean *dont_ask);
|
||||||
|
|
||||||
|
static gboolean lcms_image_set_profile (gint32 image,
|
||||||
|
GFile *file);
|
||||||
|
|
||||||
|
static gboolean lcms_icc_apply_dialog (gint32 image,
|
||||||
|
GimpColorProfile *src_profile,
|
||||||
|
GimpColorProfile *dest_profile,
|
||||||
gboolean *dont_ask);
|
gboolean *dont_ask);
|
||||||
|
|
||||||
static gboolean lcms_image_set_profile (gint32 image,
|
static GimpPDBStatusType lcms_dialog (GimpColorConfig *config,
|
||||||
GFile *file);
|
gint32 image,
|
||||||
|
gboolean apply,
|
||||||
static gboolean lcms_icc_apply_dialog (gint32 image,
|
LcmsValues *values);
|
||||||
cmsHPROFILE src_profile,
|
|
||||||
cmsHPROFILE dest_profile,
|
|
||||||
gboolean *dont_ask);
|
|
||||||
|
|
||||||
static GimpPDBStatusType lcms_dialog (GimpColorConfig *config,
|
|
||||||
gint32 image,
|
|
||||||
gboolean apply,
|
|
||||||
LcmsValues *values);
|
|
||||||
|
|
||||||
|
|
||||||
static const GimpParamDef set_args[] =
|
static const GimpParamDef set_args[] =
|
||||||
|
@ -384,9 +382,9 @@ lcms_icc_apply (GimpColorConfig *config,
|
||||||
gboolean bpc,
|
gboolean bpc,
|
||||||
gboolean *dont_ask)
|
gboolean *dont_ask)
|
||||||
{
|
{
|
||||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||||
GimpColorProfile src_profile = NULL;
|
GimpColorProfile *src_profile = NULL;
|
||||||
GimpColorProfile dest_profile = NULL;
|
GimpColorProfile *dest_profile = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), GIMP_PDB_CALLING_ERROR);
|
g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), GIMP_PDB_CALLING_ERROR);
|
||||||
g_return_val_if_fail (image != -1, GIMP_PDB_CALLING_ERROR);
|
g_return_val_if_fail (image != -1, GIMP_PDB_CALLING_ERROR);
|
||||||
|
@ -400,7 +398,7 @@ lcms_icc_apply (GimpColorConfig *config,
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
dest_profile = gimp_color_profile_open_from_file (file, &error);
|
dest_profile = gimp_color_profile_new_from_file (file, &error);
|
||||||
|
|
||||||
if (! dest_profile)
|
if (! dest_profile)
|
||||||
{
|
{
|
||||||
|
@ -415,7 +413,7 @@ lcms_icc_apply (GimpColorConfig *config,
|
||||||
g_message (_("Color profile '%s' is not for RGB color space."),
|
g_message (_("Color profile '%s' is not for RGB color space."),
|
||||||
gimp_file_get_utf8_name (file));
|
gimp_file_get_utf8_name (file));
|
||||||
|
|
||||||
gimp_color_profile_close (dest_profile);
|
g_object_unref (dest_profile);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
return GIMP_PDB_EXECUTION_ERROR;
|
return GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -431,8 +429,8 @@ lcms_icc_apply (GimpColorConfig *config,
|
||||||
gchar *src_label = gimp_color_profile_get_label (src_profile);
|
gchar *src_label = gimp_color_profile_get_label (src_profile);
|
||||||
gchar *dest_label = gimp_color_profile_get_label (dest_profile);
|
gchar *dest_label = gimp_color_profile_get_label (dest_profile);
|
||||||
|
|
||||||
gimp_color_profile_close (src_profile);
|
g_object_unref (src_profile);
|
||||||
gimp_color_profile_close (dest_profile);
|
g_object_unref (dest_profile);
|
||||||
|
|
||||||
g_printerr ("lcms: skipping conversion because profiles seem to be equal:\n");
|
g_printerr ("lcms: skipping conversion because profiles seem to be equal:\n");
|
||||||
g_printerr (" %s\n", src_label);
|
g_printerr (" %s\n", src_label);
|
||||||
|
@ -459,8 +457,8 @@ lcms_icc_apply (GimpColorConfig *config,
|
||||||
status = GIMP_PDB_EXECUTION_ERROR;
|
status = GIMP_PDB_EXECUTION_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_profile_close (src_profile);
|
g_object_unref (src_profile);
|
||||||
gimp_color_profile_close (dest_profile);
|
g_object_unref (dest_profile);
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
|
@ -472,7 +470,7 @@ static gboolean
|
||||||
lcms_image_set_profile (gint32 image,
|
lcms_image_set_profile (gint32 image,
|
||||||
GFile *file)
|
GFile *file)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (image != -1, FALSE);
|
g_return_val_if_fail (image != -1, FALSE);
|
||||||
|
|
||||||
|
@ -480,7 +478,7 @@ lcms_image_set_profile (gint32 image,
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_file (file, &error);
|
profile = gimp_color_profile_new_from_file (file, &error);
|
||||||
|
|
||||||
if (! profile)
|
if (! profile)
|
||||||
{
|
{
|
||||||
|
@ -499,14 +497,14 @@ lcms_image_set_profile (gint32 image,
|
||||||
gimp_image_undo_group_end (image);
|
gimp_image_undo_group_end (image);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
lcms_icc_profile_src_label_new (gint32 image,
|
lcms_icc_profile_src_label_new (gint32 image,
|
||||||
cmsHPROFILE profile)
|
GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
|
@ -553,7 +551,7 @@ lcms_icc_profile_src_label_new (gint32 image,
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkWidget *
|
static GtkWidget *
|
||||||
lcms_icc_profile_dest_label_new (cmsHPROFILE profile)
|
lcms_icc_profile_dest_label_new (GimpColorProfile *profile)
|
||||||
{
|
{
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
|
@ -577,10 +575,10 @@ lcms_icc_profile_dest_label_new (cmsHPROFILE profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
lcms_icc_apply_dialog (gint32 image,
|
lcms_icc_apply_dialog (gint32 image,
|
||||||
cmsHPROFILE src_profile,
|
GimpColorProfile *src_profile,
|
||||||
cmsHPROFILE dest_profile,
|
GimpColorProfile *dest_profile,
|
||||||
gboolean *dont_ask)
|
gboolean *dont_ask)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
GtkWidget *vbox;
|
GtkWidget *vbox;
|
||||||
|
@ -651,14 +649,14 @@ static GtkWidget *
|
||||||
lcms_icc_combo_box_new (GimpColorConfig *config,
|
lcms_icc_combo_box_new (GimpColorConfig *config,
|
||||||
const gchar *filename)
|
const gchar *filename)
|
||||||
{
|
{
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
gchar *history;
|
gchar *history;
|
||||||
gchar *label;
|
gchar *label;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
const gchar *rgb_filename = NULL;
|
const gchar *rgb_filename = NULL;
|
||||||
cmsHPROFILE profile = NULL;
|
GimpColorProfile *profile = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
dialog = gimp_color_profile_chooser_dialog_new (_("Select destination profile"));
|
dialog = gimp_color_profile_chooser_dialog_new (_("Select destination profile"));
|
||||||
|
|
||||||
|
@ -685,7 +683,7 @@ lcms_icc_combo_box_new (GimpColorConfig *config,
|
||||||
label = g_strdup_printf (_("RGB workspace (%s)"), name);
|
label = g_strdup_printf (_("RGB workspace (%s)"), name);
|
||||||
g_free (name);
|
g_free (name);
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
|
|
||||||
gimp_color_profile_combo_box_add (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
gimp_color_profile_combo_box_add (GIMP_COLOR_PROFILE_COMBO_BOX (combo),
|
||||||
rgb_filename, label);
|
rgb_filename, label);
|
||||||
|
@ -709,7 +707,7 @@ lcms_dialog (GimpColorConfig *config,
|
||||||
GtkWidget *frame;
|
GtkWidget *frame;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
GtkWidget *combo;
|
GtkWidget *combo;
|
||||||
GimpColorProfile src_profile;
|
GimpColorProfile *src_profile;
|
||||||
gchar *name;
|
gchar *name;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
gboolean run;
|
gboolean run;
|
||||||
|
@ -813,7 +811,7 @@ lcms_dialog (GimpColorConfig *config,
|
||||||
{
|
{
|
||||||
gchar *filename = gimp_color_profile_combo_box_get_active (box);
|
gchar *filename = gimp_color_profile_combo_box_get_active (box);
|
||||||
GFile *file = NULL;
|
GFile *file = NULL;
|
||||||
GimpColorProfile dest_profile;
|
GimpColorProfile *dest_profile;
|
||||||
|
|
||||||
gtk_widget_set_sensitive (dialog, FALSE);
|
gtk_widget_set_sensitive (dialog, FALSE);
|
||||||
|
|
||||||
|
@ -827,7 +825,7 @@ lcms_dialog (GimpColorConfig *config,
|
||||||
{
|
{
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
|
||||||
dest_profile = gimp_color_profile_open_from_file (file, &error);
|
dest_profile = gimp_color_profile_new_from_file (file, &error);
|
||||||
|
|
||||||
if (! dest_profile)
|
if (! dest_profile)
|
||||||
{
|
{
|
||||||
|
@ -857,7 +855,7 @@ lcms_dialog (GimpColorConfig *config,
|
||||||
g_message (_("Destination profile is not for RGB color space."));
|
g_message (_("Destination profile is not for RGB color space."));
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_color_profile_close (dest_profile);
|
g_object_unref (dest_profile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
|
@ -871,7 +869,7 @@ lcms_dialog (GimpColorConfig *config,
|
||||||
|
|
||||||
gtk_widget_destroy (dialog);
|
gtk_widget_destroy (dialog);
|
||||||
|
|
||||||
gimp_color_profile_close (src_profile);
|
g_object_unref (src_profile);
|
||||||
|
|
||||||
return (run ?
|
return (run ?
|
||||||
(success ? GIMP_PDB_SUCCESS : GIMP_PDB_EXECUTION_ERROR) :
|
(success ? GIMP_PDB_SUCCESS : GIMP_PDB_EXECUTION_ERROR) :
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
'guillotine' => {},
|
'guillotine' => {},
|
||||||
'hot' => { ui => 1 },
|
'hot' => { ui => 1 },
|
||||||
'jigsaw' => { ui => 1 },
|
'jigsaw' => { ui => 1 },
|
||||||
'lcms' => { ui => 1, gegl => 1, libs => 'LCMS_LIBS', cflags => 'LCMS_CFLAGS' },
|
'lcms' => { ui => 1, gegl => 1 },
|
||||||
'mail' => { ui => 1, optional => 1 },
|
'mail' => { ui => 1, optional => 1 },
|
||||||
'max-rgb' => { ui => 1 },
|
'max-rgb' => { ui => 1 },
|
||||||
'metadata' => { ui => 1, libs => 'GEXIV2_LIBS', cflags => 'GEXIV2_CFLAGS' },
|
'metadata' => { ui => 1, libs => 'GEXIV2_LIBS', cflags => 'GEXIV2_CFLAGS' },
|
||||||
|
|
|
@ -596,21 +596,23 @@ jpeg_load_cmyk_transform (guint8 *profile_data,
|
||||||
gsize profile_len)
|
gsize profile_len)
|
||||||
{
|
{
|
||||||
GimpColorConfig *config = gimp_get_color_configuration ();
|
GimpColorConfig *config = gimp_get_color_configuration ();
|
||||||
GimpColorProfile cmyk_profile = NULL;
|
GimpColorProfile *cmyk_profile = NULL;
|
||||||
GimpColorProfile rgb_profile = NULL;
|
GimpColorProfile *rgb_profile = NULL;
|
||||||
|
cmsHPROFILE cmyk_lcms;
|
||||||
|
cmsHPROFILE rgb_lcms;
|
||||||
cmsUInt32Number flags = 0;
|
cmsUInt32Number flags = 0;
|
||||||
cmsHTRANSFORM transform;
|
cmsHTRANSFORM transform;
|
||||||
|
|
||||||
/* try to load the embedded CMYK profile */
|
/* try to load the embedded CMYK profile */
|
||||||
if (profile_data)
|
if (profile_data)
|
||||||
{
|
{
|
||||||
cmyk_profile = gimp_color_profile_open_from_data (profile_data,
|
cmyk_profile = gimp_color_profile_new_from_icc_profile (profile_data,
|
||||||
profile_len,
|
profile_len,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (cmyk_profile && ! gimp_color_profile_is_cmyk (cmyk_profile))
|
if (cmyk_profile && ! gimp_color_profile_is_cmyk (cmyk_profile))
|
||||||
{
|
{
|
||||||
gimp_color_profile_close (cmyk_profile);
|
g_object_unref (cmyk_profile);
|
||||||
cmyk_profile = NULL;
|
cmyk_profile = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -633,19 +635,22 @@ jpeg_load_cmyk_transform (guint8 *profile_data,
|
||||||
if (! rgb_profile)
|
if (! rgb_profile)
|
||||||
rgb_profile = gimp_color_profile_new_srgb ();
|
rgb_profile = gimp_color_profile_new_srgb ();
|
||||||
|
|
||||||
|
cmyk_lcms = gimp_color_profile_get_lcms_profile (cmyk_profile);
|
||||||
|
rgb_lcms = gimp_color_profile_get_lcms_profile (rgb_profile);
|
||||||
|
|
||||||
if (config->display_intent ==
|
if (config->display_intent ==
|
||||||
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC)
|
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC)
|
||||||
{
|
{
|
||||||
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
flags |= cmsFLAGS_BLACKPOINTCOMPENSATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
transform = cmsCreateTransform (cmyk_profile, TYPE_CMYK_8_REV,
|
transform = cmsCreateTransform (cmyk_lcms, TYPE_CMYK_8_REV,
|
||||||
rgb_profile, TYPE_RGB_8,
|
rgb_lcms, TYPE_RGB_8,
|
||||||
config->display_intent,
|
config->display_intent,
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
gimp_color_profile_close (cmyk_profile);
|
g_object_unref (cmyk_profile);
|
||||||
gimp_color_profile_close (rgb_profile);
|
g_object_unref (rgb_profile);
|
||||||
|
|
||||||
g_object_unref (config);
|
g_object_unref (config);
|
||||||
|
|
||||||
|
|
|
@ -41,18 +41,21 @@ HELP
|
||||||
%invoke = (
|
%invoke = (
|
||||||
code => <<'CODE'
|
code => <<'CODE'
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_image_get_color_profile (image);
|
profile = gimp_image_get_color_profile (image);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
gsize length;
|
const guint8 *data;
|
||||||
|
gsize length;
|
||||||
|
|
||||||
profile_data = gimp_color_profile_save_to_data (profile, &length, NULL);
|
data = gimp_color_profile_get_icc_profile (profile, &length);
|
||||||
|
|
||||||
|
profile_data = g_memdup (data, length);
|
||||||
num_bytes = length;
|
num_bytes = length;
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CODE
|
CODE
|
||||||
|
@ -83,15 +86,16 @@ HELP
|
||||||
{
|
{
|
||||||
if (color_profile)
|
if (color_profile)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_data (color_profile, num_bytes,
|
profile = gimp_color_profile_new_from_icc_profile (color_profile,
|
||||||
error);
|
num_bytes,
|
||||||
|
error);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
success = gimp_image_set_color_profile (image, profile, error);
|
success = gimp_image_set_color_profile (image, profile, error);
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
|
@ -134,15 +138,18 @@ HELP
|
||||||
%invoke = (
|
%invoke = (
|
||||||
code => <<'CODE'
|
code => <<'CODE'
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
gsize length;
|
const guint8 *data;
|
||||||
|
gsize length;
|
||||||
|
|
||||||
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
||||||
|
|
||||||
profile_data = gimp_color_profile_save_to_data (profile, &length, NULL);
|
data = gimp_color_profile_get_icc_profile (profile, &length);
|
||||||
|
|
||||||
|
profile_data = g_memdup (data, length);
|
||||||
num_bytes = length;
|
num_bytes = length;
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
CODE
|
CODE
|
||||||
);
|
);
|
||||||
|
@ -177,16 +184,18 @@ HELP
|
||||||
{
|
{
|
||||||
if (color_profile)
|
if (color_profile)
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_color_profile_open_from_data (color_profile, num_bytes,
|
profile = gimp_color_profile_new_from_icc_profile (color_profile,
|
||||||
error);
|
num_bytes,
|
||||||
|
error);
|
||||||
|
|
||||||
if (profile)
|
if (profile)
|
||||||
{
|
{
|
||||||
success = gimp_image_convert_color_profile (image, profile,
|
success = gimp_image_convert_color_profile (image, profile,
|
||||||
intent, bpc,
|
intent, bpc,
|
||||||
progress, error);
|
progress, error);
|
||||||
|
g_object_unref (profile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
|
|
|
@ -1780,7 +1780,7 @@ HELP
|
||||||
%invoke = (
|
%invoke = (
|
||||||
code => <<'CODE'
|
code => <<'CODE'
|
||||||
{
|
{
|
||||||
GimpColorProfile profile;
|
GimpColorProfile *profile;
|
||||||
|
|
||||||
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
profile = gimp_color_managed_get_color_profile (GIMP_COLOR_MANAGED (image));
|
||||||
|
|
||||||
|
@ -1788,7 +1788,7 @@ HELP
|
||||||
profile_desc = gimp_color_profile_get_description (profile);
|
profile_desc = gimp_color_profile_get_description (profile);
|
||||||
profile_info = gimp_color_profile_get_summary (profile);
|
profile_info = gimp_color_profile_get_summary (profile);
|
||||||
|
|
||||||
gimp_color_profile_close (profile);
|
g_object_unref (profile);
|
||||||
|
|
||||||
}
|
}
|
||||||
CODE
|
CODE
|
||||||
|
@ -1826,9 +1826,9 @@ HELP
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
GimpColorProfile p;
|
GimpColorProfile *p;
|
||||||
|
|
||||||
p = gimp_color_profile_open_from_file (file, error);
|
p = gimp_color_profile_new_from_file (file, error);
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
|
|
||||||
if (p)
|
if (p)
|
||||||
|
@ -1837,7 +1837,7 @@ HELP
|
||||||
profile_desc = gimp_color_profile_get_description (p);
|
profile_desc = gimp_color_profile_get_description (p);
|
||||||
profile_info = gimp_color_profile_get_summary (p);
|
profile_info = gimp_color_profile_get_summary (p);
|
||||||
|
|
||||||
gimp_color_profile_close (p);
|
g_object_unref (p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue