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

« back to all changes in this revision

Viewing changes to app/pdb/gradients_cmds.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-2003 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
16
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 */
18
18
 
19
 
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
20
20
 
21
21
#include "config.h"
22
22
 
25
25
#include <glib-object.h>
26
26
 
27
27
#include "pdb-types.h"
28
 
#include "procedural_db.h"
 
28
#include "gimppdb.h"
 
29
#include "gimpprocedure.h"
 
30
#include "core/gimpparamspecs.h"
29
31
 
30
32
#include "core/gimp.h"
31
33
#include "core/gimpcontainer-filter.h"
34
36
#include "core/gimpgradient.h"
35
37
#include "core/gimplist.h"
36
38
 
37
 
static ProcRecord gradients_refresh_proc;
38
 
static ProcRecord gradients_get_list_proc;
39
 
static ProcRecord gradients_sample_uniform_proc;
40
 
static ProcRecord gradients_sample_custom_proc;
41
 
static ProcRecord gradients_get_gradient_data_proc;
42
 
 
43
 
void
44
 
register_gradients_procs (Gimp *gimp)
45
 
{
46
 
  procedural_db_register (gimp, &gradients_refresh_proc);
47
 
  procedural_db_register (gimp, &gradients_get_list_proc);
48
 
  procedural_db_register (gimp, &gradients_sample_uniform_proc);
49
 
  procedural_db_register (gimp, &gradients_sample_custom_proc);
50
 
  procedural_db_register (gimp, &gradients_get_gradient_data_proc);
51
 
}
52
 
 
53
 
static Argument *
54
 
gradients_refresh_invoker (Gimp         *gimp,
55
 
                           GimpContext  *context,
56
 
                           GimpProgress *progress,
57
 
                           Argument     *args)
58
 
{
59
 
  gimp_data_factory_data_save (gimp->gradient_factory);
60
 
  gimp_data_factory_data_init (gimp->gradient_factory, FALSE);
61
 
  return procedural_db_return_args (&gradients_refresh_proc, TRUE);
62
 
}
63
 
 
64
 
static ProcRecord gradients_refresh_proc =
65
 
{
66
 
  "gimp_gradients_refresh",
67
 
  "Refresh current gradients. This function always succeeds.",
68
 
  "This procedure retrieves all gradients currently in the user's gradient path and updates the gradient dialogs accordingly.",
69
 
  "Michael Natterer",
70
 
  "Michael Natterer",
71
 
  "2002",
72
 
  NULL,
73
 
  GIMP_INTERNAL,
74
 
  0,
75
 
  NULL,
76
 
  0,
77
 
  NULL,
78
 
  { { gradients_refresh_invoker } }
79
 
};
80
 
 
81
 
static Argument *
82
 
gradients_get_list_invoker (Gimp         *gimp,
83
 
                            GimpContext  *context,
84
 
                            GimpProgress *progress,
85
 
                            Argument     *args)
 
39
#include "internal_procs.h"
 
40
 
 
41
 
 
42
static GValueArray *
 
43
gradients_refresh_invoker (GimpProcedure     *procedure,
 
44
                           Gimp              *gimp,
 
45
                           GimpContext       *context,
 
46
                           GimpProgress      *progress,
 
47
                           const GValueArray *args)
 
48
{
 
49
  gimp_data_factory_data_refresh (gimp->gradient_factory);
 
50
  return gimp_procedure_get_return_values (procedure, TRUE);
 
51
}
 
52
 
 
53
static GValueArray *
 
54
gradients_get_list_invoker (GimpProcedure     *procedure,
 
55
                            Gimp              *gimp,
 
56
                            GimpContext       *context,
 
57
                            GimpProgress      *progress,
 
58
                            const GValueArray *args)
