add auto zoombar/status color, fix 3 batchrender boobies, rotate plugin tweaks, add...
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / color3way / color3way.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 COLOR3WAY_H
23 #define COLOR3WAY_H
24
25 class Color3WayMain;
26 class Color3WayEngine;
27
28 #define SHADOWS 0
29 #define MIDTONES 1
30 #define HIGHLIGHTS 2
31 #define SECTIONS 3
32 #define MAX_COLOR 1.0
33 #define ROOT_2 1.414214
34
35 #include "color3waywindow.h"
36 #include "condition.h"
37 #include "bccolors.h"
38 #include "guicast.h"
39 #include "loadbalance.h"
40 #include "pluginvclient.h"
41 #include "thread.h"
42
43
44 class Color3WayConfig
45 {
46 public:
47         Color3WayConfig();
48
49         int equivalent(Color3WayConfig &that);
50         void copy_from(Color3WayConfig &that);
51         void interpolate(Color3WayConfig &prev,
52                 Color3WayConfig &next,
53                 int64_t prev_frame,
54                 int64_t next_frame,
55                 int64_t current_frame);
56         void boundaries();
57         void copy_to_all(int section);
58
59         float hue_x[SECTIONS];
60         float hue_y[SECTIONS];
61         float value[SECTIONS];
62         float saturation[SECTIONS];
63 };
64
65
66
67
68
69 class Color3WayPackage : public LoadPackage
70 {
71 public:
72         Color3WayPackage();
73         int row1, row2;
74 };
75
76
77 class Color3WayUnit : public LoadClient
78 {
79 public:
80         Color3WayUnit(Color3WayMain *plugin, Color3WayEngine *server);
81         void process_package(LoadPackage *package);
82         Color3WayMain *plugin;
83 };
84
85 class Color3WayEngine : public LoadServer
86 {
87 public:
88         Color3WayEngine(Color3WayMain *plugin, int cpus);
89         ~Color3WayEngine();
90         void init_packages();
91         LoadClient* new_client();
92         LoadPackage* new_package();
93         Color3WayMain *plugin;
94 };
95
96
97
98
99 class Color3WayMain : public PluginVClient
100 {
101 public:
102         Color3WayMain(PluginServer *server);
103         ~Color3WayMain();
104
105 // required for all realtime plugins
106         PLUGIN_CLASS_MEMBERS2(Color3WayConfig);
107         int process_buffer(VFrame *frame,
108                 int64_t start_position,
109                 double frame_rate);
110         int is_realtime();
111         void update_gui();
112         void save_data(KeyFrame *keyframe);
113         void read_data(KeyFrame *keyframe);
114
115         void get_aggregation(int *aggregate_interpolate,
116                 int *aggregate_gamma);
117
118         void calculate_factors(float *r, float *g, float *b, int section);
119         void calculate_factors(float *r, float *g, float *b, float x, float y);
120         void process_pixel(float *r,
121                 float *g,
122                 float *b,
123                 float r_in,
124                 float g_in,
125                 float b_in,
126                 float x,
127                 float y);
128
129 // parameters needed for processor
130         int reconfigure();
131
132         Color3WayEngine *engine;
133         int total_engines;
134
135
136     int r_lookup_8[0x100];
137     int g_lookup_8[0x100];
138     int b_lookup_8[0x100];
139     int r_lookup_16[0x10000];
140     int g_lookup_16[0x10000];
141     int b_lookup_16[0x10000];
142     int redo_buffers;
143         int need_reconfigure;
144         int copy_to_all[SECTIONS];
145         int w, h;
146 };
147
148
149
150 #endif