当前位置: 首页>>代码示例>>C++>>正文


C++ GetDeviceGammaRamp函数代码示例

本文整理汇总了C++中GetDeviceGammaRamp函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDeviceGammaRamp函数的具体用法?C++ GetDeviceGammaRamp怎么用?C++ GetDeviceGammaRamp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetDeviceGammaRamp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: w32gdi_get_temperature

static int w32gdi_get_temperature(void){
	gamma_ramp_s ramp=gamma_get_ramps(GAMMA_RAMP_SIZE);
	float rb_ratio;
	HDC hdc;
	
	hdc = CreateDC(TEXT("DISPLAY"),NULL,NULL,NULL);
	if( (!hdc)||(!ramp.all) ){
		LOG(LOGERR,_("No device context or ramp."));
		(void)DeleteDC(hdc);
		return RET_FUN_FAILED;
	}

	if( !GetDeviceGammaRamp(hdc,ramp.all) ){
		LOG(LOGERR,_("Unable to get gamma ramps."));
		(void)DeleteDC(hdc);
		return RET_FUN_FAILED;
	}
	if( (!ramp.r)||(!ramp.b) ){
		LOG(LOGERR,_("No ramps found."));
		(void)DeleteDC(hdc);
		return RET_FUN_FAILED;
	}
	(void)DeleteDC(hdc);
	rb_ratio = (float)ramp.r[255]/(float)ramp.b[255];
	return gamma_find_temp(rb_ratio);
}
开发者ID:NeilBryant,项目名称:redshiftgui,代码行数:26,代码来源:w32gdi.c

示例2: WG_GetOldGammaRamp

/*
** WG_GetOldGammaRamp
**
*/
void WG_GetOldGammaRamp(void)
{
	HDC			hDC;

	hDC = GetDC(GetDesktopWindow());
	GetDeviceGammaRamp(hDC, s_oldHardwareGamma);
	ReleaseDC(GetDesktopWindow(), hDC);


	/*
	** GLimp_SetGamma
	**
	*/
	void GLimp_SetGamma(unsigned char red[256], unsigned char green[256], unsigned char blue[256]) {
		unsigned short table[3][256];
		int i;

		if (!glw_state.hDC) {
			return;
		}

		for (i = 0; i < 256; i++) {
			table[0][i] = (((unsigned short) red[i]) << 8) | red[i];
			table[1][i] = (((unsigned short) green[i]) << 8) | green[i];
			table[2][i] = (((unsigned short) blue[i]) << 8) | blue[i];
		}

		if (!SetDeviceGammaRamp(glw_state.hDC, table)) {
			common->Printf("WARNING: SetDeviceGammaRamp failed.\n");
		}
	}
开发者ID:AreaScout,项目名称:dante-doom3-odroid,代码行数:35,代码来源:win_gamma.cpp

示例3: GLimp_GetGammaRamp

/*
** GLimp_UpdateGammaRamp
*/
bool GLimp_GetGammaRamp( size_t stride, unsigned short *psize, unsigned short *ramp )
{
	unsigned short ramp256[3*256];

	if( stride < 256 )
	{
		// only supports gamma ramps with 256 mappings per channel
		return false;
	}

	if( qwglGetDeviceGammaRamp3DFX )
	{
		if( qwglGetDeviceGammaRamp3DFX( glw_state.hDC, ramp256 ) )
		{
			*psize = 256;
			memcpy( ramp,          ramp256,       256*sizeof(*ramp) );
			memcpy( ramp+  stride, ramp256+  256, 256*sizeof(*ramp) );
			memcpy( ramp+2*stride, ramp256+2*256, 256*sizeof(*ramp) );
			return true;
		}
	}

	if( GetDeviceGammaRamp( glw_state.hDC, ramp256 ) )
	{
		*psize = 256;
		memcpy( ramp,          ramp256,       256*sizeof(*ramp) );
		memcpy( ramp+  stride, ramp256+  256, 256*sizeof(*ramp) );
		memcpy( ramp+2*stride, ramp256+2*256, 256*sizeof(*ramp) );
		return true;
	}

	return false;
}
开发者ID:MGXRace,项目名称:racesow,代码行数:36,代码来源:win_glw.c

示例4: DIB_SetGammaRamp

int DIB_SetGammaRamp(_THIS, Uint16 *ramp)
{
#ifdef NO_GAMMA_SUPPORT
	SDL_SetError("SDL compiled without gamma ramp support");
	return -1;
#else
	HDC hdc;
	BOOL succeeded;

	/* Set the ramp for the display */
	if ( ! gamma_saved ) {
		gamma_saved = (WORD *)malloc(3*256*sizeof(*gamma_saved));
		if ( ! gamma_saved ) {
			SDL_OutOfMemory();
			return -1;
		}
		hdc = GetDC(SDL_Window);
		GetDeviceGammaRamp(hdc, gamma_saved);
		ReleaseDC(SDL_Window, hdc);
	}
	if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) {
		hdc = GetDC(SDL_Window);
		succeeded = SetDeviceGammaRamp(hdc, ramp);
		ReleaseDC(SDL_Window, hdc);
	} else {
		succeeded = TRUE;
	}
	return succeeded ? 0 : -1;
#endif /* !NO_GAMMA_SUPPORT */
}
开发者ID:Goettsch,项目名称:game-editor,代码行数:30,代码来源:SDL_dibvideo.c

