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

C++ GetPixelFormat函数代码示例

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

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



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

示例1: dibdrv_wglMakeCurrent

/***********************************************************************
 *		dibdrv_wglMakeCurrent
 */
static BOOL dibdrv_wglMakeCurrent( HDC hdc, struct wgl_context *context )
{
    HBITMAP bitmap;
    BITMAPOBJ *bmp;
    dib_info dib;
    GLenum type;
    BOOL ret = FALSE;

    if (!context)
    {
        pOSMesaMakeCurrent( NULL, NULL, GL_UNSIGNED_BYTE, 0, 0 );
        return TRUE;
    }

    if (GetPixelFormat( hdc ) != context->format)
        FIXME( "mismatched pixel formats %u/%u not supported yet\n",
               GetPixelFormat( hdc ), context->format );

    bitmap = GetCurrentObject( hdc, OBJ_BITMAP );
    bmp = GDI_GetObjPtr( bitmap, OBJ_BITMAP );
    if (!bmp) return FALSE;

    if (init_dib_info_from_bitmapobj( &dib, bmp ))
    {
        char *bits;
        int width = dib.rect.right - dib.rect.left;
        int height = dib.rect.bottom - dib.rect.top;

        if (dib.stride < 0)
            bits = (char *)dib.bits.ptr + (dib.rect.bottom - 1) * dib.stride;
        else
            bits = (char *)dib.bits.ptr + dib.rect.top * dib.stride;
        bits += dib.rect.left * dib.bit_count / 8;

        TRACE( "context %p bits %p size %ux%u\n", context, bits, width, height );

        if (pixel_formats[context->format - 1].mesa == OSMESA_RGB_565)
            type = GL_UNSIGNED_SHORT_5_6_5;
        else
            type = GL_UNSIGNED_BYTE;

        ret = pOSMesaMakeCurrent( context->context, bits, type, width, height );
        if (ret)
        {
            pOSMesaPixelStore( OSMESA_ROW_LENGTH, abs( dib.stride ) * 8 / dib.bit_count );
            pOSMesaPixelStore( OSMESA_Y_UP, 1 );  /* Windows seems to assume bottom-up */
        }
    }
    GDI_ReleaseObj( bitmap );
    return ret;
}
开发者ID:DusteDdk,项目名称:wine-multimedia,代码行数:54,代码来源:opengl.c


示例2: GetPixelFormat

void Image::InsertImage(const Image* image, uint32 dstX, uint32 dstY,
						uint32 srcX /* = 0 */, uint32 srcY /* = 0 */,
						uint32 srcWidth /* = -1 */, uint32 srcHeight /* = -1 */)
{
	if (GetPixelFormat() != image->GetPixelFormat())
	{
		return;
	}

	if (image == NULL || dstX >= width || dstY >= height ||
		srcX >= image->GetWidth() || srcY >= image->GetHeight())
	{
		return;
	}

	uint32 insertWidth = (srcWidth == (uint32)-1) ? image->GetWidth() : srcWidth;
	uint32 insertHeight = (srcHeight == (uint32)-1) ? image->GetHeight() : srcHeight;

	if (srcX + insertWidth > image->GetWidth())
	{
		insertWidth = image->GetWidth() - srcX;
	}
	if (dstX + insertWidth > width)
	{
		insertWidth = width - dstX;
	}

	if (srcY + insertHeight > image->GetHeight())
	{
		insertHeight = image->GetHeight() - srcY;
	}
	if (dstY + insertHeight > height)
	{
		insertHeight = height - dstY;
	}

	PixelFormat format = GetPixelFormat();
	int32 formatSize = PixelFormatDescriptor::GetPixelFormatSizeInBytes(format);

	uint8* srcData = image->GetData();
	uint8* dstData = data;

	for (uint32 i = 0; i < insertHeight; ++i)
	{
		memcpy(dstData + (width * (dstY + i) + dstX) * formatSize,
			   srcData + (image->GetWidth() * (srcY + i) + srcX) * formatSize,
			   formatSize * insertWidth);
	}
}
开发者ID:galek,项目名称:dava.framework,代码行数:49,代码来源:Image.cpp


示例3: createDeviceEx

