procedure RGB(var Bmp: TBitmap; R, G, B: Integer); 
var 
X, Y: Integer; 
I: Byte; 
ColorTable: array[0..255] of TRGBColor; 
pRGB: PRGBColor; 
begin 
for I := 0 to 255 do 
begin 
ColorTable[I].R := Byte(I + R); 
ColorTable[I].G := Byte(I + G); 
ColorTable[I].B := Byte(I + B); 
end; for Y := 0 to Bmp.Height - 1 do 
begin 
pRGB := Bmp.ScanLine[Y]; 
for X := 0 to Bmp.Width - 1 do 
begin 
pRGB.R := ColorTable[pRGB.R].R; 
pRGB.G := ColorTable[pRGB.G].G; 
pRGB.B := ColorTable[pRGB.B].B; 
end; 
Inc(pRGB); 
end; 
end; 
我想问一下这段代码中的TRGBColor和PRGBColor是什么类型
要调用什么uses

解决方案 »

  1.   

    我帮你改了一下:procedure RGB(var Bmp: TBitmap; R, G, B: Integer);
    type
      PRGBTripleArray = ^TRGBTripleArray;
      TRGBTripleArray = array[0..32767] of TRGBTriple;
    var
    X, Y: Integer;
    I: Byte;
    ColorTable: array[0..255] of TRGBTriple;
    pRGB: PRGBTripleArray;
    begin
    for I := 0 to 255 do
    begin
    ColorTable[I].rgbtRed  := Byte(I + R);
    ColorTable[I].rgbtGreen  := Byte(I + G);
    ColorTable[I].rgbtBlue  := Byte(I + B);
    end;
    bmp.PixelFormat :=pf24bit;
    for Y := 0 to Bmp.Height - 1 do
    begin
    pRGB := Bmp.ScanLine[Y];
    for X := 0 to Bmp.Width - 1 do
    begin
    pRGB[x].rgbtRed := ColorTable[pRGB[x].rgbtRed].rgbtRed;
    pRGB[x].rgbtGreen := ColorTable[pRGB[x].rgbtGreen].rgbtGreen;
    pRGB[x].rgbtBlue := ColorTable[pRGB[x].rgbtBlue].rgbtBlue;
    end;
    Inc(pRGB);
    end;
    end;