已有像素点矩阵在内存中,CDC如何得到 rt,CDC如何能得到并处理内存中已存在的像素点矩阵 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 循环画上去吧pDC->SetPixel(point.x,point.y,RGB(0,0,0)); 我需要用CDC得到像素矩阵,然后再用StretchBlt画图 // get mem unsigned fsize; fsize =if_hnd.GetLength();// BYTE *ScreenPtr1=0; ScreenPtr1=(BYTE *)new char[fsize]; //// read all in if_hnd.Read(ScreenPtr1,fsize);// 数据在这里// image data are in buffer if(if_hnd) if_hnd.Close();// make bitmap info LPBITMAPINFO pBMPinfo; pBMPinfo=(LPBITMAPINFO)new BYTE[sizeof(BITMAPINFOHEADER)+16*sizeof(RGBQUAD)]; ZeroMemory(&pBMPinfo->bmiHeader,sizeof(BITMAPINFOHEADER)); pBMPinfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER); pBMPinfo->bmiHeader.biBitCount=4; pBMPinfo->bmiHeader.biWidth=648; pBMPinfo->bmiHeader.biHeight=508; pBMPinfo->bmiHeader.biPlanes=1; pBMPinfo->bmiHeader.biSizeImage=648*508/2;// copy colors for(int jj=0; jj<16; jj++) {// reversed ! pBMPinfo->bmiColors[jj].rgbReserved=0; pBMPinfo->bmiColors[jj].rgbRed=(BYTE)(color_table[jj] & 0x0000FF); pBMPinfo->bmiColors[jj].rgbGreen=(BYTE)((color_table[jj] & 0x00FF00) >> 8); pBMPinfo->bmiColors[jj].rgbBlue=(BYTE)((color_table[jj] & 0xFF0000) >> 16); }// draw bmp pDC->SetStretchBltMode(COLORONCOLOR); StretchDIBits(pDC->GetSafeHdc(),0,0,wid,hei,0,0,wid,hei, ScreenPtr1, pBMPinfo, DIB_RGB_COLORS,SRCCOPY);// free delete pBMPinfo; delete [] ScreenPtr1; return; 怎么bitblt到memdc啊,能说的详细点吗 纠结与这样的数据该怎么写xml文件 派生类成员函数调用父类的成员OnPaint函数 关闭子窗口之前提示保存 如何在按纽上画图 ? 如何让其它程序全部最小化? 怎样得到硬件的属性! 位图中 的保留字 如何监控对引用计数的访问 AddRef、Release CSocket对象之间的传值? 请问CSDN中的文件BBS的文档要如何上传? 是不是要经过版主同意,还是如何? VC2005连接本地SQL2005数据库出错,提示_com_error错误 vc .net 2002 如何将数据库内容显示在一个DBGRID里面
pDC->SetPixel(point.x,point.y,RGB(0,0,0));
unsigned fsize;
fsize =if_hnd.GetLength();//
BYTE *ScreenPtr1=0;
ScreenPtr1=(BYTE *)new char[fsize]; //
// read all in
if_hnd.Read(ScreenPtr1,fsize);// 数据在这里
// image data are in buffer
if(if_hnd) if_hnd.Close();
// make bitmap info
LPBITMAPINFO pBMPinfo;
pBMPinfo=(LPBITMAPINFO)new BYTE[sizeof(BITMAPINFOHEADER)+16*sizeof(RGBQUAD)];
ZeroMemory(&pBMPinfo->bmiHeader,sizeof(BITMAPINFOHEADER));
pBMPinfo->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
pBMPinfo->bmiHeader.biBitCount=4;
pBMPinfo->bmiHeader.biWidth=648;
pBMPinfo->bmiHeader.biHeight=508;
pBMPinfo->bmiHeader.biPlanes=1;
pBMPinfo->bmiHeader.biSizeImage=648*508/2;
// copy colors
for(int jj=0; jj<16; jj++)
{// reversed !
pBMPinfo->bmiColors[jj].rgbReserved=0;
pBMPinfo->bmiColors[jj].rgbRed=(BYTE)(color_table[jj] & 0x0000FF);
pBMPinfo->bmiColors[jj].rgbGreen=(BYTE)((color_table[jj] & 0x00FF00) >> 8);
pBMPinfo->bmiColors[jj].rgbBlue=(BYTE)((color_table[jj] & 0xFF0000) >> 16);
}
// draw bmp
pDC->SetStretchBltMode(COLORONCOLOR);
StretchDIBits(pDC->GetSafeHdc(),0,0,wid,hei,0,0,wid,hei,
ScreenPtr1,
pBMPinfo,
DIB_RGB_COLORS,SRCCOPY);
// free
delete pBMPinfo;
delete [] ScreenPtr1;
return;