GraphicsDevice.SetGammaRamp Method
Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)
public void SetGammaRamp ( bool calibrate, GammaRamp ramp )
Parameters
- calibrate
- [MarshalAsAttribute(U1)] true to indicate that correction should be applied. false to indicate that no gamma correction should be applied. The supplied gamma table is transferred directly to the GraphicsDevice.
- ramp
- The gamma correction ramp to set.
| Exception type | Condition |
|---|---|
| ArgumentNullException | ramp is null. |
| InvalidOperationException | The arrays used in the red, green, and blue components of ramp do not have an array length of 256. Arrays used for gamma ramps must have a length of 256. |
Gamma correction results in a more consistent display, but can incur processing overhead and should not be used frequently. Short-duration effects, such as flashing the entire screen red, should not be calibrated, but long-duration gamma changes should be. If a gamma calibrator is installed, the ramp is modified before being sent to the GraphicsDevice to account for the system and monitor response curves. If no calibrator is installed, the ramp is passed directly to the GraphicsDevice.
The gamma ramp takes effect immediately. No wait for a vertical sync operation is performed.
If the GraphicsDevice does not support gamma ramps in the current presentation mode (full-screen or windowed), no error is returned. Applications can check SupportsFullScreenGamma and CanCalibrateGamma to determine the capabilities of the GraphicsDevice and whether a calibrator is installed.