本文整理汇总了C++中LPDIRECT3DSURFACE9::GetDC方法的典型用法代码示例。如果您正苦于以下问题:C++ LPDIRECT3DSURFACE9::GetDC方法的具体用法?C++ LPDIRECT3DSURFACE9::GetDC怎么用?C++ LPDIRECT3DSURFACE9::GetDC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPDIRECT3DSURFACE9
的用法示例。
在下文中一共展示了LPDIRECT3DSURFACE9::GetDC方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_info
void print_info(LPDIRECT3DSURFACE9 pSurface, int mode, float time, cv::String oclDevName)
{
HDC hDC;
HRESULT r = pSurface->GetDC(&hDC);
if (FAILED(r))
{
return;
}
HFONT hFont = (HFONT)::GetStockObject(SYSTEM_FONT);
HFONT hOldFont = (HFONT)::SelectObject(hDC, hFont);
if (hOldFont)
{
TEXTMETRIC tm;
::GetTextMetrics(hDC, &tm);
char buf[256];
int y = 0;
buf[0] = 0;
sprintf(buf, "mode: %s", m_modeStr[mode].c_str());
::TextOut(hDC, 0, y, buf, (int)strlen(buf));
y += tm.tmHeight;
buf[0] = 0;
sprintf(buf, m_demo_processing ? "blur frame" : "copy frame");
::TextOut(hDC, 0, y, buf, (int)strlen(buf));
y += tm.tmHeight;
buf[0] = 0;
sprintf(buf, "time: %4.1f msec", time);
::TextOut(hDC, 0, y, buf, (int)strlen(buf));
y += tm.tmHeight;
buf[0] = 0;
sprintf(buf, "OpenCL device: %s", oclDevName.c_str());
::TextOut(hDC, 0, y, buf, (int)strlen(buf));
::SelectObject(hDC, hOldFont);
}
r = pSurface->ReleaseDC(hDC);
return;
} // print_info()
示例2: TranslateColor
COLORREF CAnimationSpooler::TranslateColor(LPDIRECT3DSURFACE9 pSurface, COLORREF clrColor) const
{
ASSERT(pSurface);
if( clrColor == CLR_INVALID ) return clrColor;
// The only way to actually determine what color a certain RGB value gets, is
// to put a pixel on the surface and taste it.
HDC hDC = NULL;
HRESULT Hr = pSurface->GetDC(&hDC);
if( FAILED(Hr) ) return false;
COLORREF clrOld = ::GetPixel(hDC, 0, 0);
::SetPixel(hDC, 0, 0, clrColor);
clrColor = ::GetPixel(hDC, 0,0);
::SetPixel(hDC, 0, 0, clrOld);
pSurface->ReleaseDC(hDC);
return clrColor;
}
示例3: LcD3D_DrawTextBackbuffer
INT LcD3D_DrawTextBackbuffer(PDEV pDev, INT X, INT Y, LPCTSTR Text, DWORD _color)
{
HDC hDC=0;
LPDIRECT3DSURFACE9 Surface;
if(FAILED(pDev->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &Surface)))
return -1;
Surface->GetDC(&hDC);
if(NULL != hDC)
{
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, _color);
TextOut(hDC, X, Y, Text, strlen(Text));
Surface->ReleaseDC(hDC);
}
Surface->Release(); //해제한다.
return 0;
}