remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / plugins / chromakey / chromakey.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 CHROMAKEY_H
23 #define CHROMAKEY_H
24
25
26
27
28 #include "colorpicker.h"
29 #include "guicast.h"
30 #include "loadbalance.h"
31 #include "pluginvclient.h"
32
33
34 class ChromaKey;
35 class ChromaKey;
36 class ChromaKeyWindow;
37
38 class ChromaKeyConfig
39 {
40 public:
41         ChromaKeyConfig();
42
43         void copy_from(ChromaKeyConfig &src);
44         int equivalent(ChromaKeyConfig &src);
45         void interpolate(ChromaKeyConfig &prev,
46                 ChromaKeyConfig &next,
47                 int64_t prev_frame,
48                 int64_t next_frame,
49                 int64_t current_frame);
50         int get_color();
51
52         float red;
53         float green;
54         float blue;
55         float threshold;
56         float slope;
57         int use_value;
58 };
59
60 class ChromaKeyColor : public BC_GenericButton
61 {
62 public:
63         ChromaKeyColor(ChromaKey *plugin,
64                 ChromaKeyWindow *gui,
65                 int x,
66                 int y);
67
68         int handle_event();
69
70         ChromaKey *plugin;
71         ChromaKeyWindow *gui;
72 };
73
74 class ChromaKeyThreshold : public BC_FSlider
75 {
76 public:
77         ChromaKeyThreshold(ChromaKey *plugin, int x, int y);
78         int handle_event();
79         ChromaKey *plugin;
80 };
81 class ChromaKeySlope : public BC_FSlider
82 {
83 public:
84         ChromaKeySlope(ChromaKey *plugin, int x, int y);
85         int handle_event();
86         ChromaKey *plugin;
87 };
88 class ChromaKeyUseValue : public BC_CheckBox
89 {
90 public:
91         ChromaKeyUseValue(ChromaKey *plugin, int x, int y);
92         int handle_event();
93         ChromaKey *plugin;
94 };
95
96 class ChromaKeyUseColorPicker : public BC_GenericButton
97 {
98 public:
99         ChromaKeyUseColorPicker(ChromaKey *plugin, ChromaKeyWindow *gui, int x, int y);
100         int handle_event();
101         ChromaKey *plugin;
102         ChromaKeyWindow *gui;
103 };
104
105
106 class ChromaKeyColorThread : public ColorThread
107 {
108 public:
109         ChromaKeyColorThread(ChromaKey *plugin, ChromaKeyWindow *gui);
110         int handle_new_color(int output, int alpha);
111         ChromaKey *plugin;
112         ChromaKeyWindow *gui;
113 };
114
115
116 class ChromaKeyWindow : public PluginClientWindow
117 {
118 public:
119         ChromaKeyWindow(ChromaKey *plugin);
120         ~ChromaKeyWindow();
121
122         void create_objects();
123         void update_sample();
124
125         ChromaKeyColor *color;
126         ChromaKeyThreshold *threshold;
127         ChromaKeyUseValue *use_value;
128         ChromaKeyUseColorPicker *use_colorpicker;
129         ChromaKeySlope *slope;
130         BC_SubWindow *sample;
131         ChromaKey *plugin;
132         ChromaKeyColorThread *color_thread;
133 };
134
135
136
137
138
139 class ChromaKeyServer : public LoadServer
140 {
141 public:
142         ChromaKeyServer(ChromaKey *plugin);
143         void init_packages();
144         LoadClient* new_client();
145         LoadPackage* new_package();
146         ChromaKey *plugin;
147 };
148
149 class ChromaKeyPackage : public LoadPackage
150 {
151 public:
152         ChromaKeyPackage();
153         int y1, y2;
154 };
155
156 class ChromaKeyUnit : public LoadClient
157 {
158 public:
159         ChromaKeyUnit(ChromaKey *plugin, ChromaKeyServer *server);
160         void process_package(LoadPackage *package);
161         ChromaKey *plugin;
162 };
163
164
165
166
167 class ChromaKey : public PluginVClient
168 {
169 public:
170         ChromaKey(PluginServer *server);
171         ~ChromaKey();
172
173         PLUGIN_CLASS_MEMBERS(ChromaKeyConfig)
174         int process_buffer(VFrame *frame,
175                 int64_t start_position,
176                 double frame_rate);
177         int handle_opengl();
178         int is_realtime();
179         void save_data(KeyFrame *keyframe);
180         void read_data(KeyFrame *keyframe);
181         void update_gui();
182
183         VFrame *input, *output;
184         ChromaKeyServer *engine;
185 };
186
187
188
189
190
191
192
193
194 #endif
195
196
197
198
199
200
201