X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fcolorpicker.h;h=0ae021edc6a31696785a5cfc88a2876c70769b24;hp=2d69a92d8526b89491e29bdbede9dc952212a480;hb=2e48b660e37eb5c661264d601211e16cb6cd6e89;hpb=21c2e6b36d6a96c2f662a89459d607b5a387f4eb diff --git a/cinelerra-5.1/cinelerra/colorpicker.h b/cinelerra-5.1/cinelerra/colorpicker.h index 2d69a92d..0ae021ed 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.h +++ b/cinelerra-5.1/cinelerra/colorpicker.h @@ -22,30 +22,47 @@ #ifndef COLORPICKER_H #define COLORPICKER_H +#include "bcbutton.h" #include "bcdialog.h" +#include "bctextbox.h" +#include "bcsubwindow.h" +#include "clip.h" #include "condition.inc" #include "guicast.h" #include "mutex.inc" #include "thread.h" #include "vframe.inc" +#define PALLETTE_HISTORY_SIZE 16 + class ColorWindow; class PaletteWheel; class PaletteWheelValue; class PaletteOutput; class PaletteHue; -class PaletteSaturation; -class PaletteValue; +class PaletteSat; +class PaletteVal; class PaletteRed; -class PaletteGreen; -class PaletteBlue; +class PaletteGrn; +class PaletteBlu; +class PaletteLum; +class PaletteCr; +class PaletteCb; class PaletteAlpha; +class PaletteHSV; +class PaletteRGB; +class PaletteYUV; +class PaletteAPH; +class PaletteHexButton; +class PaletteHex; +class PaletteGrabButton; +class PaletteHistory; -class ColorThread : public BC_DialogThread +class ColorPicker : public BC_DialogThread { public: - ColorThread(int do_alpha = 0, const char *title = 0); - ~ColorThread(); + ColorPicker(int do_alpha = 0, const char *title = 0); + ~ColorPicker(); void start_window(int output, int alpha, int do_okcancel=0); virtual int handle_new_color(int output, int alpha); @@ -60,29 +77,65 @@ public: class ColorWindow : public BC_Window { public: - ColorWindow(ColorThread *thread, int x, int y, int w, int h, const char *title); + ColorWindow(ColorPicker *thread, int x, int y, int w, int h, const char *title); + ~ColorWindow(); void create_objects(); void change_values(); int close_event(); void update_display(); void update_rgb(); + void update_hsv(); + void update_yuv(); int handle_event(); + void get_screen_sample(); + int cursor_motion_event(); + int button_press_event(); + int button_release_event(); - ColorThread *thread; + struct { float r, g, b; } rgb; + struct { float y, u, v; } yuv; + struct { float h, s, v; } hsv; + float aph; + void update_rgb(float r, float g, float b); + void update_hsv(float h, float s, float v); + void update_yuv(float y, float u, float v); + void update_rgb_hex(const char *hex); + int rgb888(); + ColorPicker *thread; PaletteWheel *wheel; PaletteWheelValue *wheel_value; PaletteOutput *output; PaletteHue *hue; - PaletteSaturation *saturation; - PaletteValue *value; + PaletteSat *sat; + PaletteVal *val; PaletteRed *red; - PaletteGreen *green; - PaletteBlue *blue; + PaletteGrn *grn; + PaletteBlu *blu; + PaletteLum *lum; + PaletteCr *c_r; + PaletteCb *c_b; PaletteAlpha *alpha; + + PaletteHSV *hsv_h, *hsv_s, *hsv_v; + PaletteRGB *rgb_r, *rgb_g, *rgb_b; + PaletteYUV *yuv_y, *yuv_u, *yuv_v; + PaletteAPH *aph_a; + + PaletteHexButton *hex_btn; + PaletteHex *hex_box; + PaletteGrabButton *grab_btn; + PaletteHistory *history; + VFrame *value_bitmap; - float h, s, v, r, g, b, a; + int button_grabbed; + + int palette_history[PALLETTE_HISTORY_SIZE]; + void load_history(); + void save_history(); + void update_history(int color); + void update_history(); }; @@ -141,20 +194,20 @@ public: ColorWindow *window; }; -class PaletteSaturation : public BC_FSlider +class PaletteSat : public BC_FSlider { public: - PaletteSaturation(ColorWindow *window, int x, int y); - ~PaletteSaturation(); + PaletteSat(ColorWindow *window, int x, int y); + ~PaletteSat(); int handle_event(); ColorWindow *window; }; -class PaletteValue : public BC_FSlider +class PaletteVal : public BC_FSlider { public: - PaletteValue(ColorWindow *window, int x, int y); - ~PaletteValue(); + PaletteVal(ColorWindow *window, int x, int y); + ~PaletteVal(); int handle_event(); ColorWindow *window; }; @@ -168,20 +221,20 @@ public: ColorWindow *window; }; -class PaletteGreen : public BC_FSlider +class PaletteGrn : public BC_FSlider { public: - PaletteGreen(ColorWindow *window, int x, int y); - ~PaletteGreen(); + PaletteGrn(ColorWindow *window, int x, int y); + ~PaletteGrn(); int handle_event(); ColorWindow *window; }; -class PaletteBlue : public BC_FSlider +class PaletteBlu : public BC_FSlider { public: - PaletteBlue(ColorWindow *window, int x, int y); - ~PaletteBlue(); + PaletteBlu(ColorWindow *window, int x, int y); + ~PaletteBlu(); int handle_event(); ColorWindow *window; }; @@ -195,4 +248,126 @@ public: ColorWindow *window; }; +class PaletteLum : public BC_FSlider +{ +public: + PaletteLum(ColorWindow *window, int x, int y); + ~PaletteLum(); + int handle_event(); + ColorWindow *window; +}; + +class PaletteCr : public BC_FSlider +{ +public: + PaletteCr(ColorWindow *window, int x, int y); + ~PaletteCr(); + int handle_event(); + ColorWindow *window; +}; + +class PaletteCb : public BC_FSlider +{ +public: + PaletteCb(ColorWindow *window, int x, int y); + ~PaletteCb(); + int handle_event(); + ColorWindow *window; +}; + +class PaletteNum : public BC_TumbleTextBox +{ +public: + ColorWindow *window; + float *output; + + PaletteNum(ColorWindow *window, int x, int y, + float &output, float min, float max); + ~PaletteNum(); + void update_output() { *output = atof(get_text()); } + static int calculate_h() { return BC_Tumbler::calculate_h(); } +}; + +class PaletteRGB : public PaletteNum +{ +public: + PaletteRGB(ColorWindow *window, int x, int y, + float &output, float min, float max) + : PaletteNum(window, x, y, output, min, max) {} + int handle_event(); +}; + +class PaletteYUV : public PaletteNum +{ +public: + PaletteYUV(ColorWindow *window, int x, int y, + float &output, float min, float max) + : PaletteNum(window, x, y, output, min, max) {} + int handle_event(); +}; + +class PaletteHSV : public PaletteNum +{ +public: + PaletteHSV(ColorWindow *window, int x, int y, + float &output, float min, float max) + : PaletteNum(window, x, y, output, min, max) {} + int handle_event(); +}; + +class PaletteAPH : public PaletteNum +{ +public: + PaletteAPH(ColorWindow *window, int x, int y, + float &output, float min, float max) + : PaletteNum(window, x, y, output, min, max) {} + int handle_event(); +}; + +class PaletteHexButton : public BC_GenericButton +{ +public: + PaletteHexButton(ColorWindow *window, int x, int y); + ~PaletteHexButton(); + int handle_event(); + ColorWindow *window; +}; + +class PaletteHex : public BC_TextBox +{ +public: + PaletteHex(ColorWindow *window, int x, int y, const char *hex); + ~PaletteHex(); + int keypress_event(); + void update(); + ColorWindow *window; +}; + +class PaletteGrabButton : public BC_Button +{ +public: + PaletteGrabButton(ColorWindow *window, int x, int y); + ~PaletteGrabButton(); + int handle_event(); + + ColorWindow *window; + VFrame *vframes[3]; +}; + +class PaletteHistory : public BC_SubWindow +{ +public: + PaletteHistory(ColorWindow *window, int x, int y); + ~PaletteHistory(); + void update(int flush=1); + int button_press_event(); + int button_release_event(); + int cursor_motion_event(); + int cursor_leave_event(); + int repeat_event(int64_t duration); + + ColorWindow *window; + int button_down; +}; + #endif