continuing commit after broken pipe...

This commit is contained in:
Michael Natterer
2001-10-17 11:34:24 +00:00
parent 18dd072836
commit 2b0982cbff
3 changed files with 30 additions and 33 deletions

View File

@ -569,28 +569,27 @@ HELP
} }
@outargs = ( @outargs = (
{ name => 'mean', void_ret => 1, { name => 'mean', void_ret => 1, init => 1,
desc => 'Mean itensity value' }, desc => 'Mean itensity value' },
{ name => 'std_dev', { name => 'std_dev', init => 1,
desc => 'Standard deviation of intensity values' }, desc => 'Standard deviation of intensity values' },
{ name => 'median', { name => 'median', init => 1,
desc => 'Median itensity value' }, desc => 'Median itensity value' },
{ name => 'pixels', { name => 'pixels', init => 1,
desc => 'Alpha-weighted pixel count for entire image' }, desc => 'Alpha-weighted pixel count for entire image' },
{ name => 'count', { name => 'count', init => 1,
desc => 'Alpha-weighted pixel count for range' }, desc => 'Alpha-weighted pixel count for range' },
{ name => 'percentile', { name => 'percentile', init => 1,
desc => 'Percentile that range falls under' } desc => 'Percentile that range falls under' }
); );
foreach (@outargs) { foreach (@outargs) {
@$_{qw(type alias no_declare)} = ('float', "htd.$_->{name}", 1) @$_{qw(type alias)} = ('float', "$_->{name}", 1)
} }
%invoke = ( %invoke = (
headers => [ qw("tools/gimphistogramtool.h") ],
vars => [ 'PixelRegion srcPR, maskPR', 'int x1, y1, x2, y2', 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' ], 'gboolean no_mask', 'GimpChannel *mask' ],
code => <<'CODE' code => <<'CODE'
{ {
@ -599,17 +598,6 @@ HELP
success = FALSE; success = FALSE;
else 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 */ /* The information collection should occur only within selection bounds */
no_mask = (gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2) == FALSE); no_mask = (gimp_drawable_mask_bounds (drawable, &x1, &y1, &x2, &y2) == FALSE);
gimp_drawable_offsets (drawable, &off_x, &off_y); gimp_drawable_offsets (drawable, &off_x, &off_y);
@ -619,20 +607,30 @@ HELP
x1, y1, (x2 - x1), (y2 - y1), FALSE); x1, y1, (x2 - x1), (y2 - y1), FALSE);
/* Configure the mask from the gimage's selection mask */ /* Configure the mask from the gimage's selection mask */
mask = gimp_image_get_mask (gimp_drawable_gimage (GIMP_DRAWABLE (drawable))); mask = gimp_image_get_mask (gimp_drawable_gimage (drawable));
pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)), pixel_region_init (&maskPR, gimp_drawable_data (GIMP_DRAWABLE (mask)),
x1 + off_x, y1 + off_y, (x2 - x1), (y2 - y1), FALSE); x1 + off_x, y1 + off_y, (x2 - x1), (y2 - y1), FALSE);
/* Apply the image transformation to the pixels */ /* Apply the image transformation to the pixels */
htd.hist = gimp_histogram_new (); histogram = gimp_histogram_new ();
if (no_mask) if (no_mask)
gimp_histogram_calculate (htd.hist, &srcPR, NULL); gimp_histogram_calculate (histogram, &srcPR, NULL);
else else
gimp_histogram_calculate (htd.hist, &srcPR, &maskPR); gimp_histogram_calculate (histogram, &srcPR, &maskPR);
/* Calculate the statistics */ /* 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 CODE
@ -761,9 +759,9 @@ CODE
); );
} }
@headers = qw("widgets/gimphistogramview.h" "core/gimpimage.h" @headers = qw("base/gimphistogram.h" "base/gimplut.h" "base/lut-funcs.h"
"core/gimpdrawable.h" "base/gimphistogram.h" "base/gimplut.h" "base/pixel-region.h" "base/pixel-processor.h"
"base/lut-funcs.h" "base/pixel-region.h" "base/pixel-processor.h" "core/gimpdrawable.h" "core/gimpimage.h"
"tools/tools-types.h"); "tools/tools-types.h");
@procs = qw(brightness_contrast levels posterize desaturate equalize invert @procs = qw(brightness_contrast levels posterize desaturate equalize invert

View File

@ -141,14 +141,14 @@ sub get_default_comment {
%invoke = ( %invoke = (
code => <<'CODE' code => <<'CODE'
{ {
comment = the_gimp->config->default_comment; comment = gimp->config->default_comment;
success = TRUE; success = TRUE;
} }
CODE 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 @procs = qw(gimprc_query gimprc_set
get_default_comment get_monitor_resolution); get_default_comment get_monitor_resolution);

View File

@ -292,7 +292,6 @@ HELP
} }
%invoke = ( %invoke = (
headers => [ qw("app_procs.h") ],
code => <<'CODE' code => <<'CODE'
{ {
gimp_set_busy_until_idle (gimp); gimp_set_busy_until_idle (gimp);