2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
* (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
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
*/
|
2000-12-17 05:37:03 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2012-04-17 02:51:55 +08:00
|
|
|
#include <gegl.h>
|
2000-12-29 23:22:01 +08:00
|
|
|
#include <gtk/gtk.h>
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2001-01-24 07:56:18 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
|
|
|
|
2001-05-08 11:48:54 +08:00
|
|
|
#include "widgets-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2012-03-25 05:29:53 +08:00
|
|
|
#include "core/gimphistogram.h"
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
#include "core/gimpmarshal.h"
|
|
|
|
|
2001-05-23 07:05:35 +08:00
|
|
|
#include "gimphistogramview.h"
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2000-04-28 01:27:28 +08:00
|
|
|
|
2003-12-12 01:24:18 +08:00
|
|
|
#define MIN_WIDTH 64
|
|
|
|
#define MIN_HEIGHT 64
|
2003-11-02 01:39:09 +08:00
|
|
|
|
2000-12-19 22:43:54 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
RANGE_CHANGED,
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2003-01-26 02:58:45 +08:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
|
|
|
PROP_CHANNEL,
|
2003-12-12 01:24:18 +08:00
|
|
|
PROP_SCALE,
|
|
|
|
PROP_BORDER_WIDTH,
|
|
|
|
PROP_SUBDIVISIONS
|
2003-01-26 02:58:45 +08:00
|
|
|
};
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2003-12-12 01:24:18 +08:00
|
|
|
|
2017-07-05 18:20:23 +08:00
|
|
|
static void gimp_histogram_view_dispose (GObject *object);
|
2013-06-12 04:36:33 +08:00
|
|
|
static void gimp_histogram_view_set_property (GObject *object,
|
2003-12-11 21:57:03 +08:00
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2013-06-12 04:36:33 +08:00
|
|
|
static void gimp_histogram_view_get_property (GObject *object,
|
2003-12-11 21:57:03 +08:00
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2007-11-03 00:51:18 +08:00
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
static void gimp_histogram_view_size_request (GtkWidget *widget,
|
2003-12-11 21:57:03 +08:00
|
|
|
GtkRequisition *requisition);
|
|
|
|
static gboolean gimp_histogram_view_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event);
|
|
|
|
static gboolean gimp_histogram_view_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent);
|
|
|
|
static gboolean gimp_histogram_view_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent);
|
|
|
|
static gboolean gimp_histogram_view_motion_notify (GtkWidget *widget,
|
|
|
|
GdkEventMotion *bevent);
|
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
static void gimp_histogram_view_notify (GimpHistogram *histogram,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpHistogramView *view);
|
|
|
|
static void gimp_histogram_view_update_bins (GimpHistogramView *view);
|
|
|
|
|
|
|
|
static void gimp_histogram_view_draw_spike (GimpHistogramView *view,
|
|
|
|
GimpHistogramChannel channel,
|
|
|
|
cairo_t *cr,
|
|
|
|
const GdkColor *fg_color,
|
|
|
|
cairo_operator_t fg_operator,
|
|
|
|
const GdkColor *bg_color,
|
|
|
|
gint x,
|
|
|
|
gint i,
|
|
|
|
gint j,
|
|
|
|
gdouble max,
|
|
|
|
gdouble bg_max,
|
|
|
|
gint height,
|
|
|
|
gint border);
|
2004-07-07 00:33:30 +08:00
|
|
|
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
G_DEFINE_TYPE (GimpHistogramView, gimp_histogram_view,
|
2006-05-15 17:46:31 +08:00
|
|
|
GTK_TYPE_DRAWING_AREA)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
#define parent_class gimp_histogram_view_parent_class
|
2001-10-17 19:33:43 +08:00
|
|
|
|
2005-12-20 06:37:49 +08:00
|
|
|
static guint histogram_view_signals[LAST_SIGNAL] = { 0 };
|
2001-10-17 19:33:43 +08:00
|
|
|
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
|
|
|
static void
|
2001-10-17 19:33:43 +08:00
|
|
|
gimp_histogram_view_class_init (GimpHistogramViewClass *klass)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2005-07-15 02:51:32 +08:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
2002-10-15 09:15:43 +08:00
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
histogram_view_signals[RANGE_CHANGED] =
|
2005-05-27 21:05:26 +08:00
|
|
|
g_signal_new ("range-changed",
|
2003-12-12 01:24:18 +08:00
|
|
|
G_TYPE_FROM_CLASS (klass),
|
|
|
|
G_SIGNAL_RUN_FIRST,
|
|
|
|
G_STRUCT_OFFSET (GimpHistogramViewClass, range_changed),
|
|
|
|
NULL, NULL,
|
|
|
|
gimp_marshal_VOID__INT_INT,
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
G_TYPE_INT,
|
|
|
|
G_TYPE_INT);
|
2000-12-19 22:43:54 +08:00
|
|
|
|
2017-07-05 18:20:23 +08:00
|
|
|
object_class->dispose = gimp_histogram_view_dispose;
|
2007-11-20 07:39:56 +08:00
|
|
|
object_class->get_property = gimp_histogram_view_get_property;
|
|
|
|
object_class->set_property = gimp_histogram_view_set_property;
|
2003-01-26 02:58:45 +08:00
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
widget_class->size_request = gimp_histogram_view_size_request;
|
|
|
|
widget_class->expose_event = gimp_histogram_view_expose;
|
|
|
|
widget_class->button_press_event = gimp_histogram_view_button_press;
|
|
|
|
widget_class->button_release_event = gimp_histogram_view_button_release;
|
|
|
|
widget_class->motion_notify_event = gimp_histogram_view_motion_notify;
|
2002-10-15 09:15:43 +08:00
|
|
|
|
2007-11-20 07:39:56 +08:00
|
|
|
klass->range_changed = NULL;
|
2003-01-26 02:58:45 +08:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_CHANNEL,
|
2005-07-15 02:51:32 +08:00
|
|
|
g_param_spec_enum ("histogram-channel",
|
|
|
|
NULL, NULL,
|
2003-12-12 01:24:18 +08:00
|
|
|
GIMP_TYPE_HISTOGRAM_CHANNEL,
|
|
|
|
GIMP_HISTOGRAM_VALUE,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READWRITE |
|
2003-12-12 01:24:18 +08:00
|
|
|
G_PARAM_CONSTRUCT));
|
2003-01-26 02:58:45 +08:00
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_SCALE,
|
2005-07-15 02:51:32 +08:00
|
|
|
g_param_spec_enum ("histogram-scale",
|
|
|
|
NULL, NULL,
|
2003-12-12 01:24:18 +08:00
|
|
|
GIMP_TYPE_HISTOGRAM_SCALE,
|
|
|
|
GIMP_HISTOGRAM_SCALE_LINEAR,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READWRITE |
|
2003-12-12 01:24:18 +08:00
|
|
|
G_PARAM_CONSTRUCT));
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_BORDER_WIDTH,
|
|
|
|
g_param_spec_int ("border-width", NULL, NULL,
|
|
|
|
0, 32, 1,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READWRITE |
|
2003-12-12 01:24:18 +08:00
|
|
|
G_PARAM_CONSTRUCT));
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class, PROP_SUBDIVISIONS,
|
|
|
|
g_param_spec_int ("subdivisions",
|
|
|
|
NULL, NULL,
|
|
|
|
1, 64, 5,
|
2006-01-19 04:29:40 +08:00
|
|
|
GIMP_PARAM_READWRITE |
|
2003-12-12 01:24:18 +08:00
|
|
|
G_PARAM_CONSTRUCT));
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
}
|
|
|
|
|
2003-10-24 14:22:53 +08:00
|
|
|
static void
|
2001-10-17 19:33:43 +08:00
|
|
|
gimp_histogram_view_init (GimpHistogramView *view)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2007-11-15 18:26:25 +08:00
|
|
|
view->histogram = NULL;
|
|
|
|
view->bg_histogram = NULL;
|
2013-06-12 04:36:33 +08:00
|
|
|
view->n_bins = 256;
|
2007-11-15 18:26:25 +08:00
|
|
|
view->start = 0;
|
|
|
|
view->end = 255;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
}
|
|
|
|
|
2008-02-05 05:41:57 +08:00
|
|
|
static void
|
2017-07-05 18:20:23 +08:00
|
|
|
gimp_histogram_view_dispose (GObject *object)
|
2008-02-05 05:41:57 +08:00
|
|
|
{
|
|
|
|
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (object);
|
|
|
|
|
2017-07-05 18:20:23 +08:00
|
|
|
gimp_histogram_view_set_histogram (view, NULL);
|
|
|
|
gimp_histogram_view_set_background (view, NULL);
|
2008-02-05 05:41:57 +08:00
|
|
|
|
2017-07-05 18:20:23 +08:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
2008-02-05 05:41:57 +08:00
|
|
|
}
|
|
|
|
|
2003-01-26 02:58:45 +08:00
|
|
|
static void
|
|
|
|
gimp_histogram_view_set_property (GObject *object,
|
2003-12-12 01:24:18 +08:00
|
|
|
guint property_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2003-01-26 02:58:45 +08:00
|
|
|
{
|
|
|
|
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_CHANNEL:
|
2003-10-24 18:14:05 +08:00
|
|
|
view->channel = g_value_get_enum (value);
|
2003-12-12 01:24:18 +08:00
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (view));
|
2003-01-26 02:58:45 +08:00
|
|
|
break;
|
|
|
|
case PROP_SCALE:
|
2003-10-24 18:14:05 +08:00
|
|
|
view->scale = g_value_get_enum (value);
|
2003-12-12 01:24:18 +08:00
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (view));
|
|
|
|
break;
|
|
|
|
case PROP_BORDER_WIDTH:
|
|
|
|
view->border_width = g_value_get_int (value);
|
|
|
|
gtk_widget_queue_resize (GTK_WIDGET (view));
|
|
|
|
break;
|
|
|
|
case PROP_SUBDIVISIONS:
|
|
|
|
view->subdivisions = g_value_get_int (value);
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (view));
|
2003-01-26 02:58:45 +08:00
|
|
|
break;
|
2007-11-20 07:39:56 +08:00
|
|
|
|
2003-01-26 02:58:45 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
2003-10-24 14:22:53 +08:00
|
|
|
}
|
2003-01-26 02:58:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_histogram_view_get_property (GObject *object,
|
2003-12-12 01:24:18 +08:00
|
|
|
guint property_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2003-01-26 02:58:45 +08:00
|
|
|
{
|
|
|
|
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (object);
|
|
|
|
|
|
|
|
switch (property_id)
|
|
|
|
{
|
|
|
|
case PROP_CHANNEL:
|
|
|
|
g_value_set_enum (value, view->channel);
|
|
|
|
break;
|
|
|
|
case PROP_SCALE:
|
|
|
|
g_value_set_enum (value, view->scale);
|
|
|
|
break;
|
2003-12-12 01:24:18 +08:00
|
|
|
case PROP_BORDER_WIDTH:
|
|
|
|
g_value_set_int (value, view->border_width);
|
|
|
|
break;
|
|
|
|
case PROP_SUBDIVISIONS:
|
|
|
|
g_value_set_int (value, view->subdivisions);
|
|
|
|
break;
|
2007-11-20 07:39:56 +08:00
|
|
|
|
2003-01-26 02:58:45 +08:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
break;
|
2003-10-24 14:22:53 +08:00
|
|
|
}
|
2003-01-26 02:58:45 +08:00
|
|
|
}
|
|
|
|
|
2003-11-02 01:39:09 +08:00
|
|
|
static void
|
|
|
|
gimp_histogram_view_size_request (GtkWidget *widget,
|
|
|
|
GtkRequisition *requisition)
|
|
|
|
{
|
2003-12-12 01:24:18 +08:00
|
|
|
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget);
|
|
|
|
|
|
|
|
requisition->width = MIN_WIDTH + 2 * view->border_width;
|
|
|
|
requisition->height = MIN_HEIGHT + 2 * view->border_width;
|
2003-11-02 01:39:09 +08:00
|
|
|
}
|
|
|
|
|
2004-07-07 00:33:30 +08:00
|
|
|
static gdouble
|
|
|
|
gimp_histogram_view_get_maximum (GimpHistogramView *view,
|
2007-11-15 18:26:25 +08:00
|
|
|
GimpHistogram *histogram,
|
2004-07-07 00:33:30 +08:00
|
|
|
GimpHistogramChannel channel)
|
|
|
|
{
|
2007-11-15 18:26:25 +08:00
|
|
|
gdouble max = gimp_histogram_get_maximum (histogram, channel);
|
2004-07-07 00:33:30 +08:00
|
|
|
|
|
|
|
switch (view->scale)
|
|
|
|
{
|
|
|
|
case GIMP_HISTOGRAM_SCALE_LINEAR:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_HISTOGRAM_SCALE_LOGARITHMIC:
|
|
|
|
if (max > 0.0)
|
2006-04-12 20:49:29 +08:00
|
|
|
max = log (max);
|
2004-07-07 00:33:30 +08:00
|
|
|
else
|
2006-04-12 20:49:29 +08:00
|
|
|
max = 1.0;
|
2004-07-07 00:33:30 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return max;
|
|
|
|
}
|
|
|
|
|
2002-10-15 09:15:43 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_histogram_view_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event)
|
|
|
|
{
|
2010-07-30 18:18:08 +08:00
|
|
|
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget);
|
|
|
|
GtkStyle *style = gtk_widget_get_style (widget);
|
2010-01-15 22:33:08 +08:00
|
|
|
GtkAllocation allocation;
|
2010-07-30 18:18:08 +08:00
|
|
|
cairo_t *cr;
|
2004-07-07 00:33:30 +08:00
|
|
|
gint x;
|
2004-01-13 21:35:58 +08:00
|
|
|
gint x1, x2;
|
|
|
|
gint border;
|
|
|
|
gint width, height;
|
2007-11-15 18:26:25 +08:00
|
|
|
gdouble max = 0.0;
|
|
|
|
gdouble bg_max = 0.0;
|
2004-01-13 21:35:58 +08:00
|
|
|
gint xstop;
|
2010-07-30 18:18:08 +08:00
|
|
|
GdkColor *color_in;
|
|
|
|
GdkColor *color_out;
|
|
|
|
GdkColor *bg_color_in;
|
|
|
|
GdkColor *bg_color_out;
|
|
|
|
GdkColor rgb_color[3];
|
2002-10-15 09:15:43 +08:00
|
|
|
|
2010-07-30 18:18:08 +08:00
|
|
|
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
|
|
|
|
|
|
|
gdk_cairo_region (cr, event->region);
|
|
|
|
cairo_clip (cr);
|
|
|
|
|
2010-07-30 18:51:03 +08:00
|
|
|
/* Draw the background */
|
|
|
|
gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
2010-01-15 22:33:08 +08:00
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
2003-12-12 01:24:18 +08:00
|
|
|
border = view->border_width;
|
2010-01-15 22:33:08 +08:00
|
|
|
width = allocation.width - 2 * border;
|
|
|
|
height = allocation.height - 2 * border;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2010-07-30 18:18:08 +08:00
|
|
|
cairo_set_line_width (cr, 1.0);
|
|
|
|
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
|
|
|
|
cairo_translate (cr, 0.5, 0.5);
|
2003-12-11 21:57:03 +08:00
|
|
|
|
|
|
|
/* Draw the outer border */
|
2018-04-18 02:44:03 +08:00
|
|
|
gdk_cairo_set_source_color (cr, &style->text_aa[GTK_STATE_NORMAL]);
|
2010-07-30 18:18:08 +08:00
|
|
|
cairo_rectangle (cr, border, border,
|
|
|
|
width - 1, height - 1);
|
|
|
|
cairo_stroke (cr);
|
2003-10-24 14:22:53 +08:00
|
|
|
|
2010-07-30 18:51:03 +08:00
|
|
|
if (! view->histogram && ! view->bg_histogram)
|
|
|
|
{
|
|
|
|
cairo_destroy (cr);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
x1 = CLAMP (MIN (view->start, view->end), 0, view->n_bins - 1);
|
|
|
|
x2 = CLAMP (MAX (view->start, view->end), 0, view->n_bins - 1);
|
2010-07-30 18:51:03 +08:00
|
|
|
|
2007-11-15 18:26:25 +08:00
|
|
|
if (view->histogram)
|
|
|
|
max = gimp_histogram_view_get_maximum (view, view->histogram,
|
|
|
|
view->channel);
|
2004-07-07 00:33:30 +08:00
|
|
|
|
2007-11-15 18:26:25 +08:00
|
|
|
if (view->bg_histogram)
|
|
|
|
bg_max = gimp_histogram_view_get_maximum (view, view->bg_histogram,
|
|
|
|
view->channel);
|
|
|
|
|
2010-07-30 18:18:08 +08:00
|
|
|
color_in = &style->text[GTK_STATE_SELECTED];
|
|
|
|
color_out = &style->text[GTK_STATE_NORMAL];
|
2007-11-15 18:26:25 +08:00
|
|
|
|
2010-07-30 18:18:08 +08:00
|
|
|
bg_color_in = &style->mid[GTK_STATE_SELECTED];
|
|
|
|
bg_color_out = &style->mid[GTK_STATE_NORMAL];
|
2004-07-07 00:33:30 +08:00
|
|
|
|
|
|
|
if (view->channel == GIMP_HISTOGRAM_RGB)
|
|
|
|
{
|
|
|
|
for (x = 0; x < 3; x++)
|
|
|
|
{
|
2010-07-30 18:18:08 +08:00
|
|
|
rgb_color[x].red = (x == 0 ? 0xFFFF : 0x0);
|
|
|
|
rgb_color[x].green = (x == 1 ? 0xFFFF : 0x0);
|
|
|
|
rgb_color[x].blue = (x == 2 ? 0xFFFF : 0x0);
|
2004-07-07 00:33:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
xstop = 1;
|
2002-10-15 21:36:28 +08:00
|
|
|
for (x = 0; x < width; x++)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2003-12-16 01:40:31 +08:00
|
|
|
gboolean in_selection = FALSE;
|
2000-12-19 22:43:54 +08:00
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
gint i = (x * view->n_bins) / width;
|
|
|
|
gint j = ((x + 1) * view->n_bins) / width;
|
2003-11-02 00:11:26 +08:00
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
if (! (x1 == 0 && x2 == (view->n_bins - 1)))
|
2003-11-02 00:11:26 +08:00
|
|
|
{
|
2004-07-07 09:59:33 +08:00
|
|
|
gint k = i;
|
2003-11-02 00:11:26 +08:00
|
|
|
|
2004-07-07 09:59:33 +08:00
|
|
|
do
|
|
|
|
in_selection |= (x1 <= k && k <= x2);
|
|
|
|
while (++k < j);
|
2003-11-02 00:11:26 +08:00
|
|
|
}
|
|
|
|
|
2003-12-12 01:24:18 +08:00
|
|
|
if (view->subdivisions > 1 && x >= (xstop * width / view->subdivisions))
|
2003-12-11 21:57:03 +08:00
|
|
|
{
|
2018-04-18 02:44:03 +08:00
|
|
|
gdk_cairo_set_source_color (cr, &style->text_aa[GTK_STATE_NORMAL]);
|
2010-07-30 18:18:08 +08:00
|
|
|
|
|
|
|
cairo_move_to (cr, x + border, border);
|
|
|
|
cairo_line_to (cr, x + border, border + height - 1);
|
|
|
|
cairo_stroke (cr);
|
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
xstop++;
|
|
|
|
}
|
2003-12-16 01:40:31 +08:00
|
|
|
else if (in_selection)
|
|
|
|
{
|
2010-07-30 18:18:08 +08:00
|
|
|
gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_SELECTED]);
|
|
|
|
|
|
|
|
cairo_move_to (cr, x + border, border);
|
|
|
|
cairo_line_to (cr, x + border, border + height - 1);
|
|
|
|
cairo_stroke (cr);
|
2003-12-16 01:40:31 +08:00
|
|
|
}
|
2003-12-11 21:57:03 +08:00
|
|
|
|
2004-07-07 00:33:30 +08:00
|
|
|
if (view->channel == GIMP_HISTOGRAM_RGB)
|
2003-12-12 01:24:18 +08:00
|
|
|
{
|
2004-07-07 00:33:30 +08:00
|
|
|
gint c;
|
2003-12-12 01:24:18 +08:00
|
|
|
|
2004-07-07 00:33:30 +08:00
|
|
|
for (c = 0; c < 3; c++)
|
2010-07-30 18:18:08 +08:00
|
|
|
gimp_histogram_view_draw_spike (view, GIMP_HISTOGRAM_RED + c, cr,
|
|
|
|
&style->black,
|
|
|
|
CAIRO_OPERATOR_OVER,
|
2007-11-15 18:26:25 +08:00
|
|
|
NULL,
|
|
|
|
x, i, j, max, bg_max, height, border);
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2004-07-07 00:33:30 +08:00
|
|
|
for (c = 0; c < 3; c++)
|
2010-07-30 18:18:08 +08:00
|
|
|
gimp_histogram_view_draw_spike (view, GIMP_HISTOGRAM_RED + c, cr,
|
|
|
|
&rgb_color[c],
|
|
|
|
CAIRO_OPERATOR_ADD,
|
2007-11-15 18:26:25 +08:00
|
|
|
NULL,
|
|
|
|
x, i, j, max, bg_max, height, border);
|
2003-12-16 01:40:31 +08:00
|
|
|
|
2010-07-30 18:18:08 +08:00
|
|
|
gimp_histogram_view_draw_spike (view, view->channel, cr,
|
|
|
|
in_selection ? color_in : color_out,
|
|
|
|
CAIRO_OPERATOR_OVER,
|
2007-11-15 18:26:25 +08:00
|
|
|
NULL,
|
|
|
|
x, i, j, max, bg_max, height, border);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-07-30 18:18:08 +08:00
|
|
|
gimp_histogram_view_draw_spike (view, view->channel, cr,
|
|
|
|
in_selection ? color_in : color_out,
|
|
|
|
CAIRO_OPERATOR_OVER,
|
|
|
|
in_selection ? bg_color_in : bg_color_out,
|
2007-11-15 18:26:25 +08:00
|
|
|
x, i, j, max, bg_max, height, border);
|
|
|
|
}
|
2004-07-07 00:33:30 +08:00
|
|
|
}
|
|
|
|
|
2010-07-30 18:18:08 +08:00
|
|
|
cairo_destroy (cr);
|
2000-12-19 22:43:54 +08:00
|
|
|
|
2003-12-12 01:24:18 +08:00
|
|
|
return FALSE;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
}
|
|
|
|
|
2004-07-07 00:33:30 +08:00
|
|
|
static void
|
|
|
|
gimp_histogram_view_draw_spike (GimpHistogramView *view,
|
|
|
|
GimpHistogramChannel channel,
|
2010-07-30 18:18:08 +08:00
|
|
|
cairo_t *cr,
|
|
|
|
const GdkColor *fg_color,
|
|
|
|
cairo_operator_t fg_operator,
|
|
|
|
const GdkColor *bg_color,
|
2004-07-07 00:33:30 +08:00
|
|
|
gint x,
|
|
|
|
gint i,
|
|
|
|
gint j,
|
2007-08-11 23:27:11 +08:00
|
|
|
gdouble max,
|
2007-11-15 18:26:25 +08:00
|
|
|
gdouble bg_max,
|
2004-07-07 00:33:30 +08:00
|
|
|
gint height,
|
|
|
|
gint border)
|
|
|
|
{
|
2010-07-30 18:18:08 +08:00
|
|
|
gdouble value = 0.0;
|
|
|
|
gdouble bg_value = 0.0;
|
|
|
|
gint y;
|
|
|
|
gint bg_y;
|
2004-07-07 00:33:30 +08:00
|
|
|
|
2007-11-15 18:26:25 +08:00
|
|
|
if (view->histogram)
|
2004-07-07 00:33:30 +08:00
|
|
|
{
|
2018-05-07 16:17:19 +08:00
|
|
|
gint ii = i;
|
|
|
|
|
2007-11-15 18:26:25 +08:00
|
|
|
do
|
|
|
|
{
|
2018-05-07 16:17:19 +08:00
|
|
|
gdouble v = gimp_histogram_get_value (view->histogram,
|
|
|
|
channel, ii++);
|
2007-11-15 18:26:25 +08:00
|
|
|
|
|
|
|
if (v > value)
|
|
|
|
value = v;
|
|
|
|
}
|
2018-05-07 16:17:19 +08:00
|
|
|
while (ii < j);
|
2007-11-15 18:26:25 +08:00
|
|
|
}
|
2004-07-07 00:33:30 +08:00
|
|
|
|
2010-07-30 18:18:08 +08:00
|
|
|
if (bg_color && view->bg_histogram)
|
2007-11-15 18:26:25 +08:00
|
|
|
{
|
2018-05-07 16:17:19 +08:00
|
|
|
gint ii = i;
|
|
|
|
|
2007-11-15 18:26:25 +08:00
|
|
|
do
|
|
|
|
{
|
2018-05-07 16:17:19 +08:00
|
|
|
gdouble v = gimp_histogram_get_value (view->bg_histogram,
|
|
|
|
channel, ii++);
|
2007-11-15 18:26:25 +08:00
|
|
|
|
|
|
|
if (v > bg_value)
|
|
|
|
bg_value = v;
|
|
|
|
}
|
2018-05-07 16:17:19 +08:00
|
|
|
while (ii < j);
|
2004-07-07 00:33:30 +08:00
|
|
|
}
|
|
|
|
|
2007-11-15 18:26:25 +08:00
|
|
|
if (value <= 0.0 && bg_value <= 0.0)
|
2004-07-07 00:33:30 +08:00
|
|
|
return;
|
|
|
|
|
|
|
|
switch (view->scale)
|
|
|
|
{
|
|
|
|
case GIMP_HISTOGRAM_SCALE_LINEAR:
|
2007-11-15 18:26:25 +08:00
|
|
|
y = (gint) (((height - 2) * value) / max);
|
|
|
|
bg_y = (gint) (((height - 2) * bg_value) / bg_max);
|
2004-07-07 00:33:30 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GIMP_HISTOGRAM_SCALE_LOGARITHMIC:
|
2007-11-15 18:26:25 +08:00
|
|
|
y = (gint) (((height - 2) * log (value)) / max);
|
|
|
|
bg_y = (gint) (((height - 2) * log (bg_value)) / bg_max);
|
2004-07-07 00:33:30 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2007-11-15 18:26:25 +08:00
|
|
|
y = 0;
|
|
|
|
bg_y = 0;
|
2004-07-07 00:33:30 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-07-30 18:18:08 +08:00
|
|
|
if (bg_color)
|
|
|
|
{
|
|
|
|
gdk_cairo_set_source_color (cr, bg_color);
|
|
|
|
|
|
|
|
cairo_move_to (cr, x + border, height + border - 1);
|
|
|
|
cairo_line_to (cr, x + border, height + border - bg_y - 1);
|
|
|
|
|
|
|
|
cairo_stroke (cr);
|
|
|
|
}
|
|
|
|
|
|
|
|
cairo_set_operator (cr, fg_operator);
|
|
|
|
|
|
|
|
gdk_cairo_set_source_color (cr, fg_color);
|
|
|
|
|
|
|
|
cairo_move_to (cr, x + border, height + border - 1);
|
|
|
|
cairo_line_to (cr, x + border, height + border - y - 1);
|
|
|
|
|
|
|
|
cairo_stroke (cr);
|
2007-11-15 18:26:25 +08:00
|
|
|
|
2010-07-30 18:18:08 +08:00
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
|
2004-07-07 00:33:30 +08:00
|
|
|
}
|
|
|
|
|
2003-11-01 10:39:34 +08:00
|
|
|
static gboolean
|
2003-12-11 21:57:03 +08:00
|
|
|
gimp_histogram_view_button_press (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2003-12-11 21:57:03 +08:00
|
|
|
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget);
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2004-02-12 21:12:56 +08:00
|
|
|
if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 1)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2010-01-15 22:33:08 +08:00
|
|
|
GtkAllocation allocation;
|
|
|
|
gint width;
|
2000-12-19 22:43:54 +08:00
|
|
|
|
2011-12-11 04:51:05 +08:00
|
|
|
gtk_grab_add (widget);
|
2000-01-09 20:40:10 +08:00
|
|
|
|
2010-01-15 22:33:08 +08:00
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
|
|
width = allocation.width - 2 * view->border_width;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
view->start = CLAMP (((bevent->x - view->border_width) * view->n_bins) / width,
|
|
|
|
0, view->n_bins - 1);
|
2002-09-08 01:27:32 +08:00
|
|
|
view->end = view->start;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2002-10-15 09:15:43 +08:00
|
|
|
gtk_widget_queue_draw (widget);
|
2003-12-11 21:57:03 +08:00
|
|
|
}
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gimp_histogram_view_button_release (GtkWidget *widget,
|
|
|
|
GdkEventButton *bevent)
|
|
|
|
{
|
|
|
|
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget);
|
|
|
|
|
|
|
|
if (bevent->button == 1)
|
|
|
|
{
|
|
|
|
gint start, end;
|
2000-01-09 20:40:10 +08:00
|
|
|
|
2011-12-11 04:51:05 +08:00
|
|
|
gtk_grab_remove (widget);
|
2000-01-09 20:40:10 +08:00
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
start = view->start;
|
|
|
|
end = view->end;
|
2002-09-08 01:27:32 +08:00
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
view->start = MIN (start, end);
|
|
|
|
view->end = MAX (start, end);
|
2002-09-08 01:27:32 +08:00
|
|
|
|
2003-01-06 06:07:10 +08:00
|
|
|
g_signal_emit (view, histogram_view_signals[RANGE_CHANGED], 0,
|
2002-09-08 01:27:32 +08:00
|
|
|
view->start, view->end);
|
2003-12-11 21:57:03 +08:00
|
|
|
}
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
return TRUE;
|
|
|
|
}
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
static gboolean
|
|
|
|
gimp_histogram_view_motion_notify (GtkWidget *widget,
|
|
|
|
GdkEventMotion *mevent)
|
|
|
|
{
|
|
|
|
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget);
|
2010-01-15 22:33:08 +08:00
|
|
|
GtkAllocation allocation;
|
2003-12-11 21:57:03 +08:00
|
|
|
gint width;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2010-01-15 22:33:08 +08:00
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
|
|
|
|
|
|
|
width = allocation.width - 2 * view->border_width;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
view->start = CLAMP (((mevent->x - view->border_width) * view->n_bins) / width,
|
|
|
|
0, view->n_bins - 1);
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
gtk_widget_queue_draw (widget);
|
|
|
|
|
|
|
|
return TRUE;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
}
|
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
|
2018-03-25 04:49:01 +08:00
|
|
|
/* public functions */
|
2013-06-12 04:36:33 +08:00
|
|
|
|
2002-10-15 09:15:43 +08:00
|
|
|
GtkWidget *
|
2003-11-02 01:39:09 +08:00
|
|
|
gimp_histogram_view_new (gboolean range)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2003-10-24 16:12:21 +08:00
|
|
|
GtkWidget *view = g_object_new (GIMP_TYPE_HISTOGRAM_VIEW, NULL);
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2002-10-15 09:15:43 +08:00
|
|
|
if (range)
|
2003-12-12 07:35:17 +08:00
|
|
|
gtk_widget_add_events (view,
|
|
|
|
GDK_BUTTON_PRESS_MASK |
|
|
|
|
GDK_BUTTON_RELEASE_MASK |
|
|
|
|
GDK_BUTTON1_MOTION_MASK);
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
|
2001-10-17 19:33:43 +08:00
|
|
|
return view;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2002-10-15 09:15:43 +08:00
|
|
|
gimp_histogram_view_set_histogram (GimpHistogramView *view,
|
|
|
|
GimpHistogram *histogram)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2002-09-08 01:27:32 +08:00
|
|
|
g_return_if_fail (GIMP_IS_HISTOGRAM_VIEW (view));
|
2007-11-15 18:26:25 +08:00
|
|
|
#if 0
|
|
|
|
g_return_if_fail (histogram == NULL ||
|
|
|
|
view->bg_histogram == NULL ||
|
|
|
|
gimp_histogram_n_channels (view->bg_histogram) ==
|
|
|
|
gimp_histogram_n_channels (histogram));
|
|
|
|
#endif
|
2002-09-08 01:27:32 +08:00
|
|
|
|
2002-10-15 09:15:43 +08:00
|
|
|
if (view->histogram != histogram)
|
|
|
|
{
|
2008-02-05 05:41:57 +08:00
|
|
|
if (view->histogram)
|
2013-06-12 04:36:33 +08:00
|
|
|
{
|
|
|
|
g_signal_handlers_disconnect_by_func (view->histogram,
|
|
|
|
gimp_histogram_view_notify,
|
|
|
|
view);
|
|
|
|
g_object_unref (view->histogram);
|
|
|
|
}
|
2008-02-05 05:41:57 +08:00
|
|
|
|
2002-10-15 09:15:43 +08:00
|
|
|
view->histogram = histogram;
|
2000-12-19 22:43:54 +08:00
|
|
|
|
2008-02-05 05:41:57 +08:00
|
|
|
if (histogram)
|
|
|
|
{
|
2013-06-12 03:23:32 +08:00
|
|
|
g_object_ref (histogram);
|
2008-02-05 05:41:57 +08:00
|
|
|
|
2013-06-12 04:36:33 +08:00
|
|
|
g_signal_connect (histogram, "notify",
|
|
|
|
G_CALLBACK (gimp_histogram_view_notify),
|
|
|
|
view);
|
|
|
|
|
|
|
|
if (view->n_bins != gimp_histogram_n_bins (histogram))
|
|
|
|
gimp_histogram_view_update_bins (view);
|
|
|
|
|
2008-02-05 05:41:57 +08:00
|
|
|
if (view->channel >= gimp_histogram_n_channels (histogram))
|
|
|
|
gimp_histogram_view_set_channel (view, GIMP_HISTOGRAM_VALUE);
|
|
|
|
}
|
2002-10-15 09:15:43 +08:00
|
|
|
}
|
2003-10-24 14:22:53 +08:00
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (view));
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
}
|
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
GimpHistogram *
|
|
|
|
gimp_histogram_view_get_histogram (GimpHistogramView *view)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2003-12-11 21:57:03 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_HISTOGRAM_VIEW (view), NULL);
|
2002-09-08 01:27:32 +08:00
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
return view->histogram;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
}
|
|
|
|
|
2007-11-15 18:26:25 +08:00
|
|
|
void
|
|
|
|
gimp_histogram_view_set_background (GimpHistogramView *view,
|
|
|
|
GimpHistogram *histogram)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_HISTOGRAM_VIEW (view));
|
|
|
|
#if 0
|
|
|
|
g_return_if_fail (histogram == NULL ||
|
|
|
|
view->histogram == NULL ||
|
|
|
|
gimp_histogram_n_channels (view->histogram) ==
|
|
|
|
gimp_histogram_n_channels (histogram));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (view->bg_histogram != histogram)
|
|
|
|
{
|
2008-02-05 05:41:57 +08:00
|
|
|
if (view->bg_histogram)
|
2013-06-12 03:23:32 +08:00
|
|
|
g_object_unref (view->bg_histogram);
|
2008-02-05 05:41:57 +08:00
|
|
|
|
2007-11-15 18:26:25 +08:00
|
|
|
view->bg_histogram = histogram;
|
|
|
|
|
2008-02-05 05:41:57 +08:00
|
|
|
if (histogram)
|
|
|
|
{
|
2013-06-12 03:23:32 +08:00
|
|
|
g_object_ref (histogram);
|
2008-02-05 05:41:57 +08:00
|
|
|
|
2013-06-16 02:29:42 +08:00
|
|
|
if (view->n_bins != gimp_histogram_n_bins (histogram))
|
|
|
|
gimp_histogram_view_update_bins (view);
|
|
|
|
|
2008-02-05 05:41:57 +08:00
|
|
|
if (view->channel >= gimp_histogram_n_channels (histogram))
|
|
|
|
gimp_histogram_view_set_channel (view, GIMP_HISTOGRAM_VALUE);
|
|
|
|
}
|
2007-11-15 18:26:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (view));
|
|
|
|
}
|
|
|
|
|
|
|
|
GimpHistogram *
|
|
|
|
gimp_histogram_view_get_background (GimpHistogramView *view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_HISTOGRAM_VIEW (view), NULL);
|
|
|
|
|
|
|
|
return view->bg_histogram;
|
|
|
|
}
|
|
|
|
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
void
|
2003-01-26 02:58:45 +08:00
|
|
|
gimp_histogram_view_set_channel (GimpHistogramView *view,
|
|
|
|
GimpHistogramChannel channel)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2002-09-08 01:27:32 +08:00
|
|
|
g_return_if_fail (GIMP_IS_HISTOGRAM_VIEW (view));
|
|
|
|
|
2008-01-31 02:19:12 +08:00
|
|
|
if (channel != view->channel)
|
|
|
|
g_object_set (view, "histogram-channel", channel, NULL);
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
}
|
|
|
|
|
2003-01-26 02:58:45 +08:00
|
|
|
GimpHistogramChannel
|
|
|
|
gimp_histogram_view_get_channel (GimpHistogramView *view)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GIMP_IS_HISTOGRAM_VIEW (view), 0);
|
|
|
|
|
|
|
|
return view->channel;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-10-24 14:22:53 +08:00
|
|
|
gimp_histogram_view_set_scale (GimpHistogramView *view,
|
2006-04-12 20:49:29 +08:00
|
|
|
GimpHistogramScale scale)
|
2003-01-26 02:58:45 +08:00
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_HISTOGRAM_VIEW (view));
|
|
|
|
|
2008-01-31 02:19:12 +08:00
|
|
|
if (scale != view->scale)
|
|
|
|
g_object_set (view, "histogram-scale", scale, NULL);
|
2003-01-26 02:58:45 +08:00
|
|
|
}
|
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
GimpHistogramScale
|
|
|
|
gimp_histogram_view_get_scale (GimpHistogramView *view)
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
{
|
2003-12-11 21:57:03 +08:00
|
|
|
g_return_val_if_fail (GIMP_IS_HISTOGRAM_VIEW (view), 0);
|
2001-10-17 19:33:43 +08:00
|
|
|
|
2003-12-11 21:57:03 +08:00
|
|
|
return view->scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_histogram_view_set_range (GimpHistogramView *view,
|
|
|
|
gint start,
|
|
|
|
gint end)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_HISTOGRAM_VIEW (view));
|
|
|
|
|
2008-01-31 02:19:12 +08:00
|
|
|
if (view->start != MIN (start, end) ||
|
|
|
|
view->end != MAX (start, end))
|
|
|
|
{
|
|
|
|
view->start = MIN (start, end);
|
|
|
|
view->end = MAX (start, end);
|
2003-12-11 21:57:03 +08:00
|
|
|
|
2008-01-31 02:19:12 +08:00
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (view));
|
2003-12-11 21:57:03 +08:00
|
|
|
|
2008-01-31 02:19:12 +08:00
|
|
|
g_signal_emit (view, histogram_view_signals[RANGE_CHANGED], 0,
|
|
|
|
view->start, view->end);
|
|
|
|
}
|
2003-12-11 21:57:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gimp_histogram_view_get_range (GimpHistogramView *view,
|
|
|
|
gint *start,
|
|
|
|
gint *end)
|
|
|
|
{
|
|
|
|
g_return_if_fail (GIMP_IS_HISTOGRAM_VIEW (view));
|
|
|
|
|
|
|
|
if (start) *start = view->start;
|
|
|
|
if (end) *end = view->end;
|
added gimphistogram*, histogramwidget*, removed histogram.[ch]
* app/Makefile.am: added gimphistogram*, histogramwidget*,
removed histogram.[ch]
* app/histogram.[ch]: removed. replaced with histogramwidget.[ch].
* app/{gimphistogramP.h, gimphistogram.h, gimphistogram.c}: new
functions that calculate histograms in parallel and perform
calculations on them.
* app/histogramwidget.[ch]: Same as old histogram.[ch], only it is
now a real widget, and it uses GimpHistograms instead of arrays of
values.
* app/curves.c: #include gimphistogram.h instead of histogram.h.
* app/equalize.c: use GimpHistogram and GimpLut.
* app/gimpbrush.c, app/gimpimage.c, app/gimpset.c: use
GTK_RUN_FIRST in calls to gimp_signal_new.
* app/histogram_tool.c, app/levels.c, app/threshold.c: modified to
use the new HistogramWidget.
* app/paint_funcs.c: removed some unused variables.
* app/preferences_dialog.c: only display the num-processor field
if we are configured --with-mp
* plug-ins/gee/gee.c: removed a couple of c++ style comments.
1999-03-01 13:11:19 +08:00
|
|
|
}
|
2013-06-12 04:36:33 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* private functions */
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_histogram_view_notify (GimpHistogram *histogram,
|
|
|
|
const GParamSpec *pspec,
|
|
|
|
GimpHistogramView *view)
|
|
|
|
{
|
|
|
|
if (! strcmp (pspec->name, "n-bins"))
|
|
|
|
{
|
|
|
|
gimp_histogram_view_update_bins (view);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gtk_widget_queue_draw (GTK_WIDGET (view));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gimp_histogram_view_update_bins (GimpHistogramView *view)
|
|
|
|
{
|
2013-06-18 06:10:57 +08:00
|
|
|
gint new_bins = 256;
|
2013-06-16 02:29:42 +08:00
|
|
|
|
|
|
|
if (view->histogram)
|
|
|
|
new_bins = gimp_histogram_n_bins (view->histogram);
|
|
|
|
else if (view->bg_histogram)
|
|
|
|
new_bins = gimp_histogram_n_bins (view->bg_histogram);
|
2013-06-12 04:36:33 +08:00
|
|
|
|
|
|
|
view->start = ROUND (((gdouble) view->start *
|
|
|
|
(new_bins - 1) /
|
|
|
|
(view->n_bins - 1)));
|
|
|
|
view->end = ROUND (((gdouble) view->end *
|
|
|
|
(new_bins - 1) /
|
|
|
|
(view->n_bins - 1)));
|
|
|
|
|
|
|
|
view->n_bins = new_bins;
|
|
|
|
|
|
|
|
g_signal_emit (view, histogram_view_signals[RANGE_CHANGED], 0,
|
|
|
|
view->start, view->end);
|
|
|
|
}
|