improved plugins with added Tumbler box and visible values
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / huesaturation / huesaturation.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
6  * This program 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 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program 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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  *
20  */
21
22 #ifndef HUESATURATION_H
23 #define HUESATURATION_H
24
25 #include "bccolors.h"
26 #include "bcdisplayinfo.h"
27 #include "clip.h"
28 #include "bchash.h"
29 #include "filexml.h"
30 #include "guicast.h"
31 #include "language.h"
32 #include "loadbalance.h"
33 #include "bccolors.h"
34 #include "playback3d.h"
35 #include "pluginvclient.h"
36 #include "vframe.h"
37
38 #include <stdint.h>
39 #include <string.h>
40
41
42 class HueEffect;
43 class HueWindow;
44 class HueText;
45 class HueSlider;
46 class SaturationText;
47 class SaturationSlider;
48 class ValueText;
49 class ValueSlider;
50 class HueReset;
51 class HueClr;
52
53 #define MINHUE -180
54 #define MAXHUE 180
55 #define MINSATURATION -100
56 #define MAXSATURATION 100
57 #define MINVALUE -100
58 #define MAXVALUE 100
59
60 #define RESET_ALL 0
61 #define RESET_HUV 1
62 #define RESET_SAT 2
63 #define RESET_VAL 3
64
65
66 class HueConfig
67 {
68 public:
69         HueConfig();
70
71         void copy_from(HueConfig &src);
72         int equivalent(HueConfig &src);
73         void reset(int clear);
74         void interpolate(HueConfig &prev,
75                 HueConfig &next,
76                 long prev_frame,
77                 long next_frame,
78                 long current_frame);
79         float hue, saturation, value;
80 };
81
82 class HueText : public BC_TumbleTextBox
83 {
84 public:
85         HueText(HueEffect *plugin, HueWindow *gui, int x, int y);
86         ~HueText();
87         int handle_event();
88         HueEffect *plugin;
89         HueWindow *gui;
90 };
91
92 class HueSlider : public BC_FSlider
93 {
94 public:
95         HueSlider(HueEffect *plugin, HueWindow *gui, int x, int y, int w);
96         int handle_event();
97         HueEffect *plugin;
98         HueWindow *gui;
99 };
100
101 class SaturationText : public BC_TumbleTextBox
102 {
103 public:
104         SaturationText(HueEffect *plugin, HueWindow *gui, int x, int y);
105         ~SaturationText();
106         int handle_event();
107         HueEffect *plugin;
108         HueWindow *gui;
109 };
110
111 class SaturationSlider : public BC_FSlider
112 {
113 public:
114         SaturationSlider(HueEffect *plugin, HueWindow *gui, int x, int y, int w);
115         int handle_event();
116         char* get_caption();
117         HueEffect *plugin;
118         HueWindow *gui;
119         char string[BCTEXTLEN];
120 };
121
122 class ValueText : public BC_TumbleTextBox
123 {
124 public:
125         ValueText(HueEffect *plugin, HueWindow *gui, int x, int y);
126         ~ValueText();
127         int handle_event();
128         HueEffect *plugin;
129         HueWindow *gui;
130 };
131
132
133 class ValueSlider : public BC_FSlider
134 {
135 public:
136         ValueSlider(HueEffect *plugin, HueWindow *gui, int x, int y, int w);
137         int handle_event();
138         char* get_caption();
139         HueEffect *plugin;
140         HueWindow *gui;
141         char string[BCTEXTLEN];
142 };
143
144 class HueReset : public BC_GenericButton
145 {
146 public:
147         HueReset(HueEffect *plugin, HueWindow *gui, int x, int y);
148         ~HueReset();
149         int handle_event();
150         HueEffect *plugin;
151         HueWindow *gui;
152 };
153
154 class HueClr : public BC_Button
155 {
156 public:
157         HueClr(HueEffect *plugin, HueWindow *gui, int x, int y, int clear);
158         ~HueClr();
159         int handle_event();
160         HueEffect *plugin;
161         HueWindow *gui;
162         int clear;
163 };
164
165 class HueWindow : public PluginClientWindow
166 {
167 public:
168         HueWindow(HueEffect *plugin);
169         void create_objects();
170         void update_gui(int clear);
171         HueEffect *plugin;
172
173         HueText *hue_text;
174         HueSlider *hue_slider;
175         HueClr *hue_clr;
176
177         SaturationText *sat_text;
178         SaturationSlider *sat_slider;
179         HueClr *sat_clr;
180
181         ValueText *value_text;
182         ValueSlider *value_slider;
183         HueClr *value_clr;
184
185         HueReset *reset;
186 };
187
188
189 class HueEngine : public LoadServer
190 {
191 public:
192         HueEngine(HueEffect *plugin, int cpus);
193         void init_packages();
194         LoadClient* new_client();
195         LoadPackage* new_package();
196         HueEffect *plugin;
197 };
198
199 class HuePackage : public LoadPackage
200 {
201 public:
202         HuePackage();
203         int row1, row2;
204 };
205
206 class HueUnit : public LoadClient
207 {
208 public:
209         HueUnit(HueEffect *plugin, HueEngine *server);
210         void process_package(LoadPackage *package);
211         HueEffect *plugin;
212 };
213
214 class HueEffect : public PluginVClient
215 {
216 public:
217         HueEffect(PluginServer *server);
218         ~HueEffect();
219
220
221         PLUGIN_CLASS_MEMBERS(HueConfig);
222         int process_buffer(VFrame *frame,
223                 int64_t start_position,
224                 double frame_rate);
225         int is_realtime();
226         void save_data(KeyFrame *keyframe);
227         void read_data(KeyFrame *keyframe);
228         void update_gui();
229         int handle_opengl();
230
231         VFrame *input, *output;
232         HueEngine *engine;
233 };
234
235 #endif
236