void CIrrWindow::createIrrDevice()
{
	// create irr device
	SIrrlichtCreationParameters param;
	param.WindowId = (void*)getHandle();
	param.ZBufferBits = 32;
	param.DriverType = video::EDT_OPENGL;	

	m_device	= createDeviceEx(param);
	m_driver	= m_device->getVideoDriver();
	m_smgr		= m_device->getSceneManager();
	
	// init opengl
	HDC HDc = GetDC( getHandle() );
	PIXELFORMATDESCRIPTOR pfd={0};
	pfd.nSize=sizeof(PIXELFORMATDESCRIPTOR);
	int pf = GetPixelFormat(HDc);	
	DescribePixelFormat(HDc, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);	
	pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;
	pfd.cDepthBits=16;
	pf = ChoosePixelFormat(HDc, &pfd);	
	SetPixelFormat(HDc, pf, &pfd);
	
	// share video data
	m_videoData.OpenGLWin32.HWnd = NULL;
	m_videoData.OpenGLWin32.HDc = HDc;
	m_videoData.OpenGLWin32.HRc = wglCreateContext(HDc);

	// share for multithread
	wglShareLists((HGLRC)m_driver->getExposedVideoData().OpenGLWin32.HRc, (HGLRC)m_videoData.OpenGLWin32.HRc);
	
	g_irrView = this;
	initScene();
}
开发者ID:codeman001,项目名称:gsleveleditor,代码行数:34,代码来源:CIrrWindow.cpp


示例4: getInternalFormat

static GLint getInternalFormat(void)
{
  switch (glctx.type) {
#ifdef CONFIG_GL_WIN32
  case GLTYPE_W32:
  {
  PIXELFORMATDESCRIPTOR pfd;
  HDC vo_hdc = vo_w32_get_dc(vo_w32_window);
  int pf = GetPixelFormat(vo_hdc);
  if (!DescribePixelFormat(vo_hdc, pf, sizeof pfd, &pfd)) {
    r_sz = g_sz = b_sz = a_sz = 0;
  } else {
    r_sz = pfd.cRedBits;
    g_sz = pfd.cGreenBits;
    b_sz = pfd.cBlueBits;
    a_sz = pfd.cAlphaBits;
  }
  vo_w32_release_dc(vo_w32_window, vo_hdc);
  }
  break;
#endif
#ifdef CONFIG_GL_X11
  case GLTYPE_X11:
  if (glXGetConfig(mDisplay, glctx.vinfo.x11, GLX_RED_SIZE, &r_sz) != 0) r_sz = 0;
  if (glXGetConfig(mDisplay, glctx.vinfo.x11, GLX_GREEN_SIZE, &g_sz) != 0) g_sz = 0;
  if (glXGetConfig(mDisplay, glctx.vinfo.x11, GLX_BLUE_SIZE, &b_sz) != 0) b_sz = 0;
  if (glXGetConfig(mDisplay, glctx.vinfo.x11, GLX_ALPHA_SIZE, &a_sz) != 0) a_sz = 0;
  break;
#endif
  }

  rgb_sz=r_sz+g_sz+b_sz;
  if(rgb_sz<=0) rgb_sz=24;

#ifdef TEXTUREFORMAT_ALWAYS
  return TEXTUREFORMAT_ALWAYS;
#else
  if(r_sz==3 && g_sz==3 && b_sz==2 && a_sz==0)
    return GL_R3_G3_B2;
  if(r_sz==4 && g_sz==4 && b_sz==4 && a_sz==0)
    return GL_RGB4;
  if(r_sz==5 && g_sz==5 && b_sz==5 && a_sz==0)
    return GL_RGB5;
  if(r_sz==8 && g_sz==8 && b_sz==8 && a_sz==0)
    return GL_RGB8;
  if(r_sz==10 && g_sz==10 && b_sz==10 && a_sz==0)
    return GL_RGB10;
  if(r_sz==2 && g_sz==2 && b_sz==2 && a_sz==2)
    return GL_RGBA2;
  if(r_sz==4 && g_sz==4 && b_sz==4 && a_sz==4)
    return GL_RGBA4;
  if(r_sz==5 && g_sz==5 && b_sz==5 && a_sz==1)
    return GL_RGB5_A1;
  if(r_sz==8 && g_sz==8 && b_sz==8 && a_sz==8)
    return GL_RGBA8;
  if(r_sz==10 && g_sz==10 && b_sz==10 && a_sz==2)
    return GL_RGB10_A2;
#endif
  return GL_RGB;
}
开发者ID:grevutiu-gabriel,项目名称:mplayer-vaapi,代码行数:60,代码来源:vo_gl_tiled.c


