谢谢

解决方案 »

  1.   

    这是一段图像处理的代码,它是在2维数组中执行图像处理操作,然后使用ScanLine把结果拷贝到图像的TBitmap。当然这儿是BCB的代码,需要你改成Delphi的代码。
    void __fastcall TForm1::Button3Click(TObject *Sender)
    {
            int x, y;
            int Amplitude;
            float Period;
            BYTE ImageData[256][256], *LinePtr;        Image1->Picture->Bitmap = new Graphics::TBitmap;
            Image1->Picture->Bitmap->PixelFormat = pf24bit;
            Image1->Picture->Bitmap->Width = 256;
            Image1->Picture->Bitmap->Height = 256;
            for (y=0; y<=255; y++)
                    for (x=0; x<=255; x++)
                    {
                            Amplitude = 64*(255-y)/255;
                            Period = 100*sqrt(1/(1+(exp(0.013*x)*exp(0.027*x)/400)));
                            ImageData[x][y] = Amplitude*sin(2*M_PI/Period*x)+128;
                    }
            // Copy the image data to TBitmap
            for (y=0; y<=255; y++)
            {
                    LinePtr = (BYTE *) Image1->Picture->Bitmap->ScanLine[y];
                    for (x=0; x<=255; x++)
                    {
                            LinePtr[x*3]   = ImageData[x][y];       // Red
                            LinePtr[x*3+1] = ImageData[x][y];       // Green
                            LinePtr[x*3+2] = ImageData[x][y];       // Blue
                    }
            }
            Image1->Refresh();
    }
      

  2.   

    再问一下
    LinePtr = (BYTE *) Image1->Picture->Bitmap->ScanLine[y];
    这一句是什么意思
      

  3.   

    这是我用Pixels写的一个图象转置的程序,很慢
    var
      SourcePic,DestPic:TBitmap;for i:=0 to SourcePic.Width-1 do
    begin
      for j:=0 to SourcePic.Height-1 do
      begin
        DestPic.Canvas.Pixels[j,i]:=SourcePic.Canvas.Pixels[i,j];
      end;
    end;如果您不嫌麻烦,请用scanline写一遍,让我参考一下,谢谢