44
@inargs = ( &drawable_arg );
45
foreach (qw( brightness contrast)) {
46
push @inargs, { name => $_, type => '-127 <= int32 <= 127',
47
desc => "\u$_ adjustment: (%%desc%%)" }
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' }
69
60
gimp_drawable_bytes (drawable));
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);
76
pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
67
pixel_regions_process_parallel ((PixelProcessorFunc)
69
lut, 2, &srcPR, &destPR);
79
71
gimp_lut_free (lut);
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" }
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%%)" }
119
push @inargs, { name => 'gamma', type => '0.1 <= float <= 10',
120
desc => 'Gamma correction factor: (%%desc%%)' }
125
119
headers => [ qw("base/levels.h"
126
120
"core/gimpdrawable-levels.h") ],
241
238
PixelRegion srcPR, destPR;
243
lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable));
240
lut = posterize_lut_new (levels, gimp_drawable_bytes (drawable));
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);
250
pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
247
pixel_regions_process_parallel ((PixelProcessorFunc)
249
lut, 2, &srcPR, &destPR);
253
251
gimp_lut_free (lut);
274
@inargs = ( &drawable_arg );
277
headers => [ qw("core/gimpdrawable-desaturate.h") ],
280
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
281
! gimp_drawable_is_rgb (drawable))
285
gimp_drawable_desaturate (drawable);
273
{ name => 'drawable', type => 'drawable',
274
desc => 'The drawable' }
278
headers => [ qw("core/gimpdrawable-desaturate.h") ],
281
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
282
! gimp_drawable_is_rgb (drawable))
286
gimp_drawable_desaturate (drawable, GIMP_DESATURATE_LIGHTNESS);
292
sub desaturate_full {
294
Desaturate the contents of the specified drawable, with the specified formula.
298
This procedure desaturates the contents of the specified drawable,
299
with the specified formula. This procedure only works on drawables of
303
$author = $copyright = 'Karine Delvare';
308
{ name => 'drawable', type => 'drawable',
309
desc => 'The drawable' },
310
{ name => 'desaturate_mode', type => 'enum GimpDesaturateMode',
311
desc => 'The formula to use to desaturate' }
315
headers => [ qw("core/gimpdrawable-desaturate.h") ],
318
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
319
! gimp_drawable_is_rgb (drawable))
323
gimp_drawable_desaturate (drawable, desaturate_mode);
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.
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,
375
array => { name => 'num_points', type => '3 < int32 <= 34',
376
desc => 'The number of values in the control point array
419
array => { name => 'num_points', type => '4 <= int32 <= 34',
420
desc => 'The number of values in the control point array' }
428
472
gimp_drawable_bytes (drawable));
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);
435
pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
479
pixel_regions_process_parallel ((PixelProcessorFunc)
481
lut, 2, &srcPR, &destPR);
438
483
gimp_lut_free (lut);
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
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,
512
559
gimp_drawable_bytes (drawable));
514
pixel_region_init (&srcPR, gimp_drawable_data (drawable),
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);
519
pixel_regions_process_parallel ((p_func) gimp_lut_process, lut, 2,
566
pixel_regions_process_parallel ((PixelProcessorFunc)
568
lut, 2, &srcPR, &destPR);
522
570
gimp_lut_free (lut);
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.
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' }
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%%)';
565
613
headers => [ qw("base/color-balance.h") ],
591
638
color_balance_create_lookup_tables (&cb);
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);
598
for (pr = pixel_regions_register (2, &srcPR, &destPR);
600
pr = pixel_regions_process (pr))
602
color_balance (&srcPR, &destPR, &cb);
645
pixel_regions_process_parallel ((PixelProcessorFunc) color_balance,
646
&cb, 2, &srcPR, &destPR);
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.';
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
666
&neo_pdb_misc('2004', '2.2');
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' }
662
703
colorize_calculate (&colors);
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);
669
for (pr = pixel_regions_register (2, &srcPR, &destPR);
671
pr = pixel_regions_process (pr))
673
colorize (&srcPR, &destPR, &colors);
710
pixel_regions_process_parallel ((PixelProcessorFunc) colorize,
711
&colors, 2, &srcPR, &destPR);
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
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' }
711
foreach (qw(start end)) {
712
push @inargs, { name => "${_}_range", type => '0 <= int32 < 256',
713
desc => "\u$_ of the intensity measurement range" }
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' }
732
@$_{qw(type alias)} = ('float', "$_->{name}", 1)
736
headers => [ qw("config/gimpbaseconfig.h" "core/gimp.h"
737
"core/gimpdrawable-histogram.h") ],
770
headers => [ qw("core/gimp.h" "core/gimpdrawable-histogram.h") ],
740
773
if (! gimp_item_is_attached (GIMP_ITEM (drawable)) ||
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' }
796
foreach (qw(lightness saturation)) {
797
push @inargs, { name => $_, type => '-100 <= float <= 100',
798
desc => "$_ modification: (%%desc%%)" }
802
833
headers => [ qw("base/hue-saturation.h") ],
826
856
/* Calculate the transfer arrays */
827
857
hue_saturation_calculate_transfers (&hs);
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);
834
for (pr = pixel_regions_register (2, &srcPR, &destPR);
836
pr = pixel_regions_process (pr))
838
hue_saturation (&srcPR, &destPR, &hs);
864
pixel_regions_process_parallel ((PixelProcessorFunc) hue_saturation,
865
&hs, 2, &srcPR, &destPR);
841
867
gimp_drawable_merge_shadow (drawable, TRUE, _("Hue-Saturation"));
842
868
gimp_drawable_update (drawable, x, y, width, height);
862
@inargs = ( &drawable_arg );
863
foreach (qw(low high)) {
864
push @inargs, { name => "${_}_threshold", type => '0 <= int32 <= 255',
865
desc => "The $_ threshold value: %%desc%%" }
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' }
869
898
headers => [ qw("base/threshold.h") ],
888
917
tr.low_threshold = low_threshold;
889
918
tr.high_threshold = high_threshold;
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);
896
pixel_regions_process_parallel ((p_func) threshold_2, &tr, 2,
925
pixel_regions_process_parallel ((PixelProcessorFunc) threshold,
926
&tr, 2, &srcPR, &destPR);
899
928
gimp_drawable_merge_shadow (drawable, TRUE, _("Threshold"));
900
929
gimp_drawable_update (drawable, x, y, width, height);
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"
941
"base/pixel-region.h"
942
"base/pixel-processor.h"
943
"core/gimpdrawable.h"
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
917
952
%exports = (app => [@procs], lib => [@procs]);