add auto zoombar/status color, fix 3 batchrender boobies, rotate plugin tweaks, add...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / gamma / gamma.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 LINEARIZE_H
23 #define LINEARIZE_H
24
25 class GammaEngine;
26 class GammaMain;
27
28 #include "gammawindow.h"
29 #include "loadbalance.h"
30 #include "bccolors.h"
31 #include "guicast.h"
32 #include "pluginvclient.h"
33 #include "thread.h"
34
35 #define HISTOGRAM_SIZE 256
36
37 class GammaConfig
38 {
39 public:
40         GammaConfig();
41
42         int equivalent(GammaConfig &that);
43         void reset();
44         void copy_from(GammaConfig &that);
45         void interpolate(GammaConfig &prev,
46                 GammaConfig &next,
47                 int64_t prev_frame,
48                 int64_t next_frame,
49                 int64_t current_frame);
50
51         float max;
52         float gamma;
53         int automatic;
54 // Plot histogram
55         int plot;
56 };
57
58 class GammaPackage : public LoadPackage
59 {
60 public:
61         GammaPackage();
62         int start, end;
63 };
64
65 class GammaUnit : public LoadClient
66 {
67 public:
68         GammaUnit(GammaMain *plugin);
69         void process_package(LoadPackage *package);
70         GammaMain *plugin;
71         int accum[HISTOGRAM_SIZE];
72 };
73
74 class GammaEngine : public LoadServer
75 {
76 public:
77         GammaEngine(GammaMain *plugin);
78
79         void process_packages(int operation, VFrame *data);
80         void init_packages();
81         LoadClient* new_client();
82         LoadPackage* new_package();
83         VFrame *data;
84         int operation;
85         enum
86         {
87                 HISTOGRAM,
88                 APPLY
89         };
90         GammaMain *plugin;
91         int accum[HISTOGRAM_SIZE];
92 };
93
94 class GammaMain : public PluginVClient
95 {
96 public:
97         GammaMain(PluginServer *server);
98         ~GammaMain();
99
100 // required for all realtime plugins
101         int process_buffer(VFrame *frame,
102                 int64_t start_position,
103                 double frame_rate);
104         void calculate_max(VFrame *frame);
105         int is_realtime();
106         void update_gui();
107         void save_data(KeyFrame *keyframe);
108         void read_data(KeyFrame *keyframe);
109         void render_gui(void *data);
110         int handle_opengl();
111
112         GammaEngine *engine;
113         VFrame *frame;
114
115         PLUGIN_CLASS_MEMBERS(GammaConfig)
116 };
117
118
119
120 #endif