Commit dcf50dc2 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

Replaced the histogram tool by a histogram dialog:

2003-11-01  Sven Neumann  <sven@gimp.org>

	Replaced the histogram tool by a histogram dialog:

	* themes/Default/images/Makefile.am
	* themes/Default/images/tools/stock-tool-histogram-[16|22].png:
	removed here ...

	* themes/Default/images/stock-histogram-[16|22].png: ,,, and added
	under these new names.

	* libgimpwidgets/gimpstock.[ch]: register the icons as
	GIMP_STOCK_HISTOGRAM and removed the histogram tool stock icons.

	* app/base/gimphistogram.c: don't crash when uncalculated values
	are requested from a GimpHistogram. Allow to reset the histogram
	by calling gimp_histogram_calculate() with a NULL region.

	* app/widgets/gimphistogrambox.[ch]: renamed the GimpHistogramView
	struct member to "view".

	* app/tools/gimpthresholdtool.c: changed accordingly.

	* app/widgets/gimphistogramview.[ch] (gimp_histogram_view_events):
	return TRUE when events were handled.

	* app/tools/Makefile.am
	* app/tools/gimp-tools.c
	* app/tools/gimphistogramtool.[ch]: removed the histogram tool.

	* app/widgets/Makefile.am
	* app/widgets/gimphelp-ids.h
	* app/widgets/widgets-types.h
	* app/widgets/gimphistogrameditor.[ch]: added GimpHistogramEditor.
	Has some rough edges still...

	* app/gui/dialogs-constructors.[ch]
	* app/gui/dialogs.c
	* app/gui/image-menu.c: register the new dialog instead of the
	histogram tool.
