正向位图

zx005 2005-03-11 08:35:08
help, 到向位图怎样和正向位图进行转换啊~~~~~~~~~?
...全文
53 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
SatanLi1982 2005-03-11
//reverse bitmap
BitInfo & BitInfo::RvsBtm()
{
byte ucTmp;
int i=0, j=0;
int nHalf = int(m_nHeight/2);
for(i=0;i<m_nWidth;i++)
for(j=0;j<nHalf;j++)
{
ucTmp = Get2DAt(i, j);
Get2DAt(i, m_nHeight-j-1) = ucTmp;
}

return *this;
}
回复
SatanLi1982 2005-03-11
给你一段我的代码:
//Get two-dimension array's value at,,,,,,
//nWx: column
//nHy: row
//because of the character of bitmap, we should reverse the bitmap to get the pixel
byte & BitInfo::Get2DAt(int nWx, int nHy)
{
#ifdef _DEBUG
ASSERT(nWx<m_nWidth);
ASSERT(nWx>=0);
ASSERT(nHy<m_nHeight);
ASSERT(nHy>=0);
#endif

if(nWx>=m_nWidth)
nWx = m_nWidth-1;
else if(nWx<0)
nWx = 0;
if(nHy>=m_nHeight)
nHy = m_nHeight-1;
else if(nHy<0)
nHy = 0;

return *(m_ptr+(m_nHeight-nHy-1)*m_nLnBytes+nWx);
}
回复
相关推荐
发帖
图形处理/算法
创建于2007-09-28

1.9w+

社区成员

VC/MFC 图形处理/算法
申请成为版主
帖子事件
创建了帖子
2005-03-11 08:35
社区公告
暂无公告