~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to plug-ins/common/neon.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
37
37
#include "libgimp/stdplugins-intl.h"
38
38
 
39
39
 
 
40
#define PLUG_IN_PROC   "plug-in-neon"
 
41
#define PLUG_IN_BINARY "neon"
 
42
 
 
43
 
40
44
typedef struct
41
45
{
42
46
  gdouble radius;
87
91
 
88
92
/***** Local vars *****/
89
93
 
90
 
GimpPlugInInfo PLUG_IN_INFO =
 
94
const GimpPlugInInfo PLUG_IN_INFO =
91
95
{
92
96
  NULL,  /* init  */
93
97
  NULL,  /* quit  */
109
113
static void
110
114
query (void)
111
115
{
112
 
  static GimpParamDef args[] =
 
116
  static const GimpParamDef args[] =
113
117
  {
114
 
    { GIMP_PDB_INT32,    "run_mode", "Interactive, non-interactive" },
115
 
    { GIMP_PDB_IMAGE,    "image",    "Input image (unused)" },
116
 
    { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
117
 
    { GIMP_PDB_FLOAT,    "radius",   "Radius of neon effect (in pixels)" },
 
118
    { GIMP_PDB_INT32,    "run-mode", "Interactive, non-interactive"          },
 
119
    { GIMP_PDB_IMAGE,    "image",    "Input image (unused)"                  },
 
120
    { GIMP_PDB_DRAWABLE, "drawable", "Input drawable"                        },
 
121
    { GIMP_PDB_FLOAT,    "radius",   "Radius of neon effect (in pixels)"     },
118
122
    { GIMP_PDB_FLOAT,    "amount",   "Effect enhancement variable (0.0 - 1.0)" },
119
123
  };
120
124
 
126
130
    "the processing time constant between large and small"
127
131
    "standard deviations.";
128
132
 
129
 
  gimp_install_procedure ("plug_in_neon",
130
 
                          "Resolution independent edge detection",
 
133
  gimp_install_procedure (PLUG_IN_PROC,
 
134
                          N_("Simulate the glowing boundary of a neon light"),
131
135
                          help_string,
132
136
                          "Spencer Kimball",
133
137
                          "Bit Specialists, Inc.",
138
142
                          G_N_ELEMENTS (args), 0,
139
143
                          args, NULL);
140
144
 
141
 
  gimp_plugin_menu_register ("plug_in_neon", "<Image>/Filters/Edge-Detect");
 
145
  gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Edge-Detect");
142
146
}
143
147
 
144
148
static void
173
177
    {
174
178
    case GIMP_RUN_INTERACTIVE:
175
179
      /*  Possibly retrieve data  */
176
 
      gimp_get_data ("plug_in_neon", &evals);
 
180
      gimp_get_data (PLUG_IN_PROC, &evals);
177
181
 
178
182
      /*  First acquire information with a dialog  */
179
183
      if (! neon_dialog (drawable))
193
197
 
194
198
    case GIMP_RUN_WITH_LAST_VALS:
195
199
      /*  Possibly retrieve data  */
196
 
      gimp_get_data ("plug_in_neon", &evals);
 
200
      gimp_get_data (PLUG_IN_PROC, &evals);
197
201
      break;
198
202
 
199
203
    default:
204
208
  if (gimp_drawable_is_rgb (drawable->drawable_id) ||
205
209
      gimp_drawable_is_gray (drawable->drawable_id))
206
210
    {
207
 
      gimp_progress_init (_("Neon..."));
 
211
      gimp_progress_init (_("Neon"));
208
212
 
209
213
      /*  run the neon effect  */
210
214
      neon (drawable, evals.radius, evals.amount, NULL);
214
218
 
215
219
      /*  Store data  */
216
220
      if (run_mode == GIMP_RUN_INTERACTIVE)
217
 
        gimp_set_data ("plug_in_neon", &evals, sizeof (NeonVals));
 
221
        gimp_set_data (PLUG_IN_PROC, &evals, sizeof (NeonVals));
218
222
    }
219
223
  else
220
224
    {
381
385
          gimp_pixel_rgn_set_col (&dest_rgn, dest, col + x1, y1, (y2 - y1));
382
386
 
383
387
          progress += height * radius;
384
 
          if ((col % 5) == 0)
 
388
 
 
389
          if ((col % 20) == 0)
385
390
            gimp_progress_update ((double) progress / (double) max_progress);
386
391
        }
387
392
    }
470
475
          gimp_pixel_rgn_set_row (&dest_rgn, dest, x1, row + y1, (x2 - x1));
471
476
 
472
477
          progress += width * radius;
473
 
          if ((row % 5) == 0)
 
478
          if ((row % 20) == 0)
474
479
            gimp_progress_update ((double) progress / (double) max_progress);
475
480
        }
476
481
    }
647
652
    gdouble sum_n_p, sum_n_m, sum_d;
648
653
    gdouble a, b;
649
654
 
650
 
    /*
651
 
    for (i = 0; i <=4; i++)
652
 
      {
653
 
        fprintf (stderr, "n_p[%d] = %f\n", i, n_p[i]);
654
 
        fprintf (stderr, "n_m[%d] = %f\n", i, n_m[i]);
655
 
        fprintf (stderr, "d_p[%d] = %f\n", i, d_p[i]);
656
 
      }
657
 
    */
658
 
 
659
655
    sum_n_p = 0.0;
660
656
    sum_n_m = 0.0;
661
657
    sum_d   = 0.0;
692
688
  GtkObject *scale_data;
693
689
  gboolean   run;
694
690
 
695
 
  gimp_ui_init ("neon", FALSE);
 
691
  gimp_ui_init (PLUG_IN_BINARY, FALSE);
696
692
 
697
 
  dialog = gimp_dialog_new (_("Neon Detection"), "neon",
 
693
  dialog = gimp_dialog_new (_("Neon Detection"), PLUG_IN_BINARY,
698
694
                            NULL, 0,
699
 
                            gimp_standard_help_func, "plug-in-neon",
 
695
                            gimp_standard_help_func, PLUG_IN_PROC,
700
696
 
701
697
                            GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
702
698
                            GTK_STOCK_OK,     GTK_RESPONSE_OK,
703
699
 
704
700
                            NULL);
705
701
 
 
702
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
 
703
                                           GTK_RESPONSE_OK,
 
704
                                           GTK_RESPONSE_CANCEL,
 
705
                                           -1);
 
706
 
 
707
  gimp_window_set_transient (GTK_WINDOW (dialog));
 
708
 
706
709
  main_vbox = gtk_vbox_new (FALSE, 12);
707
710
  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
708
711
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
730
733
                                     8 * MAX (drawable->width, drawable->height),
731
734
                                     NULL, NULL);
732
735
 
733
 
  g_signal_connect (scale_data, "value_changed",
 
736
  g_signal_connect (scale_data, "value-changed",
734
737
                    G_CALLBACK (gimp_double_adjustment_update),
735
738
                    &evals.radius);
736
 
  g_signal_connect_swapped (scale_data, "value_changed",
 
739
  g_signal_connect_swapped (scale_data, "value-changed",
737
740
                            G_CALLBACK (gimp_preview_invalidate),
738
741
                            preview);
739
742
 
744
747
                                     TRUE, 0, 0,
745
748
                                     NULL, NULL);
746
749
 
747
 
  g_signal_connect (scale_data, "value_changed",
 
750
  g_signal_connect (scale_data, "value-changed",
748
751
                    G_CALLBACK (gimp_double_adjustment_update),
749
752
                    &evals.amount);
750
 
  g_signal_connect_swapped (scale_data, "value_changed",
 
753
  g_signal_connect_swapped (scale_data, "value-changed",
751
754
                            G_CALLBACK (gimp_preview_invalidate),
752
755
                            preview);
753
756