Proper check for rawzor libraries.
[rawtherapee-fixes.git] / rtgui / mycurve.h
blob13f0d85a07e3bc60eb6a94ff1692d38763b27d47
1 /*
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 _MYCURVE_
20 #define _MYCURVE_
22 #include <gtkmm.h>
23 #include <vector>
25 class CurveListener {
27 public:
28 virtual void curveChanged () {}
31 enum CurveType {Linear, Spline};
33 class CurveDescr {
35 public:
36 CurveType type;
37 std::vector<double> x, y;
40 class MyCurve : public Gtk::DrawingArea {
42 CurveListener* listener;
43 CurveDescr curve;
44 Gdk::CursorType cursor_type;
45 Glib::RefPtr<Gdk::Pixmap> pixmap;
46 int height;
47 int grab_point;
48 int last;
49 std::vector<Gdk::Point> point;
51 protected:
52 void draw (int width, int height);
53 void interpolate (int width, int height);
54 std::vector<double> get_vector (int veclen);
55 double spline_eval (int n, double x[], double y[], double y2[], double val);
56 void spline_solve (int n, double x[], double y[], double y2[]);
58 public:
59 MyCurve ();
61 void setCurveListener (CurveListener* cl) { listener = cl; }
62 std::vector<double> getPoints ();
63 void setPoints (const std::vector<double>& p);
64 void setType (CurveType t);
65 bool handleEvents (GdkEvent* event);
66 void notifyListener ();
69 #endif