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

« back to all changes in this revision

Viewing changes to tools/pdbgen/pdb/color.pdb

  • 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
17
17
 
18
18
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
19
19
 
20
 
sub drawable_arg () {{
21
 
    name => 'drawable',
22
 
    type => 'drawable',
23
 
    desc => 'The drawable',
24
 
}}
25
 
 
26
 
sub channel_arg () {{
27
 
    name => 'channel',
28
 
    type => 'enum GimpHistogramChannel',
29
 
    desc => 'The channel to modify: { %%desc%% }'
30
 
}}
31
 
 
32
20
sub brightness_contrast {
33
21
    $blurb = 'Modify brightness/contrast in the specified drawable.';
34
22
 
41
29
    &std_pdb_misc;
42
30
    $date = '1997';
43
31
 
44
 
    @inargs = ( &drawable_arg );
45
 
    foreach (qw( brightness contrast)) {
46
 
        push @inargs, { name => $_, type => '-127 <= int32 <= 127',
47
 
                        desc => "\u$_ adjustment: (%%desc%%)" }
48
 
    }
 
32
    @inargs = (
 
33
        { name => 'drawable', type => 'drawable',
 
34
          desc => 'The drawable' },
 
35
        { name => 'brightness', type => '-127 <= int32 <= 127',
 
36
          desc => 'Brightness adjustment' },
 
37
        { name => 'contrast', type => '-127 <= int32 <= 127',
 
38
          desc => 'Contrast adjustment' }
 
39
    );
49
40
 
50
41
    %invoke = (
51
42
        code => <<'CODE'
68
59
                                             contrast / 127.0,
69
60
                                             gimp_drawable_bytes (drawable));
70
61
 
71
 
          pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
62
          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
72
63
                             x, y, width, height, FALSE);
73
 
          pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
64
          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
74
65
                             x, y, width, height, TRUE);
75
66
 
76
 
          pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
77
 
                                          &srcPR, &destPR);
 
67
          pixel_regions_process_parallel ((PixelProcessorFunc)
 
68
                                          gimp_lut_process,
 
69
                                          lut, 2, &srcPR, &destPR);
78
70
 
79
71
          gimp_lut_free (lut);
80
72
 
107
99
    &std_pdb_misc;
108
100
 
109
101
    @inargs = (
110
 
        &drawable_arg,
111
 
        &channel_arg
 
102
        { name => 'drawable', type => 'drawable',
 
103
          desc => 'The drawable' },
 
104
        { name => 'channel', type => 'enum GimpHistogramChannel',
 
105
          desc => 'The channel to modify' },
 
106
        { name => 'low_input', type => '0 <= int32 <= 255',
 
107
          desc => "Intensity of lowest input" },
 
108
        { name => 'high_input', type => '0 <= int32 <= 255',
 
109
          desc => "Intensity of highest input" },
 
110
        { name => 'gamma', type => '0.1 <= float <= 10',
 
111
          desc => 'Gamma correction factor' },
 
112
        { name => 'low_output', type => '0 <= int32 <= 255',
 
113
          desc => "Intensity of lowest output" },
 
114
        { name => 'high_output', type => '0 <= int32 <= 255',
 
115
          desc => "Intensity of highest output" }
112
116
    );
113
117
 
114
 
    foreach $arg (qw(input output)) {
115
 
        foreach (qw(low high)) {
116
 
            push @inargs, { name => "${_}_$arg", type => '0 <= int32 <= 255',
117
 
                            desc => "Intensity of ${_}est $arg: (%%desc%%)" }
118
 
        }
119
 
        push @inargs, { name => 'gamma', type => '0.1 <= float <= 10',
120
 
                        desc => 'Gamma correction factor: (%%desc%%)' }
121
 
    }
122
 
    $#inargs--;
123
 
 
124
118
    %invoke = (
125
119
        headers => [ qw("base/levels.h"
126
120
                        "core/gimpdrawable-levels.h") ],
137
131
  if (success)
138
132
    gimp_drawable_levels (drawable, context,
139
133
                          channel,
140
 
                          low_input,
141
 
                          high_input,
 
134
                          low_input, high_input,
142
135
                          gamma,
143
 
                          low_output,
144
 
                          high_output);
 
136
                          low_output, high_output);
