PixelValue=face->Canvas->Pixels[row][column];
B=(PixelValue&0x00ff0000)>>16;               //shift 16 bits
G=(PixelValue&0x0000ff00)>>8;                //shift 8 bits
R=(PixelValue&0x000000ff);
R = G = B = 0.299*R+0.587*G+0.114*B;
face->Canvas->Pixels[row][column]=TColor(RGB(R,G,B));

解决方案 »

  1.   

    var
        R,G,B:integer;
        PixelValue:TColor;
    begin
    PixelValue:=face.Canvas.Pixels[row,column];
    B:=(PixelValue and $00FF0000) shr 16;
    G:=(PixelValue and  $0000FF00) shr 8;
    R:=(PixelValue and  $000000FF);
    B:=round(0.299*R+0.587*G+0.114*B);
    G:=B;
    R:=G;
    face.Canvas.Pixels[row,column]:=TColor(RGB(R,G,B));
      

  2.   

    编译提示:RGB 这个方法没有定义 ,是否要加什么头文件?
      

  3.   

    你是D6?D7?,在windows单元中。
    function RGB(r, g, b: Byte): COLORREF;
    begin
      Result := (r or (g shl 8) or (b shl 16));
    end;
      

  4.   

    windows单元中就有,不行的话,你把这个函数放到文件中就行了。
    function RGB(r, g, b: Byte): COLORREF;
    begin
      Result := (r or (g shl 8) or (b shl 16));
    end;
      

  5.   

    呵呵,问题已经解决了http://lysoft.7u7.net