Fixed initialisation of tf in file_open(). Without setting the memory to 0,
[cinelerra_cv/mob.git] / plugins / gradient / gradient.h
blobe2c1b47ec5f0ee7fb75ce30faa730b5463089cac
1 #ifndef GRADIENT_H
2 #define GRADIENT_H
4 class GradientMain;
5 class GradientEngine;
6 class GradientThread;
7 class GradientWindow;
8 class GradientServer;
11 #define MAXRADIUS 10000
13 #include "colorpicker.h"
14 #include "bchash.inc"
15 #include "filexml.inc"
16 #include "guicast.h"
17 #include "loadbalance.h"
18 #include "overlayframe.inc"
19 #include "plugincolors.h"
20 #include "pluginvclient.h"
21 #include "thread.h"
22 #include "vframe.inc"
24 class GradientConfig
26 public:
27 GradientConfig();
29 int equivalent(GradientConfig &that);
30 void copy_from(GradientConfig &that);
31 void interpolate(GradientConfig &prev,
32 GradientConfig &next,
33 long prev_frame,
34 long next_frame,
35 long current_frame);
36 // Int to hex triplet conversion
37 int get_in_color();
38 int get_out_color();
40 // LINEAR or RADIAL
41 int shape;
42 // LINEAR or LOG or SQUARE
43 int rate;
44 enum
46 LINEAR,
47 RADIAL,
48 LOG,
49 SQUARE
53 double center_x;
54 double center_y;
55 double angle;
56 double in_radius;
57 double out_radius;
58 int in_r, in_g, in_b, in_a;
59 int out_r, out_g, out_b, out_a;
63 class GradientShape : public BC_PopupMenu
65 public:
66 GradientShape(GradientMain *plugin,
67 GradientWindow *gui,
68 int x,
69 int y);
70 void create_objects();
71 static char* to_text(int shape);
72 static int from_text(char *text);
73 int handle_event();
74 GradientMain *plugin;
75 GradientWindow *gui;
79 class GradientRate : public BC_PopupMenu
81 public:
82 GradientRate(GradientMain *plugin,
83 int x,
84 int y);
85 void create_objects();
86 static char* to_text(int shape);
87 static int from_text(char *text);
88 int handle_event();
89 GradientMain *plugin;
90 GradientWindow *gui;
93 class GradientCenterX : public BC_FPot
95 public:
96 GradientCenterX(GradientMain *plugin, int x, int y);
97 int handle_event();
98 GradientMain *plugin;
101 class GradientCenterY : public BC_FPot
103 public:
104 GradientCenterY(GradientMain *plugin, int x, int y);
105 int handle_event();
106 GradientMain *plugin;
109 class GradientAngle : public BC_FPot
111 public:
112 GradientAngle(GradientMain *plugin, int x, int y);
113 int handle_event();
114 GradientMain *plugin;
117 class GradientInRadius : public BC_FSlider
119 public:
120 GradientInRadius(GradientMain *plugin, int x, int y);
121 int handle_event();
122 GradientMain *plugin;
125 class GradientOutRadius : public BC_FSlider
127 public:
128 GradientOutRadius(GradientMain *plugin, int x, int y);
129 int handle_event();
130 GradientMain *plugin;
133 class GradientInColorButton : public BC_GenericButton
135 public:
136 GradientInColorButton(GradientMain *plugin, GradientWindow *window, int x, int y);
137 int handle_event();
138 GradientMain *plugin;
139 GradientWindow *window;
143 class GradientOutColorButton : public BC_GenericButton
145 public:
146 GradientOutColorButton(GradientMain *plugin, GradientWindow *window, int x, int y);
147 int handle_event();
148 GradientMain *plugin;
149 GradientWindow *window;
153 class GradientInColorThread : public ColorThread
155 public:
156 GradientInColorThread(GradientMain *plugin, GradientWindow *window);
157 virtual int handle_new_color(int output, int alpha);
158 GradientMain *plugin;
159 GradientWindow *window;
163 class GradientOutColorThread : public ColorThread
165 public:
166 GradientOutColorThread(GradientMain *plugin, GradientWindow *window);
167 virtual int handle_new_color(int output, int alpha);
168 GradientMain *plugin;
169 GradientWindow *window;
174 class GradientWindow : public BC_Window
176 public:
177 GradientWindow(GradientMain *plugin, int x, int y);
178 ~GradientWindow();
180 int create_objects();
181 int close_event();
182 void update_in_color();
183 void update_out_color();
184 void update_shape();
186 GradientMain *plugin;
187 BC_Title *angle_title;
188 GradientAngle *angle;
189 GradientInRadius *in_radius;
190 GradientOutRadius *out_radius;
191 GradientInColorButton *in_color;
192 GradientOutColorButton *out_color;
193 GradientInColorThread *in_color_thread;
194 GradientOutColorThread *out_color_thread;
195 GradientShape *shape;
196 BC_Title *shape_title;
197 GradientCenterX *center_x;
198 BC_Title *center_x_title;
199 BC_Title *center_y_title;
200 GradientCenterY *center_y;
201 GradientRate *rate;
202 int in_color_x, in_color_y;
203 int out_color_x, out_color_y;
204 int shape_x, shape_y;
209 PLUGIN_THREAD_HEADER(GradientMain, GradientThread, GradientWindow)
212 class GradientMain : public PluginVClient
214 public:
215 GradientMain(PluginServer *server);
216 ~GradientMain();
218 int process_buffer(VFrame *frame,
219 int64_t start_position,
220 double frame_rate);
221 int is_realtime();
222 int load_defaults();
223 int save_defaults();
224 void save_data(KeyFrame *keyframe);
225 void read_data(KeyFrame *keyframe);
226 void update_gui();
227 int is_synthesis();
228 int handle_opengl();
230 PLUGIN_CLASS_MEMBERS(GradientConfig, GradientThread)
232 int need_reconfigure;
234 OverlayFrame *overlayer;
235 VFrame *gradient;
236 VFrame *input, *output;
237 GradientServer *engine;
240 class GradientPackage : public LoadPackage
242 public:
243 GradientPackage();
244 int y1;
245 int y2;
248 class GradientUnit : public LoadClient
250 public:
251 GradientUnit(GradientServer *server, GradientMain *plugin);
252 void process_package(LoadPackage *package);
253 GradientServer *server;
254 GradientMain *plugin;
255 YUV yuv;
258 class GradientServer : public LoadServer
260 public:
261 GradientServer(GradientMain *plugin, int total_clients, int total_packages);
262 void init_packages();
263 LoadClient* new_client();
264 LoadPackage* new_package();
265 GradientMain *plugin;
270 #endif