no longer need ffmpeg patch0 which was for Termux
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / tracer / tracer.h
1 /*
2  * CINELERRA
3  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21
22
23 #ifndef __TRACER_H__
24 #define __TRACER_H__
25
26 #include "loadbalance.h"
27 #include "pluginvclient.h"
28
29 class Tracer;
30
31 enum { PT_X, PT_Y, PT_SZ };
32
33 class TracerPoint
34 {
35 public:
36         float x, y;
37
38         TracerPoint(float x, float y);
39         ~TracerPoint();
40         void update_parameter(TracerPoint *prev, TracerPoint *src);
41 };
42 class TracerPoints : public ArrayList<TracerPoint *>
43 {
44 public:
45         TracerPoints() {}
46         ~TracerPoints() { remove_all_objects(); }
47 };
48
49 class TracerConfig
50 {
51 public:
52         TracerConfig();
53         ~TracerConfig();
54
55         int equivalent(TracerConfig &that);
56         void save_data(KeyFrame *keyframe);
57         void read_data(KeyFrame *keyframe);
58         void copy_from(TracerConfig &that);
59         void interpolate(TracerConfig &prev, TracerConfig &next,
60                 long prev_frame, long next_frame, long current_frame);
61         void limits();
62
63         TracerPoints points;
64         int add_point(float x, float y);
65         int add_point();
66         void del_point(int i);
67
68         int draw, fill;
69         int invert, feather;
70         float radius; 
71 };
72
73 class TracePoint
74 {
75 public:
76         int x, y, n;
77         TracePoint() {}
78         TracePoint(int x, int y) {
79                 this->x = x; this->y = y;
80                 this->n = 0;
81         }
82 };
83
84 class TracePoints : public ArrayList<TracePoint>
85 {
86 public:
87         TracePoints() {}
88         void add(int x, int y) {
89                 TracePoint *np = &append();
90                 np->x = x;  np->y = y;
91         }
92         void clear() { remove_all(); }
93 };
94
95
96 class Tracer : public PluginVClient
97 {
98 public:
99         Tracer(PluginServer *server);
100         ~Tracer();
101 // required for all realtime plugins
102         PLUGIN_CLASS_MEMBERS2(TracerConfig)
103         int is_realtime();
104         void update_gui();
105         void render_gui(void *data);
106         int is_dragging();
107         int new_point();
108         void save_data(KeyFrame *keyframe);
109         void read_data(KeyFrame *keyframe);
110         int process_buffer(VFrame *frame, int64_t start_position, double frame_rate);
111         void draw_edge();
112         void draw_mask();
113         void draw_point(TracerPoint *pt);
114         void draw_points();
115         int step();
116         void trace(int i0, int i1);
117         int smooth();
118         void feather(int r, double s);
119         int load_configuration1();
120         void span_keyframes(KeyFrame *src, int64_t start, int64_t end);
121         void update_parameter(TracerPoint *prev, TracerPoint *src);
122         void update_parameter(TracerConfig &prev_config, TracerConfig &src_config,
123                 KeyFrame *keyframe);
124
125         VFrame *edg, *msk, *frm;
126         uint8_t **edg_rows;
127         uint8_t **msk_rows;
128         uint8_t **frm_rows;
129         TracePoints points;
130         int w, w1, h, h1, pts;
131         int ax, ay, bx, by, cx, cy;
132         int ex, ey, nx, ny;
133         int color_model, bpp;
134         int is_float, is_yuv, has_alpha;
135         int comps, comp;
136         int drag, selected;
137 };
138
139 #endif