mask mousewheel segv bug, mask opengl sw fallback read to ram, fix tiff config withou...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / maskengine.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 MASKENGINE_H
23 #define MASKENGINE_H
24
25
26 #include "condition.inc"
27 #include "loadbalance.h"
28 #include "maskautos.inc"
29 #include "maskauto.inc"
30 #include "mutex.inc"
31 #include "vframe.inc"
32
33 typedef uint16_t temp_t; // temp is A16
34
35 class MaskEngine;
36
37 // Values for step
38 enum
39 {
40         DO_MASK,
41         DO_FEATHER,
42         DO_APPLY
43 };
44
45
46 class MaskPackage : public LoadPackage
47 {
48 public:
49         MaskPackage();
50         ~MaskPackage();
51
52         int start_x, end_x, start_y, end_y;
53 };
54
55 class MaskUnit : public LoadClient
56 {
57 public:
58         MaskUnit(MaskEngine *engine);
59         ~MaskUnit();
60
61         void draw_line(int v, int x1, int y1, int x2, int y2);
62         void draw_fill(int v);
63         void draw_feather(int ix1,int iy1, int ix2,int iy2);
64         void draw_spot(int ix, int iy);
65         void process_package(LoadPackage *package);
66
67         MaskEngine *engine;
68         int start_y, end_y;
69         int mask_model;
70         float v, r;
71         temp_t *spot;
72 };
73
74 class MaskEngine : public LoadServer
75 {
76 public:
77         MaskEngine(int cpus);
78         ~MaskEngine();
79
80         void do_mask(VFrame *output,
81 // Position relative to project, compensated for playback direction
82                 int64_t start_position_project,
83                 MaskAutos *keyframe_set,
84                 MaskAuto *keyframe,
85                 MaskAuto *default_auto);
86         int points_equivalent(ArrayList<MaskPoint*> *new_points,
87                 ArrayList<MaskPoint*> *points);
88
89         void delete_packages();
90         void init_packages();
91         LoadClient* new_client();
92         LoadPackage* new_package();
93         void draw_edge(MaskEdge &edge, MaskPointSet &points);
94
95         VFrame *output;
96         VFrame *mask, *temp;
97         MaskEdges edges;
98         MaskPointSets point_sets;
99         ArrayList<float> faders;
100         ArrayList<float> feathers;
101         int step, total_submasks;
102         int recalculate;
103         temp_t fade[SUBMASKS+1];
104 };
105
106
107
108 #endif