Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / plugins / perspective / perspective.h
blob13f2f1f00ba8a209958d36bc48ef9e2696e4252a
1 #include <math.h>
2 #include <stdint.h>
3 #include <string.h>
5 #include "bcdisplayinfo.h"
6 #include "clip.h"
7 #include "bchash.h"
8 #include "filexml.h"
9 #include "keyframe.h"
10 #include "loadbalance.h"
11 #include "picon_png.h"
12 #include "pluginvclient.h"
13 #include "vframe.h"
15 class PerspectiveMain;
16 class PerspectiveWindow;
21 class PerspectiveConfig
23 public:
24 PerspectiveConfig();
26 int equivalent(PerspectiveConfig &that);
27 void copy_from(PerspectiveConfig &that);
28 void interpolate(PerspectiveConfig &prev,
29 PerspectiveConfig &next,
30 int64_t prev_frame,
31 int64_t next_frame,
32 int64_t current_frame);
34 float x1, y1, x2, y2, x3, y3, x4, y4;
35 int mode;
36 int window_w, window_h;
37 int current_point;
38 int forward;
43 class PerspectiveCanvas : public BC_SubWindow
45 public:
46 PerspectiveCanvas(PerspectiveMain *plugin,
47 int x,
48 int y,
49 int w,
50 int h);
51 int button_press_event();
52 int button_release_event();
53 int cursor_motion_event();
54 int state;
56 enum
58 NONE,
59 DRAG,
60 DRAG_FULL,
61 ZOOM
64 int start_cursor_x, start_cursor_y;
65 float start_x1, start_y1;
66 float start_x2, start_y2;
67 float start_x3, start_y3;
68 float start_x4, start_y4;
69 PerspectiveMain *plugin;
72 class PerspectiveCoord : public BC_TumbleTextBox
74 public:
75 PerspectiveCoord(PerspectiveWindow *gui,
76 PerspectiveMain *plugin,
77 int x,
78 int y,
79 float value,
80 int is_x);
81 int handle_event();
82 PerspectiveMain *plugin;
83 int is_x;
86 class PerspectiveReset : public BC_GenericButton
88 public:
89 PerspectiveReset(PerspectiveMain *plugin,
90 int x,
91 int y);
92 int handle_event();
93 PerspectiveMain *plugin;
96 class PerspectiveMode : public BC_Radial
98 public:
99 PerspectiveMode(PerspectiveMain *plugin,
100 int x,
101 int y,
102 int value,
103 char *text);
104 int handle_event();
105 PerspectiveMain *plugin;
106 int value;
109 class PerspectiveDirection : public BC_Radial
111 public:
112 PerspectiveDirection(PerspectiveMain *plugin,
113 int x,
114 int y,
115 int value,
116 char *text);
117 int handle_event();
118 PerspectiveMain *plugin;
119 int value;
122 class PerspectiveWindow : public BC_Window
124 public:
125 PerspectiveWindow(PerspectiveMain *plugin, int x, int y);
126 ~PerspectiveWindow();
128 int create_objects();
129 int close_event();
130 int resize_event(int x, int y);
131 void update_canvas();
132 void update_mode();
133 void update_coord();
134 void calculate_canvas_coords(int &x1,
135 int &y1,
136 int &x2,
137 int &y2,
138 int &x3,
139 int &y3,
140 int &x4,
141 int &y4);
143 PerspectiveCanvas *canvas;
144 PerspectiveCoord *x, *y;
145 PerspectiveReset *reset;
146 PerspectiveMode *mode_perspective, *mode_sheer, *mode_stretch;
147 PerspectiveMain *plugin;
148 PerspectiveDirection *forward, *reverse;
153 PLUGIN_THREAD_HEADER(PerspectiveMain, PerspectiveThread, PerspectiveWindow)
156 class PerspectiveMain : public PluginVClient
158 public:
159 PerspectiveMain(PluginServer *server);
160 ~PerspectiveMain();
162 int process_buffer(VFrame *frame,
163 int64_t start_position,
164 double frame_rate);
165 int is_realtime();
166 int load_defaults();
167 int save_defaults();
168 void save_data(KeyFrame *keyframe);
169 void read_data(KeyFrame *keyframe);
170 void update_gui();
171 int handle_opengl();
173 PLUGIN_CLASS_MEMBERS(PerspectiveConfig, PerspectiveThread)
175 float get_current_x();
176 float get_current_y();
177 void set_current_x(float value);
178 void set_current_y(float value);
179 VFrame *input, *output;
180 VFrame *temp;
181 AffineEngine *engine;