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

« back to all changes in this revision

Viewing changes to plug-ins/common/engrave.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
 * Copyright (C) 1997 Eiichi Takamori
4
4
 * Copyright (C) 1996, 1997 Torsten Martinsen
20
20
 
21
21
#include "config.h"
22
22
 
23
 
#include <gtk/gtk.h>
24
 
 
25
23
#include <libgimp/gimp.h>
26
24
#include <libgimp/gimpui.h>
27
25
 
30
28
 
31
29
/* Some useful macros */
32
30
 
 
31
#define PLUG_IN_PROC    "plug-in-engrave"
 
32
#define PLUG_IN_BINARY  "engrave"
33
33
#define SCALE_WIDTH     125
34
34
#define TILE_CACHE_SIZE  16
35
35
 
70
70
                                 gint          bpp,
71
71
                                 gint          color_n);
72
72
 
73
 
GimpPlugInInfo PLUG_IN_INFO =
 
73
const GimpPlugInInfo PLUG_IN_INFO =
74
74
{
75
75
  NULL,  /* init_proc  */
76
76
  NULL,  /* quit_proc  */
90
90
static void
91
91
query (void)
92
92
{
93
 
  static GimpParamDef args[] =
 
93
  static const GimpParamDef args[] =
94
94
  {
95
 
    { GIMP_PDB_INT32, "run_mode", "Interactive, non-interactive" },
96
 
    { GIMP_PDB_IMAGE, "image", "Input image (unused)" },
97
 
    { GIMP_PDB_DRAWABLE, "drawable", "Input drawable" },
98
 
    { GIMP_PDB_INT32, "height", "Resolution in pixels" },
99
 
    { GIMP_PDB_INT32, "limit", "If true, limit line width" }
 
95
    { GIMP_PDB_INT32,    "run-mode", "Interactive, non-interactive" },
 
96
    { GIMP_PDB_IMAGE,    "image",    "Input image (unused)"         },
 
97
    { GIMP_PDB_DRAWABLE, "drawable", "Input drawable"               },
 
98
    { GIMP_PDB_INT32,    "height",   "Resolution in pixels"         },
 
99
    { GIMP_PDB_INT32,    "limit",    "If true, limit line width"    }
100
100
  };
101
101
 
102
 
  gimp_install_procedure ("plug_in_engrave",
103
 
                          "Engrave the contents of the specified drawable",
 
102
  gimp_install_procedure (PLUG_IN_PROC,
 
103
                          N_("Simulate an antique engraving"),
104
104
                          "Creates a black-and-white 'engraved' version of an image as seen in old illustrations",
105
105
                          "Spencer Kimball & Peter Mattis, Eiichi Takamori, Torsten Martinsen",
106
106
                          "Spencer Kimball & Peter Mattis, Eiichi Takamori, Torsten Martinsen",
111
111
                          G_N_ELEMENTS (args), 0,
112
112
                          args, NULL);
113
113
 
114
 
  gimp_plugin_menu_register ("plug_in_engrave", "<Image>/Filters/Distorts");
 
114
  gimp_plugin_menu_register (PLUG_IN_PROC, "<Image>/Filters/Distorts");
115
115
}
116
116
 
117
117
static void
144
144
    {
145
145
    case GIMP_RUN_INTERACTIVE:
146
146
      /*  Possibly retrieve data  */
147
 
      gimp_get_data ("plug_in_engrave", &pvals);
 
147
      gimp_get_data (PLUG_IN_PROC, &pvals);
148
148
 
149
149
      /*  First acquire information with a dialog  */
150
150
      if (!engrave_dialog (drawable))
170
170
 
171
171
    case GIMP_RUN_WITH_LAST_VALS:
172
172
      /*  Possibly retrieve data  */
173
 
      gimp_get_data ("plug_in_engrave", &pvals);
 
173
      gimp_get_data (PLUG_IN_PROC, &pvals);
174
174
      break;
175
175
 
176
176
    default:
179
179
 
180
180
  if (status == GIMP_PDB_SUCCESS)
181
181
    {
182
 
      gimp_progress_init (_("Engraving..."));
 
182
      gimp_progress_init (_("Engraving"));
183
183
 
184
184
      engrave (drawable, NULL);
185
185
 
188
188
 
189
189
      /*  Store data  */
190
190
      if (run_mode == GIMP_RUN_INTERACTIVE)
191
 
        gimp_set_data ("plug_in_engrave", &pvals, sizeof (EngraveValues));
 
191
        gimp_set_data (PLUG_IN_PROC, &pvals, sizeof (EngraveValues));
192
192
    }
193
193
  values[0].data.d_status = status;
194
194
 
206
206
  GtkObject *adj;
207
207
  gboolean   run;
208
208
 
209
 
  gimp_ui_init ("engrave", FALSE);
 
209
  gimp_ui_init (PLUG_IN_BINARY, FALSE);
210
210
 
211
 
  dialog = gimp_dialog_new (_("Engrave"), "engrave",
 
211
  dialog = gimp_dialog_new (_("Engrave"), PLUG_IN_BINARY,
212
212
                            NULL, 0,
213
 
                            gimp_standard_help_func, "plug-in-engrave",
 
213
                            gimp_standard_help_func, PLUG_IN_PROC,
214
214
 
215
215
                            GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
216
216
                            GTK_STOCK_OK,     GTK_RESPONSE_OK,
217
217
 
218
218
                            NULL);
219
219
 
 
220
  gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
 
221
                                           GTK_RESPONSE_OK,
 
222
                                           GTK_RESPONSE_CANCEL,
 
223
                                           -1);
 
224
 
 
225
  gimp_window_set_transient (GTK_WINDOW (dialog));
 
226
 
220
227
  main_vbox = gtk_vbox_new (FALSE, 12);
221
228
  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
222
229
  gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), main_vbox);
239
246
                              pvals.height, 2.0, 16.0, 1.0, 4.0, 0,
240
247
                              TRUE, 0, 0,
241
248
                              NULL, NULL);
242
 
  g_signal_connect (adj, "value_changed",
 
249
  g_signal_connect (adj, "value-changed",
243
250
                    G_CALLBACK (gimp_int_adjustment_update),
244
251
                    &pvals.height);
245
 
  g_signal_connect_swapped (adj, "value_changed",
 
252
  g_signal_connect_swapped (adj, "value-changed",
246
253
                            G_CALLBACK (gimp_preview_invalidate),
247
254
                            preview);
248
255
 
359
366
          if (bpp < 3)
360
367
            inten = average[0] / 254.0 * height;
361
368
          else
362
 
            inten = GIMP_RGB_INTENSITY (average[0],
 
369
            inten = GIMP_RGB_LUMINANCE (average[0],
363
370
                                        average[1],
364
371
                                        average[2]) / 254.0 * height;
365
372
 
550
557
      if (bpp < 3)
551
558
        inten = average[0] / 254.0 * height;
552
559
      else
553
 
        inten = GIMP_RGB_INTENSITY (average[0],
 
560
        inten = GIMP_RGB_LUMINANCE (average[0],
554
561
                                    average[1],
555
562
                                    average[2]) / 254.0 * height;
556
563