[gegl/soc-2011-seamless-clone: 35/49] Report preprocessing error messages in the seamless clone operation



commit e759951a1b629e56a469ce6b2da77ab606508bda
Author: Barak Itkin <lightningismyname gmail com>
Date:   Fri Jul 20 22:09:38 2012 +0300

    Report preprocessing error messages in the seamless clone operation

 operations/common/seamless-clone/seamless-clone.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/operations/common/seamless-clone/seamless-clone.c b/operations/common/seamless-clone/seamless-clone.c
index 33f5f2d..2882d07 100644
--- a/operations/common/seamless-clone/seamless-clone.c
+++ b/operations/common/seamless-clone/seamless-clone.c
@@ -26,6 +26,8 @@ gegl_chant_int (xoff, _("X offset"), -100000, +100000, 0,
 
 gegl_chant_int (yoff, _("Y offset"), -100000, +100000, 0,
                 _("How much vertical offset should applied to the paste"))
+
+gegl_chant_string (error_msg, _("Error message"), NULL, _("An error message in case of a failure"))
 #else
 
 #define GEGL_CHANT_TYPE_COMPOSER
@@ -130,6 +132,24 @@ process (GeglOperation       *operation,
 
       props->aux = aux;
       props->preprocess = sc_generate_cache (aux, gegl_operation_source_get_bounding_box (operation, "aux"), o -> max_refine_steps);
+      switch (props->preprocess->error)
+        {
+          case SC_ERROR_NONE:
+            o->error_msg = NULL;
+            break;
+          case SC_ERROR_NO_PASTE:
+            o->error_msg = _("The paste does not contain opaque parts");
+            break;
+          case SC_ERROR_SMALL_PASTE:
+            o->error_msg = _("The paste is too small to use");
+            break;
+          case SC_ERROR_HOLED_OR_SPLIT_PASTE:
+            o->error_msg = _("The paste contains holes and/or several unconnected parts");
+            break;
+          default:
+            g_warning ("Unknown preprocessing status %d", props->preprocess->error);
+            break;
+        }
     }
   g_mutex_unlock (props->mutex);
 



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