更改图像数据后显示不出效果
代码如下:
void CProjectDVView::OnBW()
{
BeginWaitCursor();
CProjectDVDoc * pDoc = GetDocument();
int nWidth = pDoc->m_pDib->GetWidth();
int nHeight = pDoc->m_pDib->GetHeight();
// 循环控制变量
int y;
int x;
LPBYTE m_lpImage = pDoc->m_pDib->GetBitsPtr();
for(y=0; y<nHeight; y++)
{
for(x=0; x<nWidth; x++)
{
m_lpImage[y*nWidth+x]=(unsigned char)(255-m_lpImage[y*nWidth+x]);
}
}
delete []pUnchImage;
pUnchImage = NULL ;
EndWaitCursor();
pDoc->SetModifiedFlag(TRUE);
pDoc->UpdateAllViews(NULL);
}
想实现灰度图像类似底片效果,但是运行后没有任何效果= =b
求助