I understand what is going on with the Gamma Ramp. My question is really a math problem, and thus far the solution is beyond my skill level.
The algorithm previously posted works very well, and gives good control of the gamma ramp. What I don't understand concerning this algorithm is why my question has not been asked before. It seems that the first thing you would want to do is interpret the current settings from the gamma ramp array; and present the current settings to the user so that he can then begin to make adjustments by using the algorithm that I previously posted.
I'm trying to work the problem backwards from the GetDeviceGammaRamp function call to whatever input values would be required to create the current gamma ramp array: What will be the Brightness setting, what will be the Contrast setting, what will be the Level setting, and what will be the Gamma setting "going in".
The way that the input algorithm works is made ever more complex because "value" undergoes four or five operations before arriving at a final input value for each of the 256 members of the array. How to reverse this series of operations has me stumped.
Given any two of the three parts for any of these operations; it is possible to come up with the third part:
For example: any unknown part of 6=2*3 can be determine so long as any two parts are known ie: 3=6/2.
x=pow(y,z): y can be determined using y=pow(x,(1.0/z)); and z can be determined using log(x)/log(y).
The initial "value" is determined by it's place in the array, so this is known to us. Also know to us is the final value of "value" because we can extract it from the current gamma ramp array. So how would you work the problem backwards through each operation from the value of the gamma array [element] to determine each of the values for Brightness, Contrast, Level, and Gamma?
My graph visually demonstrates what is going on with the gamma ramp array. When Gamma is set to input value of 10, the curve is neutralized, and the graph presents a strait line.
When Brightness is lower than 50 the line moves in parallel from the 45 degree angle towards the lower right, and greater that 50 moves the line towards the upper left in parallel.
When Contrast is lower than 50, the graph line pivots clockwise about it's midpoint, and an input greater than 50 will pivot the line counterclockwise about its midpoint.
When Level is adjusted below 50 then the end of the graph line swings downwards while the starting point (0,0) remains stationary; and when Level is adjusted upwards the end of the graph line swings upwards while the starting point remains stationary.
When Gamma is adjusted to either side of 10; the graph line becomes a positive or negative curve.
All very interesting, but it doesn't provide me with any solutions to my problem.
At any rate, thanks for your interest and your input!
In Corona simul veritas