Created
October 26, 2012 17:10
-
-
Save hirosof/3959998 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <Windows.h> | |
| #ifndef _CHSLine_H_ | |
| #define _CHSLine_H_ | |
| typedef struct tagCHSLine_Color{ | |
| int rgbflag; | |
| union{ | |
| COLORREF rgb; | |
| struct{ | |
| unsigned __int8 R; | |
| unsigned __int8 G; | |
| unsigned __int8 B; | |
| }_8bitRGB; | |
| struct{ | |
| double R; | |
| double G; | |
| double B; | |
| }_64bitfloatRGB; | |
| }; | |
| struct{ | |
| double H; | |
| double S; | |
| double V; | |
| }HSV; | |
| }CHSLine_Color,*PCHSLine_Color,*LPCHSLine_Color; | |
| class CHSLine{ | |
| private: //プライベート・変数 | |
| HDC hdc; //デバイスコンテキストハンドル | |
| POINT pos; //現在の位置 | |
| double color[3]; //線の色(RGB、ただし0.0~1.0) | |
| private: //プライベート関数 | |
| void ConvertRGBtoHSV(LPCHSLine_Color color); | |
| void ConvertHSVtoRGB(LPCHSLine_Color color); | |
| public: //パブリック関数 | |
| //コンストラクタ | |
| CHSLine(void); | |
| CHSLine(HDC hdc); | |
| //デバイスコンテキスト設定 | |
| HDC SetDC(HDC hdc); | |
| //現在選択されているデバイスコンテキストを取得 | |
| HDC GetDC(void); | |
| //位置設定 | |
| void SetPosition(int x,int y); | |
| void SetPosition(POINT pos); | |
| //現在の位置取得 | |
| POINT GetPosition(void); | |
| //描画(座標指定系) | |
| BOOL Draw(int end_x , int end_y , BOOL SetPosFromEndPos = TRUE); | |
| BOOL Draw(POINT end_pos , BOOL SetPosFromEndPos = TRUE); | |
| BOOL DrawEx(int start_x ,int start_y,int end_x , int end_y , BOOL SetPosFromEndPos = TRUE); | |
| BOOL DrawEx(POINT start,POINT end_pos,BOOL SetPosFromEndPos = TRUE); | |
| BOOL DrawMultiPoint(LPPOINT points,int num,BOOL SetPosFromEndPos = TRUE); | |
| BOOL DrawMultiPointEx(LPPOINT points,int num,BOOL StartOfCurrentPos = TRUE,BOOL SetPosFromEndPos = TRUE); | |
| /* | |
| //描画(サイズ指定系) | |
| BOOL DrawSize(int size_x , int size_y , BOOL SetPosFromEndPos = TRUE); | |
| BOOL DrawSize(SIZE size , BOOL SetPosFromEndPos = TRUE); | |
| BOOL DrawExSize(int start_x,int start_y,int size_x,int size_y,BOOL SetPosFromEndPos = TRUE); | |
| BOOL DrawExSize(POINT start,SIZE size ,BOOL SetPosFromEndPos = TRUE); | |
| */ | |
| //色設定 | |
| COLORREF SetColor(int r , int g , int b); | |
| COLORREF SetColor(COLORREF rgb); | |
| COLORREF SetColorHSV(double h , double s , double v); | |
| //色設定取得 | |
| COLORREF GetColor(int *pr , int *pg , int *pb); | |
| COLORREF GetColorHSV(double *ph , double *ps , double *pv); | |
| }; | |
| #endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment