[gimp] app, pdb: Modify gimp_channel_border() to take a style parameter



commit 15d4908076dcea5860f19099d907f0a0048e4aec
Author: Ell <ell_se yahoo com>
Date:   Mon Apr 4 15:49:12 2016 +0000

    app, pdb: Modify gimp_channel_border() to take a style parameter
    
    isntead of the feather parameter, and pass it to
    gimp_gegl_apply_border().
    
    Make the necessary changes to the rest of the code to maintain the
    current behavior.
    
    Mass parameter alignment changes to gimpchannel.h. Sigh #2...

 app/actions/select-commands.c  |    4 +-
 app/core/gimpchannel.c         |   33 ++++----
 app/core/gimpchannel.h         |  178 ++++++++++++++++++++--------------------
 app/core/gimpselection.c       |   16 ++--
 app/pdb/selection-cmds.c       |    6 +-
 tools/pdbgen/pdb/selection.pdb |    6 +-
 6 files changed, 123 insertions(+), 120 deletions(-)
---
diff --git a/app/actions/select-commands.c b/app/actions/select-commands.c
index cc35eb7..3124244 100644
--- a/app/actions/select-commands.c
+++ b/app/actions/select-commands.c
@@ -569,7 +569,9 @@ select_border_callback (GtkWidget *widget,
     }
 
   gimp_channel_border (gimp_image_get_mask (image), radius_x, radius_y,
-                       select_border_feather, select_border_edge_lock, TRUE);
+                       ! select_border_feather ? GIMP_CHANNEL_BORDER_STYLE_HARD :
+                                                 GIMP_CHANNEL_BORDER_STYLE_FEATHERED,
+                       select_border_edge_lock, TRUE);
   gimp_image_flush (image);
 }
 
diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c
index 27b40a9..9a3463e 100644
--- a/app/core/gimpchannel.c
+++ b/app/core/gimpchannel.c
@@ -219,7 +219,7 @@ static void       gimp_channel_real_invert   (GimpChannel         *channel,
 static void       gimp_channel_real_border   (GimpChannel         *channel,
                                               gint                 radius_x,
                                               gint                 radius_y,
-                                              gboolean             feather,
+                                              GimpChannelBorderStyle style,
                                               gboolean             edge_lock,
                                               gboolean             push_undo);
 static void       gimp_channel_real_grow     (GimpChannel         *channel,
@@ -1406,12 +1406,12 @@ gimp_channel_real_invert (GimpChannel *channel,
 }
 
 static void
-gimp_channel_real_border (GimpChannel *channel,
-                          gint         radius_x,
-                          gint         radius_y,
-                          gboolean     feather,
-                          gboolean     edge_lock,
-                          gboolean     push_undo)
+gimp_channel_real_border (GimpChannel            *channel,
+                          gint                    radius_x,
+                          gint                    radius_y,
+                          GimpChannelBorderStyle  style,
+                          gboolean                edge_lock,
+                          gboolean                push_undo)
 {
   gint x1, y1, x2, y2;
 
@@ -1457,10 +1457,7 @@ gimp_channel_real_border (GimpChannel *channel,
                           NULL, NULL,
                           gimp_drawable_get_buffer (GIMP_DRAWABLE (channel)),
                           GEGL_RECTANGLE (x1, y1, x2 - x1, y2 - y1),
-                          radius_x, radius_y,
-                          ! feather ? GIMP_CHANNEL_BORDER_STYLE_HARD :
-                                      GIMP_CHANNEL_BORDER_STYLE_FEATHERED,
-                          edge_lock);
+                          radius_x, radius_y, style, edge_lock);
 
   channel->bounds_known = FALSE;
 
@@ -2031,12 +2028,12 @@ gimp_channel_invert (GimpChannel *channel,
 }
 
 void
-gimp_channel_border (GimpChannel *channel,
-                     gint         radius_x,
-                     gint         radius_y,
-                     gboolean     feather,
-                     gboolean     edge_lock,
-                     gboolean     push_undo)
+gimp_channel_border (GimpChannel            *channel,
+                     gint                    radius_x,
+                     gint                    radius_y,
+                     GimpChannelBorderStyle  style,
+                     gboolean                edge_lock,
+                     gboolean                push_undo)
 {
   g_return_if_fail (GIMP_IS_CHANNEL (channel));
 
@@ -2044,7 +2041,7 @@ gimp_channel_border (GimpChannel *channel,
     push_undo = FALSE;
 
   GIMP_CHANNEL_GET_CLASS (channel)->border (channel,
-                                            radius_x, radius_y, feather, edge_lock,
+                                            radius_x, radius_y, style, edge_lock,
                                             push_undo);
 }
 
diff --git a/app/core/gimpchannel.h b/app/core/gimpchannel.h
index 5f16c87..07931b6 100644
--- a/app/core/gimpchannel.h
+++ b/app/core/gimpchannel.h
@@ -60,50 +60,50 @@ struct _GimpChannelClass
   GimpDrawableClass  parent_class;
 
   /*  signals  */
-  void     (* color_changed) (GimpChannel         *channel);
+  void     (* color_changed) (GimpChannel             *channel);
 
   /*  virtual functions  */
-  gboolean (* boundary)      (GimpChannel         *channel,
-                              const GimpBoundSeg **segs_in,
-                              const GimpBoundSeg **segs_out,
-                              gint                *num_segs_in,
-                              gint                *num_segs_out,
-                              gint                 x1,
-                              gint                 y1,
-                              gint                 x2,
-                              gint                 y2);
-  gboolean (* is_empty)      (GimpChannel         *channel);
-
-  void     (* feather)       (GimpChannel         *channel,
-                              gdouble              radius_x,
-                              gdouble              radius_y,
-                              gboolean             push_undo);
-  void     (* sharpen)       (GimpChannel         *channel,
-                              gboolean             push_undo);
-  void     (* clear)         (GimpChannel         *channel,
-                              const gchar         *undo_desc,
-                              gboolean             push_undo);
-  void     (* all)           (GimpChannel         *channel,
-                              gboolean             push_undo);
-  void     (* invert)        (GimpChannel         *channel,
-                              gboolean             push_undo);
-  void     (* border)        (GimpChannel         *channel,
-                              gint                 radius_x,
-                              gint                 radius_y,
-                              gboolean             feather,
-                              gboolean             edge_lock,
-                              gboolean             push_undo);
-  void     (* grow)          (GimpChannel         *channel,
-                              gint                 radius_x,
-                              gint                 radius_y,
-                              gboolean             push_undo);
-  void     (* shrink)        (GimpChannel         *channel,
-                              gint                 radius_x,
-                              gint                 radius_y,
-                              gboolean             edge_lock,
-                              gboolean             push_undo);
-  void     (* flood)         (GimpChannel         *channel,
-                              gboolean             push_undo);
+  gboolean (* boundary)      (GimpChannel             *channel,
+                              const GimpBoundSeg     **segs_in,
+                              const GimpBoundSeg     **segs_out,
+                              gint                    *num_segs_in,
+                              gint                    *num_segs_out,
+                              gint                     x1,
+                              gint                     y1,
+                              gint                     x2,
+                              gint                     y2);
+  gboolean (* is_empty)      (GimpChannel             *channel);
+
+  void     (* feather)       (GimpChannel             *channel,
+                              gdouble                  radius_x,
+                              gdouble                  radius_y,
+                              gboolean                 push_undo);
+  void     (* sharpen)       (GimpChannel             *channel,
+                              gboolean                 push_undo);
+  void     (* clear)         (GimpChannel             *channel,
+                              const gchar             *undo_desc,
+                              gboolean                 push_undo);
+  void     (* all)           (GimpChannel             *channel,
+                              gboolean                 push_undo);
+  void     (* invert)        (GimpChannel             *channel,
+                              gboolean                 push_undo);
+  void     (* border)        (GimpChannel             *channel,
+                              gint                     radius_x,
+                              gint                     radius_y,
+                              GimpChannelBorderStyle   style,
+                              gboolean                 edge_lock,
+                              gboolean                 push_undo);
+  void     (* grow)          (GimpChannel             *channel,
+                              gint                     radius_x,
+                              gint                     radius_y,
+                              gboolean                 push_undo);
+  void     (* shrink)        (GimpChannel             *channel,
+                              gint                     radius_x,
+                              gint                     radius_y,
+                              gboolean                 edge_lock,
+                              gboolean                 push_undo);
+  void     (* flood)         (GimpChannel             *channel,
+                              gboolean                 push_undo);
 
   const gchar *feather_desc;
   const gchar *sharpen_desc;
@@ -162,53 +162,53 @@ void          gimp_channel_push_undo          (GimpChannel       *mask,
 
 /*  selection mask functions  */
 
-GimpChannel * gimp_channel_new_mask           (GimpImage           *image,
-                                               gint                 width,
-                                               gint                 height);
-
-gboolean      gimp_channel_boundary           (GimpChannel         *mask,
-                                               const GimpBoundSeg **segs_in,
-                                               const GimpBoundSeg **segs_out,
-                                               gint                *num_segs_in,
-                                               gint                *num_segs_out,
-                                               gint                 x1,
-                                               gint                 y1,
-                                               gint                 x2,
-                                               gint                 y2);
-gboolean      gimp_channel_is_empty           (GimpChannel         *mask);
-
-void          gimp_channel_feather            (GimpChannel         *mask,
-                                               gdouble              radius_x,
-                                               gdouble              radius_y,
-                                               gboolean             push_undo);
-void          gimp_channel_sharpen            (GimpChannel         *mask,
-                                               gboolean             push_undo);
-
-void          gimp_channel_clear              (GimpChannel         *mask,
-                                               const gchar         *undo_desc,
-                                               gboolean             push_undo);
-void          gimp_channel_all                (GimpChannel         *mask,
-                                               gboolean             push_undo);
-void          gimp_channel_invert             (GimpChannel         *mask,
-                                               gboolean             push_undo);
-
-void          gimp_channel_border             (GimpChannel         *mask,
-                                               gint                 radius_x,
-                                               gint                 radius_y,
-                                               gboolean             feather,
-                                               gboolean             edge_lock,
-                                               gboolean             push_undo);
-void          gimp_channel_grow               (GimpChannel         *mask,
-                                               gint                 radius_x,
-                                               gint                 radius_y,
-                                               gboolean             push_undo);
-void          gimp_channel_shrink             (GimpChannel         *mask,
-                                               gint                 radius_x,
-                                               gint                 radius_y,
-                                               gboolean             edge_lock,
-                                               gboolean             push_undo);
-void          gimp_channel_flood              (GimpChannel         *mask,
-                                               gboolean             push_undo);
+GimpChannel * gimp_channel_new_mask           (GimpImage              *image,
+                                               gint                    width,
+                                               gint                    height);
+
+gboolean      gimp_channel_boundary           (GimpChannel            *mask,
+                                               const GimpBoundSeg    **segs_in,
+                                               const GimpBoundSeg    **segs_out,
+                                               gint                   *num_segs_in,
+                                               gint                   *num_segs_out,
+                                               gint                    x1,
+                                               gint                    y1,
+                                               gint                    x2,
+                                               gint                    y2);
+gboolean      gimp_channel_is_empty           (GimpChannel            *mask);
+
+void          gimp_channel_feather            (GimpChannel            *mask,
+                                               gdouble                 radius_x,
+                                               gdouble                 radius_y,
+                                               gboolean                push_undo);
+void          gimp_channel_sharpen            (GimpChannel            *mask,
+                                               gboolean                push_undo);
+
+void          gimp_channel_clear              (GimpChannel            *mask,
+                                               const gchar            *undo_desc,
+                                               gboolean                push_undo);
+void          gimp_channel_all                (GimpChannel            *mask,
+                                               gboolean                push_undo);
+void          gimp_channel_invert             (GimpChannel            *mask,
+                                               gboolean                push_undo);
+
+void          gimp_channel_border             (GimpChannel            *mask,
+                                               gint                    radius_x,
+                                               gint                    radius_y,
+                                               GimpChannelBorderStyle  style,
+                                               gboolean                edge_lock,
+                                               gboolean                push_undo);
+void          gimp_channel_grow               (GimpChannel            *mask,
+                                               gint                    radius_x,
+                                               gint                    radius_y,
+                                               gboolean                push_undo);
+void          gimp_channel_shrink             (GimpChannel            *mask,
+                                               gint                    radius_x,
+                                               gint                    radius_y,
+                                               gboolean                edge_lock,
+                                               gboolean                push_undo);
+void          gimp_channel_flood              (GimpChannel            *mask,
+                                               gboolean                push_undo);
 
 
 #endif /* __GIMP_CHANNEL_H__ */
diff --git a/app/core/gimpselection.c b/app/core/gimpselection.c
index 6b412e9..9fe6108 100644
--- a/app/core/gimpselection.c
+++ b/app/core/gimpselection.c
@@ -126,7 +126,7 @@ static void       gimp_selection_invert        (GimpChannel         *channel,
 static void       gimp_selection_border        (GimpChannel         *channel,
                                                 gint                 radius_x,
                                                 gint                 radius_y,
-                                                gboolean             feather,
+                                                GimpChannelBorderStyle style,
                                                 gboolean             edge_lock,
                                                 gboolean             push_undo);
 static void       gimp_selection_grow          (GimpChannel         *channel,
@@ -545,16 +545,16 @@ gimp_selection_invert (GimpChannel *channel,
 }
 
 static void
-gimp_selection_border (GimpChannel *channel,
-                       gint         radius_x,
-                       gint         radius_y,
-                       gboolean     feather,
-                       gboolean     edge_lock,
-                       gboolean     push_undo)
+gimp_selection_border (GimpChannel            *channel,
+                       gint                    radius_x,
+                       gint                    radius_y,
+                       GimpChannelBorderStyle  style,
+                       gboolean                edge_lock,
+                       gboolean                push_undo)
 {
   GIMP_CHANNEL_CLASS (parent_class)->border (channel,
                                              radius_x, radius_y,
-                                             feather, edge_lock,
+                                             style, edge_lock,
                                              push_undo);
 }
 
diff --git a/app/pdb/selection-cmds.c b/app/pdb/selection-cmds.c
index 1b0d774..781bb62 100644
--- a/app/pdb/selection-cmds.c
+++ b/app/pdb/selection-cmds.c
@@ -362,9 +362,11 @@ selection_border_invoker (GimpProcedure         *procedure,
 
   if (success)
     {
-      /* FIXME: "feather" and "edge-lock" hardcoded to TRUE */
+      /* FIXME: "style" and "edge-lock" hardcoded to FEATHERED and TRUE, respectively. */
       gimp_channel_border (gimp_image_get_mask (image),
-                           radius, radius, TRUE, TRUE, TRUE);
+                           radius, radius,
+                           GIMP_CHANNEL_BORDER_STYLE_FEATHERED,
+                           TRUE, TRUE);
     }
 
   return gimp_procedure_get_return_values (procedure, success,
diff --git a/tools/pdbgen/pdb/selection.pdb b/tools/pdbgen/pdb/selection.pdb
index 34e5a87..ee22d02 100644
--- a/tools/pdbgen/pdb/selection.pdb
+++ b/tools/pdbgen/pdb/selection.pdb
@@ -360,9 +360,11 @@ HELP
     %invoke = (
        code => <<'CODE'
 {
-  /* FIXME: "feather" and "edge-lock" hardcoded to TRUE */
+  /* FIXME: "style" and "edge-lock" hardcoded to FEATHERED and TRUE, respectively. */
   gimp_channel_border (gimp_image_get_mask (image),
-                       radius, radius, TRUE, TRUE, TRUE);
+                       radius, radius,
+                       GIMP_CHANNEL_BORDER_STYLE_FEATHERED,
+                       TRUE, TRUE);
 }
 CODE
     );


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