读取单色位图的问题
下面是读取单色位图i,j处的数据的函数,请帮忙看看。现在的问题是出现许多0
unsigned char CDib::GetData(int i, int j)
{
ASSERT(i>=0 && i<m_pBIH->biWidth);
ASSERT(j>=0 && j<m_pBIH->biHeight);
int index = (m_pBIH->biHeight - 1 -j) * (m_pBIH->biWidth) + (i);
unsigned char ret;
if(m_pBIH->biBitCount == 1)
{
int data = m_pDibBits[index/8];
unsigned char mod = index%8;
ret = data&(128>>mod);
ret = ret>>(7 - mod);
}
return ret;
}