add auto zoombar/status color, fix 3 batchrender boobies, rotate plugin tweaks, add...
[goodguy/cinelerra.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         void reset();
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 ChromaKeyReset : public BC_GenericButton
97 {
98 public:
99         ChromaKeyReset(ChromaKey *plugin, ChromaKeyWindow *gui, int x, int y);
100         int handle_event();
101         ChromaKey *plugin;
102         ChromaKeyWindow *gui;
103 };
104
105 class ChromaKeyUseColorPicker : public BC_GenericButton
106 {
107 public:
108         ChromaKeyUseColorPicker(ChromaKey *plugin, ChromaKeyWindow *gui, int x, int y);
109         int handle_event();
110         ChromaKey *plugin;
111         ChromaKeyWindow *gui;
112 };
113
114
115 class ChromaKeyColorThread : public ColorPicker
116 {
117 public:
118         ChromaKeyColorThread(ChromaKey *plugin, ChromaKeyWindow *gui);
119         int handle_new_color(int output, int alpha);
120         ChromaKey *plugin;
121         ChromaKeyWindow *gui;
122 };
123
124
125 class ChromaKeyWindow : public PluginClientWindow
126 {
127 public:
128         ChromaKeyWindow(ChromaKey *plugin);
129         ~ChromaKeyWindow();
130
131         void create_objects();
132         void update_gui();
133         void update_sample();
134         void done_event(int result);
135
136         ChromaKeyColor *color;
137         ChromaKeyThreshold *threshold;
138         ChromaKeyUseValue *use_value;
139         ChromaKeyUseColorPicker *use_colorpicker;
140         ChromaKeySlope *slope;
141         ChromaKeyReset *reset;
142         BC_SubWindow *sample;
143         ChromaKey *plugin;
144         ChromaKeyColorThread *color_thread;
145 };
146
147
148
149
150
151 class ChromaKeyServer : public LoadServer
152 {
153 public:
154         ChromaKeyServer(ChromaKey *plugin);
155         void init_packages();
156         LoadClient* new_client();
157         LoadPackage* new_package();
158         ChromaKey *plugin;
159 };
160
161 class ChromaKeyPackage : public LoadPackage
162 {
163 public:
164         ChromaKeyPackage();
165         int y1, y2;
166 };
167
168 class ChromaKeyUnit : public LoadClient
169 {
170 public:
171         ChromaKeyUnit(ChromaKey *plugin, ChromaKeyServer *server);
172         void process_package(LoadPackage *package);
173         ChromaKey *plugin;
174 };
175
176
177
178
179 class ChromaKey : public PluginVClient
180 {
181 public:
182         ChromaKey(PluginServer *server);
183         ~ChromaKey();
184
185         PLUGIN_CLASS_MEMBERS(ChromaKeyConfig)
186         int process_buffer(VFrame *frame,
187                 int64_t start_position,
188                 double frame_rate);
189         int handle_opengl();
190         int is_realtime();
191         void save_data(KeyFrame *keyframe);
192         void read_data(KeyFrame *keyframe);
193         void update_gui();
194
195         VFrame *input, *output;
196         ChromaKeyServer *engine;
197 };
198
199
200
201
202
203
204
205
206 #endif
207
208
209
210
211
212
213