2 * Cinelerra :: Blue Banana - color modification plugin for Cinelerra-CV
3 * Copyright (C) 2012-2013 Monty <monty@xiph.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef BLUEBANANASLIDER_H
22 #define BLUEBANANASLIDER_H
25 #include "pluginvclient.h"
26 #include "bluebanana.h"
27 #include "bluebananawindow.h"
29 class BluebananaSlider : public BC_SubWindow {
31 BluebananaSlider(BluebananaMain *plugin,
32 BluebananaWindow *gui,
41 virtual void update();
42 virtual void render() {BluebananaSlider::update();};
43 void reposition(int,int,int,int);
44 virtual void update_histogram(float *,float *, float *, float *,int pixels);
46 int active_bordercolor;
47 int inactive_bordercolor;
57 virtual void trough_color(float hdel, float vdel, float &r, float &g, float &b, float &a) {r=g=b=a=0;}
58 virtual int handle_event(){ return 1; }
59 virtual int button_press_event() { return 1; }
60 int button_release_event();
61 virtual int cursor_motion_event() { return 1; }
63 BluebananaMain *plugin;
64 BluebananaWindow *gui;
66 friend class BluebannanaSliderSingle;
67 friend class BluebannanaSliderBracket;
68 friend class BluebannanaSliderCircular;
69 friend class BluebannanaSliderGamma;
70 friend class BluebannanaSliderFill;
72 int fraction_to_pixel(float input);
73 float pixel_to_fraction(int pixel);
74 float pixel_to_value(int pixel);
75 int value_to_pixel(float gamma);
79 void draw_midslider(int x, int lit);
80 void draw_leftslider(int x, int lit);
81 void draw_rightslider(int x, int lit);
82 void draw_overslider(int x, int lit);
83 void draw_topslider(int x, int lit);
84 void draw_bottomslider(int x, int lit);
86 int in_leftslider2(int px, int x);
87 int in_midslider2(int px, int x);
88 int in_rightslider2(int px, int x);
89 int in_overslider2(int px, int x, int y);
90 int in_topslider2(int px, int x, int y);
91 int in_bottomslider2(int px, int x, int y);
93 int in_leftslider(int px, int x, int y);
94 int in_rightslider(int px, int x, int y);
95 int in_midslider(int px, int x, int y);
96 int in_overslider(int px, int x, int y);
97 int in_topslider(int px, int x, int y);
98 int in_bottomslider(int px, int x, int y);
116 class BluebananaSliderSingle : public BluebananaSlider {
118 BluebananaSliderSingle(BluebananaMain *plugin,
119 BluebananaWindow *gui,
126 ~BluebananaSliderSingle() {}
128 virtual void update();
129 virtual void render() {BluebananaSliderSingle::update();};
131 friend class BluebananaHASlider;
132 friend class BluebananaOASlider;
139 virtual void trough_color(float hdel, float vdel, float &r, float &g, float &b, float &a) {}
140 virtual int handle_event(){ return 1; }
142 virtual int button_press_event();
143 virtual int cursor_motion_event();
145 void set_val(float val);
148 class BluebananaSliderBracket : public BluebananaSlider {
150 BluebananaSliderBracket(BluebananaMain *plugin,
151 BluebananaWindow *gui,
158 ~BluebananaSliderBracket() {}
160 virtual void update();
161 virtual void render() {BluebananaSliderBracket::update();};
163 friend class BluebananaSSSlider;
164 friend class BluebananaVSSlider;
173 virtual void trough_color(float hdel, float vdel, float &r, float &g, float &b, float &a) {}
174 virtual int handle_event(){ return 1; }
176 int button_press_event();
177 int cursor_motion_event();
179 virtual void set_lo(float val);
180 virtual void set_mid(float val);
181 virtual void set_hi(float val);
182 virtual void set_delta(float val);
183 void set_over(float val);
187 class BluebananaSliderCircular : public BluebananaSliderBracket {
189 BluebananaSliderCircular(BluebananaMain *plugin,
190 BluebananaWindow *gui,
197 ~BluebananaSliderCircular() {}
199 virtual void update();
201 friend class BluebananaHSSlider;
203 virtual void trough_color(float hdel, float vdel, float &r, float &g, float &b, float &a) {}
204 virtual int handle_event(){ return 1; }
206 void set_lo(float val);
207 void set_mid(float val);
208 void set_hi(float val);
209 void set_delta(float val);
213 class BluebananaSliderChannel : public BluebananaSlider {
215 BluebananaSliderChannel(BluebananaMain *plugin,
216 BluebananaWindow *gui,
221 ~BluebananaSliderChannel();
223 virtual void update();
224 virtual void render() {BluebananaSliderChannel::update();};
225 virtual void update_histogram(float *,float *, float *, float *,int pixels);
227 friend class BluebananaSASlider;
228 friend class BluebananaVASlider;
229 friend class BluebananaRASlider;
230 friend class BluebananaGASlider;
231 friend class BluebananaBASlider;
232 friend class BluebananaYASlider;
243 virtual void trough_color(float hval, float &r, float &g, float &b) {};
244 virtual int handle_event(){ return 1; }
246 int button_press_event();
247 int cursor_motion_event();
249 void set_lo(float lo);
250 void set_hi(float hi);
251 void set_mid(float mid);
252 void set_range(float range);
253 void set_gamma(float val);
255 float pixel_to_gamma(float pixel);
256 float gamma_to_pixel(float gamma);
257 float pixel_to_value(float pixel);
258 float value_to_pixel(float gamma);
271 class BluebananaSliderFill : public BluebananaSlider {
273 BluebananaSliderFill(BluebananaMain *plugin,
274 BluebananaWindow *gui,
282 ~BluebananaSliderFill() {}
284 virtual void update();
285 virtual void render() {BluebananaSliderFill::update();};
287 friend class BluebananaFSSlider;
296 virtual void trough_color(float hdel, float vdel, float &r, float &g, float &b, float &a) {};
297 virtual int handle_event(){ return 1; }
299 int button_press_event();
300 int cursor_motion_event();
302 void set_fill(float lo, float mid, float hi);
303 void set_over(float val);
304 void set_delta(float val);
306 float pixel_to_over(int pixel);
307 int over_to_pixel(float over);