Merge branch 'ct' of git.pipapo.org:cinelerra-ct into ct
[cinelerra_cv/ct.git] / plugins / colors / colorpicker.h
blob212214df88f74a985b8974b600d8f899333de148
1 #ifndef COLORPICKER_H
2 #define COLORPICKER_H
4 #include "bcwidgetgrid.h"
5 #include "condition.inc"
6 #include "guicast.h"
7 #include "mutex.inc"
8 #include "thread.h"
9 #include "vframe.inc"
11 class ColorWindow;
12 class PaletteWheel;
13 class PaletteWheelValue;
14 class PaletteOutput;
15 class PaletteHue;
16 class PaletteSaturation;
17 class PaletteValue;
18 class PaletteRed;
19 class PaletteGreen;
20 class PaletteBlue;
21 class PaletteAlpha;
23 class ColorThread : public Thread
25 public:
26 ColorThread(int do_alpha = 0, char *title = 0);
27 ~ColorThread();
30 void run();
31 void start_window(int output, int alpha);
32 virtual int handle_new_color(int output, int alpha);
33 void update_gui(int output, int alpha);
35 private:
36 friend class ColorWindow;
38 ColorWindow *window;
39 Condition *completion;
40 // protects window, output, alpha
41 Mutex *mutex;
42 // Starting color
43 int output;
44 int alpha;
45 int do_alpha;
46 char *title;
49 class ColorWindow : public BC_Window
51 public:
52 ColorWindow(ColorThread *thread, int x, int y, char *title);
54 void create_objects();
55 void change_values();
56 int close_event();
57 void update_display();
58 void update_rgb();
59 int handle_event();
61 ColorThread *thread;
63 PaletteWheel *wheel;
64 PaletteWheelValue *wheel_value;
65 PaletteOutput *output;
66 PaletteHue *hue;
67 PaletteSaturation *saturation;
68 PaletteValue *value;
69 PaletteRed *red;
70 PaletteGreen *green;
71 PaletteBlue *blue;
72 PaletteAlpha *alpha;
73 VFrame *value_bitmap;
74 float h, s, v, r, g, b, a;
75 BC_WidgetGrid *wg, *wg1, *wg2;
79 class PaletteWheel : public BC_SubWindow
81 public:
82 PaletteWheel(ColorWindow *window, int x, int y);
83 ~PaletteWheel();
84 int button_press_event();
85 int cursor_motion_event();
86 int button_release_event();
88 int create_objects();
89 int draw(float hue, float saturation);
90 int get_angle(float x1, float y1, float x2, float y2);
91 float torads(float angle);
92 ColorWindow *window;
93 float oldhue;
94 float oldsaturation;
95 int button_down;
98 class PaletteWheelValue : public BC_SubWindow
100 public:
101 PaletteWheelValue(ColorWindow *window, int x, int y);
102 ~PaletteWheelValue();
103 int create_objects();
104 int button_press_event();
105 int cursor_motion_event();
106 int button_release_event();
107 int draw(float hue, float saturation, float value);
108 ColorWindow *window;
109 int button_down;
110 // Gradient
111 VFrame *frame;
114 class PaletteOutput : public BC_SubWindow
116 public:
117 PaletteOutput(ColorWindow *window, int x, int y);
118 ~PaletteOutput();
119 int create_objects();
120 int handle_event();
121 int draw();
122 ColorWindow *window;
125 class PaletteHue : public BC_ISlider
127 public:
128 PaletteHue(ColorWindow *window, int x, int y);
129 ~PaletteHue();
130 int handle_event();
131 ColorWindow *window;
134 class PaletteSaturation : public BC_FSlider
136 public:
137 PaletteSaturation(ColorWindow *window, int x, int y);
138 ~PaletteSaturation();
139 int handle_event();
140 ColorWindow *window;
143 class PaletteValue : public BC_FSlider
145 public:
146 PaletteValue(ColorWindow *window, int x, int y);
147 ~PaletteValue();
148 int handle_event();
149 ColorWindow *window;
152 class PaletteRed : public BC_FSlider
154 public:
155 PaletteRed(ColorWindow *window, int x, int y);
156 ~PaletteRed();
157 int handle_event();
158 ColorWindow *window;
161 class PaletteGreen : public BC_FSlider
163 public:
164 PaletteGreen(ColorWindow *window, int x, int y);
165 ~PaletteGreen();
166 int handle_event();
167 ColorWindow *window;
170 class PaletteBlue : public BC_FSlider
172 public:
173 PaletteBlue(ColorWindow *window, int x, int y);
174 ~PaletteBlue();
175 int handle_event();
176 ColorWindow *window;
179 class PaletteAlpha : public BC_FSlider
181 public:
182 PaletteAlpha(ColorWindow *window, int x, int y);
183 ~PaletteAlpha();
184 int handle_event();
185 ColorWindow *window;
188 #endif