add auto zoombar/status color, fix 3 batchrender boobies, rotate plugin tweaks, add...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / histeq / histeq.h
1
2 /*
3  * CINELERRA
4  * Copyright (C) 1997-2011 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 HISTOGRAM_H
23 #define HISTOGRAM_H
24
25
26 #include "histeq.inc"
27 #include "loadbalance.h"
28 #include "bccolors.h"
29 #include "pluginvclient.h"
30
31 class HistEqConfig {
32 public:
33         HistEqConfig();
34         ~HistEqConfig();
35
36         int split;
37         int plot;
38         float blend;
39         float gain;
40
41         void copy_from(HistEqConfig &that);
42         int equivalent(HistEqConfig &that);
43         void interpolate(HistEqConfig &prev, HistEqConfig &next,
44                 int64_t prev_frame, int64_t next_frame, int64_t current_frame);
45 };
46
47 class HistEqSplit : public BC_CheckBox
48 {
49 public:
50         HistEqSplit(HistEqWindow *gui, HistEqMain *plugin, int x, int y);
51         ~HistEqSplit();
52         int handle_event();
53
54         HistEqWindow *gui;
55         HistEqMain *plugin;
56 };
57
58 class HistEqPlot : public BC_CheckBox
59 {
60 public:
61         HistEqPlot(HistEqWindow *gui, HistEqMain *plugin, int x, int y);
62         ~HistEqPlot();
63         int handle_event();
64
65         HistEqWindow *gui;
66         HistEqMain *plugin;
67 };
68
69 class HistEqBlend : public BC_FSlider
70 {
71 public:
72         HistEqBlend(HistEqWindow *gui, HistEqMain *plugin, int x, int y);
73         ~HistEqBlend();
74         int handle_event();
75
76         HistEqWindow *gui;
77         HistEqMain *plugin;
78 };
79
80 class HistEqGain : public BC_FSlider
81 {
82 public:
83         HistEqGain(HistEqWindow *gui, HistEqMain *plugin, int x, int y);
84         ~HistEqGain();
85         int handle_event();
86
87         HistEqWindow *gui;
88         HistEqMain *plugin;
89 };
90
91 class HistEqCanvas : public BC_SubWindow
92 {
93 public:
94         HistEqCanvas(HistEqWindow *gui, HistEqMain *plugin,
95                 int x, int y, int w, int h);
96         void clear();
97         void draw_bins(HistEqMain *plugin);
98         void draw_wts(HistEqMain *plugin);
99         void draw_reg(HistEqMain *plugin);
100         void draw_lut(HistEqMain *plugin);
101         void update(HistEqMain *plugin);
102
103         HistEqMain *plugin;
104         HistEqWindow *gui;
105 };
106
107 class HistEqWindow : public PluginClientWindow
108 {
109 public:
110         HistEqWindow(HistEqMain *plugin);
111         ~HistEqWindow();
112
113         HistEqMain *plugin;
114         HistEqSplit *split;
115         HistEqPlot *plot;
116         HistEqBlend *blend;
117         HistEqGain *gain;
118         HistEqCanvas *canvas;
119
120         void create_objects();
121         void update();
122 };
123
124 class HistEqMain : public PluginVClient
125 {
126 public:
127         HistEqMain(PluginServer *server);
128         ~HistEqMain();
129
130         int process_buffer(VFrame *frame, int64_t start_position, double frame_rate);
131         int is_realtime();
132         void save_data(KeyFrame *keyframe);
133         void read_data(KeyFrame *keyframe);
134         void update_gui();
135
136         void render_gui(void *data);
137
138         PLUGIN_CLASS_MEMBERS(HistEqConfig)
139
140         VFrame *input, *output;
141         HistEqEngine *engine;
142         int w, h;
143         int sz;
144         double a, b;
145         int binsz, bsz, *bins;
146         int lutsz, lsz, *lut;
147         int wsz;  float *wts;
148 };
149
150 class HistEqPackage : public LoadPackage
151 {
152 public:
153         HistEqPackage();
154         int y0, y1;
155 };
156
157 class HistEqUnit : public LoadClient
158 {
159 public:
160         HistEqUnit(HistEqEngine *server, HistEqMain *plugin);
161         ~HistEqUnit();
162         void process_package(LoadPackage *package);
163         HistEqEngine *server;
164         HistEqMain *plugin;
165         int valid;
166         int binsz, *bins;
167 };
168
169 class HistEqEngine : public LoadServer
170 {
171 public:
172         HistEqEngine(HistEqMain *plugin, int total_clients, int total_packages);
173         void process_packages(int operation, VFrame *data);
174         void init_packages();
175         LoadClient* new_client();
176         LoadPackage* new_package();
177         HistEqMain *plugin;
178         int operation;
179
180         enum { HISTEQ, APPLY };
181         VFrame *data;
182 };
183
184 #endif