|
楼主 |
发表于 2009-8-3 22:22:09
|
显示全部楼层
上面的程序,Bmpd.dis_Bmp[5]~Bmpd.dis_Bmp[15] 的数据是正确的,Bmpd.dis_Bmp[0]~Bmpd.dis_Bmp[4]的是错误的。当我改为一下程序时:
void Bmp_Control(FileManageInfo *pf)
{
Int32u bmpOffest = 0;
static Int16u RNbyte = 0;
Int32u biWidth = 0;
Int32u bfOffest = 0;
Int32u SecIndex = 0;
Int32u LastSecIndex = 0;
Int16u k = 0;
Int08u k1 = 0;
Int16u RowByte_T = 0;
Int16u RowByte_F = 0;
Int08u *Buf = R_NULL;
Int08u SecOffset = 0;
Int16u ReadPoint = 0;
//Int08u readBmp[16];
biWidth = Bmpd.biWidth; //BMP图片的宽度
bfOffest = Bmpd.bfOffBits; //BMP图片数据的编移量
//SetOffNbyte(readBmp, 16);
SetOffNbyte(Bmpd.dis_Bmp, 16);
k = biWidth % 8;
RowByte_T = biWidth / 8;
if (k)
{
RowByte_T = RowByte_T + 1; // 一行数据占有的有效字节数
}
k = RowByte_T % 4;
if (k)
{
RowByte_F = RowByte_T + (4 - k); // 一行数据占有的字节数
}
else
{
RowByte_F = RowByte_T;
}
SecIndex = GetFristSecOfClus(pf->CurClus);
//for (k1 = 11; k1 < 16; k1++)
// {
RNbyte = 1;
k1 = 12;
bmpOffest = k1 * RowByte_F + bfOffest + RNbyte;
SecOffset = bmpOffest / 512;
SecIndex = SecIndex + SecOffset;
ReadPoint = bmpOffest % 512;
if(LastSecIndex != SecIndex)
{
Buf = OpenSector(SecIndex);
LastSecIndex = SecIndex;
}
Bmpd.dis_Bmp[15 - k1] = Buf[ReadPoint];
//}
++RNbyte;
if (RNbyte >= RowByte_T)
{
RNbyte = 0;
}
}
这个时候Bmpd.dis_Bmp[3]的数据是对的。 |
|