diff --git a/tools/pdbgen/pdb/color.pdb b/tools/pdbgen/pdb/color.pdb index ced91a0213..a8d688bc54 100644 --- a/tools/pdbgen/pdb/color.pdb +++ b/tools/pdbgen/pdb/color.pdb @@ -569,28 +569,27 @@ HELP } @outargs = ( - { name => 'mean', void_ret => 1, + { name => 'mean', void_ret => 1, init => 1, desc => 'Mean itensity value' }, - { name => 'std_dev', + { name => 'std_dev', init => 1, desc => 'Standard deviation of intensity values' }, - { name => 'median', + { name => 'median', init => 1, desc => 'Median itensity value' }, - { name => 'pixels', + { name => 'pixels', init => 1, desc => 'Alpha-weighted pixel count for entire image' }, - { name => 'count', + { name => 'count', init => 1, desc => 'Alpha-weighted pixel count for range' }, - { name => 'percentile', + { name => 'percentile', init => 1, desc => 'Percentile that range falls under' } ); foreach (@outargs) { - @$_{qw(type alias no_declare)} = ('float', "htd.$_->{name}", 1) + @$_{qw(type alias)} = ('float', "$_->{name}", 1) } %invoke = ( - headers => [ qw("tools/gimphistogramtool.h") ], vars => [ 'PixelRegion srcPR, maskPR', 'int x1, y1, x2, y2', - 'HistogramToolDialog htd', 'int off_x, off_y', + 'GimpHistogram *histogram', 'int off_x, off_y', 'gboolean no_mask', 'GimpChannel *mask' ], code => <<'CODE' { @@ -599,17 +598,6 @@ HELP success = FALSE; else { - htd.shell = NULL; - htd.channel = channel; - htd.drawable = drawable; - htd.color = gimp_drawable_is_rgb (drawable); - htd.histogram = histogram_widget_new (HISTOGRAM_WIDTH, - HISTOGRAM_HEIGHT); - - g_signal_connect (G_OBJECT (htd.histogram), "range_changed", - G_CALLBACK (histogram_tool_histogram_range), - (gpointer) &htd); - /* The information collection should occur only within selection bounds */ no_mask = (gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2) == FALSE); gimp_drawable_offsets (drawable, &off_x, &off_y); @@ -619,20 +607,30 @@ HELP x1, y1, (x2 - x1), (y2 - y1), FALSE); /* Configure the mask from the gimage's selection mask */ - mask = gimp_image_get_mask (gimp_drawable_gimage (GIMP_DRAWABLE (drawable))); - pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE(mask)), + mask = gimp_image_get_mask (gimp_drawable_gimage (drawable)); + pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)), x1 + off_x, y1 + off_y, (x2 - x1), (y2 - y1), FALSE); /* Apply the image transformation to the pixels */ - htd.hist = gimp_histogram_new (); + histogram = gimp_histogram_new (); if (no_mask) - gimp_histogram_calculate (htd.hist, &srcPR, NULL); + gimp_histogram_calculate (histogram, &srcPR, NULL); else - gimp_histogram_calculate (htd.hist, &srcPR, &maskPR); + gimp_histogram_calculate (histogram, &srcPR, &maskPR); /* Calculate the statistics */ - histogram_tool_histogram_range (htd.histogram, start_range, end_range, - &htd); + + mean = gimp_histogram_get_mean (histogram, channel, + start_range, end_range); + std_dev = gimp_histogram_get_std_dev (histogram, channel, + start_range, end_range); + median = gimp_histogram_get_median (histogram, channel, + start_range, end_range); + pixels = gimp_histogram_get_count (histogram, 0, 255); + count = gimp_histogram_get_count (histogram, start_range, end_range); + percentile = count / pixels; + + gimp_histogram_free (histogram); } } CODE @@ -761,9 +759,9 @@ CODE ); } -@headers = qw("widgets/gimphistogramview.h" "core/gimpimage.h" - "core/gimpdrawable.h" "base/gimphistogram.h" "base/gimplut.h" - "base/lut-funcs.h" "base/pixel-region.h" "base/pixel-processor.h" +@headers = qw("base/gimphistogram.h" "base/gimplut.h" "base/lut-funcs.h" + "base/pixel-region.h" "base/pixel-processor.h" + "core/gimpdrawable.h" "core/gimpimage.h" "tools/tools-types.h"); @procs = qw(brightness_contrast levels posterize desaturate equalize invert diff --git a/tools/pdbgen/pdb/gimprc.pdb b/tools/pdbgen/pdb/gimprc.pdb index 53c2ac321a..b9860e414b 100644 --- a/tools/pdbgen/pdb/gimprc.pdb +++ b/tools/pdbgen/pdb/gimprc.pdb @@ -141,14 +141,14 @@ sub get_default_comment { %invoke = ( code => <<'CODE' { - comment = the_gimp->config->default_comment; + comment = gimp->config->default_comment; success = TRUE; } CODE ); } -@headers = qw("core/gimp.h" "core/gimpcoreconfig.h" "app_procs.h" "gimprc.h"); +@headers = qw("core/gimp.h" "core/gimpcoreconfig.h" "gimprc.h"); @procs = qw(gimprc_query gimprc_set get_default_comment get_monitor_resolution); diff --git a/tools/pdbgen/pdb/image.pdb b/tools/pdbgen/pdb/image.pdb index 771b5591e7..5de1c29058 100644 --- a/tools/pdbgen/pdb/image.pdb +++ b/tools/pdbgen/pdb/image.pdb @@ -292,7 +292,6 @@ HELP } %invoke = ( - headers => [ qw("app_procs.h") ], code => <<'CODE' { gimp_set_busy_until_idle (gimp);