DirectX SDK

DirectDrawGammaControl.SetGammaRamp

The DirectDrawGammaControl.SetGammaRamp method sets the red, green, and blue gamma ramps for the primary surface.

object.SetGammaRamp( _ 
    flags As CONST_DDSGRFLAGS, _ 
    gammaRamp As DDGAMMARAMP)

Parameters

object
Object expression that resolves to a DirectDrawGammaControl object.
flags
One of the constants of the CONST_DDSGRFLAGS enumeration indicating whether gamma calibration is desired. Set this parameter DDSGR_CALIBRATE to request that the calibrator adjust the gamma ramp according to the physical properties of the display, making the result identical on all systems. If calibration is not needed, set this parameter to 0.
gammaRamp
DDGAMMARAMP type that contains the new red, green, and blue gamma ramp entries. Each array maps color values in the frame buffer to the color values to be passed to the digital-to-analog converter (DAC).

Error Codes

If the method fails, it raises an error, and Err.Number can be set to one of the following values:

DDERR_EXCEPTION
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_OUTOFMEMORY

Remarks

Not all systems support gamma calibration. To determine whether gamma calibration is supported, call DirectDraw7.GetCaps, and examine the lCaps2 member of the associated DDCAPS type after the method returns. If the DDCAPS_CANCALIBRATEGAMMA capability flag is present, gamma calibration is supported.

Calibrating gamma ramps incurs some processing overhead and should not be used frequently.

Including the DDSGR_CALIBRATE flag in the flags parameter when running on systems that do not support gamma calibration does not cause this method to fail. The method succeeds, setting new gamma ramp values without calibration.

See Also

DirectDrawGammaControl.GetGammaRamp, Gamma and Color Controls