如题,希望能给个例子.先谢谢了~~~~~~~~~

解决方案 »

  1.   

    我觉得用Canvas.Pixels[x,y]就可以取得像素值或设置像素值。ScanLine方法我一般不用,好像返回一个指针什么的,看过相关代码一头雾水,后来就改用Canvas.Pixels[x,y]了,到现在也没有搞清楚楼主所说的ScanLine。
      

  2.   

    scanline返回某行像素的指针,直接通过此指针可以修改bitmap数据,更快。
      

  3.   

    ScanLine[Row: Integer],返回一个指向像素数组的指针
      

  4.   

    Bitmap的数据是按行存储的, ScanLine返回的是某行第一个像素的数据在内存中的地址。
      

  5.   


    那我就要BS你了:),ScanLines都不用怎么搞图像处理
      

  6.   


    ScanLines的功能可以用其它办法来实现啊。这个东西不好用,不懂。
      

  7.   

    给你一下例子,求图像亮度的 
          iCount:=0;
           dY:=0;
           for j := 64 to 248 do
           begin
             P := bmp.ScanLine[j];
            for i := 16 to 256 do
            begin
              //访问像素   RGB
               b:=P^.rgbtBlue;
               g:=P^.rgbtGreen;
               r:=P^.rgbtRed ;
               inc(P);//指向下一个像素
               dY:=dY+r*30+g*59+b*11;
               iCount:=iCount+1;
            end;
           end;
           
           if iCount>0 then   dY:=dy div iCount;
           edit1.Text:=IntToStr(DY div 100);
      

  8.   

    ScanLines比Canvas.Pixels[x,y]快得多的多的多的多的多的多的多的多!
    我估计要相差2个数量级,至少一个数量级。
      

  9.   

    正解,从效率上来说比Canvas.Pixels[x,y]快很多很多。
      

  10.   

    ScanLines比Canvas.Pixels[x,y]快得多的多的多的多的多的多的多的多! 
    我估计要相差2个数量级,至少一个数量级。
    哈哈楼上的同学说的是在忆知的情况下吧
    如果按已知来计算Canvas.Pixels[20,100]整度也没法计算
    假如Bitmap的数据是按行存储的, ScanLine返回的是某行第一个像素的数据在内存中的地址。楼上所说的
    那么请问我要最某行最的的一个呢还不要用FOR或while等,也没发现他真的会快;
      

  11.   

    procedure TForm1.Button1Click(Sender: TObject);// This example shows drawing directly to the BitMap
    var
      x,y : Integer;
      BitMap : TBitMap;
      P : PByteArray;
    begin
      BitMap := TBitMap.create;
      try
        // On Windows replace MyBitmap.png with a full pathname such as
        // C:\Program Files\Common Files\Borland Shared\Images\Splash\256color\factory.bmp
        BitMap.LoadFromFile('MyBitmap.png');
        for y := 0 to BitMap.Height -1 do
        begin
          P := BitMap.ScanLine[y];      for x := 0 to BitMap.Width -1 do
            P[x] := y;
        end;
        Canvas.Draw(0,0,BitMap);
      finally
        BitMap.Free;
      end;
    end;
    Delphi 自带的例子