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
32 #define MAXRADIUS 10000
34 #include "colorpicker.h"
36 #include "filexml.inc"
38 #include "loadbalance.h"
39 #include "overlayframe.inc"
41 #include "pluginvclient.h"
50 int equivalent(GradientConfig &that);
52 void copy_from(GradientConfig &that);
53 void interpolate(GradientConfig &prev,
58 // Int to hex triplet conversion
64 // LINEAR or LOG or SQUARE
80 int in_r, in_g, in_b, in_a;
81 int out_r, out_g, out_b, out_a;
85 class GradientShape : public BC_PopupMenu
88 GradientShape(GradientMain *plugin,
92 void create_objects();
93 static char* to_text(int shape);
94 static int from_text(char *text);
101 class GradientRate : public BC_PopupMenu
104 GradientRate(GradientMain *plugin,
107 void create_objects();
108 static char* to_text(int shape);
109 static int from_text(char *text);
111 GradientMain *plugin;
115 class GradientCenterX : public BC_FPot
118 GradientCenterX(GradientMain *plugin, int x, int y);
120 GradientMain *plugin;
123 class GradientCenterY : public BC_FPot
126 GradientCenterY(GradientMain *plugin, int x, int y);
128 GradientMain *plugin;
131 class GradientAngle : public BC_FPot
134 GradientAngle(GradientMain *plugin, int x, int y);
136 GradientMain *plugin;
139 class GradientInRadius : public BC_FSlider
142 GradientInRadius(GradientMain *plugin, int x, int y);
144 GradientMain *plugin;
147 class GradientOutRadius : public BC_FSlider
150 GradientOutRadius(GradientMain *plugin, int x, int y);
152 GradientMain *plugin;
155 class GradientInColorButton : public BC_GenericButton
158 GradientInColorButton(GradientMain *plugin, GradientWindow *window, int x, int y);
160 GradientMain *plugin;
161 GradientWindow *window;
165 class GradientOutColorButton : public BC_GenericButton
168 GradientOutColorButton(GradientMain *plugin, GradientWindow *window, int x, int y);
170 GradientMain *plugin;
171 GradientWindow *window;
174 class GradientReset : public BC_GenericButton
177 GradientReset(GradientMain *plugin, GradientWindow *window, int x, int y);
179 GradientMain *plugin;
180 GradientWindow *window;
184 class GradientInColorThread : public ColorPicker
187 GradientInColorThread(GradientMain *plugin, GradientWindow *window);
188 virtual int handle_new_color(int output, int alpha);
189 GradientMain *plugin;
190 GradientWindow *window;
194 class GradientOutColorThread : public ColorPicker
197 GradientOutColorThread(GradientMain *plugin, GradientWindow *window);
198 virtual int handle_new_color(int output, int alpha);
199 GradientMain *plugin;
200 GradientWindow *window;
205 class GradientWindow : public PluginClientWindow
208 GradientWindow(GradientMain *plugin);
211 void create_objects();
212 void update_in_color();
213 void update_out_color();
216 void done_event(int result);
218 GradientMain *plugin;
219 BC_Title *angle_title;
220 GradientAngle *angle;
221 GradientInRadius *in_radius;
222 GradientOutRadius *out_radius;
223 GradientInColorButton *in_color;
224 GradientOutColorButton *out_color;
225 GradientReset *reset;
226 GradientInColorThread *in_color_thread;
227 GradientOutColorThread *out_color_thread;
228 GradientShape *shape;
229 BC_Title *shape_title;
230 GradientCenterX *center_x;
231 BC_Title *center_x_title;
232 BC_Title *center_y_title;
233 GradientCenterY *center_y;
235 int in_color_x, in_color_y;
236 int out_color_x, out_color_y;
237 int shape_x, shape_y;
246 class GradientMain : public PluginVClient
249 GradientMain(PluginServer *server);
252 int process_buffer(VFrame *frame,
253 int64_t start_position,
256 void save_data(KeyFrame *keyframe);
257 void read_data(KeyFrame *keyframe);
262 PLUGIN_CLASS_MEMBERS(GradientConfig)
264 int need_reconfigure;
266 OverlayFrame *overlayer;
268 VFrame *input, *output;
269 GradientServer *engine;
272 class GradientPackage : public LoadPackage
280 class GradientUnit : public LoadClient
283 GradientUnit(GradientServer *server, GradientMain *plugin);
284 void process_package(LoadPackage *package);
285 GradientServer *server;
286 GradientMain *plugin;
289 class GradientServer : public LoadServer
292 GradientServer(GradientMain *plugin, int total_clients, int total_packages);
293 void init_packages();
294 LoadClient* new_client();
295 LoadPackage* new_package();
296 GradientMain *plugin;