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