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