示例5: GetScreenWidth

//
// 지정된영역의 백버퍼데이타를 읽어서 surface에 옮긴다.
// GL은 프론트만 읽을수 있는줄알았는데 반대였다. 백버퍼만 읽을수 있다
// w,y,width,height: 스크린 좌표
void	XGraphicsOpenGL::ScreenToSurface( int x, int y, int width, int height, XSurface *pSurface )
{
	if( GetPixelFormat() != xPIXELFORMAT_RGB565 )
		XERROR( "아직은 RGB565포맷만 사용가능함." );
	int px, py, pw, ph;		// 물리적스크린크기와 좌표.
	float fRatioX, fRatioY;
	// phyScreen과 screen의 비율로 좌표들을 변환.
	fRatioX = (float)GetPhyScreenWidth() / GetScreenWidth();
	fRatioY = (float)GetPhyScreenHeight() / GetScreenHeight();
	px = x * fRatioX;		py = y * fRatioY;	// screen->physcreen 좌표로 변환
	pw = width * fRatioX;	ph = height * fRatioY;
	//GL_NO_ERROR
	DWORD *pdwBuffer = new DWORD[ pw * ph ];	
	glReadPixels(px, py, pw, ph, GL_RGBA, GL_UNSIGNED_BYTE, pdwBuffer );	// 위아래 뒤집혀진 이미지
	DWORD *pDst = new DWORD[ pw * ph ];
    // 위아래를 바꿈
	for( int i = 0; i < ph; i ++ )
		for( int j = 0; j < pw; j ++ )
			pDst[ i * pw + j ] = pdwBuffer[ (ph-1-i) * pw + j ];	
	SAFE_DELETE_ARRAY( pdwBuffer );
	
    
	pSurface->Create( pw, ph, 0, 0, xALPHA, pDst, sizeof(DWORD), 0, 0 );
#pragma messages( "pdwBuffer를 XSurfaceOpenGL::Create()내부에서 뽀개주도록 바꿔야 한다. 버그날까봐 일단 이상태로 놔둠" )
}
开发者ID:xahgo,项目名称:tama,代码行数:29,代码来源:XGraphicsOpenGL.cpp


示例6: ComputeVisBits

/**
 * Compute a mask of CR_*_BIT flags which reflects the attributes of
 * the pixel format of the given hdc.
 */
static GLuint ComputeVisBits( HDC hdc )
{
    PIXELFORMATDESCRIPTOR pfd;
    int iPixelFormat;
    GLuint b = 0;

    iPixelFormat = GetPixelFormat( hdc );

    DescribePixelFormat( hdc, iPixelFormat, sizeof(pfd), &pfd );

    if (pfd.cDepthBits > 0)
        b |= CR_DEPTH_BIT;
    if (pfd.cAccumBits > 0)
        b |= CR_ACCUM_BIT;
    if (pfd.cColorBits > 8)
        b |= CR_RGB_BIT;
    if (pfd.cStencilBits > 0)
        b |= CR_STENCIL_BIT;
    if (pfd.cAlphaBits > 0)
        b |= CR_ALPHA_BIT;
    if (pfd.dwFlags & PFD_DOUBLEBUFFER)
        b |= CR_DOUBLE_BIT;
    if (pfd.dwFlags & PFD_STEREO)
        b |= CR_STEREO_BIT;

    return b;
}
开发者ID:marktsai0316,项目名称:VirtualMonitor,代码行数:31,代码来源:icd_drv.c


示例7: av_frame_alloc

HRESULT CDecD3D11::DeliverD3D11Readback(LAVFrame *pFrame)
{
  AVFrame *src = (AVFrame *)pFrame->priv_data;
  AVFrame *dst = av_frame_alloc();

  int ret = av_hwframe_transfer_data(dst, src, 0);
  if (ret < 0)
  {
    ReleaseFrame(&pFrame);
    av_frame_free(&dst);
    return E_FAIL;
  }

  // free the source frame
  av_frame_free(&src);

  // and store the dst frame in LAVFrame
  pFrame->priv_data = dst;
  GetPixelFormat(&pFrame->format, &pFrame->bpp);

  ASSERT((dst->format == AV_PIX_FMT_NV12 && pFrame->format == LAVPixFmt_NV12) || (dst->format == AV_PIX_FMT_P010 && pFrame->format == LAVPixFmt_P016));

  for (int i = 0; i < 4; i++) {
    pFrame->data[i] = dst->data[i];
    pFrame->stride[i] = dst->linesize[i];
  }

  return Deliver(pFrame);
}
开发者ID:mpc-hc,项目名称:LAVFilters,代码行数:29,代码来源:d3d11va.cpp


示例8: YsCreatePalette

static HPALETTE YsCreatePalette(HDC dc)
{
	HPALETTE neo;
    PIXELFORMATDESCRIPTOR pfd;
    LOGPALETTE *lp;
    int n,i;

    n=GetPixelFormat(dc);
    DescribePixelFormat(dc,n,sizeof(PIXELFORMATDESCRIPTOR),&pfd);

    if(pfd.dwFlags & PFD_NEED_PALETTE)
    {
        n=1<<pfd.cColorBits;
        lp=(LOGPALETTE *)malloc(sizeof(LOGPALETTE)+n*sizeof(PALETTEENTRY));
        lp->palVersion=0x300;
        lp->palNumEntries=(WORD)n;
        for (i=0; i<n; i++)
        {
            lp->palPalEntry[i].peRed  =YsPalVal(i,pfd.cRedBits,pfd.cRedShift);
            lp->palPalEntry[i].peGreen=YsPalVal(i,pfd.cGreenBits,pfd.cGreenShift);
            lp->palPalEntry[i].peBlue =YsPalVal(i,pfd.cBlueBits,pfd.cBlueShift);
            lp->palPalEntry[i].peFlags=0;
        }

        neo=CreatePalette(lp);
		free(lp);
	    return neo;
    }
	return NULL;
}
开发者ID:nihar1992,项目名称:Ghost-flyer,代码行数:30,代码来源:fssimplewindow.cpp


示例9: SetMemAlign

void Image::Draw(float x, float y) const
{
	if(!m_uWidth)
		return;
	SetMemAlign(m_uWidth, FALSE);
	glRasterPos2f(x, y);
	glDrawPixels(m_uWidth, m_uHeight, GetPixelFormat(), GL_UNSIGNED_BYTE, GetDataPtr());
}
开发者ID:GGyorin,项目名称:citb501,代码行数:8,代码来源:Graphics.cpp


示例10: GetSizeX

FString UTextureCube::GetDesc()
{
	return FString::Printf(TEXT("Cube: %dx%d [%s]"),
		GetSizeX(),
		GetSizeY(),
		GPixelFormats[GetPixelFormat()].Name
		);
}
开发者ID:stoneStyle,项目名称:Unreal4,代码行数:8,代码来源:TextureCube.cpp


示例11: WGL_NATIVE

JNIEXPORT jint JNICALL WGL_NATIVE(GetPixelFormat)
	(JNIEnv *env, jclass that, jintLong arg0)
{
	jint rc = 0;
	WGL_NATIVE_ENTER(env, that, GetPixelFormat_FUNC);
	rc = (jint)GetPixelFormat((HDC)arg0);
	WGL_NATIVE_EXIT(env, that, GetPixelFormat_FUNC);
	return rc;
}
开发者ID:cj-zeiger,项目名称:TicketWatcher,代码行数:9,代码来源:wgl.c


示例12: GetDepth

