4a8870b124ebde66706c18d13f92a7c707b3ec97
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / rotate / rotate.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 ROTATE_H
23 #define ROTATE_H
24
25
26
27 #include "affine.h"
28 #include "bcdisplayinfo.h"
29 #include "clip.h"
30 #include "bchash.h"
31 #include "filexml.h"
32 #include "guicast.h"
33 #include "language.h"
34 #include "pluginvclient.h"
35 #include "rotateframe.h"
36 #include "vframe.h"
37
38
39 #include <string.h>
40
41
42 class RotateEffect;
43 class RotateWindow;
44
45
46 class RotateConfig
47 {
48 public:
49         RotateConfig();
50
51         void reset();
52         int equivalent(RotateConfig &that);
53         void copy_from(RotateConfig &that);
54         void interpolate(RotateConfig &prev,
55                 RotateConfig &next,
56                 long prev_frame,
57                 long next_frame,
58                 long current_frame);
59
60         float angle;
61         float pivot_x;
62         float pivot_y;
63         int draw_pivot;
64 //      int bilinear;
65 };
66
67 class RotateToggle : public BC_Radial
68 {
69 public:
70         RotateToggle(RotateWindow *window,
71                 RotateEffect *plugin,
72                 int init_value,
73                 int x,
74                 int y,
75                 int value,
76                 const char *string);
77         int handle_event();
78
79         RotateEffect *plugin;
80         RotateWindow *window;
81         int value;
82 };
83
84 class RotateDrawPivot : public BC_CheckBox
85 {
86 public:
87         RotateDrawPivot(RotateWindow *window,
88                 RotateEffect *plugin,
89                 int x,
90                 int y);
91         int handle_event();
92         RotateEffect *plugin;
93         RotateWindow *window;
94         int value;
95 };
96
97 class RotateInterpolate : public BC_CheckBox
98 {
99 public:
100         RotateInterpolate(RotateEffect *plugin, int x, int y);
101         int handle_event();
102         RotateEffect *plugin;
103 };
104
105 class RotateFine : public BC_FPot
106 {
107 public:
108         RotateFine(RotateWindow *window,
109                 RotateEffect *plugin,
110                 int x,
111                 int y);
112         int handle_event();
113
114         RotateEffect *plugin;
115         RotateWindow *window;
116 };
117
118 class RotateX : public BC_FPot
119 {
120 public:
121         RotateX(RotateWindow *window,
122                 RotateEffect *plugin,
123                 int x,
124                 int y);
125         int handle_event();
126         RotateEffect *plugin;
127         RotateWindow *window;
128 };
129
130 class RotateY : public BC_FPot
131 {
132 public:
133         RotateY(RotateWindow *window,
134                 RotateEffect *plugin,
135                 int x,
136                 int y);
137         int handle_event();
138         RotateEffect *plugin;
139         RotateWindow *window;
140 };
141
142
143 class RotateText : public BC_TextBox
144 {
145 public:
146         RotateText(RotateWindow *window,
147                 RotateEffect *plugin,
148                 int x,
149                 int y);
150         int handle_event();
151
152         RotateEffect *plugin;
153         RotateWindow *window;
154 };
155
156 class RotateReset : public BC_GenericButton
157 {
158 public:
159         RotateReset(RotateEffect *plugin, RotateWindow *window, int x, int y);
160         ~RotateReset();
161         int handle_event();
162         RotateEffect *plugin;
163         RotateWindow *window;
164 };
165
166
167 class RotateWindow : public PluginClientWindow
168 {
169 public:
170         RotateWindow(RotateEffect *plugin);
171
172         void create_objects();
173
174         int update();
175         int update_fine();
176         int update_text();
177         int update_toggles();
178
179         RotateEffect *plugin;
180         RotateToggle *toggle0;
181         RotateToggle *toggle90;
182         RotateToggle *toggle180;
183         RotateToggle *toggle270;
184         RotateDrawPivot *draw_pivot;
185         RotateFine *fine;
186         RotateText *text;
187         RotateX *x;
188         RotateY *y;
189 //      RotateInterpolate *bilinear;
190         RotateReset *reset;
191 };
192
193
194
195
196 class RotateEffect : public PluginVClient
197 {
198 public:
199         RotateEffect(PluginServer *server);
200         ~RotateEffect();
201
202         PLUGIN_CLASS_MEMBERS(RotateConfig)
203         int process_buffer(VFrame *frame,
204                 int64_t start_position,
205                 double frame_rate);
206         int is_realtime();
207         void update_gui();
208         void save_data(KeyFrame *keyframe);
209         void read_data(KeyFrame *keyframe);
210         int handle_opengl();
211
212         AffineEngine *engine;
213         int need_reconfigure;
214 };
215
216 #endif