145
137
}
146
138
CODE
147
139
    );
161
153
    $author = $copyright = 'Joao S.O. Bueno, Shawn Willden';
162
154
    $date = '2003';
163
155
 
164
 
    @inargs = ( &drawable_arg );
 
156
    @inargs = (
 
157
        { name => 'drawable', type => 'drawable',
 
158
          desc => 'The drawable' }
 
159
    );
165
160
 
166
161
    %invoke = (
167
162
        headers => [ qw("base/levels.h"
181
176
    );
182
177
}
183
178
 
184
 
 
185
 
 
186
179
sub levels_auto {
187
 
    &std_pdb_deprecated ('gimp_levels_stretch');
 
180
    &std_pdb_deprecated ('gimp-levels-stretch');
188
181
 
189
 
    @inargs = ( &drawable_arg );
 
182
    @inargs = (
 
183
        { name => 'drawable', type => 'drawable',
 
184
          desc => 'The drawable' }
 
185
    );
190
186
 
191
187
    %invoke = (
192
188
        headers => [ qw("base/levels.h"
218
214
    $date = '1997';
219
215
 
220
216
    @inargs = (
221
 
        &drawable_arg,
 
217
        { name => 'drawable', type => 'drawable',
 
218
          desc => 'The drawable' },
222
219
        { name => 'levels', type => '2 <= int32 <= 255',
223
 
          desc => 'Levels of posterization: (%%desc%%)' }
 
220
          desc => 'Levels of posterization' }
224
221
    );
225
222
 
226
223
    %invoke = (
240
237
          GimpLut     *lut;
241
238
          PixelRegion  srcPR, destPR;
242
239
 
243
 
          lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable)); 
 
240
          lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable));
244
241
 
245
 
          pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
242
          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
246
243
                             x, y, width, height, FALSE);
247
 
          pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
244
          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
248
245
                             x, y, width, height, TRUE);
249
246
 
250
 
          pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
251
 
                                          &srcPR, &destPR);
 
247
          pixel_regions_process_parallel ((PixelProcessorFunc)
 
248
                                          gimp_lut_process,
 
249
                                          lut, 2, &srcPR, &destPR);
252
250
 
253
251
          gimp_lut_free (lut);
254
252
 
271
269
 
272
270
    &std_pdb_misc;
273
271
 
274
 
    @inargs = ( &drawable_arg );
275
 
 
276
 
    %invoke = (
277
 
        headers => [ qw("core/gimpdrawable-desaturate.h") ],
278
 
        code => <<'CODE'
279
 
{
280
 
  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
281
 
      ! gimp_drawable_is_rgb (drawable))
282
 
    success = FALSE;
283
 
 
284
 
  if (success)
285
 
    gimp_drawable_desaturate (drawable);
 
272
    @inargs = (
 
273
        { name => 'drawable', type => 'drawable',
 
274
          desc => 'The drawable' }
 
275
    );
 
276
 
 
277
    %invoke = (
 
278
        headers => [ qw("core/gimpdrawable-desaturate.h") ],
 
279
        code => <<'CODE'
 
280
{
 
281
  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
 
282
      ! gimp_drawable_is_rgb (drawable))
 
283
    success = FALSE;
 
284
 
 
285
  if (success)
 
286
    gimp_drawable_desaturate (drawable, GIMP_DESATURATE_LIGHTNESS);
 
287
}
 
288
CODE
 
289
    );
 
290
}
 
291
 
 
292
sub desaturate_full {
 
293
    $blurb = <<'BLURB';
 
294
Desaturate the contents of the specified drawable, with the specified formula.
 
295
BLURB
 
296
 
 
297
    $help = <<'HELP';
 
298
This procedure desaturates the contents of the specified drawable,
 
299
with the specified formula. This procedure only works on drawables of
 
300
type RGB color.
 
301
HELP
 
302
 
 
303
    $author = $copyright = 'Karine Delvare';
 
304
    $date = '2005';
 
305
    $since = '2.4';
 
306
 
 
307
    @inargs = (
 
308
        { name => 'drawable', type => 'drawable',
 
309
          desc => 'The drawable' },
 
310
        { name => 'desaturate_mode', type => 'enum GimpDesaturateMode',
 
311
          desc => 'The formula to use to desaturate' }
 
312
    );
 
313
 
 
314
    %invoke = (
 
315
        headers => [ qw("core/gimpdrawable-desaturate.h") ],
 
316
        code => <<'CODE'
 
317
{
 
318
  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
 
319
      ! gimp_drawable_is_rgb (drawable))
 
320
    success = FALSE;
 
321
 
 
322
  if (success)
 
323
    gimp_drawable_desaturate (drawable, desaturate_mode);
286
324
}
287
325
CODE
288
326
    );
