1
1
/* GIMP - The GNU Image Manipulation Program
2
2
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
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.
9
9
* This program is distributed in the hope that it will be useful,
12
12
* GNU General Public License for more details.
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/>.
19
18
/* This plugin by thorsten@arch.usyd.edu.au.
67
67
static const GimpParamDef args[] =
69
{ GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" },
70
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
71
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
69
{ GIMP_PDB_INT32, "run-mode", "The run mode { RUN-INTERACTIVE (0), RUN-NONINTERACTIVE (1) }" },
70
{ GIMP_PDB_IMAGE, "image", "Input image (unused)" },
71
{ GIMP_PDB_DRAWABLE, "drawable", "Input drawable" }
74
74
gimp_install_procedure (PLUG_IN_PROC,
75
N_("High-resolution edge detection"),
76
"This plugin creates one-pixel wide edges from the "
77
"image, with the value proportional to the gradient. "
78
"It uses the Laplace operator (a 3x3 kernel with -8 "
79
"in the middle). The image has to be laplacered to "
80
"get useful results, a gauss_iir with 1.5 - 5.0 "
81
"depending on the noise in the image is best.",
88
G_N_ELEMENTS (args), 0,
75
N_("High-resolution edge detection"),
76
"This plugin creates one-pixel wide edges from the "
77
"image, with the value proportional to the gradient. "
78
"It uses the Laplace operator (a 3x3 kernel with -8 "
79
"in the middle). The image has to be laplacered to "
80
"get useful results, a gauss_iir with 1.5 - 5.0 "
81
"depending on the noise in the image is best.",
88
G_N_ELEMENTS (args), 0,
91
91
gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Edge-Detect");
277
277
for (col = 0; col < (x2 - x1) * bytes; col++)
278
if (alpha && (((col + 1) % bytes) == 0)) /* the alpha channel */
278
if (alpha && (((col + 1) % bytes) == 0)) /* the alpha channel */
284
minmax (pr[col], cr[col - bytes], cr[col], cr[col + bytes],
285
nr[col], &minval, &maxval); /* four-neighbourhood */
287
gradient = (0.5 * MAX ((maxval - cr [col]), (cr[col]- minval)));
289
*d++ = (((pr[col - bytes] + pr[col] + pr[col + bytes] +
284
minmax (pr[col], cr[col - bytes], cr[col], cr[col + bytes],
285
nr[col], &minval, &maxval); /* four-neighbourhood */
287
gradient = (0.5 * MAX ((maxval - cr [col]), (cr[col]- minval)));
289
*d++ = (((pr[col - bytes] + pr[col] + pr[col + bytes] +
290
290
cr[col - bytes] - (8 * cr[col]) + cr[col + bytes] +
291
291
nr[col - bytes] + nr[col] + nr[col + bytes]) > 0) ?
292
292
gradient : (128 + gradient));
295
295
/* store the dest */
296
296
gimp_pixel_rgn_set_row (&destPR, dest, x1, row, (x2 - x1));
368
368
if ((row % 20) == 0)
369
gimp_progress_update ((gdouble) row / (gdouble) (y2 - y1));
369
gimp_progress_update ((gdouble) row / (gdouble) (y2 - y1));
372
gimp_progress_update (1.0);
372
373
/* update the laplaced region */
373
374
gimp_drawable_flush (drawable);
374
375
gimp_drawable_merge_shadow (drawable->drawable_id, TRUE);