00001 #ifndef CHROMAKEY_H
00002 #define CHROMAKEY_H
00003
00004
00005
00006
00007 #include "colorpicker.h"
00008 #include "guicast.h"
00009 #include "loadbalance.h"
00010 #include "pluginvclient.h"
00011
00012
00013 class ChromaKey;
00014 class ChromaKey;
00015 class ChromaKeyWindow;
00016
00017 class ChromaKeyConfig
00018 {
00019 public:
00020 ChromaKeyConfig();
00021
00022 void copy_from(ChromaKeyConfig &src);
00023 int equivalent(ChromaKeyConfig &src);
00024 void interpolate(ChromaKeyConfig &prev,
00025 ChromaKeyConfig &next,
00026 int64_t prev_frame,
00027 int64_t next_frame,
00028 int64_t current_frame);
00029 int get_color();
00030
00031 float red;
00032 float green;
00033 float blue;
00034 float threshold;
00035 float slope;
00036 int use_value;
00037 };
00038
00039 class ChromaKeyColor : public BC_GenericButton
00040 {
00041 public:
00042 ChromaKeyColor(ChromaKey *plugin,
00043 ChromaKeyWindow *gui,
00044 int x,
00045 int y);
00046
00047 int handle_event();
00048
00049 ChromaKey *plugin;
00050 ChromaKeyWindow *gui;
00051 };
00052
00053 class ChromaKeyThreshold : public BC_FSlider
00054 {
00055 public:
00056 ChromaKeyThreshold(ChromaKey *plugin, int x, int y);
00057 int handle_event();
00058 ChromaKey *plugin;
00059 };
00060 class ChromaKeySlope : public BC_FSlider
00061 {
00062 public:
00063 ChromaKeySlope(ChromaKey *plugin, int x, int y);
00064 int handle_event();
00065 ChromaKey *plugin;
00066 };
00067 class ChromaKeyUseValue : public BC_CheckBox
00068 {
00069 public:
00070 ChromaKeyUseValue(ChromaKey *plugin, int x, int y);
00071 int handle_event();
00072 ChromaKey *plugin;
00073 };
00074
00075 class ChromaKeyUseColorPicker : public BC_GenericButton
00076 {
00077 public:
00078 ChromaKeyUseColorPicker(ChromaKey *plugin, ChromaKeyWindow *gui, int x, int y);
00079 int handle_event();
00080 ChromaKey *plugin;
00081 ChromaKeyWindow *gui;
00082 };
00083
00084
00085 class ChromaKeyColorThread : public ColorThread
00086 {
00087 public:
00088 ChromaKeyColorThread(ChromaKey *plugin, ChromaKeyWindow *gui);
00089 int handle_new_color(int output, int alpha);
00090 ChromaKey *plugin;
00091 ChromaKeyWindow *gui;
00092 };
00093
00094
00095 class ChromaKeyWindow : public BC_Window
00096 {
00097 public:
00098 ChromaKeyWindow(ChromaKey *plugin, int x, int y);
00099 ~ChromaKeyWindow();
00100
00101 void create_objects();
00102 int close_event();
00103 void update_sample();
00104
00105 ChromaKeyColor *color;
00106 ChromaKeyThreshold *threshold;
00107 ChromaKeyUseValue *use_value;
00108 ChromaKeyUseColorPicker *use_colorpicker;
00109 ChromaKeySlope *slope;
00110 BC_SubWindow *sample;
00111 ChromaKey *plugin;
00112 ChromaKeyColorThread *color_thread;
00113 };
00114
00115
00116
00117 PLUGIN_THREAD_HEADER(ChromaKey, ChromaKeyThread, ChromaKeyWindow)
00118
00119
00120 class ChromaKeyServer : public LoadServer
00121 {
00122 public:
00123 ChromaKeyServer(ChromaKey *plugin);
00124 void init_packages();
00125 LoadClient* new_client();
00126 LoadPackage* new_package();
00127 ChromaKey *plugin;
00128 };
00129
00130 class ChromaKeyPackage : public LoadPackage
00131 {
00132 public:
00133 ChromaKeyPackage();
00134 int y1, y2;
00135 };
00136
00137 class ChromaKeyUnit : public LoadClient
00138 {
00139 public:
00140 ChromaKeyUnit(ChromaKey *plugin, ChromaKeyServer *server);
00141 void process_package(LoadPackage *package);
00142 ChromaKey *plugin;
00143 };
00144
00145
00146
00147
00148 class ChromaKey : public PluginVClient
00149 {
00150 public:
00151 ChromaKey(PluginServer *server);
00152 ~ChromaKey();
00153
00154 int process_buffer(VFrame *frame,
00155 int64_t start_position,
00156 double frame_rate);
00157 int handle_opengl();
00158 int is_realtime();
00159 char* plugin_title();
00160 VFrame* new_picon();
00161 int load_configuration();
00162 int load_defaults();
00163 int save_defaults();
00164 void save_data(KeyFrame *keyframe);
00165 void read_data(KeyFrame *keyframe);
00166 int show_gui();
00167 int set_string();
00168 void raise_window();
00169 void update_gui();
00170
00171 ChromaKeyConfig config;
00172 VFrame *input, *output;
00173 ChromaKeyServer *engine;
00174 ChromaKeyThread *thread;
00175 BC_Hash *defaults;
00176 };
00177
00178
00179
00180
00181
00182
00183
00184
00185 #endif
00186
00187
00188
00189
00190
00191
00192