parent 5d43e5ba
2003-11-01 Sven Neumann <sven@gimp.org>
Replaced the histogram tool by a histogram dialog:
* themes/Default/images/Makefile.am
* themes/Default/images/tools/stock-tool-histogram-[16|22].png:
removed here ...
* themes/Default/images/stock-histogram-[16|22].png: ,,, and added
under these new names.
* libgimpwidgets/gimpstock.[ch]: register the icons as
GIMP_STOCK_HISTOGRAM and removed the histogram tool stock icons.
* app/base/gimphistogram.c: don't crash when uncalculated values
are requested from a GimpHistogram. Allow to reset the histogram
by calling gimp_histogram_calculate() with a NULL region.
* app/widgets/gimphistogrambox.[ch]: renamed the GimpHistogramView
struct member to "view".
* app/tools/gimpthresholdtool.c: changed accordingly.
* app/widgets/gimphistogramview.[ch] (gimp_histogram_view_events):
return TRUE when events were handled.
* app/tools/Makefile.am
* app/tools/gimp-tools.c
* app/tools/gimphistogramtool.[ch]: removed the histogram tool.
* app/widgets/Makefile.am
* app/widgets/gimphelp-ids.h
* app/widgets/widgets-types.h
* app/widgets/gimphistogrameditor.[ch]: added GimpHistogramEditor.
Has some rough edges still...
* app/gui/dialogs-constructors.[ch]
* app/gui/dialogs.c
* app/gui/image-menu.c: register the new dialog instead of the
histogram tool.
2003-10-31 Sven Neumann <sven@gimp.org>
* plug-ins/common/wmf.c: made multi-head safe.
* plug-ins/common/wmf.c: made multi-head safe. The whole tree
compiles with GDK_MULTIHEAD_SAFE now.
2003-10-31 Sven Neumann <sven@gimp.org>
......@@ -112,52 +112,58 @@ gimp_histogram_calculate (GimpHistogram *histogram,
gint i, j;
g_return_if_fail (histogram != NULL);
g_return_if_fail (region != NULL);
gimp_histogram_alloc_values (histogram, region->bytes);
if (region)
{
gimp_histogram_alloc_values (histogram, region->bytes);
#ifdef ENABLE_MP
for (i = 0; i < histogram->num_slots; i++)
{
histogram->tmp_values[i] = g_new0 (gdouble *, histogram->n_channels);
histogram->tmp_slots[i] = 0;
for (i = 0; i < histogram->num_slots; i++)
{
histogram->tmp_values[i] = g_new0 (gdouble *, histogram->n_channels);
histogram->tmp_slots[i] = 0;
for (j = 0; j < histogram->n_channels; j++)
{
gint k;
for (j = 0; j < histogram->n_channels; j++)
{
gint k;
histogram->tmp_values[i][j] = g_new0 (gdouble, 256);
histogram->tmp_values[i][j] = g_new0 (gdouble, 256);
for (k = 0; k < 256; k++)
histogram->tmp_values[i][j][k] = 0.0;
}
}
for (k = 0; k < 256; k++)
histogram->tmp_values[i][j][k] = 0.0;
}
}
#endif
for (i = 0; i < histogram->n_channels; i++)
for (j = 0; j < 256; j++)
histogram->values[i][j] = 0.0;
for (i = 0; i < histogram->n_channels; i++)
for (j = 0; j < 256; j++)
histogram->values[i][j] = 0.0;
pixel_regions_process_parallel ((p_func) gimp_histogram_calculate_sub_region,
histogram, 2, region, mask);
pixel_regions_process_parallel ((p_func) gimp_histogram_calculate_sub_region,
histogram, 2, region, mask);
#ifdef ENABLE_MP
/* add up all the tmp buffers and free their memmory */
for (i = 0; i < histogram->num_slots; i++)
{
for (j = 0; j < histogram->n_channels; j++)
{
gint k;
/* add up all the tmp buffers and free their memmory */
for (i = 0; i < histogram->num_slots; i++)
{
for (j = 0; j < histogram->n_channels; j++)
{
gint k;
for (k = 0; k < 256; k++)
histogram->values[j][k] += histogram->tmp_values[i][j][k];
for (k = 0; k < 256; k++)
histogram->values[j][k] += histogram->tmp_values[i][j][k];
g_free (histogram->tmp_values[i][j]);
}
g_free (histogram->tmp_values[i][j]);
}
g_free (histogram->tmp_values[i]);
}
g_free (histogram->tmp_values[i]);
}
#endif
}
else
{
gimp_histogram_free_values (histogram);
}
}
gdouble
......@@ -169,6 +175,9 @@ gimp_histogram_get_maximum (GimpHistogram *histogram,
g_return_val_if_fail (histogram != NULL, 0.0);
if (! histogram->values || channel >= histogram->n_channels)
return 0.0;
for (x = 0; x < 256; x++)
if (histogram->values[channel][x] > max)
max = histogram->values[channel][x];
......@@ -183,7 +192,9 @@ gimp_histogram_get_value (GimpHistogram *histogram,
{
g_return_val_if_fail (histogram != NULL, 0.0);
if (channel < histogram->n_channels && bin >= 0 && bin < 256)
if (histogram->values &&
channel < histogram->n_channels &&
bin >= 0 && bin < 256)
return histogram->values[channel][bin];
return 0.0;
......@@ -221,6 +232,9 @@ gimp_histogram_get_count (GimpHistogram *histogram,
g_return_val_if_fail (histogram != NULL, 0.0);
if (! histogram->values || channel >= histogram->n_channels)
return 0.0;
for (i = start; i <= end; i++)
count += histogram->values[channel][i];
......@@ -239,6 +253,9 @@ gimp_histogram_get_mean (GimpHistogram *histogram,
g_return_val_if_fail (histogram != NULL, 0.0);
if (! histogram->values)
return 0.0;
for (i = start; i <= end; i++)
mean += i * histogram->values[channel][i];
......@@ -262,6 +279,9 @@ gimp_histogram_get_median (GimpHistogram *histogram,
g_return_val_if_fail (histogram != NULL, -1);
if (! histogram->values || channel >= histogram->n_channels)
return 0;
count = gimp_histogram_get_count (histogram, channel, start, end);
for (i = start; i <= end; i++)
......@@ -288,6 +308,9 @@ gimp_histogram_get_std_dev (GimpHistogram *histogram,
g_return_val_if_fail (histogram != NULL, 0.0);
if (! histogram->values || channel >= histogram->n_channels)
return 0.0;
mean = gimp_histogram_get_mean (histogram, channel, start, end);
count = gimp_histogram_get_count (histogram, channel, start, end);
......@@ -333,7 +356,9 @@ gimp_histogram_free_values (GimpHistogram *histogram)
g_free (histogram->values[i]);
g_free (histogram->values);
histogram->values = NULL;
histogram->values = NULL;
histogram->n_channels = 0;
}
}
......
......@@ -44,17 +44,18 @@
#include "widgets/gimpcontainertreeview.h"
#include "widgets/gimpcontainerview-utils.h"
#include "widgets/gimpdataeditor.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimperrorconsole.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemtreeview.h"
#include "widgets/gimpdevicestatus.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpdocumentview.h"
#include "widgets/gimperrorconsole.h"
#include "widgets/gimpfontview.h"
#include "widgets/gimpgradienteditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimphistogrameditor.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemtreeview.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimpselectioneditor.h"
#include "widgets/gimptemplateview.h"
......@@ -769,6 +770,29 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
return dockable;
}
GtkWidget *
dialogs_histogram_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GimpHistogramEditor *histogram_editor;
GtkWidget *view;
GtkWidget *dockable;
view = gimp_histogram_editor_new (gimp_context_get_image (context));
histogram_editor = GIMP_HISTOGRAM_EDITOR (view);
dockable = dialogs_dockable_new (view,
_("Histogram"), NULL,
GIMP_STOCK_HISTOGRAM,
GIMP_HELP_HISTOGRAM_DIALOG);
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
return dockable;
}
GtkWidget *
dialogs_selection_editor_new (GimpDialogFactory *factory,
GimpContext *context,
......
......@@ -138,6 +138,9 @@ GtkWidget * dialogs_path_list_view_new (GimpDialogFactory *factory,
GtkWidget * dialogs_indexed_palette_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_histogram_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_selection_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......
......@@ -169,6 +169,8 @@ static const GimpDialogFactoryEntry dock_entries[] =
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-indexed-palette", dialogs_indexed_palette_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-histogram-editor", dialogs_histogram_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-selection-editor", dialogs_selection_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-undo-history", dialogs_undo_history_new,
......
......@@ -44,17 +44,18 @@
#include "widgets/gimpcontainertreeview.h"
#include "widgets/gimpcontainerview-utils.h"
#include "widgets/gimpdataeditor.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimperrorconsole.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemtreeview.h"
#include "widgets/gimpdevicestatus.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpdocumentview.h"
#include "widgets/gimperrorconsole.h"
#include "widgets/gimpfontview.h"
#include "widgets/gimpgradienteditor.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimphistogrameditor.h"
#include "widgets/gimpimagedock.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemtreeview.h"
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimpselectioneditor.h"
#include "widgets/gimptemplateview.h"
......@@ -769,6 +770,29 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
return dockable;
}
GtkWidget *
dialogs_histogram_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size)
{
GimpHistogramEditor *histogram_editor;
GtkWidget *view;
GtkWidget *dockable;
view = gimp_histogram_editor_new (gimp_context_get_image (context));
histogram_editor = GIMP_HISTOGRAM_EDITOR (view);
dockable = dialogs_dockable_new (view,
_("Histogram"), NULL,
GIMP_STOCK_HISTOGRAM,
GIMP_HELP_HISTOGRAM_DIALOG);
gimp_dockable_set_context (GIMP_DOCKABLE (dockable), context);
return dockable;
}
GtkWidget *
dialogs_selection_editor_new (GimpDialogFactory *factory,
GimpContext *context,
......
......@@ -138,6 +138,9 @@ GtkWidget * dialogs_path_list_view_new (GimpDialogFactory *factory,
GtkWidget * dialogs_indexed_palette_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_histogram_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
GtkWidget * dialogs_selection_editor_new (GimpDialogFactory *factory,
GimpContext *context,
gint preview_size);
......
......@@ -169,6 +169,8 @@ static const GimpDialogFactoryEntry dock_entries[] =
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-indexed-palette", dialogs_indexed_palette_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-histogram-editor", dialogs_histogram_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-selection-editor", dialogs_selection_editor_new,
0, FALSE, FALSE, FALSE, TRUE },
{ "gimp-undo-history", dialogs_undo_history_new,
......
......@@ -730,10 +730,10 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_SEPARATOR ("/Layer/Colors/---"),
{ { N_("/Layer/Colors/_Histogram"), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_HISTOGRAM },
"gimp-histogram-tool",
GIMP_HELP_TOOL_HISTOGRAM, NULL },
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_HISTOGRAM },
"gimp-histogram-editor",
GIMP_HELP_HISTOGRAM_DIALOG, NULL },
/* <Image>/Layer/Mask */
......
......@@ -730,10 +730,10 @@ GimpItemFactoryEntry image_menu_entries[] =
MENU_SEPARATOR ("/Layer/Colors/---"),
{ { N_("/Layer/Colors/_Histogram"), NULL,
tools_select_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_TOOL_HISTOGRAM },
"gimp-histogram-tool",
GIMP_HELP_TOOL_HISTOGRAM, NULL },
dialogs_create_dockable_cmd_callback, 0,
"<StockItem>", GIMP_STOCK_HISTOGRAM },
"gimp-histogram-editor",
GIMP_HELP_HISTOGRAM_DIALOG, NULL },
/* <Image>/Layer/Mask */
......
......@@ -64,8 +64,6 @@ libapptools_a_sources = \
gimpfreeselecttool.h \
gimpfuzzyselecttool.c \
gimpfuzzyselecttool.h \
gimphistogramtool.c \
gimphistogramtool.h \
gimphistogramoptions.c \
gimphistogramoptions.h \
gimphuesaturationtool.c \
......
......@@ -53,7 +53,6 @@
#include "gimpfliptool.h"
#include "gimpfreeselecttool.h"
#include "gimpfuzzyselecttool.h"
#include "gimphistogramtool.h"
#include "gimphuesaturationtool.h"
#include "gimpinktool.h"
#include "gimpiscissorstool.h"
......@@ -142,7 +141,6 @@ gimp_tools_init (Gimp *gimp)
gimp_measure_tool_register,
gimp_magnify_tool_register,
gimp_histogram_tool_register,
gimp_color_picker_tool_register,
/* path tool */
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "tools-types.h"
#include "base/gimphistogram.h"
#include "base/pixel-region.h"
#include "config/gimpbaseconfig.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimpenummenu.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimphistogrambox.h"
#include "widgets/gimphistogramview.h"
#include "widgets/gimppropwidgets.h"
#include "widgets/gimptooldialog.h"
#include "widgets/gimpviewabledialog.h"
#include "display/gimpdisplay.h"
#include "gimphistogramoptions.h"
#include "gimphistogramtool.h"
#include "tool_manager.h"
#include "app_procs.h"
#include "gimp-intl.h"
typedef struct _HistogramToolDialog HistogramToolDialog;
struct _HistogramToolDialog
{
GtkWidget *shell;
GtkWidget *info_labels[6];
GtkWidget *channel_menu;
GimpHistogramBox *histogram_box;
GimpHistogram *hist;
GtkWidget *gradient;
GimpDrawable *drawable;
};
/* local function prototypes */
static void gimp_histogram_tool_class_init (GimpHistogramToolClass *klass);
static void gimp_histogram_tool_init (GimpHistogramTool *hist_tool);
static void gimp_histogram_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp);
static void gimp_histogram_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp);
static HistogramToolDialog * histogram_tool_dialog_new (GimpToolInfo *tool_info);
static void histogram_tool_close_callback (GtkWidget *widget,
gpointer data);
static gboolean histogram_set_sensitive_callback
(gpointer item_data,
HistogramToolDialog *htd);
static void histogram_tool_dialog_update (HistogramToolDialog *htd,
gint start,
gint end);
static void histogram_tool_range_changed (GimpHistogramView *view,
gint start,
gint end,
gpointer data);
static void histogram_tool_channel_notify (GimpHistogramView *view,
GParamSpec *pspec,
gpointer data);
static HistogramToolDialog * histogram_dialog = NULL;
static GimpImageMapToolClass *parent_class = NULL;
/* public functions */
void
gimp_histogram_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
(* callback) (GIMP_TYPE_HISTOGRAM_TOOL,
GIMP_TYPE_HISTOGRAM_OPTIONS,
gimp_histogram_options_gui,
0,
"gimp-histogram-tool",
_("Histogram"),
_("View image histogram"),
N_("/Tools/Color Tools/_Histogram..."), NULL,
NULL, GIMP_HELP_TOOL_HISTOGRAM,
GIMP_STOCK_TOOL_HISTOGRAM,
data);
}
GType
gimp_histogram_tool_get_type (void)
{
static GType tool_type = 0;
if (! tool_type)
{
static const GTypeInfo tool_info =
{
sizeof (GimpHistogramToolClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_histogram_tool_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpHistogramTool),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_histogram_tool_init,
};
tool_type = g_type_register_static (GIMP_TYPE_IMAGE_MAP_TOOL,
"GimpHistogramTool",
&tool_info, 0);
}
return tool_type;
}
static void
gimp_histogram_tool_class_init (GimpHistogramToolClass *klass)
{
GimpToolClass *tool_class = GIMP_TOOL_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
tool_class->initialize = gimp_histogram_tool_initialize;
tool_class->control = gimp_histogram_tool_control;
}
static void
gimp_histogram_tool_init (GimpHistogramTool *hist_tool)
{
}
static void
gimp_histogram_tool_initialize (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpDrawable *drawable;
PixelRegion PR;
if (gimp_drawable_is_indexed (gimp_image_active_drawable (gdisp->gimage)))
{
g_message (_("Histogram does not operate on indexed drawables."));
return;
}
/* The histogram_tool dialog */
if (! histogram_dialog)
histogram_dialog = histogram_tool_dialog_new (tool->tool_info);
drawable = gimp_image_active_drawable (gdisp->gimage);
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (histogram_dialog->shell),
GIMP_VIEWABLE (drawable));
gtk_widget_show (histogram_dialog->shell);
histogram_dialog->drawable = drawable;
gimp_option_menu_set_sensitive (GTK_OPTION_MENU (histogram_dialog->channel_menu),
(GimpOptionMenuSensitivityCallback) histogram_set_sensitive_callback,
histogram_dialog);
/* calculate the histogram */
pixel_region_init (&PR, gimp_drawable_data (drawable),
0, 0,
gimp_item_width (GIMP_ITEM (drawable)),
gimp_item_height (GIMP_ITEM (drawable)),
FALSE);
gimp_histogram_calculate (histogram_dialog->hist, &PR, NULL);
gimp_histogram_view_set_histogram (GIMP_HISTOGRAM_VIEW (histogram_dialog->histogram_box->histogram),
histogram_dialog->hist);
gimp_histogram_view_set_range (GIMP_HISTOGRAM_VIEW (histogram_dialog->histogram_box->histogram),
0, 255);
}
static void
gimp_histogram_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *gdisp)
{
switch (action)
{
case PAUSE:
break;
case RESUME:
break;
case HALT:
if (histogram_dialog)
histogram_tool_close_callback (NULL, histogram_dialog);
break;
default:
break;
}
GIMP_TOOL_CLASS (parent_class)->control (tool, action, gdisp);
}
static void
histogram_tool_range_changed (GimpHistogramView *view,
gint start,
gint end,
gpointer data)
{
HistogramToolDialog *htd = (HistogramToolDialog *) data;
if (htd && htd->shell)
histogram_tool_dialog_update (htd, start, end);
}
static void
histogram_tool_channel_notify (GimpHistogramView *view,
GParamSpec *pspec,
gpointer data)
{
HistogramToolDialog *htd = (HistogramToolDialog *) data;
if (htd && htd->shell)
histogram_tool_dialog_update (htd, view->start, view->end);
}
static void
histogram_tool_dialog_update (HistogramToolDialog *htd,
gint start,
gint end)
{
GimpHistogramChannel channel;
gdouble pixels;
gdouble count;
gchar text[12];
if (! htd->hist || ! gimp_histogram_nchannels (htd->hist))
return;
channel = gimp_histogram_view_get_channel (htd->histogram_box->histogram);
pixels = gimp_histogram_get_count (htd->hist, channel, 0, 255);
count = gimp_histogram_get_count (htd->hist, channel, start, end);
/* mean */
g_snprintf (text, sizeof (text), "%3.1f",
gimp_histogram_get_mean (htd->hist, channel, start, end));
gtk_label_set_text (GTK_LABEL (htd->info_labels[0]), text);
/* std dev */
g_snprintf (text, sizeof (text), "%3.1f",
gimp_histogram_get_std_dev (htd->hist, channel, start, end));
gtk_label_set_text (GTK_LABEL (htd->info_labels[1]), text);
/* median */
g_snprintf (text, sizeof (text), "%3.1f",
(gdouble) gimp_histogram_get_median (htd->hist,
channel, start, end));
gtk_label_set_text (GTK_LABEL (htd->info_labels[2]), text);
/* pixels */
g_snprintf (text, sizeof (text), "%8.1f", pixels);
gtk_label_set_text (GTK_LABEL (htd->info_labels[3]), text);
/* count */
g_snprintf (text, sizeof (text), "%8.1f", count);
gtk_label_set_text (GTK_LABEL (htd->info_labels[4]), text);
/* percentile */
g_snprintf (text, sizeof (text), "%4.1f", (pixels > 0 ?
(100.0 * count / pixels) : 0.0));
gtk_label_set_text (GTK_LABEL (htd->info_labels[5]), text);
}
/***************************/
/* Histogram Tool dialog */
/***************************/
static HistogramToolDialog *