GetDeviceGammaRamp function (wingdi.h)

The GetDeviceGammaRamp function gets the gamma ramp on direct color display boards having drivers that support downloadable gamma ramps in hardware.


We strongly recommend that you don't use this API. Use of this API is subject to major limitations. See SetDeviceGammaRamp for more information.


BOOL GetDeviceGammaRamp(
  HDC    hdc,
  LPVOID lpRamp



Specifies the device context of the direct color display board in question.


Points to a buffer where the function can place the current gamma ramp of the color display board. The gamma ramp is specified in three arrays of 256 WORD elements each, which contain the mapping between RGB values in the frame buffer and digital-analog-converter (DAC) values. The sequence of the arrays is red, green, blue.

Return value

If this function succeeds, the return value is TRUE.

If this function fails, the return value is FALSE.


WORD gArray[3][256];
GetDeviceGammaRamp(handle, gArray);  
// `handle` is the device context. See GetDC for more details.
// `gArray` will hold the gamma array values in a 2-D array


Direct color display modes do not use color lookup tables and are usually 16, 24, or 32 bit. Not all direct color video boards support loadable gamma ramps. GetDeviceGammaRamp succeeds only for devices with drivers that support downloadable gamma ramps in hardware.


Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h
Library Gdi32.lib
DLL Gdi32.dll

See also