[gimp] app: add gimp_fill_options_set_by_fill_mode()



commit 00932b57afaf361cb02605546cdf060c81a3f1f3
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 11 19:48:26 2016 +0100

    app: add gimp_fill_options_set_by_fill_mode()
    
    which takes a context and a GimpBucketFillMode and configures the
    GimpFillOptions accordingly.

 app/core/gimpfilloptions.c |   32 ++++++++++++++++++++++++++++++++
 app/core/gimpfilloptions.h |   36 ++++++++++++++++++++----------------
 2 files changed, 52 insertions(+), 16 deletions(-)
---
diff --git a/app/core/gimpfilloptions.c b/app/core/gimpfilloptions.c
index 173d72c..c5ced27 100644
--- a/app/core/gimpfilloptions.c
+++ b/app/core/gimpfilloptions.c
@@ -308,6 +308,38 @@ gimp_fill_options_set_by_fill_type (GimpFillOptions  *options,
   return TRUE;
 }
 
+gboolean
+gimp_fill_options_set_by_fill_mode (GimpFillOptions     *options,
+                                    GimpContext         *context,
+                                    GimpBucketFillMode   fill_mode,
+                                    GError             **error)
+{
+  GimpFillType fill_type;
+
+  g_return_val_if_fail (GIMP_IS_FILL_OPTIONS (options), FALSE);
+  g_return_val_if_fail (GIMP_IS_CONTEXT (context), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  switch (fill_mode)
+    {
+    default:
+    case GIMP_BUCKET_FILL_FG:
+      fill_type = GIMP_FILL_FOREGROUND;
+      break;
+
+    case GIMP_BUCKET_FILL_BG:
+      fill_type = GIMP_FILL_BACKGROUND;
+      break;
+
+    case GIMP_BUCKET_FILL_PATTERN:
+      fill_type = GIMP_FILL_PATTERN;
+      break;
+    }
+
+  return gimp_fill_options_set_by_fill_type (options, context,
+                                             fill_type, error);
+}
+
 const gchar *
 gimp_fill_options_get_undo_desc (GimpFillOptions *options)
 {
diff --git a/app/core/gimpfilloptions.h b/app/core/gimpfilloptions.h
index 995e7c9..8bed04e 100644
--- a/app/core/gimpfilloptions.h
+++ b/app/core/gimpfilloptions.h
@@ -48,22 +48,26 @@ struct _GimpFillOptionsClass
 
 GType             gimp_fill_options_get_type         (void) G_GNUC_CONST;
 
-GimpFillOptions * gimp_fill_options_new              (Gimp             *gimp);
-
-GimpFillStyle     gimp_fill_options_get_style        (GimpFillOptions  *options);
-void              gimp_fill_options_set_style        (GimpFillOptions  *options,
-                                                      GimpFillStyle     style);
-
-gboolean          gimp_fill_options_get_antialias    (GimpFillOptions  *options);
-void              gimp_fill_options_set_antialias    (GimpFillOptions  *options,
-                                                      gboolean          antialias);
-
-gboolean          gimp_fill_options_set_by_fill_type (GimpFillOptions  *options,
-                                                      GimpContext      *context,
-                                                      GimpFillType      fill_type,
-                                                      GError          **error);
-
-const gchar     * gimp_fill_options_get_undo_desc    (GimpFillOptions  *options);
+GimpFillOptions * gimp_fill_options_new              (Gimp               *gimp);
+
+GimpFillStyle     gimp_fill_options_get_style        (GimpFillOptions    *options);
+void              gimp_fill_options_set_style        (GimpFillOptions    *options,
+                                                      GimpFillStyle       style);
+
+gboolean          gimp_fill_options_get_antialias    (GimpFillOptions    *options);
+void              gimp_fill_options_set_antialias    (GimpFillOptions    *options,
+                                                      gboolean            antialias);
+
+gboolean          gimp_fill_options_set_by_fill_type (GimpFillOptions    *options,
+                                                      GimpContext        *context,
+                                                      GimpFillType        fill_type,
+                                                      GError            **error);
+gboolean          gimp_fill_options_set_by_fill_mode (GimpFillOptions    *options,
+                                                      GimpContext        *context,
+                                                      GimpBucketFillMode  fill_mode,
+                                                      GError            **error);
+
+const gchar     * gimp_fill_options_get_undo_desc    (GimpFillOptions    *options);
 
 
 #endif /* __GIMP_FILL_OPTIONS_H__ */


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