[gimp] app: start an image profile API in core/gimpimage-profile.[ch]



commit e80eaf2524847fd7c5dbf2868d170ede8f4b5214
Author: Michael Natterer <mitch gimp org>
Date:   Sun Mar 16 23:49:02 2014 +0100

    app: start an image profile API in core/gimpimage-profile.[ch]
    
    add lowlevel functions gimp_image_get,set_icc_profile() which deal
    with ICC profiles in a GimpParasite.

 app/core/Makefile.am               |    2 ++
 app/core/gimpimage-convert-type.c  |    5 +++--
 app/core/gimpimage.c               |   16 +++++++++-------
 app/core/gimpimageundo.c           |    3 ++-
 app/file/file-open.c               |    3 ++-
 app/widgets/gimpimageprofileview.c |    3 ++-
 6 files changed, 20 insertions(+), 12 deletions(-)
---
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index 92be895..bc0ef13 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -238,6 +238,8 @@ libappcore_a_sources = \
        gimpimage-preview.c                     \
        gimpimage-preview.h                     \
        gimpimage-private.h                     \
+       gimpimage-profile.c                     \
+       gimpimage-profile.h                     \
        gimpimage-quick-mask.c                  \
        gimpimage-quick-mask.h                  \
        gimpimage-resize.c                      \
diff --git a/app/core/gimpimage-convert-type.c b/app/core/gimpimage-convert-type.c
index 683210e..d73caf9 100644
--- a/app/core/gimpimage-convert-type.c
+++ b/app/core/gimpimage-convert-type.c
@@ -149,6 +149,7 @@
 #include "gimperror.h"
 #include "gimpimage.h"
 #include "gimpimage-colormap.h"
+#include "gimpimage-profile.h"
 #include "gimpimage-undo.h"
 #include "gimpimage-undo-push.h"
 #include "gimplayer.h"
@@ -1082,10 +1083,10 @@ gimp_image_convert_type (GimpImage               *image,
     case GIMP_RGB:
     case GIMP_INDEXED:
       if (old_type == GIMP_GRAY)
-        gimp_image_parasite_detach (image, "icc-profile");
+        gimp_image_set_icc_profile (image, NULL);
       break;
     case GIMP_GRAY:
-      gimp_image_parasite_detach (image, "icc-profile");
+        gimp_image_set_icc_profile (image, NULL);
       break;
     default:
       break;
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 8df0e36..9bbff73 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -52,6 +52,7 @@
 #include "gimpimage-sample-points.h"
 #include "gimpimage-preview.h"
 #include "gimpimage-private.h"
+#include "gimpimage-profile.h"
 #include "gimpimage-quick-mask.h"
 #include "gimpimage-undo.h"
 #include "gimpimage-undo-push.h"
@@ -179,7 +180,8 @@ static void     gimp_image_real_unit_changed     (GimpImage         *image);
 static void     gimp_image_real_colormap_changed (GimpImage         *image,
                                                   gint               color_index);
 
-static const guint8 * gimp_image_get_icc_profile (GimpColorManaged  *managed,
+static const guint8 *
+        gimp_image_color_managed_get_icc_profile (GimpColorManaged  *managed,
                                                   gsize             *len);
 
 static void        gimp_image_projectable_flush  (GimpProjectable   *projectable,
@@ -628,7 +630,7 @@ gimp_image_class_init (GimpImageClass *klass)
 static void
 gimp_color_managed_iface_init (GimpColorManagedInterface *iface)
 {
-  iface->get_icc_profile = gimp_image_get_icc_profile;
+  iface->get_icc_profile = gimp_image_color_managed_get_icc_profile;
 }
 
 static void
@@ -1319,12 +1321,12 @@ gimp_image_real_colormap_changed (GimpImage *image,
 }
 
 static const guint8 *
-gimp_image_get_icc_profile (GimpColorManaged *managed,
-                            gsize            *len)
+gimp_image_color_managed_get_icc_profile (GimpColorManaged *managed,
+                                          gsize            *len)
 {
   const GimpParasite *parasite;
 
-  parasite = gimp_image_parasite_find (GIMP_IMAGE (managed), "icc-profile");
+  parasite = gimp_image_get_icc_profile (GIMP_IMAGE (managed));
 
   if (parasite)
     {
@@ -3087,7 +3089,7 @@ gimp_image_parasite_attach (GimpImage          *image,
   g_signal_emit (image, gimp_image_signals[PARASITE_ATTACHED], 0,
                  parasite->name);
 
-  if (strcmp (parasite->name, "icc-profile") == 0)
+  if (strcmp (parasite->name, GIMP_ICC_PROFILE_PARASITE_NAME) == 0)
     gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (image));
 }
 
@@ -3116,7 +3118,7 @@ gimp_image_parasite_detach (GimpImage   *image,
   g_signal_emit (image, gimp_image_signals[PARASITE_DETACHED], 0,
                  name);
 
-  if (strcmp (name, "icc-profile") == 0)
+  if (strcmp (name, GIMP_ICC_PROFILE_PARASITE_NAME) == 0)
     gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (image));
 }
 
diff --git a/app/core/gimpimageundo.c b/app/core/gimpimageundo.c
index 1c7d594..e250da2 100644
--- a/app/core/gimpimageundo.c
+++ b/app/core/gimpimageundo.c
@@ -37,6 +37,7 @@
 #include "gimpimage-grid.h"
 #include "gimpimage-metadata.h"
 #include "gimpimage-private.h"
+#include "gimpimage-profile.h"
 #include "gimpimageundo.h"
 #include "gimpparasitelist.h"
 
@@ -487,7 +488,7 @@ gimp_image_undo_pop (GimpUndo            *undo,
 
         name = parasite ? parasite->name : image_undo->parasite_name;
 
-        if (strcmp (name, "icc-profile") == 0)
+        if (strcmp (name, GIMP_ICC_PROFILE_PARASITE_NAME) == 0)
           gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (image));
 
         if (parasite)
diff --git a/app/file/file-open.c b/app/file/file-open.c
index f0d0376..621e46a 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -55,6 +55,7 @@
 #include "core/gimpdocumentlist.h"
 #include "core/gimpimage.h"
 #include "core/gimpimage-merge.h"
+#include "core/gimpimage-profile.h"
 #include "core/gimpimage-undo.h"
 #include "core/gimpimagefile.h"
 #include "core/gimplayer.h"
@@ -780,7 +781,7 @@ file_open_handle_color_profile (GimpImage    *image,
                                 GimpProgress *progress,
                                 GimpRunMode   run_mode)
 {
-  if (gimp_image_parasite_find (image, "icc-profile"))
+  if (gimp_image_get_icc_profile (image))
     {
       gimp_image_undo_disable (image);
 
diff --git a/app/widgets/gimpimageprofileview.c b/app/widgets/gimpimageprofileview.c
index f8551e6..9c0e735 100644
--- a/app/widgets/gimpimageprofileview.c
+++ b/app/widgets/gimpimageprofileview.c
@@ -40,6 +40,7 @@
 
 #include "core/gimp.h"
 #include "core/gimpimage.h"
+#include "core/gimpimage-profile.h"
 
 #include "gimpimageprofileview.h"
 
@@ -96,7 +97,7 @@ gimp_image_profile_view_new (GimpImage *image)
 
   return g_object_new (GIMP_TYPE_IMAGE_PROFILE_VIEW,
                        "image",    image,
-                       "parasite", "icc-profile",
+                       "parasite", GIMP_ICC_PROFILE_PARASITE_NAME,
                        NULL);
 }
 


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