procedure TForm1 Button1Click Sender TObject var dir string integer be

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
procedure TForm1.Button1Click(Sender: TObject);
var dir: string;
i,j,w,h: integer;
begin
getdir(0,dir);
dir:=dir+'\1.bmp';
Image1.Picture.LoadFromFile(dir);
Image1.AutoSize:=true;
//Image1.Canvas.Pixels[20,20]:=0;
w:= Image1.Width-1;
h:=Image1.Height-1;
Randomize;
for i:=0 to w do
for j:=0 to h do
begin
//Image1.Canvas.Pixels[i,j]:=RGB(random(255),random(255),random(255));
if Image1.Canvas.Pixels[i,j]=0 then
Image1.Canvas.Pixels[i,j]:=RGB(255,255,255)
else
Image1.Canvas.Pixels[i,j]:=0;
end;
end;