int wxIDirectFBSurface::GetDepth()
{
    DFBSurfacePixelFormat format = DSPF_UNKNOWN;

    if ( !GetPixelFormat(&format) )
        return -1;

    return DFB_BITS_PER_PIXEL(format);
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:9,代码来源:wrapdfb.cpp


示例13:

// 백버퍼의 픽셀을 읽어서 pBuffer에 담아줌.
// m_nWidth는 논리적서피스의 크기이고 work와 같고, back,frame 버퍼는 실제물리적 해상도인것으로 구분해줄 필요 있다.
void*	XGraphicsOpenGL::ReadBackBuffer( int phywidth, int phyheight, void *pBuffer )
{
	if( GetPixelFormat() != xPIXELFORMAT_RGB565 )
		XERROR( "아직은 RGB565포맷만 사용가능함." );

//	glReadBufferOES( GL_BACK );	// gl1.2 ES엔 없는듯.
    // gl1.x에선 프론트가 아니고 백버퍼만 읽을수 있는듯 하다. 잘못알고 있었음-_-;;
	glReadPixels(0, 0, phywidth, phyheight, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, pBuffer );
	return pBuffer;
}
开发者ID:xahgo,项目名称:tama,代码行数:12,代码来源:XGraphicsOpenGL.cpp


示例14: DrvCreateLayerContext

DHGLRC APIENTRY
DrvCreateLayerContext(
   HDC hdc,
   INT iLayerPlane )
{
   int iPixelFormat;
   const struct stw_pixelformat_info *pfi;
   struct st_context_attribs attribs;
   struct stw_context *ctx = NULL;
   
   if(!stw_dev)
      return 0;
   
   if (iLayerPlane != 0)
      return 0;

   iPixelFormat = GetPixelFormat(hdc);
   if(!iPixelFormat)
      return 0;
   
   pfi = stw_pixelformat_get_info( iPixelFormat - 1 );
   
   ctx = CALLOC_STRUCT( stw_context );
   if (ctx == NULL)
      goto no_ctx;

   ctx->hdc = hdc;
   ctx->iPixelFormat = iPixelFormat;

   memset(&attribs, 0, sizeof(attribs));
   attribs.profile = ST_PROFILE_DEFAULT;
   attribs.visual = pfi->stvis;

   ctx->st = stw_dev->stapi->create_context(stw_dev->stapi,
         stw_dev->smapi, &attribs, NULL);
   if (ctx->st == NULL) 
      goto no_st_ctx;

   ctx->st->st_manager_private = (void *) ctx;

   pipe_mutex_lock( stw_dev->ctx_mutex );
   ctx->dhglrc = handle_table_add(stw_dev->ctx_table, ctx);
   pipe_mutex_unlock( stw_dev->ctx_mutex );
   if (!ctx->dhglrc)
      goto no_hglrc;

   return ctx->dhglrc;

no_hglrc:
   ctx->st->destroy(ctx->st);
no_st_ctx:
   FREE(ctx);
no_ctx:
   return 0;
}
开发者ID:nikai3d,项目名称:mesa,代码行数:55,代码来源:stw_context.c


示例15: XCreateColormap

Colormap
XCreateColormap(Display* display, Window root, Visual* visual, int alloc)
{
  /* KLUDGE: this function needs XHDC to be set to the HDC currently
     being operated on before it is invoked! */

  PIXELFORMATDESCRIPTOR pfd;
  LOGPALETTE *logical;
  HPALETTE    palette;
  int n;

  /* grab the pixel format */
  memset(&pfd, 0, sizeof(PIXELFORMATDESCRIPTOR));
  DescribePixelFormat(XHDC, GetPixelFormat(XHDC), 
		      sizeof(PIXELFORMATDESCRIPTOR), &pfd);

  if (!(pfd.dwFlags & PFD_NEED_PALETTE ||
      pfd.iPixelType == PFD_TYPE_COLORINDEX))
  {
    return 0;
  }

  n = 1 << pfd.cColorBits;

  /* allocate a bunch of memory for the logical palette (assume 256
     colors in a Win32 palette */
  logical = (LOGPALETTE*)malloc(sizeof(LOGPALETTE) +
				sizeof(PALETTEENTRY) * n);
  memset(logical, 0, sizeof(LOGPALETTE) + sizeof(PALETTEENTRY) * n);

  /* set the entries in the logical palette */
  logical->palVersion = 0x300;
  logical->palNumEntries = n;

  /* start with a copy of the current system palette */
  GetSystemPaletteEntries(XHDC, 0, 256, &logical->palPalEntry[0]);
    
  if (pfd.iPixelType == PFD_TYPE_RGBA) {
    int redMask = (1 << pfd.cRedBits) - 1;
    int greenMask = (1 << pfd.cGreenBits) - 1;
    int blueMask = (1 << pfd.cBlueBits) - 1;
    int i;

    /* fill in an RGBA color palette */
    for (i = 0; i < n; ++i) {
      logical->palPalEntry[i].peRed = 
	(((i >> pfd.cRedShift)   & redMask)   * 255) / redMask;
      logical->palPalEntry[i].peGreen = 
	(((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask;
	logical->palPalEntry[i].peBlue = 
	(((i >> pfd.cBlueShift)  & blueMask)  * 255) / blueMask;
      logical->palPalEntry[i].peFlags = 0;
    }
  }
开发者ID:AltroCoin,项目名称:altrocoin,代码行数:54,代码来源:win32_x11.c


示例16: Upload

	void TextureData2D :: Upload ( int target )
	{
		glTexImage2D ( target,
			           0,
					   GetInternalFormat ( ),
					   Width,
					   Height,
					   0,
					   GetPixelFormat ( ),
					   GL_FLOAT,
					   Pixels );
	}
开发者ID:Easycker,项目名称:rt-phm,代码行数:12,代码来源:TextureData2D.cpp


示例17: SetPixelFormat

XnStatus XnSensorImageGenerator::SetPixelFormat(XnPixelFormat Format)
{
	if (GetPixelFormat() == Format)
	{
		return (XN_STATUS_OK);
	}

	XN_PROPERTY_SET_CREATE_ON_STACK(props);
	XnStatus nRetVal = XnPropertySetAddModule(&props, m_strModule);
	XN_IS_STATUS_OK(nRetVal);

	XnOutputFormats OutputFormat;
	XnUInt32* anAllowedInputFormats = NULL;
	XnUInt32 nAllowedInputFormats = 0;

	switch (Format)
	{
	case XN_PIXEL_FORMAT_RGB24:
		OutputFormat = XN_OUTPUT_FORMAT_RGB24;
		anAllowedInputFormats = g_anAllowedRGBFormats;
		nAllowedInputFormats = sizeof(g_anAllowedRGBFormats)/sizeof(XnUInt32);
		break;
	case XN_PIXEL_FORMAT_YUV422:
		OutputFormat = XN_OUTPUT_FORMAT_YUV422;
		anAllowedInputFormats = g_anAllowedYUVFormats;
		nAllowedInputFormats = sizeof(g_anAllowedYUVFormats)/sizeof(XnUInt32);
		break;
	case XN_PIXEL_FORMAT_GRAYSCALE_8_BIT:
		OutputFormat = XN_OUTPUT_FORMAT_GRAYSCALE8;
		anAllowedInputFormats = g_anAllowedGray8Formats;
		nAllowedInputFormats = sizeof(g_anAllowedGray8Formats)/sizeof(XnUInt32);
		break;
	case XN_PIXEL_FORMAT_MJPEG:
		OutputFormat = XN_OUTPUT_FORMAT_JPEG;
		anAllowedInputFormats = g_anAllowedJPEGFormats;
		nAllowedInputFormats = sizeof(g_anAllowedJPEGFormats)/sizeof(XnUInt32);
		break;
	default:
		return XN_STATUS_INVALID_OPERATION;
	}

	XnUInt32 nInputFormat = FindSupportedInputFormat(anAllowedInputFormats, nAllowedInputFormats);
	if (nInputFormat == INVALID_INPUT_FORMAT)
	{
		XN_LOG_WARNING_RETURN(XN_STATUS_DEVICE_BAD_PARAM, XN_MASK_DEVICE_SENSOR, "Cannot set pixel format to %s - no matching input format.", xnPixelFormatToString(Format));
	}

	XnPropertySetAddIntProperty(&props, m_strModule, XN_STREAM_PROPERTY_INPUT_FORMAT, (XnUInt64)nInputFormat);
	XnPropertySetAddIntProperty(&props, m_strModule, XN_STREAM_PROPERTY_OUTPUT_FORMAT, (XnUInt64)OutputFormat);

	return m_pSensor->BatchConfig(&props);
}
开发者ID:02031991,项目名称:Sensor,代码行数:52,代码来源:XnSensorImageGenerator.cpp


示例18: SetupOpenGL

//*********************************************************************************
// Setup OpenGL renderer
//
void SetupOpenGL(void)
{
	PIXELFORMATDESCRIPTOR PFD;
	int s32PixelIndex;

	//--- Retrieve window DC

	g_hDC = ::GetDC(g_hAppWnd);
	if (!g_hDC)
		return;

	//--- Init desired pixel format

	memset(&PFD, 0, sizeof(PFD));

	PFD.nSize = sizeof(PFD);
	PFD.nVersion = 1;
	PFD.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_GENERIC_ACCELERATED | PFD_DOUBLEBUFFER;
	PFD.iPixelType = PFD_TYPE_RGBA;
	PFD.cColorBits = 24;
	PFD.cAlphaBits = 8;
	PFD.cDepthBits = 24;
	PFD.iLayerType = PFD_MAIN_PLANE;

	//--- Try to match the desired pixel format

	s32PixelIndex = ChoosePixelFormat(g_hDC, &PFD);
	if (!s32PixelIndex)
		s32PixelIndex = 1;	

	//--- Get pixel format description

	memset(&PFD, 0, sizeof(PFD));
	if (!DescribePixelFormat(g_hDC, s32PixelIndex, sizeof(PFD), &PFD))
		return;

	//--- Set pixel format

	if (s32PixelIndex != GetPixelFormat(g_hDC))
		if (!SetPixelFormat(g_hDC, s32PixelIndex, &PFD))
			return;

	//--- Create GL render context

	g_hGLContext = (HGLRC)wglCreateContext(g_hDC);

	//--- Activate render context

	wglMakeCurrent(g_hDC, g_hGLContext);
}
开发者ID:kbollini,项目名称:HeightMapLandGenerator,代码行数:53,代码来源:OBJReader.cpp


示例19: GetPixelFormat

// 팔래트 초기화 함수
void NaGsView::InitializePalette(void)
{
	PIXELFORMATDESCRIPTOR pfd;
    LOGPALETTE* pPal;
    int pixelFormat = GetPixelFormat(m_hDC);
    int paletteSize;

    DescribePixelFormat(m_hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);

    /*
    ** Determine if a palette is needed and if so what size.
    */
    if (pfd.dwFlags & PFD_NEED_PALETTE) 
	{
		paletteSize = 1 << pfd.cColorBits;
    }else 
	if (pfd.iPixelType == PFD_TYPE_COLORINDEX) 
	{
		paletteSize = 4096;
    }else 
	{
		return;
    }

    pPal = (LOGPALETTE*)
	malloc(sizeof(LOGPALETTE) + paletteSize * sizeof(PALETTEENTRY));
    pPal->palVersion = 0x300;
    pPal->palNumEntries = paletteSize;

    if (pfd.iPixelType == PFD_TYPE_RGBA) 
	{
		/*
		** Fill the logical paletee with RGB color ramps
		*/
		int redMask = (1 << pfd.cRedBits) - 1;
		int greenMask = (1 << pfd.cGreenBits) - 1;
		int blueMask = (1 << pfd.cBlueBits) - 1;
		int i;

		for (i=0; i<paletteSize; ++i) 
		{
			pPal->palPalEntry[i].peRed =
				(((i >> pfd.cRedShift) & redMask) * 255) / redMask;
			pPal->palPalEntry[i].peGreen =
				(((i >> pfd.cGreenShift) & greenMask) * 255) / greenMask;
			pPal->palPalEntry[i].peBlue =
				(((i >> pfd.cBlueShift) & blueMask) * 255) / blueMask;
			pPal->palPalEntry[i].peFlags = 0;
		}
    }else 
开发者ID:cybaj,项目名称:NAK,代码行数:51,代码来源:NaGsView.cpp


示例20: setupPalette

void setupPalette(HDC hDC)
{
    int pixelFormat = GetPixelFormat(hDC);
    PIXELFORMATDESCRIPTOR pfd;

    DescribePixelFormat(hDC, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);

    if (pfd.dwFlags & PFD_NEED_PALETTE) 
	{
        //dbgFatal(DBG_Loc, "rndInit: needs paletted display");
    } 
	else 
	{
		return;
    }
}
开发者ID:Almamu,项目名称:homeworld,代码行数:16,代码来源:btgGL.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ GetPixelGreen函数代码示例发布时间:2022-05-30
下一篇:
C++ GetPixelBlue函数代码示例发布时间: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