add 1:1 convert, add es.po: thx sergio, cwdw zoom tweak, add done beep pots, bd forma...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / maskauto.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
5  *
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.
10  *
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.
15  *
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
19  *
20  */
21
22 #ifndef MASKAUTO_H
23 #define MASKAUTO_H
24
25
26 #include "arraylist.h"
27 #include "auto.h"
28 #include "maskauto.inc"
29 #include "maskautos.inc"
30
31 class MaskPoint
32 {
33 public:
34         MaskPoint();
35
36         int operator==(MaskPoint& ptr);
37         MaskPoint& operator=(MaskPoint& ptr);
38         void copy_from(MaskPoint &ptr);
39
40         float x, y;
41 // Incoming acceleration
42         float control_x1, control_y1;
43 // Outgoing acceleration
44         float control_x2, control_y2;
45 };
46
47 class MaskCoord { public: double x, y, z; };
48
49 class MaskEdge : public ArrayList<MaskCoord>
50 {
51 public:
52         MaskCoord &append(double x, double y, double z=0) {
53                 MaskCoord &c = ArrayList<MaskCoord>::append();
54                 c.x = x;  c.y = y;  c.z = z;
55                 return c;
56         }
57         void load(MaskPoints &points, float ofs);
58 };
59
60 class MaskEdges : public ArrayList<MaskEdge*> {
61 public:
62         MaskEdges() {}
63         ~MaskEdges() { remove_all_objects(); }
64 };
65
66 class MaskPoints : public ArrayList<MaskPoint *>
67 {
68 public:
69         void clear() { remove_all_objects(); }
70         MaskPoints() {}
71         ~MaskPoints() { clear(); }
72 };
73
74 class MaskPointSets : public ArrayList<MaskPoints*>
75 {
76 public:
77         void clear() { remove_all_objects(); }
78         MaskPointSets() {}
79         ~MaskPointSets() { clear(); }
80 };
81
82 #define FEATHER_MAX 100
83 // GL reg limit 1024 incls shader param list
84 #define MAX_FEATHER 1000
85
86 class SubMask
87 {
88 public:
89         SubMask(MaskAuto *keyframe, int no);
90         ~SubMask();
91
92         int operator==(SubMask& ptr);
93         int equivalent(SubMask& ptr);
94         void copy_from(SubMask& ptr, int do_name=1);
95         void load(FileXML *file);
96         void copy(FileXML *file);
97         void dump(FILE *fp);
98
99         char name[BCSTRLEN];
100         float fader;
101         float feather;
102         MaskPoints points;
103         MaskAuto *keyframe;
104 };
105
106 class MaskAuto : public Auto
107 {
108 public:
109         MaskAuto(EDL *edl, MaskAutos *autos);
110         ~MaskAuto();
111
112         int operator==(Auto &that);
113         int operator==(MaskAuto &that);
114         bool is_maskauto() { return true; }
115         int identical(MaskAuto *src);
116         void load(FileXML *file);
117         void copy(int64_t start, int64_t end, FileXML *file, int default_auto);
118         void copy_from(Auto *src);
119         int interpolate_from(Auto *a1, Auto *a2, int64_t position, Auto *templ=0);
120         void copy_from(MaskAuto *src);
121 // Copy data but not position
122         void copy_data(MaskAuto *src);
123         void get_points(MaskPoints *points,
124                 int submask);
125         void set_points(MaskPoints *points,
126                 int submask);
127
128 // Copy parameters to this which differ between ref & src
129         void update_parameter(MaskAuto *ref, MaskAuto *src);
130
131         void dump(FILE *fp);
132 // Retrieve submask with clamping
133         SubMask* get_submask(int number);
134 // Translates all submasks
135         void translate_submasks(float translate_x, float translate_y);
136 // scale all submasks
137         void scale_submasks(int orig_scale, int new_scale);
138         int has_active_mask();
139
140         ArrayList<SubMask*> masks;
141         int apply_before_plugins;
142         int disable_opengl_masking;
143 };
144
145 // shader buffer unsized array vec only seems to work for dvec (05/2019)
146 class MaskSpot { public: double x, y; };
147
148 class MaskSpots : public ArrayList<MaskSpot>
149 {
150 public:
151         MaskSpot &append() { return ArrayList<MaskSpot>::append(); }
152         MaskSpot &append(double x, double y) {
153                 MaskSpot &s = append();
154                 s.x = x;  s.y = y;
155                 return s;
156         }
157 };
158
159 #endif