• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetDeviceGammaRamp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: wglGetProcAddress

void			WinWindow::getGammaRamps(WORD* ramps)
{
  if (hDCChild == NULL)
    return;

  // see if we've got the 3Dfx gamma ramp extension
  PROC proc = wglGetProcAddress("wglGetDeviceGammaRamp3DFX");
  if (proc != NULL) {
    GammaRamp3DFX wglGetDeviceGammaRamp3DFX = (GammaRamp3DFX)proc;
    has3DFXGamma = wglGetDeviceGammaRamp3DFX(hDCChild, ramps + 3 * 256) != FALSE;
  }

  // get device gamma ramps
  hasGamma = GetDeviceGammaRamp(hDCChild, ramps) != FALSE;
}
开发者ID:mvanderkolff,项目名称:navi-misc,代码行数:15,代码来源:WinWindow.cpp


示例17: DIB_GetGammaRamp

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

	/* Get the ramp from the display */
	hdc = GetDC(SDL_Window);
	succeeded = GetDeviceGammaRamp(hdc, ramp);
	ReleaseDC(SDL_Window, hdc);
	return succeeded ? 0 : -1;
#endif /* !NO_GAMMA_SUPPORT */
}
开发者ID:Goettsch,项目名称:game-editor,代码行数:16,代码来源:SDL_dibvideo.c


示例18: GetDisplayForWindow

//--------------------------------------------------------------------------
bool VeWindows::_GetWindowGammaRamp(Window* pkWindow,
	VeUInt16* pu16Ramp)
{
	VideoDisplay* pkDisplay = GetDisplayForWindow(pkWindow);
	VE_ASSERT(pkDisplay);
	DisplayData* pkData = (DisplayData*)(VeRefObject*)(pkDisplay->m_spDriverData);
	HDC hHdc;
	BOOL bSucceeded = FALSE;
	hHdc = CreateDC(pkData->m_acDeviceName, NULL, NULL, NULL);
	if(hHdc)
	{
		bSucceeded = GetDeviceGammaRamp(hHdc, (LPVOID)pu16Ramp);
		DeleteDC(hHdc);
	}
	return bSucceeded ? true : false;
}
开发者ID:Napoleon314,项目名称:Venus2D,代码行数:17,代码来源:_VeWindows.cpp


示例19: WG_CheckHardwareGamma

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

	glConfig.deviceSupportsGamma = qfalse;

	// gamma correction
	// for the fallback, always check if it will work
	if ( r_gammamethod->integer >= GAMMA_HARDWARE ) {
		hDC = GetDC( GetDesktopWindow() );
		glConfig.deviceSupportsGamma = (qboolean)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:entdark,项目名称:jk2mv,代码行数:51,代码来源:win_gamma.cpp


示例20: WG_CheckHardwareGamma

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

	glConfig.deviceSupportsGamma = qfalse;

	if ( !r_ignorehwgamma->integer )
	{
		hDC = GetDC( GetDesktopWindow() );
		glConfig.deviceSupportsGamma = (qboolean)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;
				Com_Printf (S_COLOR_YELLOW  "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;

				Com_Printf (S_COLOR_YELLOW  "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:Chedo,项目名称:OpenJK,代码行数:50,代码来源:win_gamma.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetDeviceName函数代码示例发布时间:2022-05-30
下一篇:
C++ GetDeviceCaps函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap