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
32 #include "loadbalance.h"
33 #include "pluginvclient.h"
37 class PerspectiveConfig;
38 class PerspectiveCanvas;
39 class PerspectiveCoord;
40 class PerspectiveReset;
41 class PerspectiveMode;
42 class PerspectiveDirection;
43 class PerspectiveAffine;
44 class PerspectiveAffineItem;
45 class PerspectiveZoomView;
46 class PerspectiveWindow;
47 class PerspectiveMain;
49 class PerspectiveConfig
54 int equivalent(PerspectiveConfig &that);
55 void copy_from(PerspectiveConfig &that);
56 void interpolate(PerspectiveConfig &prev, PerspectiveConfig &next,
57 int64_t prev_frame, int64_t next_frame, int64_t current_frame);
59 float x1, y1, x2, y2, x3, y3, x4, y4;
60 float view_x, view_y, view_zoom;
62 int window_w, window_h;
69 class PerspectiveCanvas : public BC_SubWindow
72 PerspectiveCanvas(PerspectiveWindow *gui,
73 int x, int y, int w, int h);
74 int button_press_event();
75 int button_release_event();
76 int cursor_motion_event();
79 enum { NONE, DRAG, DRAG_FULL, ZOOM, DRAG_VIEW };
82 float start_x1, start_y1;
83 float start_x2, start_y2;
84 float start_x3, start_y3;
85 float start_x4, start_y4;
86 PerspectiveWindow *gui;
89 class PerspectiveCoord : public BC_TumbleTextBox
92 PerspectiveCoord(PerspectiveWindow *gui,
93 int x, int y, float value, int is_x);
95 PerspectiveWindow *gui;
99 class PerspectiveReset : public BC_GenericButton
102 PerspectiveReset(PerspectiveWindow *gui, int x, int y);
104 PerspectiveWindow *gui;
107 class PerspectiveMode : public BC_Radial
110 PerspectiveMode(PerspectiveWindow *gui,
111 int x, int y, int value, char *text);
113 PerspectiveWindow *gui;
117 class PerspectiveDirection : public BC_Radial
120 PerspectiveDirection(PerspectiveWindow *gui,
121 int x, int y, int value, char *text);
123 PerspectiveWindow *gui;
127 class PerspectiveAffine : public BC_PopupMenu
129 static const int n_modes = AffineEngine::AF_MODES;
130 const char *affine_modes[n_modes];
131 PerspectiveAffineItem *affine_items[n_modes];
133 PerspectiveAffine(PerspectiveWindow *gui, int x, int y);
134 ~PerspectiveAffine();
136 void create_objects();
137 void update(int mode, int send=1);
138 void affine_item(int id);
140 PerspectiveWindow *gui;
144 class PerspectiveAffineItem : public BC_MenuItem
147 PerspectiveAffineItem(const char *txt, int id)
148 : BC_MenuItem(txt) { this->id = id; }
151 PerspectiveWindow *gui;
155 class PerspectiveZoomView : public BC_FSlider
158 PerspectiveZoomView(PerspectiveWindow *gui,
159 int x, int y, int w);
160 ~PerspectiveZoomView();
164 void update(float zoom);
166 PerspectiveWindow *gui;
170 class PerspectiveWindow : public PluginClientWindow
173 PerspectiveWindow(PerspectiveMain *plugin);
174 ~PerspectiveWindow();
176 void create_objects();
177 int resize_event(int x, int y);
178 void update_canvas();
180 void update_view_zoom();
183 void calculate_canvas_coords(
184 int &x1, int &y1, int &x2, int &y2,
185 int &x3, int &y3, int &x4, int &y4);
187 PerspectiveCanvas *canvas;
188 PerspectiveCoord *x, *y;
189 PerspectiveReset *reset;
190 PerspectiveZoomView *zoom_view;
191 PerspectiveMode *mode_perspective, *mode_sheer, *mode_stretch;
192 PerspectiveAffine *affine;
193 PerspectiveMain *plugin;
194 PerspectiveDirection *forward, *reverse;
198 class PerspectiveMain : public PluginVClient
201 PerspectiveMain(PluginServer *server);
204 int process_buffer(VFrame *frame,
205 int64_t start_position,
208 void save_data(KeyFrame *keyframe);
209 void read_data(KeyFrame *keyframe);
213 PLUGIN_CLASS_MEMBERS(PerspectiveConfig)
215 float get_current_x();
216 float get_current_y();
217 void set_current_x(float value);
218 void set_current_y(float value);
219 VFrame *input, *output;
221 AffineEngine *engine;