分析c++代码----回答给分
rect *TextBlock;
Byte *ptr;
int LineQty=5;
long ProjectV[640], ProjectH[480];
for(int i = 0; i < LineQty; i++)
{
//
ZeroMemory(ProjectV, sizeof(long)*640);//这个是内存清零;
for(int row = TextBlock[i].Top; row < TextBlock[i].Bottom; row++)
{
ptr = (Byte *)Image1->Picture->Bitmap->ScanLine[row];
for(int col = 0; col < 640; col++)
{
if(ptr[col] != 255) //
ProjectV[col]++; //
}
}
for(int col = 0; col < 640; col++)
{
if(ProjectV[col] != 0)
{
TextBlock[i].Left = col;
break;
}
}
for(int col = 639; col >= 0; col--)
{
if(ProjectV[col] != 0)
{
TextBlock[i].Right = col;
break;
}
}
}
Image3->Canvas->Brush->Color = clWhite;
Image3->Canvas->FillRect(TRect(0,0,Image3->Width,Image3->Height));
Image3->Canvas->Brush->Color = clBlue;
for(int i = 0; i < LineQty; i++)
Image3->Canvas->FrameRect(TRect(TextBlock[i].Left,
TextBlock[i].Top,
TextBlock[i].Right + 1,
TextBlock[i].Bottom + 1));
}
尽可能详细分析一下。顺便再问一下:
ptr = (Byte *)Image1->Picture->Bitmap->ScanLine[row];转换成(byte*)之前返回值类型是什么?