r632: Boost up the requirement for mjpegtools to 1.6.3
[cinelerra_cv/mob.git] / cinelerra / bezierautos.h
blob34350547c6c713e346dafaf419b4d50b45fa3aee
1 #ifndef BEZIERAUTOS_H
2 #define BEZIERAUTOS_H
4 #include "auto.inc"
5 #include "autos.h"
6 #include "edl.inc"
7 #include "guicast.h"
8 #include "bezierauto.inc"
9 #include "filexml.inc"
10 #include "mwindow.inc"
11 #include "track.inc"
13 // how to draw a bezier curve
15 // x(t)=(1-t)^3*x0+3*t*(1-t)^2*x1+3*t^2*(1-t)*x2+t^3*x3
16 // y(t)=(1-t)^3*y0+3*t*(1-t)^2*y1+3*t^2*(1-t)*y2+t^3*y3
18 // 0 <= t <= 1
19 // (x1, y1) (x3, y3) control points
20 // (x0, y0) (x2, y2) end points
22 class BezierAutos : public Autos
24 public:
25 BezierAutos(EDL *edl,
26 Track *track,
27 int color,
28 float center_x,
29 float center_y,
30 float center_z,
31 float frame_w,
32 float frame_h,
33 float virtual_w = 160,
34 float virtual_h = 160);
35 ~BezierAutos();
37 Auto* new_auto();
38 int paste_derived(FileXML *xml, int64_t start);
40 int draw(BC_SubWindow *canvas,
41 int pixel,
42 int zoom_track,
43 float units_per_pixel,
44 float view_start,
45 int vertical);
47 int get_center(float &x,
48 float &y,
49 float &z,
50 float frame,
51 int direction,
52 BezierAuto **before,
53 BezierAuto **after);
55 int draw_floating_autos(BC_SubWindow *canvas,
56 int pixel,
57 int zoom_track,
58 float units_per_pixel,
59 float view_start,
60 int vertical,
61 int flash);
63 int select_auto(BC_SubWindow *canvas,
64 int pixel,
65 int zoom_track,
66 float units_per_pixel,
67 float view_start,
68 int cursor_x,
69 int cursor_y,
70 int shift_down,
71 int ctrl_down,
72 int mouse_button,
73 int vertical);
75 int move_auto(BC_SubWindow *canvas,
76 int pixel,
77 int zoom_track,
78 float units_per_pixel,
79 float view_start,
80 int cursor_x,
81 int cursor_y,
82 int shift_down,
83 int vertical);
85 int release_auto_derived();
86 int scale_video(float scale, int *offsets);
87 int dump();
89 Auto* add_auto(int64_t frame, float x, float y, float z);
90 Auto* append_auto();
91 int get_frame_half(float scale, int vertical, float units_per_pixel);
92 // Get the pixel on the track display of the center of an auto
93 int get_auto_pixel(int64_t position, float view_start, float units_per_pixel, int frame_half);
94 // Get the frame on the track of the cursor pixel
95 int64_t get_auto_frame(int position, float view_start, float units_per_pixel, int vertical);
97 // need frame dimensions here so same auto can be camera or projector
98 float frame_w, frame_h;
99 float virtual_center_x, virtual_center_y;
100 float virtual_w;
101 float center_x, center_y, center_z; // default values
102 BezierAuto *old_selected, *new_selected;
104 // selection type is
105 // 0 - none
106 // 1 - frame number
107 // 2 - xy
108 // 3 - zoom
109 // 4 - control_in_xy
110 // 5 - control_out_xy
111 // 6 - control_in_zoom
112 // 7 - control_out_zoom
113 int selection_type;
114 MWindow *mwindow;
115 EDL *edl;
117 private:
118 int get_virtual_center(float &x, float &y, int cursor_x, int cursor_y, int vertical, float scale);
119 // don't draw the new auto position
120 int swap_out_selected();
121 int swap_in_selected();
127 #endif