c111b55ec396549f7b1049a2b0edd0befc846a15
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / radialblur / radialblur.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 RADIALBLUR_H
23 #define RADIALBLUR_H
24
25
26 #include <math.h>
27 #include <stdint.h>
28 #include <string.h>
29
30
31 #include "affine.h"
32 #include "bcdisplayinfo.h"
33 #include "clip.h"
34 #include "bchash.h"
35 #include "filexml.h"
36 #include "keyframe.h"
37 #include "language.h"
38 #include "loadbalance.h"
39 #include "pluginvclient.h"
40 #include "vframe.h"
41
42 #define RESET_DEFAULT_SETTINGS 10
43 #define RESET_ALL     0
44 #define RESET_XSLIDER 1
45 #define RESET_YSLIDER 2
46 #define RESET_ANGLE   3
47 #define RESET_STEPS   4
48
49 class RadialBlurMain;
50 class RadialBlurWindow;
51 class RadialBlurEngine;
52 class RadialBlurReset;
53 class RadialBlurDefaultSettings;
54 class RadialBlurSliderClr;
55
56
57
58 class RadialBlurConfig
59 {
60 public:
61         RadialBlurConfig();
62
63         void reset(int clear);
64         int equivalent(RadialBlurConfig &that);
65         void copy_from(RadialBlurConfig &that);
66         void interpolate(RadialBlurConfig &prev,
67                 RadialBlurConfig &next,
68                 long prev_frame,
69                 long next_frame,
70                 long current_frame);
71
72         int x;
73         int y;
74         int steps;
75         int angle;
76         int r;
77         int g;
78         int b;
79         int a;
80 };
81
82
83
84 class RadialBlurSize : public BC_ISlider
85 {
86 public:
87         RadialBlurSize(RadialBlurMain *plugin,
88                 int x,
89                 int y,
90                 int *output,
91                 int min,
92                 int max);
93         int handle_event();
94         RadialBlurMain *plugin;
95         int *output;
96 };
97
98 class RadialBlurToggle : public BC_CheckBox
99 {
100 public:
101         RadialBlurToggle(RadialBlurMain *plugin,
102                 int x,
103                 int y,
104                 int *output,
105                 char *string);
106         int handle_event();
107         RadialBlurMain *plugin;
108         int *output;
109 };
110
111 class RadialBlurReset : public BC_GenericButton
112 {
113 public:
114         RadialBlurReset(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y);
115         ~RadialBlurReset();
116         int handle_event();
117         RadialBlurMain *plugin;
118         RadialBlurWindow *gui;
119 };
120
121 class RadialBlurDefaultSettings : public BC_GenericButton
122 {
123 public:
124         RadialBlurDefaultSettings(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w);
125         ~RadialBlurDefaultSettings();
126         int handle_event();
127         RadialBlurMain *plugin;
128         RadialBlurWindow *gui;
129 };
130
131 class RadialBlurSliderClr : public BC_GenericButton
132 {
133 public:
134         RadialBlurSliderClr(RadialBlurMain *plugin, RadialBlurWindow *gui, int x, int y, int w, int clear);
135         ~RadialBlurSliderClr();
136         int handle_event();
137         RadialBlurMain *plugin;
138         RadialBlurWindow *gui;
139         int clear;
140 };
141
142 class RadialBlurWindow : public PluginClientWindow
143 {
144 public:
145         RadialBlurWindow(RadialBlurMain *plugin);
146         ~RadialBlurWindow();
147
148         void create_objects();
149         void update_gui(int clear);
150
151         RadialBlurSize *x, *y, *steps, *angle;
152         RadialBlurToggle *r, *g, *b, *a;
153         RadialBlurMain *plugin;
154         RadialBlurReset *reset;
155         RadialBlurDefaultSettings *default_settings;
156         RadialBlurSliderClr *xClr;
157         RadialBlurSliderClr *yClr;
158         RadialBlurSliderClr *angleClr;
159         RadialBlurSliderClr *stepsClr;
160 };
161
162
163
164
165
166
167 class RadialBlurMain : public PluginVClient
168 {
169 public:
170         RadialBlurMain(PluginServer *server);
171         ~RadialBlurMain();
172
173         int process_buffer(VFrame *frame,
174                 int64_t start_position,
175                 double frame_rate);
176         int is_realtime();
177         void save_data(KeyFrame *keyframe);
178         void read_data(KeyFrame *keyframe);
179         void update_gui();
180         int handle_opengl();
181
182         PLUGIN_CLASS_MEMBERS(RadialBlurConfig)
183
184         VFrame *input, *output, *temp;
185         RadialBlurEngine *engine;
186 // Rotate engine only used for OpenGL
187         AffineEngine *rotate;
188 };
189
190 class RadialBlurPackage : public LoadPackage
191 {
192 public:
193         RadialBlurPackage();
194         int y1, y2;
195 };
196
197 class RadialBlurUnit : public LoadClient
198 {
199 public:
200         RadialBlurUnit(RadialBlurEngine *server, RadialBlurMain *plugin);
201         void process_package(LoadPackage *package);
202         RadialBlurEngine *server;
203         RadialBlurMain *plugin;
204 };
205
206 class RadialBlurEngine : public LoadServer
207 {
208 public:
209         RadialBlurEngine(RadialBlurMain *plugin,
210                 int total_clients,
211                 int total_packages);
212         void init_packages();
213         LoadClient* new_client();
214         LoadPackage* new_package();
215         RadialBlurMain *plugin;
216 };
217
218 #endif