2 ===========================================================================
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
26 ===========================================================================
29 #ifndef __DIALOGCOLORPICKER__
30 #define __DIALOGCOLORPICKER__
32 // Original ColorPicker/DIB source by Rajiv Ramachandran <rrajivram@hotmail.com>
33 // included with permission from the author
38 #define PI 3.14159265358
42 #define TOSCALE(x) (((x)*RADIUS)/255.0)
43 #define SCALETOMAX(x) (((x)*255.0)/RADIUS)
50 #define BAD_SLOPE 1000000.0
56 COLORREF color() { return RGB( r, g, b ); }
73 class CDialogColorPicker : public CDialog
77 CDialogColorPicker(COLORREF c,CWnd* pParent = NULL); // standard constructor
78 ~CDialogColorPicker();
80 COLORREF GetColor() { return color.color();};
81 float GetOverBright() { return overBright; };
85 //{{AFX_DATA(CDialogColorPicker)
86 enum { IDD = IDD_DIALOG_COLORS };
90 void (*UpdateParent)( float r, float g, float b, float a );
93 // ClassWizard generated virtual function overrides
94 //{{AFX_VIRTUAL(CDialogColorPicker)
100 // Generated message map functions
101 //{{AFX_MSG(CDialogColorPicker)
102 afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
103 afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
104 afx_msg void OnMouseMove(UINT nFlags, CPoint point);
105 afx_msg void OnSysColorChange();
106 afx_msg void OnPaint();
107 virtual BOOL OnInitDialog();
108 afx_msg void OnChangeEditBlue();
109 afx_msg void OnChangeEditGreen();
110 afx_msg void OnChangeEditHue();
111 afx_msg void OnChangeEditRed();
112 afx_msg void OnChangeEditSat();
113 afx_msg void OnChangeEditVal();
114 afx_msg void OnChangeEditOverbright();
115 afx_msg void OnTimer(UINT nIDEvent);
116 afx_msg void OnBtnColor();
118 DECLARE_MESSAGE_MAP()
120 void DrawFilledColor(CDC *pDC,CRect cr,COLORREF c);
121 void DrawLines(CDC *pDC);
122 void DrawXorRect(CDC *pDC,CRect& cr);
126 void CreateBrightDIB();
127 void SetDIBPalette();
128 void DrawMarkers(CDC *pDC);
129 void TrackPoint(CPoint pt);
132 BOOL InCircle(CPoint pt);
133 BOOL InBright(CPoint pt);
134 BOOL InOverBright(CPoint pt);
141 void DrawRGB(CDC *pDC);
142 void DrawHSB(CDC *pDC);
144 void LoadMappedBitmap(CBitmap& bitmap,UINT nIdResource,CSize& size);
146 CBitmap m_RgbBitmap,m_HsbBitmap;
158 CRect m_CurrentRect,brightMark;
160 CRect overBrightRect;
191 bool DoNewColor( int* i1, int* i2, int* i3, float *overBright, void (*Update)( float, float, float, float ) = NULL );
193 #endif /* !__DIALOGCOLORPICKER__ */