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