code_twain/sane/DlgGamma.h

61 lines
1.3 KiB
C
Raw Normal View History

2022-06-24 09:01:00 +00:00
#pragma once
#include <Windows.h>
#include <string>
#include "DlgPage.h"
// CDlgIndicator 对话框
class dlg_gamma: public dlg_base
{
int exit_code_;
bool is_color_;
2022-06-27 01:38:12 +00:00
bool show_all_;
2022-06-24 09:01:00 +00:00
RECT paint_area_;
HBITMAP bkgnd_;
typedef struct _gamma_curve
{
std::vector<POINT> points;
std::vector<double> 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);
2023-01-29 07:03:32 +00:00
void layout(void);
2022-06-24 09:01:00 +00:00
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);
2022-06-27 01:38:12 +00:00
void draw_current_curve(HDC hdc);
2022-06-24 09:01:00 +00:00
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);
2022-06-24 09:01:00 +00:00
};