5,930
社区成员
发帖
与我相关
我的任务
分享
procedure TForm1.btn1Click(Sender: TObject);
var w,h,x,y:integer;
p:pbytearray;
fiestr:string;
src:TBitmap;
begin
src:=TBitmap.Create;
src:=img1.Picture.Bitmap;
w:=src.width;
h:=src.height;
src.PixelFormat :=pf24bit; //像素模式
for y:=0 to h-1 do begin
p:=src.scanline[y]; //取得一行象素点
for x:=0 to w-1 do begin
//pf24bit的图像每个像素用3个字节表示
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;
img2.Picture.Bitmap:=src;
end;