Credit Andrew - fix bug in render farm usage when using in/out pointers or selection
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / swatch / swatch.h
1 /*
2  * CINELERRA
3  * Copyright (C) 2024 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 #ifndef SWATCH_H
22 #define SWATCH_H
23
24 class SwatchMain;
25 class SwatchEngine;
26 class SwatchWindow;
27 class SwatchEngine;
28
29
30
31 #include "guicast.h"
32 #include "loadbalance.h"
33 #include "pluginvclient.h"
34
35 class SwatchConfig
36 {
37 public:
38         SwatchConfig();
39
40         int equivalent(SwatchConfig &that);
41         void copy_from(SwatchConfig &that);
42         void interpolate(SwatchConfig &prev, 
43                 SwatchConfig &next, 
44                 long prev_frame, 
45                 long next_frame, 
46                 long current_frame);
47
48     int brightness;
49     int saturation;
50     int fix_brightness;
51     int draw_src;
52     int angle;
53 };
54
55
56 class SwatchSlider : public BC_ISlider
57 {
58 public:
59         SwatchSlider(SwatchMain *plugin, 
60         SwatchWindow *gui, 
61         int x, 
62         int y, 
63         int min,
64         int max,
65         int *output);
66         int handle_event();
67         SwatchMain *plugin;
68     int *output;
69 };
70
71 class SwatchRadial : public BC_Radial
72 {
73 public:
74     SwatchRadial(SwatchMain *plugin, 
75         SwatchWindow *gui, 
76         int x, 
77         int y, 
78         const char *text,
79         int fix_brightness);
80         int handle_event();
81         SwatchMain *plugin;
82     SwatchWindow *gui;
83     int fix_brightness;
84 };
85
86 class SwatchCheck : public BC_CheckBox
87 {
88 public:
89     SwatchCheck(SwatchMain *plugin, 
90         int x, 
91         int y, 
92         const char *text,
93         int *output);
94         int handle_event();
95         SwatchMain *plugin;
96     SwatchWindow *gui;
97     int *output;
98 };
99
100 class SwatchWindow : public PluginClientWindow
101 {
102 public:
103         SwatchWindow(SwatchMain *plugin);
104         ~SwatchWindow();
105         
106         void create_objects();
107     void update_fixed();
108
109         SwatchMain *plugin;
110     SwatchSlider *brightness;
111     SwatchSlider *saturation;
112     SwatchSlider *angle;
113     SwatchRadial *fix_brightness;
114     SwatchRadial *fix_saturation;
115     SwatchCheck *draw_src;
116     BC_Title *brightness_title;
117     BC_Title *saturation_title;
118 };
119
120
121
122
123
124
125
126 class SwatchMain : public PluginVClient
127 {
128 public:
129         SwatchMain(PluginServer *server);
130         ~SwatchMain();
131
132         int process_buffer(VFrame *frame,
133                 int64_t start_position,
134                 double frame_rate);
135         int is_realtime();
136         void save_data(KeyFrame *keyframe);
137         void read_data(KeyFrame *keyframe);
138         void update_gui();
139         int is_synthesis();
140         int handle_opengl();
141
142         PLUGIN_CLASS_MEMBERS(SwatchConfig)
143
144         int need_reconfigure;
145
146         VFrame *temp;
147     VFrame *src_temp;
148         SwatchEngine *engine;
149 };
150
151 class SwatchPackage : public LoadPackage
152 {
153 public:
154         SwatchPackage();
155         int y1;
156         int y2;
157 };
158
159 class SwatchUnit : public LoadClient
160 {
161 public:
162         SwatchUnit(SwatchEngine *server, SwatchMain *plugin);
163         void process_package(LoadPackage *package);
164         SwatchEngine *server;
165         SwatchMain *plugin;
166         YUV yuv;
167 };
168
169 class SwatchEngine : public LoadServer
170 {
171 public:
172         SwatchEngine(SwatchMain *plugin, int total_clients, int total_packages);
173         void init_packages();
174
175     void draw_pattern();
176     void draw_src();
177
178         LoadClient* new_client();
179         LoadPackage* new_package();
180         SwatchMain *plugin;
181     int mode;
182 };
183
184
185
186 #endif