[gimp] libgimpcolor: add gimp_color_profile_save_to_file()



commit 46096a17e3fad6ad2da9c0986effc69b9aafe495
Author: Michael Natterer <mitch gimp org>
Date:   Wed May 4 20:40:04 2016 +0200

    libgimpcolor: add gimp_color_profile_save_to_file()

 libgimpcolor/gimpcolor.def      |    1 +
 libgimpcolor/gimpcolorprofile.c |   31 +++++++++++++++++++++++++++++++
 libgimpcolor/gimpcolorprofile.h |    4 ++++
 3 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/libgimpcolor/gimpcolor.def b/libgimpcolor/gimpcolor.def
index 9cd03ff..6178706 100644
--- a/libgimpcolor/gimpcolor.def
+++ b/libgimpcolor/gimpcolor.def
@@ -51,6 +51,7 @@ EXPORTS
        gimp_color_profile_new_rgb_srgb
        gimp_color_profile_new_rgb_srgb_linear
        gimp_color_profile_new_srgb_trc_from_color_profile
+       gimp_color_profile_save_to_file
        gimp_hsl_get_type
        gimp_hsl_set
        gimp_hsl_set_alpha
diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c
index bab7f79..93f291c 100644
--- a/libgimpcolor/gimpcolorprofile.c
+++ b/libgimpcolor/gimpcolorprofile.c
@@ -359,6 +359,37 @@ gimp_color_profile_new_from_lcms_profile (gpointer   lcms_profile,
 }
 
 /**
+ * gimp_color_profile_save_to_file:
+ * profile: a #GimpColorProfile
+ * @file:   a #GFile
+ * @error:  return location for #GError
+ *
+ * This function saves @profile to @file as ICC profile.
+ *
+ * Return value: %TRUE on success, %FALSE if an error occured.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_color_profile_save_to_file (GimpColorProfile  *profile,
+                                 GFile             *file,
+                                 GError           **error)
+{
+  g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile), FALSE);
+  g_return_val_if_fail (G_IS_FILE (file), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  return g_file_replace_contents (file,
+                                  (const gchar *) profile->priv->data,
+                                  profile->priv->length,
+                                  NULL, FALSE,
+                                  G_FILE_CREATE_NONE,
+                                  NULL,
+                                  NULL,
+                                  error);
+}
+
+/**
  * gimp_color_profile_get_icc_profile:
  * @profile: a #GimpColorProfile
  * @length:  return location for the number of bytes
diff --git a/libgimpcolor/gimpcolorprofile.h b/libgimpcolor/gimpcolorprofile.h
index 222c1e1..8d37ac5 100644
--- a/libgimpcolor/gimpcolorprofile.h
+++ b/libgimpcolor/gimpcolorprofile.h
@@ -86,6 +86,10 @@ GimpColorProfile * gimp_color_profile_new_from_icc_profile  (const guint8      *
 GimpColorProfile * gimp_color_profile_new_from_lcms_profile (gpointer           lcms_profile,
                                                              GError           **error);
 
+gboolean           gimp_color_profile_save_to_file          (GimpColorProfile  *profile,
+                                                             GFile             *file,
+                                                             GError           **error);
+
 const guint8     * gimp_color_profile_get_icc_profile       (GimpColorProfile  *profile,
                                                              gsize             *length);
 gpointer           gimp_color_profile_get_lcms_profile      (GimpColorProfile  *profile);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]