[gimp/goat-invasion: 274/526] app: add GimpOperationShapeburst to calculate the distance map for blend



commit e4abdb64c116c8fd9791af81b4e7076de1623edb
Author: Michael Natterer <mitch gimp org>
Date:   Tue Mar 27 00:48:20 2012 +0200

    app: add GimpOperationShapeburst to calculate the distance map for blend

 app/core/gimpdrawable-blend.c      |   59 ++++---
 app/gegl/Makefile.am               |    2 +
 app/gegl/gimp-gegl-types.h         |    1 +
 app/gegl/gimp-gegl.c               |    2 +
 app/gegl/gimpoperationshapeburst.c |  320 ++++++++++++++++++++++++++++++++++++
 app/gegl/gimpoperationshapeburst.h |   55 ++++++
 app/paint-funcs/paint-funcs.c      |  145 ----------------
 app/paint-funcs/paint-funcs.h      |    5 -
 8 files changed, 413 insertions(+), 176 deletions(-)
---
diff --git a/app/core/gimpdrawable-blend.c b/app/core/gimpdrawable-blend.c
index 6ce922b..7df9837 100644
--- a/app/core/gimpdrawable-blend.c
+++ b/app/core/gimpdrawable-blend.c
@@ -39,6 +39,7 @@
 #include "gegl/gimp-gegl-utils.h"
 
 #include "gimp.h"
+#include "gimp-apply-operation.h"
 #include "gimpchannel.h"
 #include "gimpcontext.h"
 #include "gimpdrawable-blend.h"