86
59
{
87
60
  gboolean success = TRUE;
88
 
  Argument *return_args;
89
 
  gchar *filter;
90
 
  gint32 num_gradients;
 
61
  GValueArray *return_vals;
 
62
  const gchar *filter;
 
63
  gint32 num_gradients = 0;
91
64
  gchar **gradient_list = NULL;
92
65
 
93
 
  filter = (gchar *) args[0].value.pdb_pointer;
94
 
  if (filter && !g_utf8_validate (filter, -1, NULL))
95
 
    success = FALSE;
96
 
 
97
 
  if (success)
98
 
    gradient_list = gimp_container_get_filtered_name_array (gimp->gradient_factory->container, filter, &num_gradients);
99
 
 
100
 
  return_args = procedural_db_return_args (&gradients_get_list_proc, success);
101
 
 
102
 
  if (success)
103
 
    {
104
 
      return_args[1].value.pdb_int = num_gradients;
105
 
      return_args[2].value.pdb_pointer = gradient_list;
106
 
    }
107
 
 
108
 
  return return_args;
 
66
  filter = g_value_get_string (&args->values[0]);
 
67
 
 
68
  if (success)
 
69
    {
 
70
      gradient_list = gimp_container_get_filtered_name_array (gimp->gradient_factory->container,
 
71
                                                              filter, &num_gradients);
 
72
    }
 
73
 
 
74
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
75
 
 
76
  if (success)
 
77
    {
 
78
      g_value_set_int (&return_vals->values[1], num_gradients);
 
79
      gimp_value_take_stringarray (&return_vals->values[2], gradient_list, num_gradients);
 
80
    }
 
81
 
 
82
  return return_vals;
109
83
}
110
84
 
111
 
static ProcArg gradients_get_list_inargs[] =
112
 
{
113
 
  {
114
 
    GIMP_PDB_STRING,
115
 
    "filter",
116
 
    "An optional regular expression used to filter the list"
117
 
  }
118
 
};
119
 
 
120
 
static ProcArg gradients_get_list_outargs[] =
121
 
{
122
 
  {
123
 
    GIMP_PDB_INT32,
124
 
    "num_gradients",
125
 
    "The number of loaded gradients"
126
 
  },
127
 
  {
128
 
    GIMP_PDB_STRINGARRAY,
129
 
    "gradient_list",
130
 
    "The list of gradient names"
131
 
  }
132
 
};
133
 
 
134
 
static ProcRecord gradients_get_list_proc =
135
 
{
136
 
  "gimp_gradients_get_list",
137
 
  "Retrieve the list of loaded gradients.",
138
 
  "This procedure returns a list of the gradients that are currently loaded. You can later use the 'gimp_context_set_gradient' function to set the active gradient.",
139
 
  "Federico Mena Quintero",
140
 
  "Federico Mena Quintero",
141
 
  "1997",
142
 
  NULL,
143
 
  GIMP_INTERNAL,
144
 
  1,
145
 
  gradients_get_list_inargs,
146
 
  2,
147
 
  gradients_get_list_outargs,
148
 
  { { gradients_get_list_invoker } }
149
 
};
150
 
 
151
 
static Argument *
152
 
gradients_sample_uniform_invoker (Gimp         *gimp,
153
 
                                  GimpContext  *context,
154
 
                                  GimpProgress *progress,
155
 
                                  Argument     *args)
 
85
static GValueArray *
 
86
gradients_sample_uniform_invoker (GimpProcedure     *procedure,
 
87
                                  Gimp              *gimp,
 
88
                                  GimpContext       *context,
 
89
                                  GimpProgress      *progress,
 
90
                                  const GValueArray *args)
