Microsoft DirectX 9.0

IDirect3DDevice9::SetGammaRamp Method

Sets the gamma correction ramp for the implicit swap chain.


void SetGammaRamp(      

    UINT iSwapChain,     DWORD Flags,     CONST D3DGAMMARAMP *pRamp );


[in] Unsigned integer specifying the swap chain.
[in] Indicates whether correction should be applied. 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 whole screen red should not be calibrated, but long-duration gamma changes should be calibrated. One of the following values can be set.
If a gamma calibrator is installed, the ramp will be modified before being sent to the device to account for the system and monitor response curves. If a calibrator is not installed, the ramp will be passed directly to the device.
No gamma correction is applied. The supplied gamma table is transferred directly to the device.
[in] Pointer to a D3DGAMMARAMP structure, representing the gamma correction ramp to be set for the implicit swap chain.

Return Value



There is always at least one swap chain (the implicit swap chain) for each device, because Microsoft?Direct3D?for Microsoft DirectX?9.0 has one swap chain as a property of the device.

Starting with version DirectX 8.x, setting a gamma ramp has no effect unless the swap chain is full-screen. To change the gamma ramp in windowed mode, use the Microsoft Windows?Graphics Device Interface (GDI) function SetDeviceGammaRamp, which will impact the entire screen(not just the active window). SetDeviceGammaRamp will not allow "extreme" gamma ramps, such as an all red gamma ramp. In contrast, IDirect3DDevice9::SetGammaRamp will clean up the gamma ramp when the application is minimized or exits, and then restore it again when the application is restored.

The gamma ramp takes effect immediately. No wait for VSYNC is performed.

If the device does not support gamma ramps in the swap chain's current presentation mode (full-screen or windowed), no error return is given. Applications can check the D3DCAPS2_FULLSCREENGAMMA and D3DCAPS2_CANCALIBRATEGAMMA capability bits in the Caps2 member of the D3DCAPS9 structure to determine the capabilities of the device and whether a calibrator is installed.

See Also

IDirect3DSwapChain9, IDirect3DDevice9::GetGammaRamp

© 2002 Microsoft Corporation. All rights reserved.