304
342
    &std_pdb_misc;
305
343
 
306
344
    @inargs = (
307
 
        &drawable_arg,
 
345
        { name => 'drawable', type => 'drawable',
 
346
          desc => 'The drawable' },
308
347
        { name => 'mask_only', type => 'boolean',
309
348
          desc => 'Equalization option' }
310
349
    );
335
374
 
336
375
    &std_pdb_misc;
337
376
 
338
 
    @inargs = ( &drawable_arg );
 
377
    @inargs = (
 
378
        { name => 'drawable', type => 'drawable',
 
379
          desc => 'The drawable' }
 
380
    );
339
381
 
340
382
    %invoke = (
341
383
        headers => [ qw("core/gimpdrawable-invert.h") ],
360
402
drawable must be either grayscale or RGB, and the channel can be either an
361
403
intensity component, or the value. The 'control_pts' parameter is an array of
362
404
integers which define a set of control points which describe a Catmull Rom
363
 
spline which yields the final intensity curve. Use the 'gimp_curves_explicit'
 
405
spline which yields the final intensity curve. Use the gimp_curves_explicit()
364
406
function to explicitly modify intensity levels.
365
407
HELP
366
408
 
367
409
    &std_pdb_misc;
368
410
 
369
411
    @inargs = (
370
 
        &drawable_arg,
371
 
        &channel_arg,
 
412
        { name => 'drawable', type => 'drawable',
 
413
          desc => 'The drawable' },
 
414
        { name => 'channel', type => 'enum GimpHistogramChannel',
 
415
          desc => 'The channel to modify' },
372
416
        { name => 'control_pts', type => 'int8array',
373
417
          desc => 'The spline control points: { cp1.x, cp1.y, cp2.x, cp2.y,
374
418
                   ... }',
375
 
          array => { name => 'num_points', type => '3 < int32 <= 34',
376
 
                     desc => 'The number of values in the control point array
377
 
                              (%%desc%%)' } }
 
419
          array => { name => 'num_points', type => '4 <= int32 <= 34',
 
420
                     desc => 'The number of values in the control point array' }
 
421
       }
378
422
    );
379
423
 
380
424
    %invoke = (
427
471
                          &c,
428
472
                          gimp_drawable_bytes (drawable));
429
473
 
430
 
          pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
474
          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
431
475
                             x, y, width, height, FALSE);
432
 
          pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
476
          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
433
477
                             x, y, width, height, TRUE);
434
478
 
435
 
          pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
436
 
                                          &srcPR, &destPR);
 
479
          pixel_regions_process_parallel ((PixelProcessorFunc)
 
480
                                          gimp_lut_process,
 
481
                                          lut, 2, &srcPR, &destPR);
437
482
 
438
483
          gimp_lut_free (lut);
439
484
 
454
499
drawable must be either grayscale or RGB, and the channel can be either an
455
500
intensity component, or the value. The 'curve' parameter is an array of bytes
456
501
which explicitly defines how each pixel value in the drawable will be modified.
457
 
Use the 'gimp_curves_spline' function to modify intensity levels with Catmull
 
502
Use the gimp_curves_spline() function to modify intensity levels with Catmull
458
503
Rom splines.
459
504
HELP
460
505
 
461
506
    &std_pdb_misc;
462
507
 
