4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
28 #include "colorpicker.h"
31 #include "loadbalance.h"
32 #include "pluginvclient.h"
34 #define RESET_DEFAULT_SETTINGS 10
38 #define RESET_THRESHOLD 3
40 #define MIN_VALUE 0.00
41 #define MAX_VALUE 100.00
45 class ChromaKeyWindow;
47 class ChromaKeyFSlider;
49 class ChromaKeyDefaultSettings;
56 void reset(int clear);
57 void copy_from(ChromaKeyConfig &src);
58 int equivalent(ChromaKeyConfig &src);
59 void interpolate(ChromaKeyConfig &prev,
60 ChromaKeyConfig &next,
63 int64_t current_frame);
74 class ChromaKeyColor : public BC_GenericButton
77 ChromaKeyColor(ChromaKey *plugin,
88 class ChromaKeyThreshold : public BC_FSlider
91 ChromaKeyThreshold(ChromaKey *plugin, int x, int y);
95 class ChromaKeySlope : public BC_FSlider
98 ChromaKeySlope(ChromaKey *plugin, int x, int y);
102 class ChromaKeyUseValue : public BC_CheckBox
105 ChromaKeyUseValue(ChromaKey *plugin, int x, int y);
110 class ChromaKeyFText : public BC_TumbleTextBox
113 ChromaKeyFText(ChromaKey *plugin, ChromaKeyWindow *gui,
114 ChromaKeyFSlider *slider, float *output, int x, int y, float min, float max);
118 ChromaKeyWindow *gui;
119 ChromaKeyFSlider *slider;
124 class ChromaKeyFSlider : public BC_FSlider
127 ChromaKeyFSlider(ChromaKey *plugin,
128 ChromaKeyFText *text, float *output, int x, int y,
129 float min, float max, int w);
133 ChromaKeyFText *text;
137 class ChromaKeyClr : public BC_Button
140 ChromaKeyClr(ChromaKey *plugin, ChromaKeyWindow *gui, int x, int y, int clear);
144 ChromaKeyWindow *gui;
148 class ChromaKeyReset : public BC_GenericButton
151 ChromaKeyReset(ChromaKey *plugin, ChromaKeyWindow *gui, int x, int y);
154 ChromaKeyWindow *gui;
157 class ChromaKeyDefaultSettings : public BC_GenericButton
160 ChromaKeyDefaultSettings(ChromaKey *plugin, ChromaKeyWindow *gui, int x, int y, int w);
161 ~ChromaKeyDefaultSettings();
164 ChromaKeyWindow *gui;
167 class ChromaKeyUseColorPicker : public BC_GenericButton
170 ChromaKeyUseColorPicker(ChromaKey *plugin, ChromaKeyWindow *gui, int x, int y);
173 ChromaKeyWindow *gui;
177 class ChromaKeyColorThread : public ColorPicker
180 ChromaKeyColorThread(ChromaKey *plugin, ChromaKeyWindow *gui);
181 int handle_new_color(int output, int alpha);
183 ChromaKeyWindow *gui;
187 class ChromaKeyWindow : public PluginClientWindow
190 ChromaKeyWindow(ChromaKey *plugin);
193 void create_objects();
194 void update_gui(int clear);
195 void update_sample();
196 void done_event(int result);
198 ChromaKeyColor *color;
200 ChromaKeyFText *threshold_text;
201 ChromaKeyFSlider *threshold_slider;
202 ChromaKeyClr *threshold_Clr;
204 ChromaKeyUseValue *use_value;
205 ChromaKeyUseColorPicker *use_colorpicker;
207 ChromaKeyFText *slope_text;
208 ChromaKeyFSlider *slope_slider;
209 ChromaKeyClr *slope_Clr;
211 ChromaKeyReset *reset;
212 ChromaKeyDefaultSettings *default_settings;
213 BC_SubWindow *sample;
215 ChromaKeyColorThread *color_thread;
222 class ChromaKeyServer : public LoadServer
225 ChromaKeyServer(ChromaKey *plugin);
226 void init_packages();
227 LoadClient* new_client();
228 LoadPackage* new_package();
232 class ChromaKeyPackage : public LoadPackage
239 class ChromaKeyUnit : public LoadClient
242 ChromaKeyUnit(ChromaKey *plugin, ChromaKeyServer *server);
243 void process_package(LoadPackage *package);
250 class ChromaKey : public PluginVClient
253 ChromaKey(PluginServer *server);
256 PLUGIN_CLASS_MEMBERS(ChromaKeyConfig)
257 int process_buffer(VFrame *frame,
258 int64_t start_position,
262 void save_data(KeyFrame *keyframe);
263 void read_data(KeyFrame *keyframe);
266 VFrame *input, *output;
267 ChromaKeyServer *engine;