Exemple #1
0
static void
select_grow_callback (GtkWidget *widget,
                      gdouble    size,
                      GimpUnit   unit,
                      gpointer   data)
{
  GimpImage *image = GIMP_IMAGE (data);
  gdouble    radius_x;
  gdouble    radius_y;

  radius_x = radius_y = select_grow_pixels = ROUND (size);

  if (unit != GIMP_UNIT_PIXEL)
    {
      gdouble factor;

      factor = (MAX (image->xresolution, image->yresolution) /
                MIN (image->xresolution, image->yresolution));

      if (image->xresolution == MIN (image->xresolution, image->yresolution))
        radius_y *= factor;
      else
        radius_x *= factor;
    }

  gimp_channel_grow (gimp_image_get_mask (image), radius_x, radius_y, TRUE);
  gimp_image_flush (image);
}
Exemple #2
0
static GimpValueArray *
selection_grow_invoker (GimpProcedure         *procedure,
                        Gimp                  *gimp,
                        GimpContext           *context,
                        GimpProgress          *progress,
                        const GimpValueArray  *args,
                        GError               **error)
{
  gboolean success = TRUE;
  GimpImage *image;
  gint32 steps;

  image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
  steps = g_value_get_int (gimp_value_array_index (args, 1));

  if (success)
    {
      gimp_channel_grow (gimp_image_get_mask (image),
                         steps, steps, TRUE);
    }

  return gimp_procedure_get_return_values (procedure, success,
                                           error ? *error : NULL);
}