~ubuntu-branches/ubuntu/vivid/gimp/vivid

« back to all changes in this revision

Viewing changes to plug-ins/common/edge-dog.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach
  • Date: 2012-05-08 18:50:03 UTC
  • mto: (1.1.26) (0.5.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 71.
  • Revision ID: package-import@ubuntu.com-20120508185003-tltkvbaysf8d2426
ImportĀ upstreamĀ versionĀ 2.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
 
 * This program is free software; you can redistribute it and/or modify
 
4
 * This program is free software: you can redistribute it and/or modify
5
5
 * it under the terms of the GNU General Public License as published by
6
 
 * the Free Software Foundation; either version 2 of the License, or
 
6
 * the Free Software Foundation; either version 3 of the License, or
7
7
 * (at your option) any later version.
8
8
 *
9
9
 * This program is distributed in the hope that it will be useful,
12
12
 * GNU General Public License for more details.
13
13
 *
14
14
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
15
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
16
 */
18
17
 
19
18
/*
37
36
 
38
37
#define PLUG_IN_PROC   "plug-in-dog"
39
38
#define PLUG_IN_BINARY "edge-dog"
 
39
#define PLUG_IN_ROLE   "gimp-edge-dog"
40
40
 
41
41
 
42
42
typedef struct
122
122
{
123
123
  static const GimpParamDef args[] =
124
124
  {
125
 
    { GIMP_PDB_INT32,    "run-mode",  "Interactive, non-interactive" },
 
125
    { GIMP_PDB_INT32,    "run-mode",  "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }" },
126
126
    { GIMP_PDB_IMAGE,    "image",     "Input image" },
127
127
    { GIMP_PDB_DRAWABLE, "drawable",  "Input drawable" },
128
128
    { GIMP_PDB_FLOAT,    "inner",     "Radius of inner gaussian blur (in pixels, > 0.0)" },
129
129
    { GIMP_PDB_FLOAT,    "outer",     "Radius of outer gaussian blur (in pixels, > 0.0)" },
130
 
    { GIMP_PDB_INT32,    "normalize", "True, False" },
131
 
    { GIMP_PDB_INT32,    "invert",    "True, False" }
 
130
    { GIMP_PDB_INT32,    "normalize", "Normalize { TRUE, FALSE }" },
 
131
    { GIMP_PDB_INT32,    "invert",    "Invert { TRUE, FALSE }" }
132
132
  };
133
133
 
134
134
  gimp_install_procedure (PLUG_IN_PROC,
172
172
  values[0].type          = GIMP_PDB_STATUS;
173
173
  values[0].data.d_status = status;
174
174
 
175
 
  if (! gimp_drawable_is_layer (param[2].data.d_drawable))
 
175
  if (! gimp_item_is_layer (param[2].data.d_drawable))
176
176
    {
177
177
      g_set_error (&error, 0, 0, "%s",
178
178
                   _("Can operate on layers only "
299
299
 
300
300
  gimp_ui_init (PLUG_IN_BINARY, FALSE);
301
301
 
302
 
  dialog = gimp_dialog_new (_("DoG Edge Detect"), PLUG_IN_BINARY,
 
302
  dialog = gimp_dialog_new (_("DoG Edge Detect"), PLUG_IN_ROLE,
303
303
                            NULL, 0,
304
304
                            gimp_standard_help_func, PLUG_IN_PROC,
305
305
 
315
315
 
316
316
  gimp_window_set_transient (GTK_WINDOW (dialog));
317
317
 
318
 
  main_vbox = gtk_vbox_new (FALSE, 12);
 
318
  main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
319
319
  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
320
 
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
 
320
  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
 
321
                      main_vbox, TRUE, TRUE, 0);
321
322
  gtk_widget_show (main_vbox);
322
323
 
323
324
  preview = gimp_drawable_preview_new (drawable, NULL);
468
469
  gimp_drawable_flush (drawable);
469
470
 
470
471
  layer1 = gimp_layer_copy (drawable_id);
471
 
  gimp_drawable_set_visible (layer1, FALSE);
472
 
  gimp_drawable_set_name (layer1, "dog_scratch_layer1");
473
 
  gimp_image_add_layer (image_ID, layer1, 0);
 
472
  gimp_item_set_visible (layer1, FALSE);
 
473
  gimp_item_set_name (layer1, "dog_scratch_layer1");
 
474
  gimp_image_insert_layer (image_ID, layer1,
 
475
                           gimp_item_get_parent (drawable_id), 0);
474
476
 
475
477
  layer2 = gimp_layer_copy (drawable_id);
476
 
  gimp_drawable_set_visible (layer2, FALSE);
477
 
  gimp_drawable_set_name (layer2, "dog_scratch_layer2");
478
 
  gimp_image_add_layer (image_ID, layer2, 0);
 
478
  gimp_item_set_visible (layer2, FALSE);
 
479
  gimp_item_set_name (layer2, "dog_scratch_layer2");
 
480
  gimp_image_insert_layer (image_ID, layer2,
 
481
                           gimp_item_get_parent (drawable_id), 0);
479
482
 
480
483
  drawable1 = gimp_drawable_get (layer1);
481
484
  drawable2 = gimp_drawable_get (layer2);
990
993
                           x1, y1, width, height);
991
994
 
992
995
  /* set up gimp drawable for rendering preview into */
993
 
  src_image_id = gimp_drawable_get_image (drawable->drawable_id);
 
996
  src_image_id = gimp_item_get_image (drawable->drawable_id);
994
997
  image_id = gimp_image_new (width, height,
995
998
                             gimp_image_base_type (src_image_id));
996
999
  preview_id = gimp_layer_new (image_id, "preview", width, height,
998
1001
                               100,
999
1002
                               GIMP_NORMAL_MODE);
1000
1003
  preview_drawable = gimp_drawable_get (preview_id);
1001
 
  gimp_image_add_layer (image_id, preview_id, 0);
 
1004
  gimp_image_insert_layer (image_id, preview_id, -1, 0);
1002
1005
  gimp_layer_set_offsets (preview_id, 0, 0);
1003
1006
  gimp_pixel_rgn_init (&preview_rgn, preview_drawable,
1004
1007
                       0, 0, width, height, TRUE, TRUE);