00001 #include <math.h>
00002 #include <stdint.h>
00003 #include <string.h>
00004
00005 #include "bcdisplayinfo.h"
00006 #include "clip.h"
00007 #include "bchash.h"
00008 #include "filexml.h"
00009 #include "keyframe.h"
00010 #include "loadbalance.h"
00011 #include "picon_png.h"
00012 #include "pluginvclient.h"
00013 #include "vframe.h"
00014
00015 class PerspectiveMain;
00016 class PerspectiveWindow;
00017
00018
00019
00020
00021 class PerspectiveConfig
00022 {
00023 public:
00024 PerspectiveConfig();
00025
00026 int equivalent(PerspectiveConfig &that);
00027 void copy_from(PerspectiveConfig &that);
00028 void interpolate(PerspectiveConfig &prev,
00029 PerspectiveConfig &next,
00030 int64_t prev_frame,
00031 int64_t next_frame,
00032 int64_t current_frame);
00033
00034 float x1, y1, x2, y2, x3, y3, x4, y4;
00035 int mode;
00036 int window_w, window_h;
00037 int current_point;
00038 int forward;
00039 };
00040
00041
00042
00043 class PerspectiveCanvas : public BC_SubWindow
00044 {
00045 public:
00046 PerspectiveCanvas(PerspectiveMain *plugin,
00047 int x,
00048 int y,
00049 int w,
00050 int h);
00051 int button_press_event();
00052 int button_release_event();
00053 int cursor_motion_event();
00054 int state;
00055
00056 enum
00057 {
00058 NONE,
00059 DRAG,
00060 DRAG_FULL,
00061 ZOOM
00062 };
00063
00064 int start_cursor_x, start_cursor_y;
00065 float start_x1, start_y1;
00066 float start_x2, start_y2;
00067 float start_x3, start_y3;
00068 float start_x4, start_y4;
00069 PerspectiveMain *plugin;
00070 };
00071
00072 class PerspectiveCoord : public BC_TumbleTextBox
00073 {
00074 public:
00075 PerspectiveCoord(PerspectiveWindow *gui,
00076 PerspectiveMain *plugin,
00077 int x,
00078 int y,
00079 float value,
00080 int is_x);
00081 int handle_event();
00082 PerspectiveMain *plugin;
00083 int is_x;
00084 };
00085
00086 class PerspectiveReset : public BC_GenericButton
00087 {
00088 public:
00089 PerspectiveReset(PerspectiveMain *plugin,
00090 int x,
00091 int y);
00092 int handle_event();
00093 PerspectiveMain *plugin;
00094 };
00095
00096 class PerspectiveMode : public BC_Radial
00097 {
00098 public:
00099 PerspectiveMode(PerspectiveMain *plugin,
00100 int x,
00101 int y,
00102 int value,
00103 char *text);
00104 int handle_event();
00105 PerspectiveMain *plugin;
00106 int value;
00107 };
00108
00109 class PerspectiveDirection : public BC_Radial
00110 {
00111 public:
00112 PerspectiveDirection(PerspectiveMain *plugin,
00113 int x,
00114 int y,
00115 int value,
00116 char *text);
00117 int handle_event();
00118 PerspectiveMain *plugin;
00119 int value;
00120 };
00121
00122 class PerspectiveWindow : public BC_Window
00123 {
00124 public:
00125 PerspectiveWindow(PerspectiveMain *plugin, int x, int y);
00126 ~PerspectiveWindow();
00127
00128 int create_objects();
00129 int close_event();
00130 int resize_event(int x, int y);
00131 void update_canvas();
00132 void update_mode();
00133 void update_coord();
00134 void calculate_canvas_coords(int &x1,
00135 int &y1,
00136 int &x2,
00137 int &y2,
00138 int &x3,
00139 int &y3,
00140 int &x4,
00141 int &y4);
00142
00143 PerspectiveCanvas *canvas;
00144 PerspectiveCoord *x, *y;
00145 PerspectiveReset *reset;
00146 PerspectiveMode *mode_perspective, *mode_sheer, *mode_stretch;
00147 PerspectiveMain *plugin;
00148 PerspectiveDirection *forward, *reverse;
00149 };
00150
00151
00152
00153 PLUGIN_THREAD_HEADER(PerspectiveMain, PerspectiveThread, PerspectiveWindow)
00154
00155
00156 class PerspectiveMain : public PluginVClient
00157 {
00158 public:
00159 PerspectiveMain(PluginServer *server);
00160 ~PerspectiveMain();
00161
00162 int process_buffer(VFrame *frame,
00163 int64_t start_position,
00164 double frame_rate);
00165 int is_realtime();
00166 int load_defaults();
00167 int save_defaults();
00168 void save_data(KeyFrame *keyframe);
00169 void read_data(KeyFrame *keyframe);
00170 void update_gui();
00171 int handle_opengl();
00172
00173 PLUGIN_CLASS_MEMBERS(PerspectiveConfig, PerspectiveThread)
00174
00175 float get_current_x();
00176 float get_current_y();
00177 void set_current_x(float value);
00178 void set_current_y(float value);
00179 VFrame *input, *output;
00180 VFrame *temp;
00181 AffineEngine *engine;
00182 };
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194