因为从扫描仪得到的是像素矩阵,所以试验了下面的代码:
  Graphics::TBitmap *orig = new Graphics::TBitmap();
  Graphics::TBitmap *dest = new Graphics::TBitmap();
  TMemoryStream *stream;
  BYTE *rowin, *rowout;
  int i, j;  orig->LoadFromFile("CHESS11.BMP");
  dest->Width = orig->Width;
  dest->Height = orig->Height;
  dest->PixelFormat = orig->PixelFormat;
  for ( i=0; i<dest->Height; i++)
  {
    rowout = (BYTE *)orig->ScanLine[i];
    rowin = (BYTE *)dest->ScanLine[i];
    for ( j=0; j<dest->Width; j++ )
    {
      rowout[j] = rowin[j];
    }    //    strcpy( (char*)out, (char*)orig->ScanLine[i] );
  }
  dest->SaveToFile("test.bmp");
}
为什么最后test.bmp是空的?还有,为什么调用savetostream总是出错?access violation ...rlt60.bpl

解决方案 »

  1.   

    兄弟你是不是弄反了?
        rowout = (BYTE *)orig->ScanLine[i];
        rowin = (BYTE *)dest->ScanLine[i];
    ->
        rowin = (BYTE *)orig->ScanLine[i];
        rowout = (BYTE *)dest->ScanLine[i];另外savetostream的代码在哪?是不是stream没有创建?
      

  2.   

    不好意思,是弄反了。stream也是。可以看到图像了,大致轮廓对了,但是细节还是不对,是不是还有其他的东东没设对?