//========================================================================================= /// <summary> /// Updates the actual brightness of the game with the current settings. /// </summary> //========================================================================================= private static void UpdateBrightness() { // Make a gamma ramp: GammaRamp g = new GammaRamp(); // Calculate the gamma ramp: short[] ramp_table = new short[256]; for ( int i = 0 ; i < 256 ; i++ ) { // Calculate the normal intensity of this value: double l = (double)(i) / 255.0; // Adjust by gamma setting: l = Math.Pow( l , 1.0f - ( s_brightness - 1.0f ) ); // Clamp: if ( l > 1.0f ) l = 1.0f; // Back to integer: l *= 65535; // Save to table: ramp_table[i] = (short) l; } // Set tables: g.SetRed(ramp_table); g.SetGreen(ramp_table); g.SetBlue(ramp_table); // Set on graphics device: try { if ( Core.Graphics != null ) Core.Graphics.Device.SetGammaRamp(false,g); } catch ( Exception ){} }
public void SetGammaRamp(bool calibrate, GammaRamp ramp) { throw new NotImplementedException(); }