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);
51 void copy_from(GradientConfig &that);
52 void interpolate(GradientConfig &prev,
57 // Int to hex triplet conversion
63 // LINEAR or LOG or SQUARE
79 int in_r, in_g, in_b, in_a;
80 int out_r, out_g, out_b, out_a;
84 class GradientShape : public BC_PopupMenu
87 GradientShape(GradientMain *plugin,
91 void create_objects();
92 static char* to_text(int shape);
93 static int from_text(char *text);
100 class GradientRate : public BC_PopupMenu
103 GradientRate(GradientMain *plugin,
106 void create_objects();
107 static char* to_text(int shape);
108 static int from_text(char *text);
110 GradientMain *plugin;
114 class GradientCenterX : public BC_FPot
117 GradientCenterX(GradientMain *plugin, int x, int y);
119 GradientMain *plugin;
122 class GradientCenterY : public BC_FPot
125 GradientCenterY(GradientMain *plugin, int x, int y);
127 GradientMain *plugin;
130 class GradientAngle : public BC_FPot
133 GradientAngle(GradientMain *plugin, int x, int y);
135 GradientMain *plugin;
138 class GradientInRadius : public BC_FSlider
141 GradientInRadius(GradientMain *plugin, int x, int y);
143 GradientMain *plugin;
146 class GradientOutRadius : public BC_FSlider
149 GradientOutRadius(GradientMain *plugin, int x, int y);
151 GradientMain *plugin;
154 class GradientInColorButton : public BC_GenericButton
157 GradientInColorButton(GradientMain *plugin, GradientWindow *window, int x, int y);
159 GradientMain *plugin;
160 GradientWindow *window;
164 class GradientOutColorButton : public BC_GenericButton
167 GradientOutColorButton(GradientMain *plugin, GradientWindow *window, int x, int y);
169 GradientMain *plugin;
170 GradientWindow *window;
174 class GradientInColorThread : public ColorThread
177 GradientInColorThread(GradientMain *plugin, GradientWindow *window);
178 virtual int handle_new_color(int output, int alpha);
179 GradientMain *plugin;
180 GradientWindow *window;
184 class GradientOutColorThread : public ColorThread
187 GradientOutColorThread(GradientMain *plugin, GradientWindow *window);
188 virtual int handle_new_color(int output, int alpha);
189 GradientMain *plugin;
190 GradientWindow *window;
195 class GradientWindow : public PluginClientWindow
198 GradientWindow(GradientMain *plugin);
201 void create_objects();
202 void update_in_color();
203 void update_out_color();
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 GradientInColorThread *in_color_thread;
214 GradientOutColorThread *out_color_thread;
215 GradientShape *shape;
216 BC_Title *shape_title;
217 GradientCenterX *center_x;
218 BC_Title *center_x_title;
219 BC_Title *center_y_title;
220 GradientCenterY *center_y;
222 int in_color_x, in_color_y;
223 int out_color_x, out_color_y;
224 int shape_x, shape_y;
233 class GradientMain : public PluginVClient
236 GradientMain(PluginServer *server);
239 int process_buffer(VFrame *frame,
240 int64_t start_position,
243 void save_data(KeyFrame *keyframe);
244 void read_data(KeyFrame *keyframe);
249 PLUGIN_CLASS_MEMBERS(GradientConfig)
251 int need_reconfigure;
253 OverlayFrame *overlayer;
255 VFrame *input, *output;
256 GradientServer *engine;
259 class GradientPackage : public LoadPackage
267 class GradientUnit : public LoadClient
270 GradientUnit(GradientServer *server, GradientMain *plugin);
271 void process_package(LoadPackage *package);
272 GradientServer *server;
273 GradientMain *plugin;
277 class GradientServer : public LoadServer
280 GradientServer(GradientMain *plugin, int total_clients, int total_packages);
281 void init_packages();
282 LoadClient* new_client();
283 LoadPackage* new_package();
284 GradientMain *plugin;