本文整理汇总了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);
}
示例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");
}
}
示例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;
}
示例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 */
}
示例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;
}
}
}
}
}
示例6: VID_BackupGamma
void VID_BackupGamma() // jitgamma
{
HDC hdc;
hdc = GetDC (GetDesktopWindow());
gammaramp_supported = GetDeviceGammaRamp (hdc, &desktop_gammaramp[0][0]);
ReleaseDC (GetDesktopWindow(), hdc);
}
示例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 );
}
示例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 );
}
示例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
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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));
}
示例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 */
}