32a00f1cb76b252a5a0c31fd3f3bff6046be1a07
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / zoomblur / zoomblur.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 ZOOMBLUR_H
23 #define ZOOMBLUR_H
24
25
26 #include "bcdisplayinfo.h"
27 #include "bcsignals.h"
28 #include "clip.h"
29 #include "bchash.h"
30 #include "filexml.h"
31 #include "keyframe.h"
32 #include "language.h"
33 #include "loadbalance.h"
34 #include "pluginvclient.h"
35 #include "vframe.h"
36
37
38
39 class ZoomBlurMain;
40 class ZoomBlurWindow;
41 class ZoomBlurEngine;
42 class ZoomBlurReset;
43
44
45
46
47 class ZoomBlurConfig
48 {
49 public:
50         ZoomBlurConfig();
51
52         void reset();
53         int equivalent(ZoomBlurConfig &that);
54         void copy_from(ZoomBlurConfig &that);
55         void interpolate(ZoomBlurConfig &prev,
56                 ZoomBlurConfig &next,
57                 long prev_frame,
58                 long next_frame,
59                 long current_frame);
60
61         int x;
62         int y;
63         int radius;
64         int steps;
65         int r;
66         int g;
67         int b;
68         int a;
69 };
70
71
72
73 class ZoomBlurSize : public BC_ISlider
74 {
75 public:
76         ZoomBlurSize(ZoomBlurMain *plugin,
77                 int x,
78                 int y,
79                 int *output,
80                 int min,
81                 int max);
82         int handle_event();
83         ZoomBlurMain *plugin;
84         int *output;
85 };
86
87 class ZoomBlurToggle : public BC_CheckBox
88 {
89 public:
90         ZoomBlurToggle(ZoomBlurMain *plugin,
91                 int x,
92                 int y,
93                 int *output,
94                 char *string);
95         int handle_event();
96         ZoomBlurMain *plugin;
97         int *output;
98 };
99
100 class ZoomBlurWindow : public PluginClientWindow
101 {
102 public:
103         ZoomBlurWindow(ZoomBlurMain *plugin);
104         ~ZoomBlurWindow();
105
106         void create_objects();
107         void update();
108
109         ZoomBlurSize *x, *y, *radius, *steps;
110         ZoomBlurToggle *r, *g, *b, *a;
111         ZoomBlurMain *plugin;
112         ZoomBlurReset *reset;
113 };
114
115 class ZoomBlurReset : public BC_GenericButton
116 {
117 public:
118         ZoomBlurReset(ZoomBlurMain *plugin, ZoomBlurWindow *window, int x, int y);
119         ~ZoomBlurReset();
120         int handle_event();
121         ZoomBlurMain *plugin;
122         ZoomBlurWindow *window;
123 };
124
125
126
127
128 // Output coords for a layer of blurring
129 // Used for OpenGL only
130 class ZoomBlurLayer
131 {
132 public:
133         ZoomBlurLayer() {};
134         float x1, y1, x2, y2;
135 };
136
137 class ZoomBlurMain : public PluginVClient
138 {
139 public:
140         ZoomBlurMain(PluginServer *server);
141         ~ZoomBlurMain();
142
143         int process_buffer(VFrame *frame,
144                 int64_t start_position,
145                 double frame_rate);
146         int is_realtime();
147         void save_data(KeyFrame *keyframe);
148         void read_data(KeyFrame *keyframe);
149         void update_gui();
150         int handle_opengl();
151
152         PLUGIN_CLASS_MEMBERS(ZoomBlurConfig)
153
154         void delete_tables();
155         VFrame *input, *output, *temp;
156         ZoomBlurEngine *engine;
157         int **scale_y_table;
158         int **scale_x_table;
159         ZoomBlurLayer *layer_table;
160         int table_entries;
161         int need_reconfigure;
162 // The accumulation buffer is needed because 8 bits isn't precise enough
163         unsigned char *accum;
164 };
165
166 class ZoomBlurPackage : public LoadPackage
167 {
168 public:
169         ZoomBlurPackage();
170         int y1, y2;
171 };
172
173 class ZoomBlurUnit : public LoadClient
174 {
175 public:
176         ZoomBlurUnit(ZoomBlurEngine *server, ZoomBlurMain *plugin);
177         void process_package(LoadPackage *package);
178         ZoomBlurEngine *server;
179         ZoomBlurMain *plugin;
180 };
181
182 class ZoomBlurEngine : public LoadServer
183 {
184 public:
185         ZoomBlurEngine(ZoomBlurMain *plugin,
186                 int total_clients,
187                 int total_packages);
188         void init_packages();
189         LoadClient* new_client();
190         LoadPackage* new_package();
191         ZoomBlurMain *plugin;
192 };
193
194
195 #endif