cdc createcompatibledccdc createcompatibledc
bi.biClrUsed = 0;
bi.biClrImportant = 0;
BYTE * lpbuffer;
hBitmap = CreateDIBSection(
NULL, //HDC hdc, // handle to device context
(BITMAPINFO *)&bi, //CONST BITMAPINFO *pbmi,
// pointer to structure containing bitmap size,
// format, and color data
DIB_RGB_COLORS, //UINT iUsage, // color data type indicator: RGBvalues or
// palette indexes
(void **)&lpbuffer, //VOID *ppvBits, // pointer to variable toreceive a pointer to
// the bitmap's bit values
NULL, //HANDLE hSection, // optional handle to a file mappingobject
0 //DWORD dwOffset // offset to the bitmap bit values withinthe
// file mapping object
);
lpcFileBuffer = m_pCircularBuffer + m_nFrameSize * wparam;
for (int i=0;i<iHeight/2;i++) {
for(int j=0;j<iWidth/2;j++) {
iB = lpcFileBuffer[i*2*iWidth+j*2];
iG1 = lpcFileBuffer[i*2*iWidth+j*2+1];
iG2 = lpcFileBuffer[(i*2+1)*iWidth+j*2];
iR = lpcFileBuffer[(i*2+1)*iWidth+j*2+1];
iG = (iG1+iG2)/2;
lpcBMPBuffer[(iHeight/2-1-i)*iLineBytes+j*3] = iG;
lpcBMPBuffer[(iHeight/2-1-i)*iLineBytes+j*3+1] = iR;
lpcBMPBuffer[(iHeight/2-1-i)*iLineBytes+j*3+2] = iB;
}
}
CWnd *pWin = GetDlgItem(IDC_STATICMAP);
HDC hDesDC = pWin->GetDC()->m_hDC;
HDC hSrcDC = CreateCompatibleDC(hDesDC);
SelectObject(hSrcDC, hBitmap);
BitBlt(hDesDC,0,0,m_nWidth/2,m_nHeight/2,hSrcDC,0,0,SRCCOPY);
DeleteObject(hBitmap);
DeleteDC(hSrcDC);
DeleteDC(hDesDC);
g_cLock.Unlock();
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-32780-1.html
质检总局就是个假货
送测