4 * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
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.
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.
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
31 #include "loadbalance.h"
32 #include "pluginvclient.h"
36 class PerspectiveConfig;
37 class PerspectiveCanvas;
38 class PerspectiveCoord;
39 class PerspectiveReset;
40 class PerspectiveMode;
41 class PerspectiveDirection;
42 class PerspectiveAffine;
43 class PerspectiveAffineItem;
44 class PerspectiveWindow;
45 class PerspectiveMain;
47 class PerspectiveConfig
52 int equivalent(PerspectiveConfig &that);
53 void copy_from(PerspectiveConfig &that);
54 void interpolate(PerspectiveConfig &prev, PerspectiveConfig &next,
55 int64_t prev_frame, int64_t next_frame, int64_t current_frame);
57 float x1, y1, x2, y2, x3, y3, x4, y4;
59 int window_w, window_h;
66 class PerspectiveCanvas : public BC_SubWindow
69 PerspectiveCanvas(PerspectiveMain *plugin,
70 int x, int y, int w, int h);
71 int button_press_event();
72 int button_release_event();
73 int cursor_motion_event();
76 enum { NONE, DRAG, DRAG_FULL, ZOOM };
78 int start_cursor_x, start_cursor_y;
79 float start_x1, start_y1;
80 float start_x2, start_y2;
81 float start_x3, start_y3;
82 float start_x4, start_y4;
83 PerspectiveMain *plugin;
86 class PerspectiveCoord : public BC_TumbleTextBox
89 PerspectiveCoord(PerspectiveWindow *gui,
90 PerspectiveMain *plugin,
91 int x, int y, float value, int is_x);
93 PerspectiveMain *plugin;
97 class PerspectiveReset : public BC_GenericButton
100 PerspectiveReset(PerspectiveMain *plugin,
103 PerspectiveMain *plugin;
106 class PerspectiveMode : public BC_Radial
109 PerspectiveMode(PerspectiveMain *plugin,
110 int x, int y, int value, char *text);
112 PerspectiveMain *plugin;
116 class PerspectiveDirection : public BC_Radial
119 PerspectiveDirection(PerspectiveMain *plugin,
120 int x, int y, int value, char *text);
122 PerspectiveMain *plugin;
126 class PerspectiveAffine : public BC_PopupMenu
128 static const int n_modes = AffineEngine::AF_MODES;
129 const char *affine_modes[n_modes];
130 PerspectiveAffineItem *affine_items[n_modes];
132 PerspectiveAffine(PerspectiveWindow *gui, int x, int y);
133 ~PerspectiveAffine();
135 void create_objects();
136 void update(int mode, int send=1);
137 void affine_item(int id);
139 PerspectiveWindow *gui;
143 class PerspectiveAffineItem : public BC_MenuItem
146 PerspectiveAffineItem(const char *txt, int id)
147 : BC_MenuItem(txt) { this->id = id; }
150 PerspectiveWindow *gui;
156 class PerspectiveWindow : public PluginClientWindow
159 PerspectiveWindow(PerspectiveMain *plugin);
160 ~PerspectiveWindow();
162 void create_objects();
163 int resize_event(int x, int y);
164 void update_canvas();
167 void calculate_canvas_coords(
168 int &x1, int &y1, int &x2, int &y2,
169 int &x3, int &y3, int &x4, int &y4);
171 PerspectiveCanvas *canvas;
172 PerspectiveCoord *x, *y;
173 PerspectiveReset *reset;
174 PerspectiveMode *mode_perspective, *mode_sheer, *mode_stretch;
175 PerspectiveAffine *affine;
176 PerspectiveMain *plugin;
177 PerspectiveDirection *forward, *reverse;
181 class PerspectiveMain : public PluginVClient
184 PerspectiveMain(PluginServer *server);
187 int process_buffer(VFrame *frame,
188 int64_t start_position,
191 void save_data(KeyFrame *keyframe);
192 void read_data(KeyFrame *keyframe);
196 PLUGIN_CLASS_MEMBERS(PerspectiveConfig)
198 float get_current_x();
199 float get_current_y();
200 void set_current_x(float value);
201 void set_current_y(float value);
202 VFrame *input, *output;
204 AffineEngine *engine;