[gimp] libgimpcolor: add GimpColorManaged::get_color_profile()



commit cdb3b0aabb35f2669462d43c5822fe640b469963
Author: Michael Natterer <mitch gimp org>
Date:   Wed May 13 00:43:16 2015 +0200

    libgimpcolor: add GimpColorManaged::get_color_profile()
    
    which returns a GimpColorProfile instead of just an ICC blob like
    get_icc_profile(). Also, it will always return a profile, as in
    fall back to the built-in profiles automatically.

 libgimpcolor/gimpcolor.def      |    1 +
 libgimpcolor/gimpcolormanaged.c |   30 ++++++++++++++++++++++++++++--
 libgimpcolor/gimpcolormanaged.h |   19 ++++++++++++-------
 3 files changed, 41 insertions(+), 9 deletions(-)
---
diff --git a/libgimpcolor/gimpcolor.def b/libgimpcolor/gimpcolor.def
index 540b1df..98c02bd 100644
--- a/libgimpcolor/gimpcolor.def
+++ b/libgimpcolor/gimpcolor.def
@@ -21,6 +21,7 @@ EXPORTS
        gimp_cmyka_get_uchar
        gimp_cmyka_set
        gimp_cmyka_set_uchar
+       gimp_color_managed_get_color_profile
        gimp_color_managed_get_icc_profile
        gimp_color_managed_interface_get_type
        gimp_color_managed_profile_changed
diff --git a/libgimpcolor/gimpcolormanaged.c b/libgimpcolor/gimpcolormanaged.c
index 6299643..9678104 100644
--- a/libgimpcolor/gimpcolormanaged.c
+++ b/libgimpcolor/gimpcolormanaged.c
@@ -91,8 +91,9 @@ gimp_color_managed_base_init (GimpColorManagedInterface *iface)
                       g_cclosure_marshal_VOID__VOID,
                       G_TYPE_NONE, 0);
 
-      iface->get_icc_profile = NULL;
-      iface->profile_changed = NULL;
+      iface->get_icc_profile   = NULL;
+      iface->get_color_profile = NULL;
+      iface->profile_changed   = NULL;
 
       initialized = TRUE;
     }
@@ -128,6 +129,31 @@ gimp_color_managed_get_icc_profile (GimpColorManaged *managed,
 }
 
 /**
+ * gimp_color_managed_get_color_profile:
+ * @managed: an object the implements the #GimpColorManaged interface
+ *
+ * This function, if implemented, always returns a #GimpColorProfile.
+ *
+ * Return value: The @managed's #GimpColorProfile.
+ *
+ * Since: GIMP 2.10
+ **/
+GimpColorProfile
+gimp_color_managed_get_color_profile (GimpColorManaged *managed)
+{
+  GimpColorManagedInterface *iface;
+
+  g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), NULL);
+
+  iface = GIMP_COLOR_MANAGED_GET_INTERFACE (managed);
+
+  if (iface->get_color_profile)
+    return iface->get_color_profile (managed);
+
+  return NULL;
+}
+
+/**
  * gimp_color_managed_profile_changed:
  * @managed: an object the implements the #GimpColorManaged interface
  *
diff --git a/libgimpcolor/gimpcolormanaged.h b/libgimpcolor/gimpcolormanaged.h
index 67b3041..1dc0149 100644
--- a/libgimpcolor/gimpcolormanaged.h
+++ b/libgimpcolor/gimpcolormanaged.h
@@ -44,19 +44,24 @@ struct _GimpColorManagedInterface
   GTypeInterface  base_iface;
 
   /*  virtual functions  */
-  const guint8 * (* get_icc_profile) (GimpColorManaged *managed,
-                                      gsize            *len);
+  const guint8     * (* get_icc_profile)   (GimpColorManaged *managed,
+                                            gsize            *len);
 
   /*  signals  */
-  void           (* profile_changed) (GimpColorManaged *managed);
+  void               (* profile_changed)   (GimpColorManaged *managed);
+
+  /*  virtual functions  */
+  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,
+                                                         gsize            *len);
+GimpColorProfile  gimp_color_managed_get_color_profile  (GimpColorManaged *managed);
 
-const guint8 * gimp_color_managed_get_icc_profile    (GimpColorManaged *managed,
-                                                      gsize            *len);
-void           gimp_color_managed_profile_changed    (GimpColorManaged *managed);
+void              gimp_color_managed_profile_changed    (GimpColorManaged *managed);
 
 
 G_END_DECLS


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