source: golgotha/src/max_plugin/sdk_inc/hsv.h @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 11 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
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
24class 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.
33extern 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
41CoreExport void RGBtoHSV (DWORD rgb, int *ho, int *so, int *vo);
42CoreExport DWORD HSVtoRGB (int H, int S, int V);
43CoreExport void HSVtoHWBt (int h, int s, int v, int *ho, int *w, int *bt);
44CoreExport void HWBttoHSV (int h, int w, int bt, int *ho, int *s, int *v);
45
46// RB: Added floating point versions
47class Color;
48CoreExport Color RGBtoHSV(Color rgb);
49CoreExport Color HSVtoRGB(Color hsv);
50
51
52// MODELESS Version
53
54class 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
66CoreExport ColorPicker *CreateColorPicker(HWND hwndOwner, DWORD initColor,
67         IPoint2* spos, HSVCallback *pcallback, TCHAR *name, int objClr=0);
68         
69CoreExport void SetCPInitPos(IPoint2 &pos);
70CoreExport IPoint2 GetCPInitPos(void); 
71
72#define WM_ADD_COLOR    (WM_USER+2321)  // wParam = color
73
74#endif
Note: See TracBrowser for help on using the repository browser.