正向位图

zx005 2005-03-11 08:35:08
help, 到向位图怎样和正向位图进行转换啊~~~~~~~~~?
...全文
101 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
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);
}

19,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