1 | /**********************************************************************
|
---|
2 | *<
|
---|
3 | FILE: hsv.h
|
---|
4 |
|
---|
5 | DESCRIPTION:
|
---|
6 |
|
---|
7 | CREATED BY: Dan Silva
|
---|
8 |
|
---|
9 | HISTORY:
|
---|
10 |
|
---|
11 | *> Copyright (c) 1994, All Rights Reserved.
|
---|
12 | **********************************************************************/
|
---|
13 |
|
---|
14 | #ifndef __HSV__H
|
---|
15 | #define __HSV__H
|
---|
16 |
|
---|
17 |
|
---|
18 | #define MAXCOLORS 16
|
---|
19 |
|
---|
20 |
|
---|
21 | // This callback proc gets called after every mouse button up to tell you the
|
---|
22 | // new color, if you want to do interactive update.
|
---|
23 |
|
---|
24 | class HSVCallback {
|
---|
25 | public:
|
---|
26 | virtual void ButtonDown() {}
|
---|
27 | virtual void ButtonUp(BOOL accept) {}
|
---|
28 | virtual void ColorChanged(DWORD col, BOOL buttonUp)=0;
|
---|
29 | virtual void BeingDestroyed(IPoint2 pos)=0; // gets called when picker is closed:
|
---|
30 | };
|
---|
31 |
|
---|
32 | // Put up the dialog.
|
---|
33 | extern CoreExport int HSVDlg_Do(
|
---|
34 | HWND hwndOwner, // owning window
|
---|
35 | DWORD *lpc, // pointer to color to be edited
|
---|
36 | IPoint2 *spos, // starting position, set to ending position
|
---|
37 | HSVCallback *callBack, // called when color changes
|
---|
38 | TCHAR *name // name of color being edited
|
---|
39 | );
|
---|
40 |
|
---|
41 | CoreExport void RGBtoHSV (DWORD rgb, int *ho, int *so, int *vo);
|
---|
42 | CoreExport DWORD HSVtoRGB (int H, int S, int V);
|
---|
43 | CoreExport void HSVtoHWBt (int h, int s, int v, int *ho, int *w, int *bt);
|
---|
44 | CoreExport void HWBttoHSV (int h, int w, int bt, int *ho, int *s, int *v);
|
---|
45 |
|
---|
46 | // RB: Added floating point versions
|
---|
47 | class Color;
|
---|
48 | CoreExport Color RGBtoHSV(Color rgb);
|
---|
49 | CoreExport Color HSVtoRGB(Color hsv);
|
---|
50 |
|
---|
51 |
|
---|
52 | // MODELESS Version
|
---|
53 |
|
---|
54 | class ColorPicker {
|
---|
55 | public:
|
---|
56 | ColorPicker() {}
|
---|
57 | virtual ~ColorPicker() {};
|
---|
58 | virtual void ModifyColor (DWORD color)=0;
|
---|
59 | virtual void SetNewColor (DWORD color, TCHAR *name)=0;
|
---|
60 | virtual DWORD GetColor()=0;
|
---|
61 | virtual IPoint2 GetPosition()=0;
|
---|
62 | virtual void Destroy()=0; //when parent is going away.
|
---|
63 | virtual void InstallNewCB(DWORD col, HSVCallback *pcb, TCHAR *name)=0;
|
---|
64 | };
|
---|
65 |
|
---|
66 | CoreExport ColorPicker *CreateColorPicker(HWND hwndOwner, DWORD initColor,
|
---|
67 | IPoint2* spos, HSVCallback *pcallback, TCHAR *name, int objClr=0);
|
---|
68 |
|
---|
69 | CoreExport void SetCPInitPos(IPoint2 &pos);
|
---|
70 | CoreExport IPoint2 GetCPInitPos(void);
|
---|
71 |
|
---|
72 | #define WM_ADD_COLOR (WM_USER+2321) // wParam = color
|
---|
73 |
|
---|
74 | #endif
|
---|