为了提高画图速度,在代码中用DrawDIBDraw代替了StretchBlt,产生了镜面的翻转问题:
  
 / 
/镜面的翻转

bool	CZdsc::Reverse(int nWidth,int nHeight,unsigned char *pImageData)
{
	int		nDeep = 3;		//一个像素点代表的字节数
	char	buf[4];
	int		nLen;
	int		nRevLen;
	UCHAR *lpData = pImageData;

	for(int cy=0; cy<nHeight;cy++ )
	{
		for (int cx = 0; cx <nWidth/2; cx++) 
		{
			nLen = (cy*nWidth + cx)*nDeep;
			nRevLen = ((cy+1)*nWidth -cx)*nDeep;
			memcpy(buf,lpData+nLen,nDeep);
			memcpy(lpData+nLen,lpData+nRevLen,nDeep);
			memcpy(lpData+nRevLen,buf,nDeep);
		}
	}
	return true;
}   

  

posted on 2013-03-01 08:32  №影  阅读(651)  评论(0编辑  收藏  举报