@@ -573,11 +574,8 @@ gradient_precalc_shapeburst (GimpImage    *image,
                              GimpProgress *progress)
 {
   GimpChannel *mask;
-  TileManager *temp_tiles;
   GeglBuffer  *temp_buffer;
-  PixelRegion  tempR;
   gfloat       max_iteration;
-  gfloat      *distp;
   gint         size;
   gpointer     pr;
 
@@ -585,7 +583,8 @@ gradient_precalc_shapeburst (GimpImage    *image,
   distR.tiles = tile_manager_new (PR->w, PR->h, sizeof (gfloat));
 
   /*  allocate the selection mask copy  */
-  temp_tiles = tile_manager_new (PR->w, PR->h, 1);
+  temp_buffer = gimp_gegl_buffer_new (GIMP_GEGL_RECT (0, 0, PR->w, PR->h),
+                                      babl_format ("Y u8"));
 
   mask = gimp_image_get_mask (image);
 
@@ -598,9 +597,6 @@ gradient_precalc_shapeburst (GimpImage    *image,
       gimp_item_mask_intersect (GIMP_ITEM (drawable), &x, &y, &width, &height);
       gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
 
-      temp_buffer = gimp_tile_manager_create_buffer (temp_tiles,
-                                                     babl_format ("Y u8"));
-
       /*  copy the mask to the temp mask  */
       gegl_buffer_copy (gimp_drawable_get_buffer (GIMP_DRAWABLE (mask)),
                         GIMP_GEGL_RECT (x+off_x, y + off_y, width, height),
@@ -612,37 +608,50 @@ gradient_precalc_shapeburst (GimpImage    *image,
       /*  If the intended drawable has an alpha channel, use that  */
       if (gimp_drawable_has_alpha (drawable))
         {
-          temp_buffer = gimp_tile_manager_create_buffer (temp_tiles,
-                                                         babl_format ("A u8"));
-
           /*  extract the aplha into the temp mask  */
+          gegl_buffer_set_format (temp_buffer, babl_format ("A u8"));
           gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
                             GIMP_GEGL_RECT (PR->x, PR->y, PR->w, PR->h),
                             temp_buffer,
-                            GIMP_GEGL_RECT (0,0,0,0));
+                            GIMP_GEGL_RECT (0, 0, 0, 0));
+          gegl_buffer_set_format (temp_buffer, NULL);
         }
       else
         {
           GeglColor *white = gegl_color_new ("white");
 
-          temp_buffer = gimp_tile_manager_create_buffer (temp_tiles,
-                                                         babl_format ("Y u8"));
-
           /*  Otherwise, just fill the shapeburst to white  */
           gegl_buffer_set_color (temp_buffer, NULL, white);
           g_object_unref (white);
         }
     }
 
-  gegl_buffer_flush (temp_buffer);
+  {
+    GeglBuffer *dist_buffer;
+    GeglNode   *shapeburst;
+    gdouble     max = 0.0;
+
+    dist_buffer = gimp_tile_manager_create_buffer (distR.tiles,
+                                                   babl_format ("Y float"));
+
+    shapeburst = gegl_node_new_child (NULL,
+                                      "operation", "gimp:shapeburst",
+                                      NULL);
+
+    gimp_apply_operation (temp_buffer, NULL, NULL,
+                          shapeburst,
+                          dist_buffer, NULL);
+
+    gegl_node_get (shapeburst, "max-iterations", &max, NULL);
 
-  pixel_region_init (&tempR, temp_tiles, 0, 0, PR->w, PR->h, TRUE);
-  pixel_region_init (&distR, distR.tiles, 0, 0, PR->w, PR->h, TRUE);
+    g_object_unref (shapeburst);
 
-  max_iteration = shapeburst_region (&tempR, &distR,
-                                     progress ?
-                                     gimp_progress_update_and_flush : NULL,
-                                     progress);
+    max_iteration = max;
+
+    g_object_unref (dist_buffer);
+  }
+
+  g_object_unref (temp_buffer);
 
   /*  normalize the shapeburst with the max iteration  */
   if (max_iteration > 0)
@@ -653,8 +662,9 @@ gradient_precalc_shapeburst (GimpImage    *image,
            pr != NULL;
            pr = pixel_regions_process (pr))
         {
-          distp = (gfloat *) distR.data;
-          size  = distR.w * distR.h;
+          gfloat *distp = (gfloat *) distR.data;
+
+          size = distR.w * distR.h;
 
           while (size--)
             *distp++ /= max_iteration;
@@ -662,9 +672,6 @@ gradient_precalc_shapeburst (GimpImage    *image,
 
       pixel_region_init (&distR, distR.tiles, 0, 0, PR->w, PR->h, FALSE);
     }
-
-  g_object_unref (temp_buffer);
-  tile_manager_unref (temp_tiles);
 }
 
 
diff --git a/app/gegl/Makefile.am b/app/gegl/Makefile.am
index a47acaf..665a8e3 100644
--- a/app/gegl/Makefile.am
+++ b/app/gegl/Makefile.am
@@ -62,6 +62,8 @@ libappgegl_a_sources = \
 	gimpoperationgrow.h			\
 	gimpoperationsetalpha.c			\
 	gimpoperationsetalpha.h			\
+	gimpoperationshapeburst.c		\
+	gimpoperationshapeburst.h		\
 	gimpoperationshrink.c			\
 	gimpoperationshrink.h			\
 	\
diff --git a/app/gegl/gimp-gegl-types.h b/app/gegl/gimp-gegl-types.h
index 778053b..be6512f 100644
--- a/app/gegl/gimp-gegl-types.h
+++ b/app/gegl/gimp-gegl-types.h
@@ -33,6 +33,7 @@ typedef struct _GimpOperationCageTransform      GimpOperationCageTransform;
 typedef struct _GimpOperationEqualize           GimpOperationEqualize;
 typedef struct _GimpOperationGrow               GimpOperationGrow;
 typedef struct _GimpOperationSetAlpha           GimpOperationSetAlpha;
+typedef struct _GimpOperationShapeburst         GimpOperationShapeburst;
 typedef struct _GimpOperationShrink             GimpOperationShrink;
 
 typedef struct _GimpOperationPointFilter        GimpOperationPointFilter;
diff --git a/app/gegl/gimp-gegl.c b/app/gegl/gimp-gegl.c
index 1db74e3..ca784fe 100644
--- a/app/gegl/gimp-gegl.c
+++ b/app/gegl/gimp-gegl.c
@@ -38,6 +38,7 @@
 #include "gimpoperationequalize.h"
 #include "gimpoperationgrow.h"
 #include "gimpoperationsetalpha.h"
+#include "gimpoperationshapeburst.h"
 #include "gimpoperationshrink.h"
 
 #include "gimpoperationbrightnesscontrast.h"
@@ -128,6 +129,7 @@ gimp_gegl_init (Gimp *gimp)
   g_type_class_ref (GIMP_TYPE_OPERATION_EQUALIZE);
   g_type_class_ref (GIMP_TYPE_OPERATION_GROW);
   g_type_class_ref (GIMP_TYPE_OPERATION_SET_ALPHA);
+  g_type_class_ref (GIMP_TYPE_OPERATION_SHAPEBURST);
   g_type_class_ref (GIMP_TYPE_OPERATION_SHRINK);
 
   g_type_class_ref (GIMP_TYPE_OPERATION_BRIGHTNESS_CONTRAST);
diff --git a/app/gegl/gimpoperationshapeburst.c b/app/gegl/gimpoperationshapeburst.c
new file mode 100644
index 0000000..af0dc2f
--- /dev/null
+++ b/app/gegl/gimpoperationshapeburst.c
@@ -0,0 +1,320 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationshapeburst.c
+ * Copyright (C) 2012 Michael Natterer <mitch gimp org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <cairo.h>
+#include <gegl.h>
+
+#include "libgimpcolor/gimpcolor.h"
+#include "libgimpmath/gimpmath.h"
+
+#include "gimp-gegl-types.h"
+
+#include "gimp-gegl-utils.h"
+#include "gimpoperationshapeburst.h"
+
+
+enum
+{
+  PROP_0,
+  PROP_MAX_ITERATIONS,
+  PROP_PROGRESS
+};
+
+
+static void     gimp_operation_shapeburst_get_property (GObject      *object,
+                                                        guint         property_id,
+                                                        GValue       *value,
+                                                        GParamSpec   *pspec);
+static void     gimp_operation_shapeburst_set_property (GObject      *object,
+                                                        guint         property_id,
+                                                        const GValue *value,
+                                                        GParamSpec   *pspec);
+
+static GeglRectangle
+gimp_operation_shapeburst_get_required_for_output (GeglOperation       *self,
+                                                   const gchar         *input_pad,
+                                                   const GeglRectangle *roi);
+static GeglRectangle
+      gimp_operation_shapeburst_get_cached_region (GeglOperation       *self,
+                                                   const GeglRectangle *roi);
+static void     gimp_operation_shapeburst_prepare (GeglOperation       *operation);
+static gboolean gimp_operation_shapeburst_process (GeglOperation       *operation,
+                                                   GeglBuffer          *input,
+                                                   GeglBuffer          *output,
+                                                   const GeglRectangle *roi,
+                                                   gint                 level);
+
+
+G_DEFINE_TYPE (GimpOperationShapeburst, gimp_operation_shapeburst,
+               GEGL_TYPE_OPERATION_FILTER)
+
+#define parent_class gimp_operation_shapeburst_parent_class
+
+
+static void
+gimp_operation_shapeburst_class_init (GimpOperationShapeburstClass *klass)
+{
+  GObjectClass             *object_class    = G_OBJECT_CLASS (klass);
+  GeglOperationClass       *operation_class = GEGL_OPERATION_CLASS (klass);
+  GeglOperationFilterClass *filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
+
+  object_class->set_property   = gimp_operation_shapeburst_set_property;
+  object_class->get_property   = gimp_operation_shapeburst_get_property;
+
+  operation_class->name        = "gimp:shapeburst";
+  operation_class->categories  = "gimp";
+  operation_class->description = "GIMP Shapeburst operation";
+
+  operation_class->prepare                 = gimp_operation_shapeburst_prepare;
+  operation_class->get_required_for_output = gimp_operation_shapeburst_get_required_for_output;
+  operation_class->get_cached_region       = gimp_operation_shapeburst_get_cached_region;
+
+  filter_class->process        = gimp_operation_shapeburst_process;
+
+  g_object_class_install_property (object_class, PROP_MAX_ITERATIONS,
+                                   g_param_spec_double ("max-iterations",
+                                                        "Max Iterations",
+                                                        "Max Iterations",
+                                                        0.0, G_MAXFLOAT, 0.0,
+                                                        G_PARAM_READWRITE));
+
+  g_object_class_install_property (object_class, PROP_PROGRESS,
+                                   g_param_spec_double ("progress",
+                                                        "Progress",
+                                                        "Progress indicator, and a bad hack",
+                                                        0.0, 1.0, 0.0,
+                                                        G_PARAM_READWRITE));
+}
+
+static void
+gimp_operation_shapeburst_init (GimpOperationShapeburst *self)
+{
+}
+
+static void
+gimp_operation_shapeburst_get_property (GObject    *object,
+                                        guint       property_id,
+                                        GValue     *value,
+                                        GParamSpec *pspec)
+{
+ GimpOperationShapeburst *self = GIMP_OPERATION_SHAPEBURST (object);
+
+  switch (property_id)
+    {
+    case PROP_MAX_ITERATIONS:
+      g_value_set_double (value, self->max_iterations);
+      break;
+
+    case PROP_PROGRESS:
+      g_value_set_double (value, self->progress);
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+static void
+gimp_operation_shapeburst_set_property (GObject      *object,
+                                        guint         property_id,
+                                        const GValue *value,
+                                        GParamSpec   *pspec)
+{
+ GimpOperationShapeburst *self = GIMP_OPERATION_SHAPEBURST (object);
+
+  switch (property_id)
+    {
+    case PROP_MAX_ITERATIONS:
+      self->max_iterations = g_value_get_double (value);
+      break;
+
+    case PROP_PROGRESS:
+      self->progress = g_value_get_double (value);
+      break;
+
+   default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+    }
+}
+
+static void
+gimp_operation_shapeburst_prepare (GeglOperation *operation)
+{
+  gegl_operation_set_format (operation, "input",  babl_format ("Y u8"));
+  gegl_operation_set_format (operation, "output", babl_format ("Y float"));
+}
+
+static GeglRectangle
+gimp_operation_shapeburst_get_required_for_output (GeglOperation       *self,
+                                                   const gchar         *input_pad,
+                                                   const GeglRectangle *roi)
+{
+  return *gegl_operation_source_get_bounding_box (self, "input");
+}
+
+static GeglRectangle
+gimp_operation_shapeburst_get_cached_region (GeglOperation       *self,
+                                             const GeglRectangle *roi)
+{
+  return *gegl_operation_source_get_bounding_box (self, "input");
+}
+
+static gboolean
+gimp_operation_shapeburst_process (GeglOperation       *operation,
+                                   GeglBuffer          *input,
+                                   GeglBuffer          *output,
+                                   const GeglRectangle *roi,
+                                   gint                 level)
+{
+  const Babl *input_format   = babl_format ("Y u8");
+  const Babl *output_format  = babl_format ("Y float");
+  gfloat      max_iterations = 0.0;
+  gfloat     *distp_cur;
+  gfloat     *distp_prev;
+  gfloat     *memory;
+  gint        length;
+  gint        i;
+  gint        max_progress = roi->width * roi->height;
+  gint        progress     = 0;
+
+  length = roi->width + 1;
+  memory = g_new (gfloat, length * 2);
+
+  distp_prev = memory;
+  for (i = 0; i < length; i++)
+    distp_prev[i] = 0.0;
+
+  distp_prev += 1;
+  distp_cur = distp_prev + length;
+
+  for (i = 0; i < roi->height; i++)
+    {
+      gfloat *tmp;
+      gint    src = 0;
+      gint    j;
+
+      /*  set the current dist row to 0's  */
+      memset (distp_cur - 1, 0, sizeof (gfloat) * (length - 1));
+
+      for (j = 0; j < roi->width; j++)
+        {
+          gfloat float_tmp;
+          gfloat min_prev = MIN (distp_cur[j-1], distp_prev[j]);
+          gint   min_left = MIN ((roi->width - j - 1), (roi->height - i - 1));
+          gint   min      = (gint) MIN (min_left, min_prev);
+          gint   fraction = 255;
+          gint   k;
+
+          /*  This might need to be changed to 0
+              instead of k = (min) ? (min - 1) : 0  */
+
+          for (k = (min) ? (min - 1) : 0; k <= min; k++)
+            {
+              gint x   = j;
+              gint y   = i + k;
+              gint end = y - k;
+
+              while (y >= end)
+                {
+                  guchar src_uchar;
+
+#if 0
+                  /* FIXME: this should be much faster, it converts
+                   * to 32 bit rgba intermediately, bah...
+                   */
+                  gegl_buffer_sample (input, x, y, NULL, &src_uchar,
+                                      input_format,
+                                      GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);
+#endif
+                  gegl_buffer_get (input, GIMP_GEGL_RECT (x, y, 1, 1), 1.0,
+                                   input_format, &src_uchar,
+                                   GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+
+                  src = src_uchar;
+
+                  if (src == 0)
+                    {
+                      min = k;
+                      y = -1;
+                      break;
+                    }
+
+                  if (src < fraction)
+                    fraction = src;
+
+                  x++;
+                  y--;
+                }
+            }
+
+          if (src != 0)
+            {
+              /*  If min_left != min_prev use the previous fraction
+               *   if it is less than the one found
+               */
+              if (min_left != min)
+                {
+                  gint prev_frac = (int) (255 * (min_prev - min));
+
+                  if (prev_frac == 255)
+                    prev_frac = 0;
+
+                  fraction = MIN (fraction, prev_frac);
+                }
+
+              min++;
+            }
+
+          float_tmp = distp_cur[j] = min + fraction / 256.0;
+
+          if (float_tmp > max_iterations)
+            max_iterations = float_tmp;
+        }
+
+      /*  set the dist row  */
+      gegl_buffer_set (output,
+                       GIMP_GEGL_RECT (roi->x, roi->y + i,
+                                       roi->width, 1),
+                       1.0, output_format, distp_cur,
+                       GEGL_AUTO_ROWSTRIDE);
+
+      /*  swap pointers around  */
+      tmp = distp_prev;
+      distp_prev = distp_cur;
+      distp_cur = tmp;
+
+      progress += roi->height;
+      g_object_set (operation,
+                    "progress", (gdouble) progress / max_progress,
+                    NULL);
+    }
+
+  g_free (memory);
+
+  g_object_set (operation,
+                "max-iterations", (gdouble) max_iterations,
+                NULL);
+
+  return TRUE;
+}
diff --git a/app/gegl/gimpoperationshapeburst.h b/app/gegl/gimpoperationshapeburst.h
new file mode 100644
index 0000000..f5cef9d
--- /dev/null
+++ b/app/gegl/gimpoperationshapeburst.h
@@ -0,0 +1,55 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpoperationshapeburst.h
+ * Copyright (C) 2012 Michael Natterer <mitch gimp org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_OPERATION_SHAPEBURST_H__
+#define __GIMP_OPERATION_SHAPEBURST_H__
+
+
+#include <gegl-plugin.h>
+
+
+#define GIMP_TYPE_OPERATION_SHAPEBURST            (gimp_operation_shapeburst_get_type ())
+#define GIMP_OPERATION_SHAPEBURST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_OPERATION_SHAPEBURST, GimpOperationShapeburst))
+#define GIMP_OPERATION_SHAPEBURST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  GIMP_TYPE_OPERATION_SHAPEBURST, GimpOperationShapeburstClass))
+#define GIMP_IS_OPERATION_SHAPEBURST(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_OPERATION_SHAPEBURST))
+#define GIMP_IS_OPERATION_SHAPEBURST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  GIMP_TYPE_OPERATION_SHAPEBURST))
+#define GIMP_OPERATION_SHAPEBURST_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  GIMP_TYPE_OPERATION_SHAPEBURST, GimpOperationShapeburstClass))
+
+
+typedef struct _GimpOperationShapeburstClass GimpOperationShapeburstClass;
+
+struct _GimpOperationShapeburst
+{
+  GeglOperationFilter  parent_instance;
+
+  gdouble              max_iterations;
+  gdouble              progress;
+};
+
+struct _GimpOperationShapeburstClass
+{
+  GeglOperationFilterClass  parent_class;
+};
+
+
+GType   gimp_operation_shapeburst_get_type (void) G_GNUC_CONST;
+
+
+#endif /* __GIMP_OPERATION_SHAPEBURST_H__ */
diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c
index 048a55f..74b3f82 100644
--- a/app/paint-funcs/paint-funcs.c
+++ b/app/paint-funcs/paint-funcs.c
@@ -1888,151 +1888,6 @@ rotate_pointers (guchar  **p,
 }
 
 
-gfloat
-shapeburst_region (PixelRegion      *srcPR,
-                   PixelRegion      *distPR,
-                   GimpProgressFunc  progress_callback,
-                   gpointer          progress_data)
-{
-  Tile   *tile;
-  guchar *tile_data;
-  gfloat  max_iterations = 0.0;
-  gfloat *distp_cur;
-  gfloat *distp_prev;
-  gfloat *memory;
-  gfloat *tmp;
-  gfloat  min_prev;
-  gfloat  float_tmp;
-  gint    min;
-  gint    min_left;
-  gint    length;
-  gint    i, j, k;
-  gint    fraction;
-  gint    prev_frac;
-  gint    x, y;
-  gint    end;
-  gint    boundary;
-  gint    inc;
-  gint    src          = 0;
-  gint    max_progress = srcPR->w * srcPR->h;
-  gint    progress     = 0;
-
-  length = distPR->w + 1;
-  memory = g_new (gfloat, length * 2);
-
-  distp_prev = memory;
-  for (i = 0; i < length; i++)
-    distp_prev[i] = 0.0;
-
-  distp_prev += 1;
-  distp_cur = distp_prev + length;
-
-  for (i = 0; i < srcPR->h; i++)
-    {
-      /*  set the current dist row to 0's  */
-      memset (distp_cur - 1, 0, sizeof (gfloat) * (length - 1));
-
-      for (j = 0; j < srcPR->w; j++)
-        {
-          min_prev = MIN (distp_cur[j-1], distp_prev[j]);
-          min_left = MIN ((srcPR->w - j - 1), (srcPR->h - i - 1));
-          min = (gint) MIN (min_left, min_prev);
-          fraction = 255;
-
-          /*  This might need to be changed to 0
-              instead of k = (min) ? (min - 1) : 0  */
-
-          for (k = (min) ? (min - 1) : 0; k <= min; k++)
-            {
-              x = j;
-              y = i + k;
-              end = y - k;
-
-              while (y >= end)
-                {
-                  gint width;
-
-                  tile = tile_manager_get_tile (srcPR->tiles,
-                                                x, y, TRUE, FALSE);
-
-                  tile_data = tile_data_pointer (tile, x, y);
-                  width = tile_ewidth (tile);
-
-                  boundary = MIN (y % TILE_HEIGHT,
-                                  width - (x % TILE_WIDTH) - 1);
-                  boundary = MIN (boundary, y - end) + 1;
-
-                  inc = 1 - width;
-
-                  while (boundary--)
-                    {
-                      src = *tile_data;
-
-                      if (src == 0)
-                        {
-                          min = k;
-                          y = -1;
-                          break;
-                        }
-
-                      if (src < fraction)
-                        fraction = src;
-
-                      x++;
-                      y--;
-                      tile_data += inc;
-                    }
-
-                  tile_release (tile, FALSE);
-                }
-            }
-
-          if (src != 0)
-            {
-              /*  If min_left != min_prev use the previous fraction
-               *   if it is less than the one found
-               */
-              if (min_left != min)
-                {
-                  prev_frac = (int) (255 * (min_prev - min));
-
-                  if (prev_frac == 255)
-                    prev_frac = 0;
-
-                  fraction = MIN (fraction, prev_frac);
-                }
-
-              min++;
-            }
-
-          float_tmp = distp_cur[j] = min + fraction / 256.0;
-
-          if (float_tmp > max_iterations)
-            max_iterations = float_tmp;
-        }
-
-      /*  set the dist row  */
-      pixel_region_set_row (distPR,
-                            distPR->x, distPR->y + i, distPR->w,
-                            (guchar *) distp_cur);
-
-      /*  swap pointers around  */
-      tmp = distp_prev;
-      distp_prev = distp_cur;
-      distp_cur = tmp;
-
-      if (progress_callback)
-        {
-          progress += srcPR->h;
-          (* progress_callback) (0, max_progress, progress, progress_data);
-        }
-    }
-
-  g_free (memory);
-
-  return max_iterations;
-}
-
 /*  Simple convolution filter to smooth a mask (1bpp).  */
 void
 smooth_region (PixelRegion *region)
diff --git a/app/paint-funcs/paint-funcs.h b/app/paint-funcs/paint-funcs.h
index 1ae490c..5857ce4 100644
--- a/app/paint-funcs/paint-funcs.h
+++ b/app/paint-funcs/paint-funcs.h
@@ -282,11 +282,6 @@ void  convolve_region                     (PixelRegion         *srcR,
                                            GimpConvolutionType  mode,
                                            gboolean             alpha_weighting);
 
-gfloat shapeburst_region                  (PixelRegion      *srcPR,
-                                           PixelRegion      *distPR,
-                                           GimpProgressFunc  progress_callback,
-                                           gpointer          progress_data);
-
 void  smooth_region                       (PixelRegion *region);
 void  erode_region                        (PixelRegion *region);
 void  dilate_region                       (PixelRegion *region);



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