463
508
    @inargs = (
464
 
        &drawable_arg,
465
 
        &channel_arg,
 
509
        { name => 'drawable', type => 'drawable',
 
510
          desc => 'The drawable' },
 
511
        { name => 'channel', type => 'enum GimpHistogramChannel',
 
512
          desc => 'The channel to modify' },
466
513
        { name => 'curve', type => 'int8array',
467
514
          desc => 'The explicit curve',
468
515
          array => { name => 'num_bytes',
510
557
                          (GimpLutFunc) curves_lut_func,
511
558
                          &c,
512
559
                          gimp_drawable_bytes (drawable));
513
 
      
514
 
          pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
560
 
 
561
          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
515
562
                             x, y, width, height, FALSE);
516
 
          pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
563
          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
517
564
                             x, y, width, height, TRUE);
518
565
 
519
 
          pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
520
 
                                          &srcPR, &destPR);
 
566
          pixel_regions_process_parallel ((PixelProcessorFunc)
 
567
                                          gimp_lut_process,
 
568
                                          lut, 2, &srcPR, &destPR);
521
569
 
522
570
          gimp_lut_free (lut);
523
571
 
538
586
can be modified: cyan-red, magenta-green, and yellow-blue. Negative values
539
587
increase the amount of the former, positive values increase the amount of the
540
588
latter. Color balance can be controlled with the 'transfer_mode' setting, which
541
 
allows shadows, midtones, and highlights in an image to be affected
542
 
differently. The 'preserve_lum' parameter, if non-zero, ensures that the
 
589
allows shadows, mid-tones, and highlights in an image to be affected
 
590
differently. The 'preserve-lum' parameter, if TRUE, ensures that the
543
591
luminosity of each pixel remains fixed.
544
592
HELP
545
593
 
547
595
    $date = '1997';
548
596
 
549
597
    @inargs = (
550
 
        &drawable_arg,
 
598
        { name => 'drawable', type => 'drawable',
 
599
          desc => 'The drawable' },
551
600
        { name => 'transfer_mode', type => 'enum GimpTransferMode',
552
 
          desc => 'Transfer mode: { %%desc%% }' },
 
601
          desc => 'Transfer mode' },
553
602
        { name => 'preserve_lum', type => 'boolean',
554
 
          desc => 'Preserve luminosity values at each pixel' }
 
603
          desc => 'Preserve luminosity values at each pixel' },
 
604
        { name => 'cyan_red', type => '-100 <= float <= 100',
 
605
          desc => 'Cyan-Red color balance' },
 
606
        { name => 'magenta_green', type => '-100 <= float <= 100',
 
607
          desc => 'Magenta-Green color balance' },
 
608
        { name => 'yellow_blue', type => '-100 <= float <= 100',
 
609
          desc => 'Yellow-Blue color balance' }
555
610
    );
556
611
 
557
 
    foreach (qw(cyan_red magenta_green yellow_blue)) {
558
 
        my $arg = { name => $_, type => '-100 <= float <= 100' };
559
 
        ($arg->{desc} = ucfirst $_) =~ s/_(.)/-\U$1\E/;
560
 
         $arg->{desc} .= ' color balance: (%%desc%%)';
561
 
        push @inargs, $arg;
562
 
    }
563
 
 
564
612
    %invoke = (
565
613
        headers => [ qw("base/color-balance.h") ],
566
614
        code => <<'CODE'
576
624
      /* The application should occur only within selection bounds */
577
625
      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
578
626
        {
579
 
          ColorBalance         cb;
580
 
          PixelRegionIterator *pr;
581
 
          PixelRegion          srcPR, destPR;
 
627
          ColorBalance  cb;
 
628
          PixelRegion   srcPR, destPR;
582
629
 
583
630
          color_balance_init (&cb);
584
631
 
590
637
 
591
638
          color_balance_create_lookup_tables (&cb);
592
639
 
593
 
          pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
640
          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
594
641
                             x, y, width, height, FALSE);
595
 
          pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
642
          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
596
643
                             x, y, width, height, TRUE);
597
644
 
598
 
          for (pr = pixel_regions_register (2, &srcPR, &destPR);
599
 
               pr;
600
 
               pr = pixel_regions_process (pr))
601
 
            {
602
 
              color_balance (&srcPR, &destPR, &cb);
603
 
            }
 
645
          pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
 
646
                                          &cb, 2, &srcPR, &destPR);
604
647
 
