improved plugins with added Tumbler box and visible values
[goodguy/cinelerra.git] / cinelerra-5.1 / plugins / rgbshift / rgbshift.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 RGBSHIFT_H
23 #define RGBSHIFT_H
24
25
26 #include "bcdisplayinfo.h"
27 #include "clip.h"
28 #include "bchash.h"
29 #include "filexml.h"
30 #include "guicast.h"
31 #include "language.h"
32 #include "bccolors.h"
33 #include "pluginvclient.h"
34 #include "theme.h"
35 #include "vframe.h"
36
37 #include <stdint.h>
38 #include <string.h>
39
40 #define MAXVALUE 100
41
42 #define RESET_ALL  0
43 #define RESET_R_DX 1
44 #define RESET_R_DY 2
45 #define RESET_G_DX 3
46 #define RESET_G_DY 4
47 #define RESET_B_DX 5
48 #define RESET_B_DY 6
49
50 class RGBShiftEffect;
51 class RGBShiftWindow;
52 class RGBShiftIText;
53 class RGBShiftISlider;
54 class RGBShiftReset;
55 class RGBShiftClr;
56
57
58 class RGBShiftConfig
59 {
60 public:
61         RGBShiftConfig();
62
63         void reset(int clear);
64         void copy_from(RGBShiftConfig &src);
65         int equivalent(RGBShiftConfig &src);
66         void interpolate(RGBShiftConfig &prev,
67                 RGBShiftConfig &next,
68                 long prev_frame,
69                 long next_frame,
70                 long current_frame);
71
72         int r_dx, r_dy, g_dx, g_dy, b_dx, b_dy;
73 };
74
75 class RGBShiftIText : public BC_TumbleTextBox
76 {
77 public:
78         RGBShiftIText(RGBShiftWindow *window, RGBShiftEffect *plugin,
79                 RGBShiftISlider *slider, int *output, int x, int y, int min, int max);
80         ~RGBShiftIText();
81         int handle_event();
82         RGBShiftWindow *window;
83         RGBShiftEffect *plugin;
84         RGBShiftISlider *slider;
85         int *output;
86         int min, max;
87 };
88
89 class RGBShiftISlider : public BC_ISlider
90 {
91 public:
92         RGBShiftISlider(RGBShiftEffect *plugin, RGBShiftIText *text, int *output, int x, int y);
93         int handle_event();
94         RGBShiftEffect *plugin;
95         RGBShiftIText *text;
96         int *output;
97 };
98
99 class RGBShiftReset : public BC_GenericButton
100 {
101 public:
102         RGBShiftReset(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y);
103         ~RGBShiftReset();
104         int handle_event();
105         RGBShiftEffect *plugin;
106         RGBShiftWindow *window;
107 };
108
109 class RGBShiftClr : public BC_Button
110 {
111 public:
112         RGBShiftClr(RGBShiftEffect *plugin, RGBShiftWindow *window, int x, int y, int clear);
113         ~RGBShiftClr();
114         int handle_event();
115         RGBShiftEffect *plugin;
116         RGBShiftWindow *window;
117         int clear;
118 };
119
120 class RGBShiftWindow : public PluginClientWindow
121 {
122 public:
123         RGBShiftWindow(RGBShiftEffect *plugin);
124         void create_objects();
125         void update_gui(int clear);
126
127         RGBShiftIText *r_dx_text;
128         RGBShiftISlider *r_dx_slider;
129         RGBShiftClr *r_dx_Clr;
130         RGBShiftIText *r_dy_text;
131         RGBShiftISlider *r_dy_slider;
132         RGBShiftClr *r_dy_Clr;
133
134         RGBShiftIText *g_dx_text;
135         RGBShiftISlider *g_dx_slider;
136         RGBShiftClr *g_dx_Clr;
137         RGBShiftIText *g_dy_text;
138         RGBShiftISlider *g_dy_slider;
139         RGBShiftClr *g_dy_Clr;
140
141         RGBShiftIText *b_dx_text;
142         RGBShiftISlider *b_dx_slider;
143         RGBShiftClr *b_dx_Clr;
144         RGBShiftIText *b_dy_text;
145         RGBShiftISlider *b_dy_slider;
146         RGBShiftClr *b_dy_Clr;
147
148         RGBShiftEffect *plugin;
149         RGBShiftReset *reset;
150 };
151
152
153
154 class RGBShiftEffect : public PluginVClient
155 {
156         VFrame *temp_frame;
157 public:
158         RGBShiftEffect(PluginServer *server);
159         ~RGBShiftEffect();
160
161
162         PLUGIN_CLASS_MEMBERS(RGBShiftConfig)
163         int process_realtime(VFrame *input, VFrame *output);
164         int is_realtime();
165         void save_data(KeyFrame *keyframe);
166         void read_data(KeyFrame *keyframe);
167         void update_gui();
168 };
169
170 #endif