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 ColorBoxButton
158 GradientInColorButton(GradientMain *plugin, GradientWindow *gui,
159 int x, int y, int color, int alpha);
160 ~GradientInColorButton();
162 int handle_new_color(int color, int alpha);
163 void handle_done_event(int result);
165 GradientMain *plugin;
170 class GradientOutColorButton : public ColorBoxButton
173 GradientOutColorButton(GradientMain *plugin, GradientWindow *gui,
174 int x, int y, int color, int alpha);
175 ~GradientOutColorButton();
177 int handle_new_color(int color, int alpha);
178 void handle_done_event(int result);
180 GradientMain *plugin;
185 class GradientReset : public BC_GenericButton
188 GradientReset(GradientMain *plugin, GradientWindow *window, int x, int y);
190 GradientMain *plugin;
191 GradientWindow *window;
195 class GradientWindow : public PluginClientWindow
198 GradientWindow(GradientMain *plugin);
201 void create_objects();
204 void done_event(int result);
206 GradientMain *plugin;
207 BC_Title *angle_title;
208 GradientAngle *angle;
209 GradientInRadius *in_radius;
210 GradientOutRadius *out_radius;
211 GradientInColorButton *in_color;
212 GradientOutColorButton *out_color;
213 GradientReset *reset;
214 GradientShape *shape;
215 BC_Title *shape_title;
216 GradientCenterX *center_x;
217 BC_Title *center_x_title;
218 BC_Title *center_y_title;
219 GradientCenterY *center_y;
221 int shape_x, shape_y;
225 class GradientMain : public PluginVClient
228 GradientMain(PluginServer *server);
231 int process_buffer(VFrame *frame,
232 int64_t start_position,
235 void save_data(KeyFrame *keyframe);
236 void read_data(KeyFrame *keyframe);
241 PLUGIN_CLASS_MEMBERS(GradientConfig)
243 int need_reconfigure;
245 OverlayFrame *overlayer;
247 VFrame *input, *output;
248 GradientServer *engine;
254 class GradientPackage : public LoadPackage
262 class GradientUnit : public LoadClient
265 GradientUnit(GradientServer *server, GradientMain *plugin);
266 void process_package(LoadPackage *package);
267 GradientServer *server;
268 GradientMain *plugin;
271 class GradientServer : public LoadServer
274 GradientServer(GradientMain *plugin, int total_clients, int total_packages);
275 void init_packages();
276 LoadClient* new_client();
277 LoadPackage* new_package();
278 GradientMain *plugin;