remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / cinelerra / colorpicker.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 COLORPICKER_H
23 #define COLORPICKER_H
24
25 #include "bcdialog.h"
26 #include "condition.inc"
27 #include "guicast.h"
28 #include "mutex.inc"
29 #include "thread.h"
30 #include "vframe.inc"
31
32 class ColorWindow;
33 class PaletteWheel;
34 class PaletteWheelValue;
35 class PaletteOutput;
36 class PaletteHue;
37 class PaletteSaturation;
38 class PaletteValue;
39 class PaletteRed;
40 class PaletteGreen;
41 class PaletteBlue;
42 class PaletteAlpha;
43
44 class ColorThread : public BC_DialogThread
45 {
46 public:
47         ColorThread(int do_alpha = 0, const char *title = 0);
48         ~ColorThread();
49
50         void start_window(int output, int alpha, int do_okcancel=0);
51         virtual int handle_new_color(int output, int alpha);
52         void update_gui(int output, int alpha);
53         BC_Window* new_gui();
54
55         int output, alpha;
56         int do_alpha, do_okcancel;
57         const char *title;
58 };
59
60 class ColorWindow : public BC_Window
61 {
62 public:
63         ColorWindow(ColorThread *thread, int x, int y, int w, int h, const char *title);
64
65         void create_objects();
66         void change_values();
67         int close_event();
68         void update_display();
69         void update_rgb();
70         int handle_event();
71
72         ColorThread *thread;
73
74         PaletteWheel *wheel;
75         PaletteWheelValue *wheel_value;
76         PaletteOutput *output;
77         PaletteHue *hue;
78         PaletteSaturation *saturation;
79         PaletteValue *value;
80         PaletteRed *red;
81         PaletteGreen *green;
82         PaletteBlue *blue;
83         PaletteAlpha *alpha;
84         VFrame *value_bitmap;
85         float h, s, v, r, g, b, a;
86 };
87
88
89 class PaletteWheel : public BC_SubWindow
90 {
91 public:
92         PaletteWheel(ColorWindow *window, int x, int y);
93         ~PaletteWheel();
94         int button_press_event();
95         int cursor_motion_event();
96         int button_release_event();
97
98         void create_objects();
99         int draw(float hue, float saturation);
100         int get_angle(float x1, float y1, float x2, float y2);
101         float torads(float angle);
102         ColorWindow *window;
103         float oldhue;
104         float oldsaturation;
105         int button_down;
106 };
107
108 class PaletteWheelValue : public BC_SubWindow
109 {
110 public:
111         PaletteWheelValue(ColorWindow *window, int x, int y);
112         ~PaletteWheelValue();
113         void create_objects();
114         int button_press_event();
115         int cursor_motion_event();
116         int button_release_event();
117         int draw(float hue, float saturation, float value);
118         ColorWindow *window;
119         int button_down;
120 // Gradient
121         VFrame *frame;
122 };
123
124 class PaletteOutput : public BC_SubWindow
125 {
126 public:
127         PaletteOutput(ColorWindow *window, int x, int y);
128         ~PaletteOutput();
129         void create_objects();
130         int handle_event();
131         int draw();
132         ColorWindow *window;
133 };
134
135 class PaletteHue : public BC_ISlider
136 {
137 public:
138         PaletteHue(ColorWindow *window, int x, int y);
139         ~PaletteHue();
140         int handle_event();
141         ColorWindow *window;
142 };
143
144 class PaletteSaturation : public BC_FSlider
145 {
146 public:
147         PaletteSaturation(ColorWindow *window, int x, int y);
148         ~PaletteSaturation();
149         int handle_event();
150         ColorWindow *window;
151 };
152
153 class PaletteValue : public BC_FSlider
154 {
155 public:
156         PaletteValue(ColorWindow *window, int x, int y);
157         ~PaletteValue();
158         int handle_event();
159         ColorWindow *window;
160 };
161
162 class PaletteRed : public BC_FSlider
163 {
164 public:
165         PaletteRed(ColorWindow *window, int x, int y);
166         ~PaletteRed();
167         int handle_event();
168         ColorWindow *window;
169 };
170
171 class PaletteGreen : public BC_FSlider
172 {
173 public:
174         PaletteGreen(ColorWindow *window, int x, int y);
175         ~PaletteGreen();
176         int handle_event();
177         ColorWindow *window;
178 };
179
180 class PaletteBlue : public BC_FSlider
181 {
182 public:
183         PaletteBlue(ColorWindow *window, int x, int y);
184         ~PaletteBlue();
185         int handle_event();
186         ColorWindow *window;
187 };
188
189 class PaletteAlpha : public BC_FSlider
190 {
191 public:
192         PaletteAlpha(ColorWindow *window, int x, int y);
193         ~PaletteAlpha();
194         int handle_event();
195         ColorWindow *window;
196 };
197
198 #endif