[讨论]内在地址
void CImageProcessView::OnVIEWTranslationRight() {
// TODO: Add your command handler code here
long i,j,i0,j0;
int lYOffsets=10;
int lXOffsets=10;
long lHeight=pDib->m_nHeight;
long lWidth=pDib->m_nHeight;
long lLineByte = pDib->GetLineByte(pDib->m_nWidth*8);
int size=pDib->GetSize();
char* lpStr;
char* lpDst;//=new char[lLineByte*lHeight];
// memset(lpDst, 255, lLineByte*lHeight);// 给lpDst分sizeof(lpDst)大小个"0"
// memset(lpStr, 255, lLineByte*lHeight);// 初始化
LPBYTE lpNewDIBBits= new BYTE[size];
LPBYTE lpDIBBits=pDib->m_pDibData;
///老师给的
for(i=0;i<lHeight;i++)
for(j=0;j<lWidth;j++)
{
lpDst=(char*)lpNewDIBBits+lLineByte*(lHeight-1-i)+j;
i0=i-lYOffsets;
j0=j-lXOffsets;
if((j0>0)&&(j0<lWidth)&&(i0>0)&&(i0<lHeight))
{
lpStr=(char*)lpDIBBits+lLineByte*(lHeight-1-i0)+j0;
*lpDst=*lpStr;//////////这里错了
}
else
*lpDst=255;//////////这里错了
}
memcpy(lpDIBBits,lpNewDIBBits,lLineByte*lHeight);
delete lpStr;
delete lpDst;
Invalidate();
return ;
}