#pragma once #include #include #include "DlgPage.h" // CDlgIndicator 对话框 class dlg_gamma: public dlg_base { int exit_code_; bool is_color_; bool show_all_; RECT paint_area_; HBITMAP bkgnd_; typedef struct _gamma_curve { std::vector points; std::vector coefs; int drag; int left; int right; COLORREF clr; }GAMMACURVE; GAMMACURVE rgb_gray_; GAMMACURVE red_; GAMMACURVE green_; GAMMACURVE blue_; GAMMACURVE* cur_; BOOL handle_message(UINT msg, WPARAM wp, LPARAM lp) override; void handle_command(WORD code, WORD id, HANDLE ctrl); void create_background(void); void init_curve(GAMMACURVE* curv, COLORREF clr = RGB(255, 255, 255)); int add_drag_point(int x, int y); BYTE calc_value(BYTE x); bool is_adjacent(POINT p1, POINT p2); bool hit_test(int* x, int* y); void draw_ellipse(HDC hdc, POINT center, int xl, int yl); void draw_current_curve(HDC hdc); void on_init_dlg(void); void on_paint(HDC hdc); void on_mouse_move(DWORD key, int x, int y); void on_lbutton_down(int x, int y); void on_lbutton_up(int x, int y); void on_combo_sel_changed(int id, int sel); public: dlg_gamma(HWND parent, bool color); ~dlg_gamma(); public: int do_modal(HWND parent); void get_gamma(SANE_Gamma* gamma); void set_gamma(const SANE_Gamma* gamma, bool gray); };