阅读:2043回复:2
在线等 请教StretchBlt在位图拷贝过程中 压缩大时图像失真我该如何处理啊 内有原码
CBitmap MemBitmap;//定义一个位图对象
CFileException e;//出错处理 BITMAPFILEHEADER bmfh;//BMP文件头变量 RGBTRIPLE *rgb;//24位真彩色数据格式 InitData(); if (!cf.Open(pFilename,CFile::modeRead, &e))//找到文件后,打开文件 { MessageBox("Can not open the file!","24Open File"); return; } cf.SeekToBegin(); cf.Read(&bmfh,sizeof(bmfh));//读取文件头 cf.Read(&bmih,sizeof(bmih));//读取文件信息头 rgb = new RGBTRIPLE[bmih.biWidth*bmih.biHeight]; cf.SeekToBegin(); cf.Seek(bmfh.bfOffBits,CFile::begin); if ((cf.GetLength())>64*1024) { cf.ReadHuge(rgb,bmih.biWidth*bmih.biHeight*3); } else { cf.Read(rgb,bmih.biWidth*bmih.biHeight); } CClientDC dc(this); HBITMAP hBitmap=::CreateDIBitmap(dc.m_hDC, &bmih, CBM_INIT, rgb, (LPBITMAPINFO) &bmih,DIB_RGB_COLORS); HDC hMemDC=::CreateCompatibleDC(dc.m_hDC);// 建立内存 HBITMAP hBitmapOld= (HBITMAP)SelectObject(hMemDC, hBitmap); // 选择对象 // 成员CRect mDispR用于指示图形显示区域的大小. // 成员CPoint mPos用于指示图形显示起始位置坐标. ::StretchBlt(dc.m_hDC,0,0, bmih.biWidth/2, bmih.biHeight/2, hMemDC,0,0, bmih.biWidth, bmih.biHeight, SRCCOPY); |
|
|
沙发#
发布于:2004-07-16 13:08
如何失真???给个完整的例子,调试看看.....
|
|
|
板凳#
发布于:2004-07-16 20:10
我解决了 谢谢
没有选择拷贝模式 |
|
|