示例5: WG_CheckHardwareGamma

/*
** WG_CheckHardwareGamma
**
** Determines if the underlying hardware supports the Win32 gamma correction API.
*/
void WG_CheckHardwareGamma( void ) {
	HDC hDC;

	glConfig.deviceSupportsGamma = qfalse;

    //BBi
	//if ( qwglSetDeviceGammaRamp3DFX ) {
	//	glConfig.deviceSupportsGamma = qtrue;

	//	hDC = GetDC( GetDesktopWindow() );
	//	glConfig.deviceSupportsGamma = qwglGetDeviceGammaRamp3DFX( hDC, s_oldHardwareGamma );
	//	ReleaseDC( GetDesktopWindow(), hDC );

	//	return;
	//}
    //BBi

    //BBi
	//// non-3Dfx standalone drivers don't support gamma changes, period
	//if ( glConfig.driverType == GLDRV_STANDALONE ) {
	//	return;
	//}
    //BBi

	if ( !r_ignorehwgamma->integer ) {
		hDC = GetDC( GetDesktopWindow() );
		glConfig.deviceSupportsGamma = GetDeviceGammaRamp( hDC, s_oldHardwareGamma );
		ReleaseDC( GetDesktopWindow(), hDC );

		if ( glConfig.deviceSupportsGamma ) {
			//
			// do a sanity check on the gamma values
			//
			if ( ( HIBYTE( s_oldHardwareGamma[0][255] ) <= HIBYTE( s_oldHardwareGamma[0][0] ) ) ||
				 ( HIBYTE( s_oldHardwareGamma[1][255] ) <= HIBYTE( s_oldHardwareGamma[1][0] ) ) ||
				 ( HIBYTE( s_oldHardwareGamma[2][255] ) <= HIBYTE( s_oldHardwareGamma[2][0] ) ) ) {
				glConfig.deviceSupportsGamma = qfalse;
				ri.Printf( PRINT_WARNING, "WARNING: device has broken gamma support, generated gamma.dat\n" );
			}

			//
			// make sure that we didn't have a prior crash in the game, and if so we need to
			// restore the gamma values to at least a linear value
			//
			if ( ( HIBYTE( s_oldHardwareGamma[0][181] ) == 255 ) ) {
				int g;

				ri.Printf( PRINT_WARNING, "WARNING: suspicious gamma tables, using linear ramp for restoration\n" );

				for ( g = 0; g < 255; g++ )
				{
					s_oldHardwareGamma[0][g] = g << 8;
					s_oldHardwareGamma[1][g] = g << 8;
					s_oldHardwareGamma[2][g] = g << 8;
				}
			}
		}
	}
}
开发者ID:bibendovsky,项目名称:rtcw,代码行数:64,代码来源:win_gamma.cpp

示例6: VID_BackupGamma

void VID_BackupGamma() // jitgamma
{
	HDC	hdc;

	hdc = GetDC (GetDesktopWindow());
	gammaramp_supported = GetDeviceGammaRamp (hdc, &desktop_gammaramp[0][0]);
	ReleaseDC (GetDesktopWindow(), hdc);
}
开发者ID:jitspoe,项目名称:starviewer,代码行数:8,代码来源:vid_dll.c

示例7: SWimp_SaveOldHWGamma

void SWimp_SaveOldHWGamma()
{
	HDC desktop_hdc = GetDC( GetDesktopWindow() );
	if( GetDeviceGammaRamp( desktop_hdc, old_gamma ) == FALSE )
		sw_state.hw_gamma_supported= 0;
	else
		sw_state.hw_gamma_supported= 1;
	ReleaseDC( GetDesktopWindow(), desktop_hdc );
}
开发者ID:Panzerschrek,项目名称:Q2PR,代码行数:9,代码来源:rw_imp.c

示例8: GLimp_SaveGamma

