rework keyframe hide popup, keyframe auto render, textbox set_selection wide text
[goodguy/history.git] / cinelerra-5.1 / cinelerra / overlayframe.h.float
1 #ifndef OVERLAYFRAME_H
2 #define OVERLAYFRAME_H
3
4 #include "loadbalance.h"
5 #include "overlayframe.inc"
6 #include "vframe.inc"
7
8
9
10 // Translation
11
12 typedef struct
13 {
14         int in_x1;
15         float in_fraction1;
16         int in_x2;       // Might be same as in_x1 for boundary
17         float in_fraction2;
18         float output_fraction;
19 } transfer_table;
20
21
22 class ScaleEngine;
23
24 class ScalePackage : public LoadPackage
25 {
26 public:
27         ScalePackage();
28
29         int out_row1, out_row2;
30 };
31
32
33 class ScaleUnit : public LoadClient
34 {
35 public:
36         ScaleUnit(ScaleEngine *server, OverlayFrame *overlay);
37         ~ScaleUnit();
38         
39         float cubic_bspline(float x);
40         void tabulate_bspline(float* &table, 
41                 float scale,
42                 int pixels,
43                 float coefficient);
44
45         void process_package(LoadPackage *package);
46         
47         OverlayFrame *overlay;
48 };
49
50 class ScaleEngine : public LoadServer
51 {
52 public:
53         ScaleEngine(OverlayFrame *overlay, int cpus);
54         ~ScaleEngine();
55         
56         void init_packages();
57         LoadClient* new_client();
58         LoadPackage* new_package();
59         
60         OverlayFrame *overlay;
61 };
62
63
64
65
66
67
68
69 class TranslateEngine;
70
71 class TranslatePackage : public LoadPackage
72 {
73 public:
74         TranslatePackage();
75
76         int out_row1, out_row2;
77 };
78
79
80 class TranslateUnit : public LoadClient
81 {
82 public:
83         TranslateUnit(TranslateEngine *server, OverlayFrame *overlay);
84         ~TranslateUnit();
85
86         void process_package(LoadPackage *package);
87         void translation_array(transfer_table* &table, 
88                 float out_x1, 
89                 float out_x2,
90                 float in_x1,
91                 float in_x2,
92                 int in_total, 
93                 int out_total, 
94                 int &out_x1_int,
95                 int &out_x2_int);
96         void translate(VFrame *output, 
97                         VFrame *input, 
98                         float in_x1,
99                         float in_y1,
100                         float in_x2,
101                         float in_y2,
102                         float out_x1,
103                         float out_y1,
104                         float out_x2,
105                         float out_y2,
106                         float alpha,
107                         int mode,
108                         int row1,
109                         int row2);
110
111         OverlayFrame *overlay;
112 };
113
114 class TranslateEngine : public LoadServer
115 {
116 public:
117         TranslateEngine(OverlayFrame *overlay, int cpus);
118         ~TranslateEngine();
119         
120         void init_packages();
121         LoadClient* new_client();
122         LoadPackage* new_package();
123         
124         OverlayFrame *overlay;
125 };
126
127
128
129
130
131
132
133
134
135 class ScaleTranslateEngine;
136
137 class ScaleTranslatePackage : public LoadPackage
138 {
139 public:
140         ScaleTranslatePackage();
141
142         int out_row1, out_row2;
143 };
144
145
146 class ScaleTranslateUnit : public LoadClient
147 {
148 public:
149         ScaleTranslateUnit(ScaleTranslateEngine *server, OverlayFrame *overlay);
150         ~ScaleTranslateUnit();
151
152         void process_package(LoadPackage *package);
153         void scale_array(int* &table, 
154                 int out_x1, 
155                 int out_x2,
156                 int in_x1,
157                 int in_x2,
158                 int is_x);
159         
160         OverlayFrame *overlay;
161         ScaleTranslateEngine *scale_translate;
162 };
163
164 class ScaleTranslateEngine : public LoadServer
165 {
166 public:
167         ScaleTranslateEngine(OverlayFrame *overlay, int cpus);
168         ~ScaleTranslateEngine();
169         
170         void init_packages();
171         LoadClient* new_client();
172         LoadPackage* new_package();
173         
174         OverlayFrame *overlay;
175         
176         
177 // Arguments
178         VFrame *output;
179         VFrame *input;
180         int in_x1;
181         int in_y1;
182         int in_x2;
183         int in_y2;
184         int out_x1;
185         int out_y1;
186         int out_x2;
187         int out_y2;
188         float alpha;
189         int mode;
190 };
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206 class BlendEngine;
207
208 class BlendPackage : public LoadPackage
209 {
210 public:
211         BlendPackage();
212
213         int out_row1, out_row2;
214 };
215
216
217 class BlendUnit : public LoadClient
218 {
219 public:
220         BlendUnit(BlendEngine *server, OverlayFrame *overlay);
221         ~BlendUnit();
222
223         void process_package(LoadPackage *package);
224         void translation_array(transfer_table* &table, 
225                 float out_x1, 
226                 float out_x2,
227                 float in_x1,
228                 float in_x2,
229                 int in_total, 
230                 int out_total, 
231                 int &out_x1_int,
232                 int &out_x2_int);
233         void translate(VFrame *output, 
234                         VFrame *input, 
235                         float in_x1,
236                         float in_y1,
237                         float in_x2,
238                         float in_y2,
239                         float out_x1,
240                         float out_y1,
241                         float out_x2,
242                         float out_y2,
243                         float alpha,
244                         int mode,
245                         int row1,
246                         int row2);
247
248         OverlayFrame *overlay;
249         BlendEngine *blend_engine;
250 };
251
252 class BlendEngine : public LoadServer
253 {
254 public:
255         BlendEngine(OverlayFrame *overlay, int cpus);
256         ~BlendEngine();
257         
258         void init_packages();
259         LoadClient* new_client();
260         LoadPackage* new_package();
261         
262         OverlayFrame *overlay;
263         
264         
265 // Arguments
266         VFrame *output;
267         VFrame *input;
268         float alpha;
269         int mode;
270 };
271
272
273
274
275
276
277
278
279
280
281
282
283
284 class OverlayFrame
285 {
286 public:
287         OverlayFrame(int cpus = 1);
288         virtual ~OverlayFrame();
289
290 // Alpha is from 0 - 1
291         int overlay(VFrame *output, 
292                 VFrame *input, 
293                 float in_x1, 
294                 float in_y1, 
295                 float in_x2, 
296                 float in_y2, 
297                 float out_x1, 
298                 float out_y1, 
299                 float out_x2, 
300                 float out_y2, 
301                 float alpha, 
302                 int mode,
303                 int interpolation_type);
304
305         int overlay(VFrame *output, unsigned char *input,
306                 float in_x1, float in_y1, float in_x2, float in_y2,
307                 float out_x1, float out_y1, float out_x2, float out_y2, 
308                 int alpha, int in_w, int in_h);
309         int use_alpha, use_float, mode, interpolate;
310         int color_model;
311
312         BlendEngine *blend_engine;
313         ScaleEngine *scale_engine;
314         TranslateEngine *translate_engine;
315         ScaleTranslateEngine *scaletranslate_engine;
316
317
318         VFrame *temp_frame;
319         int cpus;
320
321 // TODO: These should all be in their respective Engine
322 // Global parameters for scaling units
323         VFrame *scale_output;
324         VFrame *scale_input;
325         float w_scale;
326         float h_scale;
327         int in_x1_int;
328         int in_y1_int;
329         int out_w_int;
330         int out_h_int;
331         int interpolation_type;
332 // Global parameters for translate units
333         VFrame *translate_output;
334         VFrame *translate_input;
335         float translate_in_x1;
336         float translate_in_y1;
337         float translate_in_x2;
338         float translate_in_y2;
339         float translate_out_x1;
340         float translate_out_y1;
341         float translate_out_x2;
342         float translate_out_y2;
343         float translate_alpha;
344         int translate_mode;
345 };
346
347 #endif