605
648
          gimp_drawable_merge_shadow (drawable, TRUE, _("Color Balance"));
606
649
          gimp_drawable_update (drawable, x, y, width, height);
615
658
    $blurb = 'Render the drawable as a grayscale image seen through a colored glass.';
616
659
 
617
660
    $help = <<'HELP';
618
 
Desatures the drawable, then tints it with the specified color. This tool is
 
661
Desaturates the drawable, then tints it with the specified color. This tool is
619
662
only valid on RGB color images. It will not operate on grayscale or indexed
620
663
drawables.
621
664
HELP
622
665
 
623
 
    &std_pdb_misc;
624
 
    $date = '2004';
625
 
    $since = '2.2';
 
666
    &neo_pdb_misc('2004', '2.2');
626
667
 
627
668
    @inargs = (
628
 
        &drawable_arg,
 
669
        { name => 'drawable', type => 'drawable',
 
670
          desc => 'The drawable' },
629
671
        { name => 'hue', type => '0 <= float <= 360',
630
 
          desc => 'Hue in degrees: (%%desc%%)' },
 
672
          desc => 'Hue in degrees' },
631
673
        { name => 'saturation', type => '0 <= float <= 100',
632
 
          desc => 'Saturation in percent: (%%desc%%)' },
 
674
          desc => 'Saturation in percent' },
633
675
        { name => 'lightness', type => '-100 <= float <= 100',
634
 
          desc => 'Lightness in percent: (%%desc%%)' }
 
676
          desc => 'Lightness in percent' }
635
677
    );
636
678
 
637
679
    %invoke = (
649
691
      /* The application should occur only within selection bounds */
650
692
      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
651
693
        {
652
 
          Colorize             colors;
653
 
          PixelRegionIterator *pr;
654
 
          PixelRegion          srcPR, destPR;
 
694
          Colorize     colors;
 
695
          PixelRegion  srcPR, destPR;
655
696
 
656
697
          colorize_init (&colors);
657
698
 
661
702
 
662
703
          colorize_calculate (&colors);
663
704
 
664
 
          pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
705
          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
665
706
                             x, y, width, height, FALSE);
666
 
          pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
707
          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
667
708
                             x, y, width, height, TRUE);
668
709
 
669
 
          for (pr = pixel_regions_register (2, &srcPR, &destPR);
670
 
               pr;
671
 
               pr = pixel_regions_process (pr))
672
 
            {
673
 
              colorize (&srcPR, &destPR, &colors);
674
 
            }
 
710
          pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
 
711
                                          &colors, 2, &srcPR, &destPR);
675
712
 
676
713
          gimp_drawable_merge_shadow (drawable, TRUE, _("Colorize"));
677
714
          gimp_drawable_update (drawable, x, y, width, height);
692
729
of a drawable. A channel to examine is first specified. This can be either
693
730
value, red, green, or blue, depending on whether the drawable is of type color
694
731
or grayscale. The drawable may not be indexed. Second, a range of intensities
695
 
are specified. The gimp_histogram function returns statistics based on the
 
732
are specified. The gimp_histogram() function returns statistics based on the
696
733
pixels in the drawable that fall under this range of values. Mean, standard
697
734
deviation, median, number of pixels, and percentile are all returned.
698
735
Additionally, the total count of pixels in the image is returned. Counts of
704
741
    &std_pdb_misc;
705
742
 
706
743
    @inargs = (
707
 
        &drawable_arg,
708
 
        &channel_arg,
 
744
        { name => 'drawable', type => 'drawable',
 
745
          desc => 'The drawable' },
 
746
        { name => 'channel', type => 'enum GimpHistogramChannel',
 
747
          desc => 'The channel to modify' },
 
748
        { name => 'start_range', type => '0 <= int32 < 256',
 
749
          desc => 'Start of the intensity measurement range' },
 
750
        { name => 'end_range', type => '0 <= int32 < 256',
 
751
          desc => 'End of the intensity measurement range' }
709
752
    );
710
753
 
711
 
    foreach (qw(start end)) {
712
 
        push @inargs, { name => "${_}_range", type => '0 <= int32 < 256',
713
 
                        desc => "\u$_ of the intensity measurement range" }
714
 
    }
