bg/clr color tweaks, clear borders rework, fc31 depends
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / shapewipe / shapewipe.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef SHAPEWIPE_H
23 #define SHAPEWIPE_H
24
25 class ShapeWipeConfig;
26 class ShapeWipeMain;
27 class ShapeWipeWindow;
28 class ShapeWipeW2B;
29 class ShapeWipeB2W;
30 class ShapeWipeTumble;
31 class ShapeWipeFeather;
32 class ShapeWipeFSlider;
33 class ShapeWipeReset;
34 class ShapeWipeShape;
35 class ShapeWipePreserveAspectRatio;
36 class ShapePackage;
37 class ShapeUnit;
38 class ShapeEngine;
39
40 #include "overlayframe.inc"
41 #include "pluginvclient.h"
42 #include "vframe.inc"
43
44 class ShapeWipeW2B : public BC_Radial
45 {
46 public:
47         ShapeWipeW2B(ShapeWipeMain *plugin,
48                 ShapeWipeWindow *window,
49                 int x,
50                 int y);
51         int handle_event();
52         ShapeWipeMain *plugin;
53         ShapeWipeWindow *window;
54 };
55
56 class ShapeWipeB2W : public BC_Radial
57 {
58 public:
59         ShapeWipeB2W(ShapeWipeMain *plugin,
60                 ShapeWipeWindow *window,
61                 int x,
62                 int y);
63         int handle_event();
64         ShapeWipeMain *plugin;
65         ShapeWipeWindow *window;
66 };
67
68
69 class ShapeWipeTumble : public BC_Tumbler
70 {
71 public:
72         ShapeWipeTumble(ShapeWipeMain *client,
73                 ShapeWipeWindow *window,
74                 int x,
75                 int y);
76
77         int handle_up_event();
78         int handle_down_event();
79
80         ShapeWipeMain *client;
81         ShapeWipeWindow *window;
82 };
83
84 class ShapeWipeFeather : public BC_TumbleTextBox
85 {
86 public:
87         ShapeWipeFeather(ShapeWipeMain *client,
88                 ShapeWipeWindow *window, int x, int y);
89         int handle_event();
90
91         ShapeWipeMain *client;
92         ShapeWipeWindow *window;
93 };
94
95 class ShapeWipeFSlider : public BC_FSlider
96 {
97 public:
98         ShapeWipeFSlider(ShapeWipeMain *client,
99                 ShapeWipeWindow *window, int x, int y, int w);
100         int handle_event();
101
102         ShapeWipeMain *client;
103         ShapeWipeWindow *window;
104 };
105
106 class ShapeWipeReset : public BC_Button
107 {
108 public:
109         ShapeWipeReset(ShapeWipeMain *client,
110                 ShapeWipeWindow *window, int x, int y);
111         int handle_event();
112
113         ShapeWipeMain *client;
114         ShapeWipeWindow *window;
115 };
116
117 class ShapeWipeShape : public BC_PopupTextBox
118 {
119 public:
120         ShapeWipeShape(ShapeWipeMain *client, ShapeWipeWindow *window,
121                 int x, int y, int text_w, int list_h);
122         int handle_event();
123         ShapeWipeMain *client;
124         ShapeWipeWindow *window;
125 };
126
127 class ShapeWipePreserveAspectRatio : public BC_CheckBox
128 {
129 public:
130         ShapeWipePreserveAspectRatio(ShapeWipeMain *plugin,
131                 ShapeWipeWindow *window,
132                 int x,
133                 int y);
134         int handle_event();
135         ShapeWipeMain *plugin;
136         ShapeWipeWindow *window;
137 };
138
139
140 class ShapeWipeWindow : public PluginClientWindow
141 {
142 public:
143         ShapeWipeWindow(ShapeWipeMain *plugin);
144         ~ShapeWipeWindow();
145         void create_objects();
146         void next_shape();
147         void prev_shape();
148
149         ShapeWipeMain *plugin;
150         ShapeWipeW2B *left;
151         ShapeWipeB2W *right;
152         ShapeWipeTumble *shape_tumbler;
153         ShapeWipeShape *shape_text;
154         ShapeWipeFeather *shape_feather;
155         ShapeWipeFSlider *shape_fslider;
156         ShapeWipeReset *shape_reset;
157         ArrayList<BC_ListBoxItem*> shapes;
158 };
159
160 class ShapeWipeConfig
161 {
162 public:
163         ShapeWipeConfig();
164         ~ShapeWipeConfig();
165         void read_xml(KeyFrame *keyframe);
166         void save_xml(KeyFrame *keyframe);
167
168         int direction;
169         float feather;
170         int preserve_aspect;
171         char shape_name[BCTEXTLEN];
172 };
173
174 class ShapeWipeMain : public PluginVClient
175 {
176 public:
177         ShapeWipeMain(PluginServer *server);
178         ~ShapeWipeMain();
179
180         PLUGIN_CLASS_MEMBERS(ShapeWipeConfig)
181         int process_realtime(VFrame *input, VFrame *output);
182         int uses_gui();
183         int is_transition();
184         void read_data(KeyFrame *keyframe);
185         void save_data(KeyFrame *keyframe);
186
187         int read_pattern_image(char *shape_name,
188                 int new_frame_width, int new_frame_height);
189         void reset_pattern_image();
190         void init_shapes();
191
192         VFrame *input, *output;
193         ShapeEngine *engine;
194         ArrayList<char*> shape_paths;
195         ArrayList<char*> shape_titles;
196
197         int shapes_initialized;
198         int threshold;
199         char current_filename[BCTEXTLEN];
200         char current_name[BCTEXTLEN];
201         unsigned char **pattern_image;
202         unsigned char min_value;
203         unsigned char max_value;
204         int frame_width;
205         int frame_height;
206         int preserve_aspect;
207         int last_preserve_aspect;
208 };
209
210
211 class ShapePackage : public LoadPackage
212 {
213 public:
214         ShapePackage();
215         int y1, y2;
216 };
217
218 class ShapeUnit : public LoadClient
219 {
220 public:
221         ShapeUnit(ShapeEngine *server);
222         ~ShapeUnit();
223         void process_package(LoadPackage *package);
224         ShapeEngine *server;
225         unsigned char threshold;
226 };
227
228 class ShapeEngine : public LoadServer
229 {
230 public:
231         ShapeEngine(ShapeWipeMain *plugin,
232                 int total_clients, int total_packages);
233         ~ShapeEngine();
234
235         void init_packages();
236         LoadClient *new_client();
237         LoadPackage *new_package();
238         ShapeWipeMain *plugin;
239 };
240
241 #endif