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         void save_data(KeyFrame *keyframe);
56         void read_data(KeyFrame *keyframe);
57         int equivalent(TracerConfig &that);
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 drag, draw, fill;
69         int invert, feather;
70         float radius; 
71         int selected;
72 };
73
74 class TracePoint
75 {
76 public:
77         int x, y, n;
78         TracePoint() {}
79         TracePoint(int x, int y) {
80                 this->x = x; this->y = y;
81                 this->n = 0;
82         }
83 };
84
85 class TracePoints : public ArrayList<TracePoint>
86 {
87 public:
88         TracePoints() {}
89         void add(int x, int y) {
90                 TracePoint *np = &append();
91                 np->x = x;  np->y = y;
92         }
93         void clear() { remove_all(); }
94 };
95
96
97 class Tracer : public PluginVClient
98 {
99 public:
100         Tracer(PluginServer *server);
101         ~Tracer();
102 // required for all realtime plugins
103         PLUGIN_CLASS_MEMBERS2(TracerConfig)
104         int is_realtime();
105         void update_gui();
106         int new_point();
107         void save_data(KeyFrame *keyframe);
108         void read_data(KeyFrame *keyframe);
109         int process_buffer(VFrame *frame, int64_t start_position, double frame_rate);
110         void draw_edge();
111         void draw_mask();
112         void draw_point(TracerPoint *pt);
113         void draw_points();
114         int step();
115         void trace(int i0, int i1);
116         int smooth();
117         void feather(int r, double s);
118         int load_configuration1();
119         void span_keyframes(KeyFrame *src, int64_t start, int64_t end);
120         void update_parameter(TracerPoint *prev, TracerPoint *src);
121         void update_parameter(TracerConfig &prev_config, TracerConfig &src_config,
122                 KeyFrame *keyframe);
123
124         VFrame *edg, *msk, *frm;
125         uint8_t **edg_rows;
126         uint8_t **msk_rows;
127         uint8_t **frm_rows;
128         TracePoints points;
129         int w, w1, h, h1, pts;
130         int ax, ay, bx, by, cx, cy;
131         int ex, ey, nx, ny;
132         int color_model, bpp;
133         int is_float, is_yuv, has_alpha;
134         int comps, comp;
135 };
136
137 #endif