-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBitmapToPicDialog.h
132 lines (110 loc) · 3.79 KB
/
BitmapToPicDialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#pragma once
#include "NoFlickerStatic.h"
// fwd decl
class CPicDoc;
// CBitmapToPicDialog dialog
class CBitmapToPicDialog : public CExtNCW<CExtResizableDialog>
{
public:
CBitmapToPicDialog(CWnd* pParent = NULL); // standard constructor
virtual ~CBitmapToPicDialog();
void SetPicPalette(const EGACOLOR *pPalette) { CopyMemory(&_picPalette, pPalette, sizeof(_picPalette)); }
// After DoModal returns IDOK, call this:
void InsertIntoPic(CPicDoc *pepic);
// Dialog Data
enum { IDD = IDD_BITMAPTOPIC };
private:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual void OnCancel();
virtual void OnOK();
static BOOL s_ConvertToPic(HWND hwnd, HANDLE hEvent, CArray<PicCommand, PicCommand> *pcommands, EGACOLOR *pegaTemp, CSize &size, BOOL fIgnoreWhite, EGACOLOR *rgColors, int cColors, BOOL fDontSetPalette);
void _AddToEdit(PCTSTR pszText);
void _SetBitmap(HBITMAP hbmp);
static UINT s_ThreadWorker(void *pParam);
afx_msg void OnConvert();
afx_msg void OnBrowse();
afx_msg void OnPasteFromClipboard();
void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pWnd);
void OnTimer(UINT_PTR nIDEvent);
LRESULT _OnConvertDone(WPARAM wParam, LPARAM lParam);
LRESULT _OnConvertStatus(WPARAM wParam, LPARAM lParam);
LRESULT _OnConvertProgress(WPARAM wParam, LPARAM lParam);
void _UpdateOrigBitmap();
void _PrepareBitmapForConversion();
BOOL _ReallocateCRBitmap(CSize size);
BOOL _Init(Gdiplus::Image *pImage);
void _ApplySettingsToCurrentBitmap();
void _CalculateContrastCenter(Gdiplus::Bitmap *pBitmap, BYTE *pbContrastCenter);
void _DeleteCommands();
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
CExtEdit m_wndEditStatus;
CExtProgressWnd m_wndProgress;
int _iAlgorithm;
int _iPalette;
int _iScaleImage;
int _iIgnoreWhite;
int _nColors;
CExtNoFlickerStatic m_wndPic;
CExtButton m_wndFromClipboard;
CExtNoFlickerStatic m_wndOrig;
// just for prof-uis
CExtSliderWnd m_wndSlider1;
CExtSliderWnd m_wndSlider2;
CExtSliderWnd m_wndSlider3;
CExtSliderWnd m_wndSlider4;
CExtButton m_wndButton1;
CExtButton m_wndButton2;
CExtButton m_wndButton3;
CExtButton m_wndButton4;
CExtRadioButton m_wndRadio1;
CExtRadioButton m_wndRadio2;
CExtRadioButton m_wndRadio3;
CExtRadioButton m_wndRadio4;
CExtRadioButton m_wndRadio5;
CExtRadioButton m_wndRadio6;
CExtRadioButton m_wndRadio7;
CExtRadioButton m_wndRadio8;
CExtRadioButton m_wndRadio9;
CExtGroupBox m_wndGroup1;
CExtGroupBox m_wndGroup2;
CExtGroupBox m_wndGroup3;
CExtGroupBox m_wndGroup4;
CExtCheckBox m_wndCheck1;
CExtCheckBox m_wndCheck2;
CExtLabel m_wndLabel1;
CExtLabel m_wndLabel2;
CExtLabel m_wndLabel3;
// Straight through
COLORREF *_pCRBitmap;
CSize _size;
CWinThread *_pThread;
BOOL _fConverting;
HANDLE _hEvent;
Gdiplus::Bitmap *_pbmpNormal;
int _nContrastCenter;
Gdiplus::Bitmap *_pbmpScaled;
Gdiplus::Bitmap *_pbmpCurrent;
BYTE _bContrastCenterNormal;
BYTE _bContrastCenterScaled;
int _nBrightness;
int _nContrast;
int _nSaturation;
CArray<PicCommand, PicCommand> *_pcommands;
BOOL _fTooBig;
// Optional palette from current pic.
EGACOLOR _picPalette[40];
bool _fInitializedControls;
public:
afx_msg void OnBnClickedRadio4();
afx_msg void OnBnClickedRadio1();
afx_msg void OnBnClickedRadio2();
afx_msg void OnBnClickedRadio3();
afx_msg void OnBnClickedRadio5();
afx_msg void OnBnClickedRadiohalftone();
afx_msg void OnBnClickedRadiosolid();
afx_msg void OnBnClickedRadiohalftonesmooth();
afx_msg void OnScaleClicked();
afx_msg void OnBnClickedRadiopicpalette();
afx_msg void OnBnClickedCheckignorewhite();
};