715
 
 
716
754
    @outargs = (
717
 
        { name => 'mean', void_ret => 1, init => 1,
 
755
        { name => 'mean', type => 'float', void_ret => 1,
718
756
          desc => 'Mean intensity value' },
719
 
        { name => 'std_dev', init => 1,
 
757
        { name => 'std_dev',  type => 'float',
720
758
          desc => 'Standard deviation of intensity values' },
721
 
        { name => 'median', init => 1,
 
759
        { name => 'median',  type => 'float',
722
760
          desc => 'Median intensity value' },
723
 
        { name => 'pixels', init => 1,
 
761
        { name => 'pixels',  type => 'float',
724
762
          desc => 'Alpha-weighted pixel count for entire image' },
725
 
        { name => 'count', init => 1,
 
763
        { name => 'count',  type => 'float',
726
764
          desc => 'Alpha-weighted pixel count for range' },
727
 
        { name => 'percentile', init => 1,
 
765
        { name => 'percentile',  type => 'float',
728
766
          desc => 'Percentile that range falls under' }
729
767
    );
730
768
 
731
 
    foreach (@outargs) {
732
 
       @$_{qw(type alias)} = ('float', "$_->{name}", 1)
733
 
    }
734
 
 
735
769
    %invoke = (
736
 
        headers => [ qw("config/gimpbaseconfig.h" "core/gimp.h"
737
 
                        "core/gimpdrawable-histogram.h") ],
 
770
        headers => [ qw("core/gimp.h" "core/gimpdrawable-histogram.h") ],
738
771
        code => <<'CODE'
739
772
{
740
773
  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
747
780
 
748
781
  if (success)
749
782
    {
750
 
      GimpHistogram *histogram;
751
 
 
752
 
      histogram = gimp_histogram_new (GIMP_BASE_CONFIG (gimp->config));
 
783
      GimpHistogram *histogram = gimp_histogram_new ();
753
784
 
754
785
      gimp_drawable_calculate_histogram (drawable, histogram);
755
786
 
778
809
 
779
810
    $help = <<'HELP';
780
811
This procedures allows the hue, lightness, and saturation in the specified
781
 
drawable to be modified. The 'hue_range' parameter provides the capability to
 
812
drawable to be modified. The 'hue-range' parameter provides the capability to
782
813
limit range of affected hues.
783
814
HELP
784
815
 
786
817
    $date = '1997';
787
818
 
788
819
    @inargs = (
789
 
        &drawable_arg,
 
820
        { name => 'drawable', type => 'drawable',
 
821
          desc => 'The drawable' },
790
822
        { name => 'hue_range', type => 'enum GimpHueRange',
791
 
          desc => 'Range of affected hues: { %%desc%% }' },
 
823
          desc => 'Range of affected hues' },
792
824
        { name => 'hue_offset', type => '-180 <= float <= 180',
793
 
          desc => 'Hue offset in degrees: (%%desc%%)' }
 
825
          desc => 'Hue offset in degrees' },
 
826
        { name => 'lightness', type => '-100 <= float <= 100',
 
827
          desc => 'Lightness modification' },
 
828
        { name => 'saturation', type => '-100 <= float <= 100',
 
829
          desc => 'Saturation modification' }
794
830
    );
795
831
 
796
 
    foreach (qw(lightness saturation)) {
797
 
        push @inargs, { name => $_, type => '-100 <= float <= 100',
798
 
                        desc => "$_ modification: (%%desc%%)" }
799
 
    }
800
 
 
801
832
    %invoke = (
802
833
        headers => [ qw("base/hue-saturation.h") ],
803
834
        code => <<'CODE'
813
844
      /* The application should occur only within selection bounds */
814
845
      if (gimp_drawable_mask_intersect (drawable, &x, &y, &width, &height))
815
846
        {
816
 
          HueSaturation        hs;
817
 
          PixelRegionIterator *pr;
818
 
          PixelRegion          srcPR, destPR;
 
847
          HueSaturation  hs;
 
848
          PixelRegion    srcPR, destPR;
819
849
 
820
850
          hue_saturation_init (&hs);
821
851
 
826
856
          /* Calculate the transfer arrays */
827
857
          hue_saturation_calculate_transfers (&hs);
828
858
 
829
 
          pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
859
          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
830
860
                             x, y, width, height, FALSE);
831
 
          pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
861
          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
832
862
                             x, y, width, height, TRUE);
833
863
 
834
 
          for (pr = pixel_regions_register (2, &srcPR, &destPR);
835
 
               pr;
836
 
               pr = pixel_regions_process (pr))
837
 
            {
838
 
              hue_saturation (&srcPR, &destPR, &hs);
839
 
            }
 
864
          pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
 
865
                                          &hs, 2, &srcPR, &destPR);
840
866
 
841
867
          gimp_drawable_merge_shadow (drawable, TRUE, _("Hue-Saturation"));
842
868
          gimp_drawable_update (drawable, x, y, width, height);
859
885
    &std_pdb_misc;
860
886
    $date = '1997';
861
887
 
862
 
    @inargs = ( &drawable_arg );
863
 
    foreach (qw(low high)) {
864
 
        push @inargs, { name => "${_}_threshold", type => '0 <= int32 <= 255',
865
 
                        desc => "The $_ threshold value: %%desc%%" }
866
 
    }
 
888
    @inargs = (
 
889
        { name => 'drawable', type => 'drawable',
 
890
          desc => 'The drawable' },
 
891
        { name => 'low_threshold', type => '0 <= int32 <= 255',
 
892
          desc => 'The low threshold value' },
 
893
        { name => 'high_threshold', type => '0 <= int32 <= 255',
 
894
          desc => 'The high threshold value' }
 
895
    );
867
896
 
868
897
    %invoke = (
869
898
        headers => [ qw("base/threshold.h") ],
871
900
{
872
901
  if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
873
902
      gimp_drawable_is_indexed (drawable) ||
874
 
      (low_threshold >= high_threshold))
 
903
      (low_threshold > high_threshold))
875
904
    success = FALSE;
876
905
 
877
906
  if (success)
888
917
          tr.low_threshold  = low_threshold;
889
918
          tr.high_threshold = high_threshold;
890
919
 
891
 
          pixel_region_init (&srcPR, gimp_drawable_data (drawable),
 
920
          pixel_region_init (&srcPR, gimp_drawable_get_tiles (drawable),
892
921
                             x, y, width, height, FALSE);
893
 
          pixel_region_init (&destPR, gimp_drawable_shadow (drawable),
 
922
          pixel_region_init (&destPR, gimp_drawable_get_shadow_tiles (drawable),
894
923
                             x, y, width, height, TRUE);
895
924
 
896
 
          pixel_regions_process_parallel ((p_func) threshold_2, &tr, 2,
897
 
                                          &srcPR, &destPR);
 
925
          pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
 
926
                                          &tr, 2, &srcPR, &destPR);
898
927
 
899
928
          gimp_drawable_merge_shadow (drawable, TRUE, _("Threshold"));
900
929
          gimp_drawable_update (drawable, x, y, width, height);
905
934
    );
906
935
}
907
936
 
 
937
 
908
938
@headers = qw("base/gimphistogram.h"
909
 
              "base/gimplut.h" "base/lut-funcs.h"
910
 
              "base/pixel-region.h" "base/pixel-processor.h"
911
 
              "core/gimpdrawable.h" "core/gimpimage.h"
 
939
              "base/gimplut.h"
 
940
              "base/lut-funcs.h"
 
941
              "base/pixel-region.h"
 
942
              "base/pixel-processor.h"
 
943
              "core/gimpdrawable.h"
 
944
              "core/gimpimage.h"
912
945
              "gimp-intl.h");
913
946
 
914
 
@procs = qw(brightness_contrast levels levels_auto levels_stretch posterize desaturate
915
 
            equalize invert curves_spline curves_explicit color_balance
916
 
            colorize histogram hue_saturation threshold);
 
947
@procs = qw(brightness_contrast levels levels_auto levels_stretch posterize
 
948
            desaturate desaturate_full equalize invert curves_spline
 
949
            curves_explicit color_balance colorize histogram hue_saturation
 
950
            threshold);
 
951
 
917
952
%exports = (app => [@procs], lib => [@procs]);
918
953
 
919
954
$desc = 'Color';