Created
February 9, 2013 16:45
-
-
Save hirosof/4745967 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
| DWORD CALLBACK ThreadProc_CCB(LPVOID lpVData){ | |
| MyCreateThreadData *lpData = (MyCreateThreadData*)lpVData; | |
| HDC hdc_main = lpData->hDC_Base; | |
| double dHLS[3] , dRGB[3]; | |
| int color_rgb[3]; | |
| double plus_h = 360.0 / (ColorBoxSizeX - 1) , plus_s = 1.0 / (ColorBoxSizeY - 1); | |
| HSConvColorData convdata; | |
| convdata.ModeFlag = 1; | |
| convdata.Color.Pointer.lpInput = dHLS; | |
| convdata.Color.Pointer.lpOutput = dRGB; | |
| SetHSPB_Range(lpData->hProgress , 0 , ColorBoxLightNums); | |
| for (int i = 0; i <= ColorBoxLightNums; i++) | |
| { | |
| dHLS[1] = (double)i / (double)ColorBoxLightNums; | |
| hdc_colorbox[i] = CreateCompatibleDC(hdc_main); | |
| SelectObject(hdc_colorbox[i] , CreateCompatibleBitmap(hdc_main , ColorBoxSizeX , ColorBoxSizeY)); | |
| for (int y = 0; y < ColorBoxSizeY; y++) | |
| { | |
| dHLS[2] = 1.0 - y * plus_s ; | |
| for (int x = 0; x < ColorBoxSizeX; x++) | |
| { | |
| dHLS[0] = x * plus_h; | |
| HSColor2_HLStoRGB(&convdata); | |
| for (int j = 0; j < 3; j++) color_rgb[j] = (int)dRGB[j]; | |
| SetPixel(hdc_colorbox[i] , x , y , RGB(color_rgb[0],color_rgb[1],color_rgb[2])); | |
| } | |
| } | |
| HSPB_SetPos(lpData->hProgress , i); | |
| } | |
| Sleep(1000); | |
| ExitThread(0); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment