2 * This file is part of RawTherapee.
4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
6 * RawTherapee is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * RawTherapee is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _HISTOGRAMPANEL_
20 #define _HISTOGRAMPANEL_
27 struct HistogramAreaIdleHelper
{
33 class HistogramArea
: public Gtk::DrawingArea
{
37 Glib::RefPtr
<Gdk::GC
> gc_
;
38 Glib::RefPtr
<Gdk::Pixmap
> backBuffer
;
48 unsigned int lhist
[256];
49 unsigned int rhist
[256];
50 unsigned int ghist
[256];
51 unsigned int bhist
[256];
54 int oldwidth
, oldheight
;
61 HistogramAreaIdleHelper
* haih
;
68 void renderHistogram ();
69 void update (unsigned int* rh
, unsigned int* gh
, unsigned int* bh
, unsigned int* lh
);
70 void updateOptions (bool r
, bool g
, bool b
, bool v
);
72 bool on_expose_event(GdkEventExpose
* event
);
73 bool on_button_press_event (GdkEventButton
* event
);
74 void styleChanged (const Glib::RefPtr
<Gtk::Style
>& style
);
77 class HistogramPanel
: public Gtk::HBox
, public rtengine::HistogramListener
{
81 HistogramArea
* histogramArea
;
82 Gtk::ToggleButton
* showRed
;
83 Gtk::ToggleButton
* showGreen
;
84 Gtk::ToggleButton
* showBlue
;
85 Gtk::ToggleButton
* showValue
;
87 sigc::connection rconn
;
93 void histogramChanged (unsigned int* rh
, unsigned int* gh
, unsigned int* bh
, unsigned int* lh
) { histogramArea
->update (rh
, gh
, bh
, lh
); }
95 void resized (Gtk::Allocation
& req
);