/*
========================
GLimp_GetOldGammaRamp
========================
*/
static void GLimp_SaveGamma() {
    HDC			hDC;
    BOOL		success;

    hDC = GetDC( GetDesktopWindow() );
    success = GetDeviceGammaRamp( hDC, win32.oldHardwareGamma );
    common->DPrintf( "...getting default gamma ramp: %s\n", success ? "success" : "failed" );
    ReleaseDC( GetDesktopWindow(), hDC );
}
开发者ID:neilogd,项目名称:DOOM-3-BFG,代码行数:14,代码来源:win_glimp.cpp

示例9: GetGammaRamp

static BOOL APIENTRY GetGammaRamp (Uint16 *redtable, Uint16 *greentable, Uint16 *bluetable)
#endif
{
#ifndef unix
	return GetDeviceGammaRamp(m_hDC, ramp);
#else
	return (SDL_GetGammaRamp(redtable, greentable, bluetable) >= 0);
#endif
}
开发者ID:ddraigcymraeg,项目名称:gzscoredoom,代码行数:9,代码来源:r_opengl.cpp

示例10: ReadGamma

// Called from GLimp_Init()
static void ReadGamma()
{
	if (r_ignorehwgamma->integer)
	{
		gammaStored = false;
		return;
	}
	HWND hwnd = GetDesktopWindow();
	HDC hdc = GetDC(hwnd);
	gammaStored = GetDeviceGammaRamp(hdc, gammaRamp) != 0;
	ReleaseDC(hwnd, hdc);
}
开发者ID:RkShaRkz,项目名称:Quake2,代码行数:13,代码来源:gl_win.cpp

示例11: wined3d_swapchain_get_gamma_ramp

HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain,
        struct wined3d_gamma_ramp *ramp)
{
    HDC dc;

    TRACE("swapchain %p, ramp %p.\n", swapchain, ramp);

    dc = GetDC(swapchain->device_window);
    GetDeviceGammaRamp(dc, ramp);
    ReleaseDC(swapchain->device_window, dc);

    return WINED3D_OK;
}
开发者ID:mgriepentrog,项目名称:wine,代码行数:13,代码来源:swapchain.c

示例12: GLimp_GetGammaRamp

/*
** GLimp_UpdateGammaRamp
*/
qboolean GLimp_GetGammaRamp( size_t stride, unsigned short *ramp )
{
	if( qwglGetDeviceGammaRamp3DFX )
	{
		if( qwglGetDeviceGammaRamp3DFX( glw_state.hDC, ramp ) )
			return qtrue;
	}

	if( GetDeviceGammaRamp( glw_state.hDC, ramp ) )
		return qtrue;

	return qfalse;
}
开发者ID:Racenet,项目名称:racesow,代码行数:16,代码来源:win_glw.c

示例13: GetDeviceGammaRamp

void _stdcall ProxyDevice::GetGammaRamp(D3DGAMMARAMP *a)
{
    IDirect3DSwapChain9 *sc;
    D3DPRESENT_PARAMETERS pp;

    realDevice->GetSwapChain(0, &sc);
    sc->GetPresentParameters(&pp);
    sc->Release();

    if(pp.Windowed)
        GetDeviceGammaRamp(GetDC(pp.hDeviceWindow), (void*)a);
    else
        realDevice->GetGammaRamp(0, a);
}
开发者ID:Petethegoat,项目名称:MGE-XE,代码行数:14,代码来源:d3d8device.cpp

示例14: _glfwPlatformGetGammaRamp

void _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp)
{
    HDC dc;
    WORD values[768];

    dc = CreateDCW(L"DISPLAY", monitor->win32.adapterName, NULL, NULL);
    GetDeviceGammaRamp(dc, values);
    DeleteDC(dc);

    _glfwAllocGammaArrays(ramp, 256);

    memcpy(ramp->red,   values +   0, 256 * sizeof(unsigned short));
    memcpy(ramp->green, values + 256, 256 * sizeof(unsigned short));
    memcpy(ramp->blue,  values + 512, 256 * sizeof(unsigned short));
}
开发者ID:ConfusedReality,项目名称:pkg_opengl_glfw,代码行数:15,代码来源:win32_monitor.c

示例15: DIB_CheckGamma

static void DIB_CheckGamma(_THIS)
{
#ifndef NO_GAMMA_SUPPORT
	HDC hdc;
	WORD ramp[3*256];

	/* If we fail to get gamma, disable gamma control */
	hdc = GetDC(SDL_Window);
	if ( ! GetDeviceGammaRamp(hdc, ramp) ) {
		this->GetGammaRamp = NULL;
		this->SetGammaRamp = NULL;
	}
	ReleaseDC(SDL_Window, hdc);
#endif /* !NO_GAMMA_SUPPORT */
}
开发者ID:Goettsch,项目名称:game-editor,代码行数:15,代码来源:SDL_dibvideo.c


注:本文中的GetDeviceGammaRamp函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。