15,743,934 members
Home / Discussions / C / C++ / MFC

# C / C++ / MFC

 Re: How do you read / use this code? Vaclav_8-Sep-16 10:16 Vaclav_ 8-Sep-16 10:16
 Re: How do you read / use this code? Bram van Kampen8-Sep-16 14:40 Bram van Kampen 8-Sep-16 14:40
 Re: How do you read / use this code? leon de boer8-Sep-16 17:26 leon de boer 8-Sep-16 17:26
 SOLVED Re: How do you read / use this code? Vaclav_9-Sep-16 18:23 Vaclav_ 9-Sep-16 18:23
 Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp - My best solution Keith Davis3-Sep-16 6:28 Keith Davis 3-Sep-16 6:28
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp Richard MacCutchan3-Sep-16 6:36 Richard MacCutchan 3-Sep-16 6:36
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp Keith Davis3-Sep-16 6:47 Keith Davis 3-Sep-16 6:47
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp Keith Davis3-Sep-16 7:11 Keith Davis 3-Sep-16 7:11
 Here is my C++ implementation of the algorythm: C++ ``` ``` C# ```void __fastcall TForm1::SetRamp(double level, double gamma, double bright, double cntrst){ // level should be between 2 and 100 // gamma should be between 2 and 50 // brigntess should be between 0 and 100 // contrast should be between 0 and 100 HDC GammaDC=GetDC(NULL); WORD GammaArray[3][256]; gamma /= 10; bright = 1 + (((bright - 50) / 100) * 65535); cntrst = 1 + ((cntrst - 50) / 100); level = 1 + ((level - 50) / 100); for(DWORD i=0;i<256;i++){ double value = i * 256; value = (pow(value / 65535, 1 / gamma) * 65535) + 0.5; value = ((((value / 65535) - 0.5) * cntrst) + 0.5) * 65535; value = value += bright; value *= level; if(value>65535){value=65535;} if(value<0){value=0;} GammaArray[0][i]=GammaArray[1][i]=GammaArray[2][i]=(WORD)value; } if(!SetDeviceGammaRamp(GammaDC,GammaArray)){ Memo1->Lines->Add("SetDeviceGammaRamp Failed"); GraphIt(&GammaArray[0][0], false); }else{ GraphIt(&GammaArray[0][0], true); } ReleaseDC(NULL,GammaDC); }```
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp leon de boer4-Sep-16 3:54 leon de boer 4-Sep-16 3:54
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp Keith Davis4-Sep-16 9:10 Keith Davis 4-Sep-16 9:10
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp leon de boer4-Sep-16 22:36 leon de boer 4-Sep-16 22:36
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp Keith Davis5-Sep-16 4:38 Keith Davis 5-Sep-16 4:38
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp leon de boer5-Sep-16 6:06 leon de boer 5-Sep-16 6:06
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp Keith Davis5-Sep-16 8:23 Keith Davis 5-Sep-16 8:23
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp leon de boer5-Sep-16 18:55 leon de boer 5-Sep-16 18:55
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp Keith Davis5-Sep-16 19:55 Keith Davis 5-Sep-16 19:55
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp Keith Davis8-Sep-16 9:31 Keith Davis 8-Sep-16 9:31
 Re: Reference CalculateRamp - How to derive entry arguments from the existing Gamma Ramp - My Solution Keith Davis7-Sep-16 10:30 Keith Davis 7-Sep-16 10:30
 Printer Control Bram van Kampen27-Aug-16 15:38 Bram van Kampen 27-Aug-16 15:38
 Re: Printer Control Richard MacCutchan27-Aug-16 20:31 Richard MacCutchan 27-Aug-16 20:31
 Re: Printer Control Bram van Kampen28-Aug-16 14:20 Bram van Kampen 28-Aug-16 14:20
 Re: Printer Control Richard MacCutchan28-Aug-16 20:56 Richard MacCutchan 28-Aug-16 20:56
 Re: Printer Control Jochen Arndt28-Aug-16 21:38 Jochen Arndt 28-Aug-16 21:38
 Re: Printer Control Richard MacCutchan28-Aug-16 22:03 Richard MacCutchan 28-Aug-16 22:03
 Re: Printer Control Jochen Arndt28-Aug-16 22:09 Jochen Arndt 28-Aug-16 22:09
 Last Visit: 31-Dec-99 18:00     Last Update: 26-Sep-23 2:08 Refresh ᐊ Prev1...365366367368369370371372373374 Next ᐅ