156
91
{
157
92
  gboolean success = TRUE;
158
 
  Argument *return_args;
159
 
  gint32 i;
 
93
  GValueArray *return_vals;
 
94
  gint32 num_samples;
160
95
  gboolean reverse;
161
96
  gint32 array_length = 0;
162
97
  gdouble *color_samples = NULL;
163
 
  GimpGradient *gradient;
164
 
  gdouble pos, delta;
165
 
  GimpRGB color;
166
 
  gdouble *pv;
167
 
 
168
 
  i = args[0].value.pdb_int;
169
 
  if (i < 2)
170
 
    success = FALSE;
171
 
 
172
 
  reverse = args[1].value.pdb_int ? TRUE : FALSE;
 
98
 
 
99
  num_samples = g_value_get_int (&args->values[0]);
 
100
  reverse = g_value_get_boolean (&args->values[1]);
173
101
 
174
102
  if (success)
175
103
    {
 
104
      GimpGradient        *gradient;
 
105
      GimpGradientSegment *seg = NULL;
 
106
      gdouble              pos, delta;
 
107
      GimpRGB              color;
 
108
      gdouble             *pv;
 
109
 
176
110
      pos   = 0.0;
177
 
      delta = 1.0 / (i - 1);
 
111
      delta = 1.0 / (num_samples - 1);
178
112
 
179
 
      array_length = i * 4;
 
113
      array_length = num_samples * 4;
180
114
 
181
115
      pv = color_samples = g_new (gdouble, array_length);
182
116
 
183
117
      gradient = gimp_context_get_gradient (context);
184
118
 
185
 
      while (i--)
 
119
      while (num_samples--)
186
120
        {
187
 
          gimp_gradient_get_color_at (gradient, pos, reverse, &color);
 
121
          seg = gimp_gradient_get_color_at (gradient, context, seg,
 
122
                                            pos, reverse, &color);
188
123
 
189
124
          *pv++ = color.r;
190
125
          *pv++ = color.g;
195
130
        }
196
131
    }
197
132
 
198
 
  return_args = procedural_db_return_args (&gradients_sample_uniform_proc, success);
 
133
  return_vals = gimp_procedure_get_return_values (procedure, success);
199
134
 
200
135
  if (success)
201
136
    {
202
 
      return_args[1].value.pdb_int = array_length;
203
 
      return_args[2].value.pdb_pointer = color_samples;
 
137
      g_value_set_int (&return_vals->values[1], array_length);
 
138
      gimp_value_take_floatarray (&return_vals->values[2], color_samples, array_length);
204
139
    }
205
140
 
206
 
  return return_args;
 
141
  return return_vals;
207
142
}
208
143
 
209
 
static ProcArg gradients_sample_uniform_inargs[] =
210
 
{
211
 
  {
212
 
    GIMP_PDB_INT32,
213
 
    "num_samples",
214
 
    "The number of samples to take"
215
 
  },
216
 
  {
217
 
    GIMP_PDB_INT32,
218
 
    "reverse",
219
 
    "Use the reverse gradient (TRUE or FALSE)"
220
 
  }
221
 
};
222
 
 
223
 
static ProcArg gradients_sample_uniform_outargs[] =
224
 
{
225
 
  {
226
 
    GIMP_PDB_INT32,
227
 
    "array_length",
228
 
    "Length of the color_samples array (4 * num_samples)"
229
 
  },
230
 
  {
231
 
    GIMP_PDB_FLOATARRAY,
232
 
    "color_samples",
233
 
    "Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }"
234
 
  }
235
 
};
236
 
 
237
 
static ProcRecord gradients_sample_uniform_proc =
238
 
{
239
 
  "gimp_gradients_sample_uniform",
240
 
  "This procedure is deprecated! Use 'gimp_gradient_get_uniform_samples' instead.",
241
 
  "This procedure is deprecated! Use 'gimp_gradient_get_uniform_samples' instead.",
242
 
  "",
243
 
  "",
244
 
  "",
245
 
  "gimp_gradient_get_uniform_samples",
246
 
  GIMP_INTERNAL,
247
 
  2,
248
 
  gradients_sample_uniform_inargs,
249
 
  2,
250
 
  gradients_sample_uniform_outargs,
251
 
  { { gradients_sample_uniform_invoker } }
252
 
};
253
 
 
254
 
static Argument *
255
 
gradients_sample_custom_invoker (Gimp         *gimp,
256
 
                                 GimpContext  *context,
257
 
                                 GimpProgress *progress,
258
 
                                 Argument     *args)
 
144
static GValueArray *
 
145
gradients_sample_custom_invoker (GimpProcedure     *procedure,
 
146
                                 Gimp              *gimp,
 
147
                                 GimpContext       *context,
 
148
                                 GimpProgress      *progress,
 
149
                                 const GValueArray *args)
259
150
{
260
151
  gboolean success = TRUE;
261
 
  Argument *return_args;
262
 
  gint32 i;
263
 
  gdouble *pos;
 
152
  GValueArray *return_vals;
 
153
  gint32 num_samples;
 
154
  const gdouble *positions;
264
155
  gboolean reverse;
265
156
  gint32 array_length = 0;
266
157
  gdouble *color_samples = NULL;
267
 
  GimpGradient *gradient;
268
 
  GimpRGB color;
269
 
  gdouble *pv;
270
 
 
271
 
  i = args[0].value.pdb_int;
272
 
  if (i <= 0)
273
 
    success = FALSE;
274
 
 
275
 
  pos = (gdouble *) args[1].value.pdb_pointer;
276
 
 
277
 
  reverse = args[2].value.pdb_int ? TRUE : FALSE;
 
158
 
 
159
  num_samples = g_value_get_int (&args->values[0]);
 
160
  positions = gimp_value_get_floatarray (&args->values[1]);
 
161
  reverse = g_value_get_boolean (&args->values[2]);
278
162
 
279
163
  if (success)
280
164
    {
281
 
      array_length = i * 4;
 
165
      GimpGradient        *gradient;
 
166
      GimpGradientSegment *seg = NULL;
 
167
      GimpRGB              color;
 
168
      gdouble             *pv;
 
169
 
 
170
      array_length = num_samples * 4;
282
171
 
283
172
      pv = color_samples = g_new (gdouble, array_length);
284
173
 
285
174
      gradient = gimp_context_get_gradient (context);
286
175
 
287
 
      while (i--)
 
176
      while (num_samples--)
288
177
        {
289
 
          gimp_gradient_get_color_at (gradient, *pos, reverse, &color);
 
178
          seg = gimp_gradient_get_color_at (gradient, context, seg,
 
179
                                            *positions, reverse, &color);
290
180
 
291
181
          *pv++ = color.r;
292
182
          *pv++ = color.g;
293
183
          *pv++ = color.b;
294
184
          *pv++ = color.a;
295
185
 
296
 
          pos++;
 
186
          positions++;
297
187
        }
298
188
    }
299
189
 
300
 
  return_args = procedural_db_return_args (&gradients_sample_custom_proc, success);
 
190
  return_vals = gimp_procedure_get_return_values (procedure, success);
301
191
 
302
192
  if (success)
303
193
    {
304
 
      return_args[1].value.pdb_int = array_length;
305
 
      return_args[2].value.pdb_pointer = color_samples;
 
194
      g_value_set_int (&return_vals->values[1], array_length);
 
195
      gimp_value_take_floatarray (&return_vals->values[2], color_samples, array_length);
306
196
    }
307
197
 
308
 
  return return_args;
 
198
  return return_vals;
309
199
}
310
200
 
311
 
static ProcArg gradients_sample_custom_inargs[] =
312
 
{
313
 
  {
314
 
    GIMP_PDB_INT32,
315
 
    "num_samples",
316
 
    "The number of samples to take"
317
 
  },
318
 
  {
319
 
    GIMP_PDB_FLOATARRAY,
320
 
    "positions",
321
 
    "The list of positions to sample along the gradient"
322
 
  },
323
 
  {
324
 
    GIMP_PDB_INT32,
325
 
    "reverse",
326
 
    "Use the reverse gradient (TRUE or FALSE)"
327
 
  }
328
 
};
329
 
 
330
 
static ProcArg gradients_sample_custom_outargs[] =
331
 
{
332
 
  {
333
 
    GIMP_PDB_INT32,
334
 
    "array_length",
335
 
    "Length of the color_samples array (4 * num_samples)"
336
 
  },
337
 
  {
338
 
    GIMP_PDB_FLOATARRAY,
339
 
    "color_samples",
340
 
    "Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }"
341
 
  }
342
 
};
343
 
 
344
 
static ProcRecord gradients_sample_custom_proc =
345
 
{
346
 
  "gimp_gradients_sample_custom",
347
 
  "This procedure is deprecated! Use 'gimp_gradient_get_custom_samples' instead.",
348
 
  "This procedure is deprecated! Use 'gimp_gradient_get_custom_samples' instead.",
349
 
  "",
350
 
  "",
351
 
  "",
352
 
  "gimp_gradient_get_custom_samples",
353
 
  GIMP_INTERNAL,
354
 
  3,
355
 
  gradients_sample_custom_inargs,
356
 
  2,
357
 
  gradients_sample_custom_outargs,
358
 
  { { gradients_sample_custom_invoker } }
359
 
};
360
 
 
361
 
static Argument *
362
 
gradients_get_gradient_data_invoker (Gimp         *gimp,
363
 
                                     GimpContext  *context,
364
 
                                     GimpProgress *progress,
365
 
                                     Argument     *args)
 
201
static GValueArray *
 
202
gradients_get_gradient_data_invoker (GimpProcedure     *procedure,
 
203
                                     Gimp              *gimp,
 
204
                                     GimpContext       *context,
 
205
                                     GimpProgress      *progress,
 
206
                                     const GValueArray *args)
366
207
{
367
208
  gboolean success = TRUE;
368
 
  Argument *return_args;
369
 
  gchar *name;
 
209
  GValueArray *return_vals;
 
210
  const gchar *name;
370
211
  gint32 sample_size;
371
212
  gboolean reverse;
372
 
  gdouble *values = NULL;
373
 
  GimpGradient *gradient = NULL;
374
 
 
375
 
  name = (gchar *) args[0].value.pdb_pointer;
376
 
  if (name && !g_utf8_validate (name, -1, NULL))
377
 
    success = FALSE;
378
 
 
379
 
  sample_size = args[1].value.pdb_int;
380
 
  if (sample_size <= 0 || sample_size > 10000)
381
 
    sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
382
 
 
383
 
  reverse = args[2].value.pdb_int ? TRUE : FALSE;
 
213
  gchar *actual_name = NULL;
 
214
  gint32 width = 0;
 
215
  gdouble *grad_data = NULL;
 
216
 
 
217
  name = g_value_get_string (&args->values[0]);
 
218
  sample_size = g_value_get_int (&args->values[1]);
 
219
  reverse = g_value_get_boolean (&args->values[2]);
384
220
 
385
221
  if (success)
386
222
    {
 
223
      GimpGradient *gradient;
 
224
 
 
225
      if (sample_size < 1 || sample_size > 10000)
 
226
        sample_size = GIMP_GRADIENT_DEFAULT_SAMPLE_SIZE;
 
227
 
387
228
      if (name && strlen (name))
388
229
        {
389
230
          gradient = (GimpGradient *)
397
238
 
398
239
      if (gradient)
399
240
        {
400
 
          gdouble *pv;
401
 
          gdouble  pos, delta;
402
 
          GimpRGB  color;
403
 
          gint     i;
 
241
          GimpGradientSegment *seg = NULL;
 
242
          gdouble             *pv;
 
243
          gdouble              pos, delta;
 
244
          GimpRGB              color;
404
245
 
405
 
          i     = sample_size;
406
246
          pos   = 0.0;
407
 
          delta = 1.0 / (i - 1);
408
 
 
409
 
          pv = values = g_new (gdouble, i * 4);
410
 
 
411
 
          while (i--)
 
247
          delta = 1.0 / (sample_size - 1);
 
248
 
 
249
          actual_name = g_strdup (gimp_object_get_name (GIMP_OBJECT (gradient)));
 
250
          grad_data   = g_new (gdouble, sample_size * 4);
 
251
          width       = sample_size * 4;
 
252
 
 
253
          pv = grad_data;
 
254
 
 
255
          while (sample_size)
412
256
            {
413
 
              gimp_gradient_get_color_at (gradient, pos, reverse, &color);
 
257
              seg = gimp_gradient_get_color_at (gradient, context, seg,
 
258
                                                pos, reverse, &color);
414
259
 
415
260
              *pv++ = color.r;
416
261
              *pv++ = color.g;
424
269
        success = FALSE;
425
270
    }
426
271
 
427
 
  return_args = procedural_db_return_args (&gradients_get_gradient_data_proc, success);
 
272
  return_vals = gimp_procedure_get_return_values (procedure, success);
428
273
 
429
274
  if (success)
430
275
    {
431
 
      return_args[1].value.pdb_pointer = g_strdup (GIMP_OBJECT (gradient)->name);
432
 
      return_args[2].value.pdb_int = sample_size * 4;
433
 
      return_args[3].value.pdb_pointer = values;
 
276
      g_value_take_string (&return_vals->values[1], actual_name);
 
277
      g_value_set_int (&return_vals->values[2], width);
 
278
      gimp_value_take_floatarray (&return_vals->values[3], grad_data, width);
434
279
    }
435
280
 
436
 
  return return_args;
437
 
}
438
 
 
439
 
static ProcArg gradients_get_gradient_data_inargs[] =
440
 
{
441
 
  {
442
 
    GIMP_PDB_STRING,
443
 
    "name",
444
 
    "The gradient name (\"\" means current active gradient)"
445
 
  },
446
 
  {
447
 
    GIMP_PDB_INT32,
448
 
    "sample_size",
449
 
    "Size of the sample to return when the gradient is changed (0 < sample_size <= 10000)"
450
 
  },
451
 
  {
452
 
    GIMP_PDB_INT32,
453
 
    "reverse",
454
 
    "Use the reverse gradient (TRUE or FALSE)"
455
 
  }
456
 
};
457
 
 
458
 
static ProcArg gradients_get_gradient_data_outargs[] =
459
 
{
460
 
  {
461
 
    GIMP_PDB_STRING,
462
 
    "name",
463
 
    "The gradient name"
464
 
  },
465
 
  {
466
 
    GIMP_PDB_INT32,
467
 
    "width",
468
 
    "The gradient sample width (r,g,b,a)"
469
 
  },
470
 
  {
471
 
    GIMP_PDB_FLOATARRAY,
472
 
    "grad_data",
473
 
    "The gradient sample data"
474
 
  }
475
 
};
476
 
 
477
 
static ProcRecord gradients_get_gradient_data_proc =
478
 
{
479
 
  "gimp_gradients_get_gradient_data",
480
 
  "This procedure is deprecated! Use 'gimp_gradient_get_uniform_samples' instead.",
481
 
  "This procedure is deprecated! Use 'gimp_gradient_get_uniform_samples' instead.",
482
 
  "",
483
 
  "",
484
 
  "",
485
 
  "gimp_gradient_get_uniform_samples",
486
 
  GIMP_INTERNAL,
487
 
  3,
488
 
  gradients_get_gradient_data_inargs,
489
 
  3,
490
 
  gradients_get_gradient_data_outargs,
491
 
  { { gradients_get_gradient_data_invoker } }
492
 
};
 
281
  return return_vals;
 
282
}
 
283
 
 
284
void
 
285
register_gradients_procs (GimpPDB *pdb)
 
286
{
 
287
  GimpProcedure *procedure;
 
288
 
 
289
  /*
 
290
   * gimp-gradients-refresh
 
291
   */
 
292
  procedure = gimp_procedure_new (gradients_refresh_invoker);
 
293
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-gradients-refresh");
 
294
  gimp_procedure_set_static_strings (procedure,
 
295
                                     "gimp-gradients-refresh",
 
296
                                     "Refresh current gradients. This function always succeeds.",
 
297
                                     "This procedure retrieves all gradients currently in the user's gradient path and updates the gradient dialogs accordingly.",
 
298
                                     "Michael Natterer <mitch@gimp.org>",
 
299
                                     "Michael Natterer",
 
300
                                     "2002",
 
301
                                     NULL);
 
302
  gimp_pdb_register_procedure (pdb, procedure);
 
303
  g_object_unref (procedure);
 
304
 
 
305
  /*
 
306
   * gimp-gradients-get-list
 
307
   */
 
308
  procedure = gimp_procedure_new (gradients_get_list_invoker);
 
309
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-gradients-get-list");
 
310
  gimp_procedure_set_static_strings (procedure,
 
311
                                     "gimp-gradients-get-list",
 
312
                                     "Retrieve the list of loaded gradients.",
 
313
                                     "This procedure returns a list of the gradients that are currently loaded. You can later use the 'gimp-context-set-gradient' function to set the active gradient.",
 
314
                                     "Federico Mena Quintero",
 
315
                                     "Federico Mena Quintero",
 
316
                                     "1997",
 
317
                                     NULL);
 
318
  gimp_procedure_add_argument (procedure,
 
319
                               gimp_param_spec_string ("filter",
 
320
                                                       "filter",
 
321
                                                       "An optional regular expression used to filter the list",
 
322
                                                       FALSE, TRUE,
 
323
                                                       NULL,
 
324
                                                       GIMP_PARAM_READWRITE));
 
325
  gimp_procedure_add_return_value (procedure,
 
326
                                   gimp_param_spec_int32 ("num-gradients",
 
327
                                                          "num gradients",
 
328
                                                          "The number of loaded gradients",
 
329
                                                          0, G_MAXINT32, 0,
 
330
                                                          GIMP_PARAM_READWRITE));
 
331
  gimp_procedure_add_return_value (procedure,
 
332
                                   gimp_param_spec_string_array ("gradient-list",
 
333
                                                                 "gradient list",
 
334
                                                                 "The list of gradient names",
 
335
                                                                 GIMP_PARAM_READWRITE));
 
336
  gimp_pdb_register_procedure (pdb, procedure);
 
337
  g_object_unref (procedure);
 
338
 
 
339
  /*
 
340
   * gimp-gradients-sample-uniform
 
341
   */
 
342
  procedure = gimp_procedure_new (gradients_sample_uniform_invoker);
 
343
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-gradients-sample-uniform");
 
344
  gimp_procedure_set_static_strings (procedure,
 
345
                                     "gimp-gradients-sample-uniform",
 
346
                                     "This procedure is deprecated! Use 'gimp-gradient-get-uniform-samples' instead.",
 
347
                                     "This procedure is deprecated! Use 'gimp-gradient-get-uniform-samples' instead.",
 
348
                                     "",
 
349
                                     "",
 
350
                                     "",
 
351
                                     "gimp-gradient-get-uniform-samples");
 
352
  gimp_procedure_add_argument (procedure,
 
353
                               gimp_param_spec_int32 ("num-samples",
 
354
                                                      "num samples",
 
355
                                                      "The number of samples to take",
 
356
                                                      2, G_MAXINT32, 2,
 
357
                                                      GIMP_PARAM_READWRITE));
 
358
  gimp_procedure_add_argument (procedure,
 
359
                               g_param_spec_boolean ("reverse",
 
360
                                                     "reverse",
 
361
                                                     "Use the reverse gradient",
 
362
                                                     FALSE,
 
363
                                                     GIMP_PARAM_READWRITE));
 
364
  gimp_procedure_add_return_value (procedure,
 
365
                                   gimp_param_spec_int32 ("array-length",
 
366
                                                          "array length",
 
367
                                                          "Length of the color_samples array (4 * num_samples)",
 
368
                                                          0, G_MAXINT32, 0,
 
369
                                                          GIMP_PARAM_READWRITE));
 
370
  gimp_procedure_add_return_value (procedure,
 
371
                                   gimp_param_spec_float_array ("color-samples",
 
372
                                                                "color samples",
 
373
                                                                "Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }",
 
374
                                                                GIMP_PARAM_READWRITE));
 
375
  gimp_pdb_register_procedure (pdb, procedure);
 
376
  g_object_unref (procedure);
 
377
 
 
378
  /*
 
379
   * gimp-gradients-sample-custom
 
380
   */
 
381
  procedure = gimp_procedure_new (gradients_sample_custom_invoker);
 
382
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-gradients-sample-custom");
 
383
  gimp_procedure_set_static_strings (procedure,
 
384
                                     "gimp-gradients-sample-custom",
 
385
                                     "This procedure is deprecated! Use 'gimp-gradient-get-custom-samples' instead.",
 
386
                                     "This procedure is deprecated! Use 'gimp-gradient-get-custom-samples' instead.",
 
387
                                     "",
 
388
                                     "",
 
389
                                     "",
 
390
                                     "gimp-gradient-get-custom-samples");
 
391
  gimp_procedure_add_argument (procedure,
 
392
                               gimp_param_spec_int32 ("num-samples",
 
393
                                                      "num samples",
 
394
                                                      "The number of samples to take",
 
395
                                                      0, G_MAXINT32, 0,
 
396
                                                      GIMP_PARAM_READWRITE));
 
397
  gimp_procedure_add_argument (procedure,
 
398
                               gimp_param_spec_float_array ("positions",
 
399
                                                            "positions",
 
400
                                                            "The list of positions to sample along the gradient",
 
401
                                                            GIMP_PARAM_READWRITE));
 
402
  gimp_procedure_add_argument (procedure,
 
403
                               g_param_spec_boolean ("reverse",
 
404
                                                     "reverse",
 
405
                                                     "Use the reverse gradient",
 
406
                                                     FALSE,
 
407
                                                     GIMP_PARAM_READWRITE));
 
408
  gimp_procedure_add_return_value (procedure,
 
409
                                   gimp_param_spec_int32 ("array-length",
 
410
                                                          "array length",
 
411
                                                          "Length of the color_samples array (4 * num_samples)",
 
412
                                                          0, G_MAXINT32, 0,
 
413
                                                          GIMP_PARAM_READWRITE));
 
414
  gimp_procedure_add_return_value (procedure,
 
415
                                   gimp_param_spec_float_array ("color-samples",
 
416
                                                                "color samples",
 
417
                                                                "Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }",
 
418
                                                                GIMP_PARAM_READWRITE));
 
419
  gimp_pdb_register_procedure (pdb, procedure);
 
420
  g_object_unref (procedure);
 
421
 
 
422
  /*
 
423
   * gimp-gradients-get-gradient-data
 
424
   */
 
425
  procedure = gimp_procedure_new (gradients_get_gradient_data_invoker);
 
426
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-gradients-get-gradient-data");
 
427
  gimp_procedure_set_static_strings (procedure,
 
428
                                     "gimp-gradients-get-gradient-data",
 
429
                                     "This procedure is deprecated! Use 'gimp-gradient-get-uniform-samples' instead.",
 
430
                                     "This procedure is deprecated! Use 'gimp-gradient-get-uniform-samples' instead.",
 
431
                                     "",
 
432
                                     "",
 
433
                                     "",
 
434
                                     "gimp-gradient-get-uniform-samples");
 
435
  gimp_procedure_add_argument (procedure,
 
436
                               gimp_param_spec_string ("name",
 
437
                                                       "name",
 
438
                                                       "The gradient name (\"\" means current active gradient)",
 
439
                                                       FALSE, TRUE,
 
440
                                                       NULL,
 
441
                                                       GIMP_PARAM_READWRITE));
 
442
  gimp_procedure_add_argument (procedure,
 
443
                               gimp_param_spec_int32 ("sample-size",
 
444
                                                      "sample size",
 
445
                                                      "Size of the sample to return when the gradient is changed",
 
446
                                                      1, 10000, 1,
 
447
                                                      GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
 
448
  gimp_procedure_add_argument (procedure,
 
449
                               g_param_spec_boolean ("reverse",
 
450
                                                     "reverse",
 
451
                                                     "Use the reverse gradient",
 
452
                                                     FALSE,
 
453
                                                     GIMP_PARAM_READWRITE));
 
454
  gimp_procedure_add_return_value (procedure,
 
455
                                   gimp_param_spec_string ("actual-name",
 
456
                                                           "actual name",
 
457
                                                           "The gradient name",
 
458
                                                           FALSE, FALSE,
 
459
                                                           NULL,
 
460
                                                           GIMP_PARAM_READWRITE));
 
461
  gimp_procedure_add_return_value (procedure,
 
462
                                   gimp_param_spec_int32 ("width",
 
463
                                                          "width",
 
464
                                                          "The gradient sample width (r,g,b,a)",
 
465
                                                          0, G_MAXINT32, 0,
 
466
                                                          GIMP_PARAM_READWRITE));
 
467
  gimp_procedure_add_return_value (procedure,
 
468
                                   gimp_param_spec_float_array ("grad-data",
 
469
                                                                "grad data",
 
470
                                                                "The gradient sample data",
 
471
                                                                GIMP_PARAM_READWRITE));
 
472
  gimp_pdb_register_procedure (pdb, procedure);
 
473
  g_object_unref (procedure);
 
474
}