用scanline啊,比如bmp的反色:
procedure TForm1.anticolorClick(Sender: TObject);
var
p ByteArray;
x,y :Integer;
Bmp :TBitmap;
begin
Bmp :=TBitmap.Create;
Bmp.Assign(Image1.Picture.Bitmap);
Bmp.PixelFormat :=pf24Bit;
for y:=0 to Bmp.Height-1 do
begin
p:=Bmp.scanline[y];
for x:=0 to Bmp.Width-1 do
begin
// Gray:=Round(p[x*3+2]*0.3+p[x*3+1]*0.59+p[x*3]*0.11);
p[x*3]:=not p[x*3];
p[x*3+1]:=not p[x*3+1];
p[x*3+2]:=not p[x*3+2];
end;
end;
Image1.Picture.Bitmap.Assign(Bmp);
Bmp.Free;
end;